From 2b896697710769c40f214a07574e6ef91a0de527 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 10 Nov 2026 04:50:47 -0800 Subject: [PATCH 1/5] feat(chat): select installed Claude, Codex or Copilot assistants Pin conversations to their provider, retain broker tool approvals, and exclude internal sessions by provider identity. Closes #103. --- .env.example | 6 +- README.md | 5 +- cmd/driga-docgen/settings.go | 1 + docs/specs/2026-11-10-assistant-providers.md | 84 ++++ docs/usage.md | 40 +- internal/chat/broker.go | 15 +- internal/chat/codex.go | 301 +++++++++++++ internal/chat/codex_test.go | 219 +++++++++ internal/chat/copilot.go | 426 ++++++++++++++++++ internal/chat/copilot_test.go | 277 ++++++++++++ internal/chat/provider.go | 115 +++++ internal/chat/provider_test.go | 222 +++++++++ internal/chat/provider_tools.go | 335 ++++++++++++++ internal/chat/provider_tools_test.go | 273 +++++++++++ internal/chat/transport.go | 4 +- internal/chat/transport_test.go | 4 +- internal/cli/ask.go | 4 +- internal/cli/dev_serve.go | 2 +- internal/cli/root.go | 2 +- internal/cli/top.go | 2 +- internal/collector/chat_provider_self_test.go | 75 +++ internal/collector/chat_self_test.go | 2 +- internal/collector/daemon.go | 23 +- internal/collector/pass.go | 4 +- internal/collector/review_regression_test.go | 2 +- internal/collector/sources.go | 26 +- internal/config/assistant_test.go | 58 +++ internal/config/config.go | 4 + internal/config/settings.go | 7 +- internal/llm/provider.go | 36 ++ internal/llm/provider_test.go | 29 ++ internal/store/chat.go | 19 +- internal/store/chat_provider_test.go | 105 +++++ internal/store/panel_events.go | 9 +- internal/tui/app.go | 2 + internal/tui/chat.go | 9 +- internal/tui/chat_provider_test.go | 48 ++ internal/tui/chat_test.go | 3 +- .../{index-Dp2Y4syB.js => index-DsNBhmsi.js} | 42 +- internal/web/app/index.html | 2 +- site/src/content/docs/reference/cli.mdx | 6 +- site/src/content/docs/reference/settings.mdx | 15 +- ui/src/host/Chat.stories.tsx | 8 + ui/src/host/Chat.tsx | 6 + ui/src/host/api.ts | 2 +- 45 files changed, 2801 insertions(+), 78 deletions(-) create mode 100644 docs/specs/2026-11-10-assistant-providers.md create mode 100644 internal/chat/codex.go create mode 100644 internal/chat/codex_test.go create mode 100644 internal/chat/copilot.go create mode 100644 internal/chat/copilot_test.go create mode 100644 internal/chat/provider.go create mode 100644 internal/chat/provider_test.go create mode 100644 internal/chat/provider_tools.go create mode 100644 internal/chat/provider_tools_test.go create mode 100644 internal/collector/chat_provider_self_test.go create mode 100644 internal/config/assistant_test.go create mode 100644 internal/llm/provider.go create mode 100644 internal/llm/provider_test.go create mode 100644 internal/store/chat_provider_test.go create mode 100644 internal/tui/chat_provider_test.go rename internal/web/app/assets/{index-Dp2Y4syB.js => index-DsNBhmsi.js} (74%) diff --git a/.env.example b/.env.example index 58910d76..3ac6fd02 100644 --- a/.env.example +++ b/.env.example @@ -84,6 +84,10 @@ # Allowed: nonempty. # DRIGA_SUMMARIES_MODEL= +# assistant.provider: string; default=auto; optional. Answering assistant; auto prefers Claude, Codex, then Copilot independently of session discovery. +# Allowed: auto, claude, codex or copilot. +# DRIGA_ASSISTANT_PROVIDER= + # cleanup.worktree_idle: duration; default=168h; optional. Idle worktree cleanup eligibility. # Allowed: 0..2562047h47m16.854775807s; zero = no idle minimum. # DRIGA_CLEANUP_WORKTREE_IDLE= @@ -162,7 +166,7 @@ # DRIGA_CHAT_READ_ONLY: marker; default=unset; optional. 1 keeps the Chat MCP child read-only. # DRIGA_CHAT_READ_ONLY= -# DRIGA_INTERNAL: marker; default=unset; optional. 1 suppresses recursive hooks from Driga-owned Claude subprocesses. +# DRIGA_INTERNAL: marker; default=unset; optional. 1 suppresses recursive hooks from Driga-owned assistant subprocesses. # DRIGA_INTERNAL= # DRIGA_FIXTURE_OUTPUT: path; default=unset; optional. Fixture generator output directory (tests only). diff --git a/README.md b/README.md index e1e006aa..f10348c5 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,9 @@ Collection stays local unless you configure fleet peers. Fleet sharing defaults to metadata and titles; the serving peer controls text sharing. Optional OTLP intake listens on loopback. The desktop app opens no network port. -Optional summaries and Chat run Claude through your installed CLI and its -existing vendor connection. Explicit questions and permitted context can leave +Chat automatically selects a compatible installed Claude, Codex or Copilot CLI; +optional project summaries use Claude. Both use the CLI's existing login and +vendor connection. Explicit questions and permitted context can leave the machine through that connection. Agent configuration changes only through explicit setup and hook commands. See [privacy and configuration](docs/usage.md#privacy-and-configuration) for paths, capture settings, and the fleet sharing table. diff --git a/cmd/driga-docgen/settings.go b/cmd/driga-docgen/settings.go index 58c26382..e0cb7600 100644 --- a/cmd/driga-docgen/settings.go +++ b/cmd/driga-docgen/settings.go @@ -18,6 +18,7 @@ var settingGroups = []struct{ prefix, title, intro string }{ {"orphans", "Orphans", "The `[orphans]` table."}, {"machine", "Machine health", "The `[machine]` table."}, {"summaries", "Summaries", "The `[summaries]` table. Summaries run your installed Claude CLI on demand."}, + {"assistant", "Answering assistant", "The `[assistant]` table selects the answering CLI independently of monitored agents."}, {"cleanup", "Cleanup", "The `[cleanup]` table."}, {"fleet", "Fleet", "The `[fleet]` table for paired machines."}, {"inbox", "Inbox and alerts", "The `[inbox]` table."}, diff --git a/docs/specs/2026-11-10-assistant-providers.md b/docs/specs/2026-11-10-assistant-providers.md new file mode 100644 index 00000000..899a3cf8 --- /dev/null +++ b/docs/specs/2026-11-10-assistant-providers.md @@ -0,0 +1,84 @@ +# Assistant providers + +Issue: https://github.com/labstack/driga/issues/103 + +Chat and `driga ask` must work when only one supported assistant CLI is installed. +Collection must remain independent of assistant installation and login. + +## Selection and identity + +`assistant.provider` defaults to `auto`, selecting the first compatible CLI in +Claude → Codex → Copilot order. `DRIGA_ASSISTANT_PROVIDER` or the config file can +select one explicitly. Selection runs only when creating a conversation; no +background probes, installation, login, or model requests are performed. +Compatibility probes inspect CLI metadata. Users authenticate with their CLI. +Authentication or quota errors do not trigger automatic replay elsewhere. + +The selected provider is persisted before the first prompt. Resumption always +uses that provider and exact session ID, even if the preferred CLI changes. +Missing/incompatible CLIs produce an actionable error and leave monitoring alive. +Internal-session exclusion keys are `(provider, session ID)`, including hooks, +so equal vendor IDs cannot hide another provider's workload. Unknown identities +are handled conservatively. + +## Provider adapters + +The existing `chat.Agent.Run` interface remains the seam. Requests carry the +persisted provider. The broker owns conversation state, cancellation, capture, +trust modes and command approvals for every provider. + +Claude keeps its strict MCP configuration and permission bridge. Codex uses +config-free `exec`, retaining authentication in `CODEX_HOME`, ignoring user exec +rules and project configuration through a private working directory. Its native +execution environment is disabled with `CODEX_EXEC_SERVER_URL=none`, including +runtime filesystem/command backstops. The adapter accepts the audited 0.167.0 +release; unknown registries fail closed. Only Driga's read catalog and, for action +chat, `list_prompts` and broker-gated `run_command` are enabled. Credentials and +prompts stay out of process arguments. Dashboard edits are currently unavailable +through this Codex adapter; read and panel tools remain available. + +Copilot uses framed SDK protocol 3 and a host-owned MCP tool bridge. It retains +the CLI's authentication home but uses a private session config directory and +working directory. Session configuration disables ambient hooks, plugins, +instructions, skills, MCP servers and host Git operations. Before sending a +prompt, Driga requires the safety-options acknowledgment and an exact tool +catalog containing only its custom declarations. Permission requests for native +operations are denied. Unsupported protocol/options/catalogs fail closed. + +The host bridge exposes read tools and a bounded action subset. It excludes +model-direct approval, Claim tools and dashboard replace/restore/delete calls. +`run_command` performs approval and execution through the existing broker. +Duplicate host-dispatched provider call IDs, foreign sessions, oversized frames +and incomplete streams fail the turn; children are canceled together. Codex owns +its MCP dispatch; Driga validates its reported tool catalog and call identities +in the output stream, while command authorization remains inside the MCP broker. + +Project summaries remain Claude-specific because their model and USD budget +contract needs a separate provider-specific design. Selecting a Chat provider +does not change summary behavior or monitoring-adapter enablement. + +## Product presentation + +Reference lock: retain the existing Chat and TUI typography, muted status text, +trust-mode controls and layout. The bundled Refero copywriting reference's +orientation/status rule applies: show the actual answering provider, avoid a +Claude label on Codex/Copilot answers. No new provider picker or onboarding flow +is needed; the existing config mechanism provides the explicit override. + +## Validation + +Tests use disposable homes and synthetic executable/protocol fixtures only. +Cover ordered automatic selection, explicit failures, lazy initialization, +provider-pinned resume after restart, cancellation without replay, config/env +precedence, provider-ID collisions, hook/spool exclusion, native tool rejection, +permission denial, frame limits and child cleanup. Story fixtures verify provider +labels. Live authentication/model turns are deliberately outside test execution; +metadata checks alone are not an end-to-end vendor-service certification. + +Primary protocol evidence: + +- [Codex environment-disabled tools and runtime backstops](https://github.com/openai/codex/commit/a504d8f0fa70c88f38cbf6c5dae26a1e1223fd63) +- [Codex app-server protocol](https://learn.chatgpt.com/docs/app-server) +- [Codex CLI source/configuration](https://github.com/openai/codex) +- [Copilot SDK protocol and empty mode](https://github.com/github/copilot-sdk) +- [Copilot CLI command reference](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference) diff --git a/docs/usage.md b/docs/usage.md index ec6750ec..6511da04 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -798,8 +798,8 @@ read-only MCP tool. ## Summaries and Chat -Both run your installed `claude` CLI, on demand only; Driga never calls a model in -the background and has no API key. +Chat selects an installed assistant CLI on demand; project summaries use Claude. +Driga never calls a model in the background and requires no separate API key. ```sh driga projects summarize ... | --all # needs [summaries] enabled = true @@ -813,10 +813,21 @@ contents or paths. It runs `claude -p --safe-mode --no-session-persistence --too with a $0.05 budget cap. A summary built from handoff text is shared with fleet viewers only at `fleet.share_text = "snippets"`. -`driga ask` is a one-shot Chat broker client. Chat uses your installed Claude CLI -and login; Codex and Copilot are listed as coming. Required flags are probed on -the first turn, and an unsupported CLI fails with the missing flag and version. -No real agent CLI is run by tests. +`driga ask` is a one-shot, read-only Chat broker client. Chat defaults to +`assistant.provider = "auto"`: Claude Code, then Codex, then GitHub Copilot CLI, +skipping missing or incompatible CLIs. Install and sign in through your chosen +CLI. Set `provider = "claude"`, `"codex"` or `"copilot"` under `[assistant]` in +TOML (or set `DRIGA_ASSISTANT_PROVIDER`) to select one explicitly. Selection is lazy; +monitoring works without an assistant. Conversations stay with their original +provider. Authentication, quota and turn failures are never replayed with another +provider. Start a new conversation after changing providers. + +Codex currently requires the audited 0.167.0 CLI series and supports Driga reads, +panels and broker-gated commands; dashboard edits are unavailable through that +adapter. Copilot requires headless SDK protocol 3 and an exact Driga-only tool +catalog. Unsupported versions fail with an error rather than loosening approval +or configuration controls. No real agent CLI is run by tests. Project summaries +retain their Claude-specific model and budget cap regardless of this setting. In the app, press **c** on any page, or choose View → Chat (Cmd+K, Ctrl+K on Windows and Linux), to dock Chat on the right. @@ -828,7 +839,7 @@ Context chips describe the current page, selected session/project and machine; remove a chip to leave it out. Session references in answers select the session on the current page. Tool calls appear in a collapsed **Tools used** list. Driga replies are rendered as Markdown -and marked **answered by Claude Code**. A timed indicator shows thinking, writing +and show the selected provider. A timed indicator shows thinking, writing or the current read tool. Streaming follows the bottom until you scroll up; reduced motion uses a static dot. @@ -845,19 +856,20 @@ starts a conversation, Ctrl+T toggles tool details, Ctrl+X clears context and Alt+0 returns to Flow. Thinking/writing/tool status includes elapsed time and a streaming cursor; NoColor uses a static indicator. Flow's copy-resume key is **C**. -Chat can acknowledge inbox items, jump to a session terminal, kill an agent or -orphan, clean up a candidate and refresh project summaries. It also has Claude’s -built-in shell and file tools. Actions are local-only and keep the CLI’s process, -cleanup and jump safety checks. Chat never types into a live agent terminal. +Chat provides Driga read tools, panels and local commands through `run_command`. +Commands use the broker's approval cards, process identity checks and sandbox. +Claude additionally retains its permission-gated native read tools and existing +action bridge. Copilot exposes a bounded subset of dashboard edits. Vendor-native +shell and file editing tools are disabled. Chat never types into a live agent terminal. Each conversation starts in **Confirm**. Change trust mode with the app's Chat header buttons or **m** in TUI navigate mode: | Mode | Runs without asking | Asks | |---|---|---| -| Confirm | Driga read tools and reads inside the working directory | Reads elsewhere and every other call | -| Auto | Auto allows driga read tools, reads inside the working directory, inbox acknowledgments, jumps and summaries, and allows Edit/Write only inside a git project working directory that is neither home, the driga data directory nor an ancestor of either, with no hidden components or agent instruction names (`claude*.md`, `agents*.md`, `gemini*.md`, `copilot-instructions.md`, case-insensitive) in the given or resolved relative path after trimming trailing dots and spaces, and always asks on colons. | Everything else asks | -| Full auto | Everything | Nothing | +| Confirm | Driga read tools | Every local command | +| Auto | Driga read tools and commands classified Read | Other, Process and Destructive commands | +| Full auto | Driga read tools, Read commands and sandboxed Other commands | Process and Destructive commands, plus Other when sandboxing is unavailable | Full auto requires confirmation and is shown in red with its remaining time. The TUI warning stays visible while replies and action cards update; press **m** diff --git a/internal/chat/broker.go b/internal/chat/broker.go index 8c438af9..7481fe90 100644 --- a/internal/chat/broker.go +++ b/internal/chat/broker.go @@ -37,6 +37,7 @@ type Context struct { Machine string `json:"machine,omitempty"` } type Request struct { + Provider string Prompt, Resume, Directory string Socket, Conversation, Token string ReadOnly bool @@ -214,13 +215,23 @@ func (b *Broker) dispose(c *conversation) { c.actions, c.messages, c.events, c.queue, c.result = nil, nil, nil, nil, nil } func (b *Broker) Create(ctx context.Context) (store.Conversation, error) { + provider := "claude" + if selector, ok := b.agent.(interface { + Select(context.Context) (string, error) + }); ok { + var err error + provider, err = selector.Select(ctx) + if err != nil { + return store.Conversation{}, err + } + } b.mu.Lock() defer b.mu.Unlock() if b.closed { return store.Conversation{}, errors.New("chat closed") } now := time.Now().UTC() - c := store.Conversation{ID: uuid.NewString(), MachineID: b.st.MachineID(), Agent: "claude", CreatedAt: now, UpdatedAt: now} + c := store.Conversation{ID: uuid.NewString(), MachineID: b.st.MachineID(), Agent: provider, CreatedAt: now, UpdatedAt: now} if err := b.st.SaveConversation(ctx, c); err != nil { return c, err } @@ -528,7 +539,7 @@ func (b *Broker) run(ctx context.Context, c *conversation) { if err == nil && !c.readOnly { err = b.ensureSocket() } - req := Request{Prompt: preamble(t.context) + t.message.Text, Resume: resume, Directory: dir, Socket: b.socket, Conversation: c.row.ID, Token: c.token, ReadOnly: c.readOnly} + req := Request{Provider: c.row.Agent, Prompt: preamble(t.context) + t.message.Text, Resume: resume, Directory: dir, Socket: b.socket, Conversation: c.row.ID, Token: c.token, ReadOnly: c.readOnly} if c.readOnly { req.Prompt = "Use driga read tools only; no actions are available.\n" + req.Prompt } diff --git a/internal/chat/codex.go b/internal/chat/codex.go new file mode 100644 index 00000000..b027c312 --- /dev/null +++ b/internal/chat/codex.go @@ -0,0 +1,301 @@ +package chat + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "sort" + "strings" + + "github.com/google/uuid" + "github.com/labstack/driga/internal/llm" + "github.com/labstack/driga/internal/secfile" + "github.com/labstack/driga/internal/self" + "github.com/pelletier/go-toml/v2" +) + +// Codex uses exec's config-free mode, retaining CLI authentication. Disabling +// its execution environment removes native filesystem and command tools, with +// runtime backstops; commands are available only through Driga's broker. +type Codex struct{ Path, DataDir, Executable string } + +func codexVersion(ctx context.Context, path string) error { + version, err := providerMetadata(ctx, path, []string{"--version"}) + if err != nil { + return err + } + // The environment-disabled runtime was audited against this exact release. + // Fail closed for unknown tool registries rather than assume flag parity. + fields := strings.Fields(strings.TrimSpace(version)) + if len(fields) != 2 || fields[0] != "codex-cli" || fields[1] != "0.167.0" { + return errors.New("Codex assistant requires the audited 0.167.0 CLI release; other builds are not yet supported") + } + return nil +} + +func (a *Codex) Run(ctx context.Context, r Request, emit func(Delta) error) (err error) { + if err := codexVersion(ctx, a.Path); err != nil { + return err + } + if r.Resume != "" { + if _, err := uuid.Parse(r.Resume); err != nil { + return errors.New("invalid Codex resume session") + } + } + exe := a.Executable + if exe == "" { + exe, err = self.Executable() + if err != nil { + return err + } + } + env, err := mcpEnvironment(a.DataDir) + if err != nil { + return err + } + tools := append([]string{}, ReadTools...) + actions := !r.ReadOnly && r.Socket != "" && r.Token != "" + env["DRIGA_CHAT_READ_ONLY"] = "1" + if actions { + env["DRIGA_CHAT_READ_ONLY"] = "0" + env["DRIGA_CHAT_SOCKET"], env["DRIGA_CHAT_CONVERSATION"], env["DRIGA_CHAT_TOKEN"] = r.Socket, r.Conversation, r.Token + tools = append(tools, "list_prompts", "run_command") + } + // A scratch cwd prevents project configuration or instructions discovery. + // The selected project stays broker-owned; run_command resolves it there. + if err := secfile.MkdirPrivate(a.DataDir); err != nil { + return err + } + dir, err := os.MkdirTemp(a.DataDir, "codex-chat-*") + if err != nil { + return err + } + defer os.RemoveAll(dir) + var envNames, extraEnv []string + for key, value := range env { + envNames = append(envNames, key) + extraEnv = append(extraEnv, key+"="+value) + } + sort.Strings(envNames) + extraEnv = append(extraEnv, "CODEX_EXEC_SERVER_URL=none") + conf := map[string]any{ + "mcp_servers": map[string]any{"driga": map[string]any{"command": exe, "args": []string{"mcp", "--chat"}, "env_vars": envNames, "enabled_tools": tools, "required": true}}, + "approval_policy": "never", "sandbox_mode": "read-only", "web_search": "disabled", "project_doc_max_bytes": 0, + "notify": []string{}, "agents": map[string]any{"enabled": false}, + "skills": map[string]any{"bundled": map[string]any{"enabled": false}, "include_instructions": false}, + "features": map[string]any{"hooks": false, "plugins": false, "plugin_hooks": false, "apps": false, "shell_tool": false, "unified_exec": false, "js_repl": false, "multi_agent": false, "multi_agent_v2": false, "memories": false, "image_generation": false, "in_app_browser": false, "request_permissions_tool": false}, + } + args := []string{"exec", "--ignore-user-config", "--ignore-rules", "--strict-config", "--json", "--skip-git-repo-check"} + // Marshal one complete TOML value per override. Do not shell-escape arguments: + // these are passed directly to exec. Broker credentials stay out of argv. + for _, key := range []string{"mcp_servers", "approval_policy", "sandbox_mode", "web_search", "project_doc_max_bytes", "notify", "agents", "skills", "features"} { + encoded, e := toml.Marshal(map[string]any{"value": conf[key]}) + if e != nil { + return e + } + var parsed map[string]any + if e = toml.Unmarshal(encoded, &parsed); e != nil { + return e + } + value, e := codexTOMLValue(parsed["value"]) + if e != nil { + return e + } + args = append(args, "-c", key+"="+value) + } + if r.Resume != "" { + args = append(args, "resume", r.Resume) + } + args = append(args, "-") + ctx, cancel := context.WithCancel(ctx) + defer cancel() + allowed := make(map[string]bool, len(tools)) + for _, tool := range tools { + allowed[tool] = true + } + s := codexStream{emit: emit, cancel: cancel, resume: r.Resume, allowed: allowed, calls: map[string]string{}, finished: map[string]bool{}} + s.cards = stream{emit: emit, cancel: cancel} + defer func() { err = errors.Join(err, s.cards.flushCards()) }() + err = llm.RunProvider(ctx, a.Path, dir, args, extraEnv, strings.NewReader(r.Prompt), &s, io.Discard) + if s.err != nil { + return s.err + } + if err != nil { + return err + } + if len(s.buf) != 0 || !s.started || !s.completed { + return errors.New("Codex stream ended without a complete turn") + } + return nil +} + +// JSON strings and numbers are valid TOML scalars; arrays and inline tables +// need their own separators. Keys are always quoted, including environment keys. +func codexTOMLValue(value any) (string, error) { + switch v := value.(type) { + case map[string]any: + var items []string + for key, item := range v { + s, err := codexTOMLValue(item) + if err != nil { + return "", err + } + raw, _ := json.Marshal(key) + items = append(items, string(raw)+"="+s) + } + return "{" + strings.Join(items, ",") + "}", nil + case []any: + var items []string + for _, item := range v { + s, err := codexTOMLValue(item) + if err != nil { + return "", err + } + items = append(items, s) + } + return "[" + strings.Join(items, ",") + "]", nil + default: + raw, err := json.Marshal(v) + return string(raw), err + } +} + +type codexStream struct { + emit func(Delta) error + cancel context.CancelFunc + buf []byte + err error + resume string + started, completed bool + allowed map[string]bool + calls map[string]string + finished map[string]bool + cards stream +} + +func (s *codexStream) Write(p []byte) (int, error) { + if s.err != nil { + return 0, s.err + } + for _, b := range p { + if b == '\n' { + s.err = s.line(s.buf) + s.buf = s.buf[:0] + if s.err != nil { + s.cancel() + return 0, s.err + } + } else { + if len(s.buf) >= 1<<20 { + s.err = errors.New("Codex event exceeds limit") + s.cancel() + return 0, s.err + } + s.buf = append(s.buf, b) + } + } + return len(p), nil +} +func (s *codexStream) line(line []byte) error { + if len(bytes.TrimSpace(line)) == 0 { + return nil + } + var e struct { + Type, ThreadID string + Thread string `json:"thread_id"` + Item struct { + ID, Type, Text, Server, Tool, Status string + Arguments json.RawMessage + Result struct { + Content json.RawMessage + IsError bool `json:"isError"` + } + } + Error json.RawMessage + } + if err := json.Unmarshal(line, &e); err != nil { + return errors.New("invalid Codex event JSON") + } + if s.completed { + return errors.New("Codex event after completed turn") + } + switch e.Type { + case "thread.started": + if s.started { + return errors.New("duplicate Codex session") + } + if _, err := uuid.Parse(e.Thread); err != nil { + return errors.New("invalid Codex session ID") + } + if s.resume != "" && e.Thread != s.resume { + return errors.New("Codex resumed a different session") + } + s.started = true + return s.emit(Delta{SessionID: e.Thread}) + case "turn.started": + if !s.started { + return errors.New("Codex turn before session") + } + case "item.started", "item.updated", "item.completed": + if !s.started { + return errors.New("Codex item before session") + } + switch e.Item.Type { + case "agent_message": + if e.Type == "item.completed" { + return s.emit(Delta{Text: e.Item.Text}) + } + case "mcp_tool_call": + if e.Item.Server != "driga" { + return errors.New("Codex called an unexpected MCP server") + } + if !s.allowed[e.Item.Tool] { + return errors.New("Codex called a disabled Driga tool") + } + if e.Item.ID == "" || len(e.Item.ID) > 256 { + return errors.New("invalid Codex tool call ID") + } + if s.calls == nil { + s.calls = map[string]string{} + s.finished = map[string]bool{} + } + previous, exists := s.calls[e.Item.ID] + if s.finished[e.Item.ID] || exists && (previous != e.Item.Tool || e.Type == "item.started") { + return errors.New("duplicate Codex tool call ID") + } + if !exists { + if len(s.calls) >= 256 { + return errors.New("Codex tool call limit exceeded") + } + s.calls[e.Item.ID] = e.Item.Tool + if err := s.cards.panel(e.Item.ID, "mcp__driga__"+e.Item.Tool, e.Item.Arguments); err != nil { + return err + } + } + if e.Type == "item.started" { + return s.emit(Delta{Tool: e.Item.Tool}) + } + if e.Type == "item.completed" { + s.finished[e.Item.ID] = true + return s.cards.settle(e.Item.ID, e.Item.Result.Content, e.Item.Result.IsError || e.Item.Status == "failed") + } + case "reasoning", "todo_list": + default: + return fmt.Errorf("unexpected Codex native tool or item %q", e.Item.Type) + } + case "turn.completed": + if !s.started { + return errors.New("Codex completed before session") + } + s.completed = true + case "turn.failed", "error": + return errors.New("Codex turn failed; check CLI authentication and availability") + default: + return fmt.Errorf("unsupported Codex event %q", e.Type) + } + return nil +} diff --git a/internal/chat/codex_test.go b/internal/chat/codex_test.go new file mode 100644 index 00000000..97c41b7c --- /dev/null +++ b/internal/chat/codex_test.go @@ -0,0 +1,219 @@ +package chat + +import ( + "context" + "errors" + "os" + "path/filepath" + "runtime" + "strings" + "testing" + "time" + + "github.com/pelletier/go-toml/v2" +) + +const codexSession = "35a3c7c8-0f2a-4e2d-8187-bc00e17620d6" +const codexStart = `{"type":"thread.started","thread_id":"` + codexSession + `"}` + "\n" + +func TestCodexStream(t *testing.T) { + for _, tc := range []struct { + name, events, resume string + want string + fail bool + }{ + {"answer", codexStart + `{"type":"turn.started"}` + "\n" + `{"type":"item.completed","item":{"type":"agent_message","text":"answer"}}` + "\n" + `{"type":"turn.completed"}` + "\n", "", "answer", false}, + {"resume mismatch", codexStart, "f2b09f5c-9172-4271-adab-e8727ee650f5", "", true}, + {"duplicate session", codexStart + codexStart, "", "", true}, + {"native execution", codexStart + `{"type":"item.started","item":{"type":"command_execution"}}` + "\n", "", "", true}, + {"ambient MCP", codexStart + `{"type":"item.started","item":{"type":"mcp_tool_call","server":"personal"}}` + "\n", "", "", true}, + {"unknown event", codexStart + `{"type":"new.unknown"}` + "\n", "", "", true}, + {"failure", codexStart + `{"type":"turn.failed"}` + "\n", "", "", true}, + {"malformed", "broken\n", "", "", true}, + {"completion before init", `{"type":"turn.completed"}` + "\n", "", "", true}, + } { + t.Run(tc.name, func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + var answer string + s := codexStream{resume: tc.resume, cancel: cancel, emit: func(d Delta) error { answer += d.Text; return nil }} + // Exercise fragmented writes, including inside JSON strings. + var err error + for _, b := range []byte(tc.events) { + _, err = s.Write([]byte{b}) + if err != nil { + break + } + } + if (err != nil) != tc.fail { + t.Fatalf("error=%v", err) + } + if tc.fail && ctx.Err() == nil { + t.Fatal("invalid stream did not cancel child") + } + if answer != tc.want { + t.Fatalf("answer=%q", answer) + } + }) + } +} + +func fakeCodex(t *testing.T, body string) (*Codex, string) { + t.Helper() + if runtime.GOOS == "windows" { + t.Skip("Unix script fixture") + } + dir := t.TempDir() + record := filepath.Join(dir, "record") + path := filepath.Join(dir, "codex") + t.Setenv("CODEX_RECORD", record) + t.Setenv("CODEX_HOME", t.TempDir()) + t.Setenv("DRIGA_CONFIG", filepath.Join(t.TempDir(), "config.toml")) + t.Setenv("DRIGA_SPOOL_DIR", t.TempDir()) + script := "#!/bin/sh\nif [ \"$1\" = --version ]; then echo codex-cli 0.167.0; exit; fi\nprintf '%s\\n' \"$@\" > \"$CODEX_RECORD.args\"\npwd > \"$CODEX_RECORD.cwd\"\nprintf '%s\\n' \"$CODEX_EXEC_SERVER_URL\" \"$DRIGA_CHAT_TOKEN\" \"$DRIGA_INTERNAL\" > \"$CODEX_RECORD.env\"\n/bin/cat > \"$CODEX_RECORD.prompt\"\n" + body + "\n" + if err := os.WriteFile(path, []byte(script), 0700); err != nil { + t.Fatal(err) + } + return &Codex{Path: path, DataDir: t.TempDir(), Executable: "/fake/driga"}, record +} + +func TestCodexLaunchIsolationAndResume(t *testing.T) { + a, record := fakeCodex(t, "/bin/cat <<'EVENTS'\n"+codexStart+`{"type":"turn.completed"}`+"\nEVENTS") + r := Request{Prompt: "private question", Resume: codexSession, Directory: t.TempDir(), Socket: "private.sock", Conversation: "conversation", Token: "private-token"} + if err := a.Run(context.Background(), r, func(Delta) error { return nil }); err != nil { + t.Fatal(err) + } + read := func(suffix string) string { + b, e := os.ReadFile(record + suffix) + if e != nil { + t.Fatal(e) + } + return string(b) + } + args := read(".args") + for _, want := range []string{"--ignore-user-config\n", "--ignore-rules\n", "--strict-config\n", "resume\n" + codexSession + "\n-\n"} { + if !strings.Contains(args, want) { + t.Fatalf("missing %q in args %s", want, args) + } + } + if strings.Contains(args, r.Token) || strings.Contains(args, r.Prompt) { + t.Fatal("private token or prompt in argv") + } + if got := read(".env"); got != "none\nprivate-token\n1\n" { + t.Fatalf("env=%q", got) + } + if got := strings.TrimSpace(read(".cwd")); got == r.Directory { + t.Fatal("provider launched in selected project") + } else if _, err := os.Stat(got); !os.IsNotExist(err) { + t.Fatalf("scratch survived: %v", err) + } + if read(".prompt") != r.Prompt { + t.Fatal("prompt changed") + } + var conf map[string]any + for _, arg := range strings.Split(args, "\n") { + if strings.HasPrefix(arg, "mcp_servers=") { + if err := toml.Unmarshal([]byte(arg), &conf); err != nil { + t.Fatal(err) + } + } + } + server := conf["mcp_servers"].(map[string]any)["driga"].(map[string]any) + var allowed []string + for _, v := range server["enabled_tools"].([]any) { + allowed = append(allowed, v.(string)) + } + for _, bad := range []string{"approve", "kill_process", "replace_dashboard", "create_dashboard"} { + for _, name := range allowed { + if name == bad { + t.Fatalf("unsafe tool %s", bad) + } + } + } + if !strings.Contains(strings.Join(allowed, ","), "run_command") { + t.Fatal("missing broker command tool") + } +} + +func TestCodexReadOnlyAndIncomplete(t *testing.T) { + a, record := fakeCodex(t, "printf '%s\\n' '"+strings.TrimSpace(codexStart)+"'") + if err := a.Run(context.Background(), Request{ReadOnly: true}, func(Delta) error { return nil }); err == nil { + t.Fatal("accepted incomplete turn") + } + args, err := os.ReadFile(record + ".args") + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(args), "run_command") || strings.Contains(string(args), "list_prompts") { + t.Fatal("read-only launch exposes actions") + } +} + +func TestCodexPanelAndToolIdentity(t *testing.T) { + _, cancel := context.WithCancel(context.Background()) + defer cancel() + var panels []Delta + emit := func(d Delta) error { panels = append(panels, d); return nil } + s := codexStream{emit: emit, cancel: cancel, allowed: map[string]bool{"show_panels": true}, cards: stream{emit: emit, cancel: cancel}} + started := `{"type":"item.started","item":{"id":"call1","type":"mcp_tool_call","server":"driga","tool":"show_panels","arguments":{"panels":[]}}}` + "\n" + completed := `{"type":"item.completed","item":{"id":"call1","type":"mcp_tool_call","server":"driga","tool":"show_panels","result":{"content":[{"type":"text","text":"ok"}]}}}` + "\n" + if _, err := s.Write([]byte(codexStart + started + completed)); err != nil { + t.Fatal(err) + } + if len(panels) != 3 || len(panels[2].Panel) == 0 || !strings.Contains(string(panels[2].Panel), `"tool":"show_panels"`) { + t.Fatalf("missing panel: %+v", panels) + } + if _, err := s.Write([]byte(completed)); err == nil { + t.Fatal("accepted duplicate tool completion") + } + for _, name := range []string{"approve", "run_command", "replace_dashboard"} { + s := codexStream{emit: emit, cancel: cancel, allowed: map[string]bool{"show_panels": true}} + line := `{"type":"item.started","item":{"id":"disabled","type":"mcp_tool_call","server":"driga","tool":"` + name + `"}}` + "\n" + if _, err := s.Write([]byte(codexStart + line)); err == nil { + t.Fatalf("accepted disabled %s", name) + } + } +} + +func TestCodexCancellationAndCallbackFailure(t *testing.T) { + t.Run("cancel", func(t *testing.T) { + a, _ := fakeCodex(t, "/bin/sleep 60") + ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) + defer cancel() + start := time.Now() + if err := a.Run(ctx, Request{}, func(Delta) error { return nil }); err == nil { + t.Fatal("cancel succeeded") + } + if time.Since(start) > 3*time.Second { + t.Fatal("child not bounded") + } + }) + t.Run("callback", func(t *testing.T) { + a, _ := fakeCodex(t, "printf '%s\\n' '"+strings.TrimSpace(codexStart)+"'\n/bin/sleep 60") + want := errors.New("store failed") + if err := a.Run(context.Background(), Request{}, func(Delta) error { return want }); !errors.Is(err, want) { + t.Fatalf("error=%v", err) + } + }) +} + +func TestCodexUnauditedVersionsNeverReceivePrompt(t *testing.T) { + for _, version := range []string{"0.166.0", "0.167.1", "0.168.0", "0.167.0-beta", "unknown"} { + t.Run(version, func(t *testing.T) { + a, record := fakeCodex(t, "exit 0") + raw, err := os.ReadFile(a.Path) + if err != nil { + t.Fatal(err) + } + if err := os.WriteFile(a.Path, []byte(strings.Replace(string(raw), "codex-cli 0.167.0", "codex-cli "+version, 1)), 0700); err != nil { + t.Fatal(err) + } + if err := a.Run(context.Background(), Request{Prompt: "do not send"}, func(Delta) error { return nil }); err == nil { + t.Fatal("accepted unaudited version") + } + if _, err := os.Stat(record + ".prompt"); !os.IsNotExist(err) { + t.Fatalf("prompt dispatched: %v", err) + } + }) + } +} diff --git a/internal/chat/copilot.go b/internal/chat/copilot.go new file mode 100644 index 00000000..7000d3fc --- /dev/null +++ b/internal/chat/copilot.go @@ -0,0 +1,426 @@ +package chat + +import ( + "bufio" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "strconv" + "strings" + "time" + + "github.com/google/uuid" + "github.com/labstack/driga/internal/llm" + "github.com/labstack/driga/internal/secfile" +) + +// Copilot uses the SDK's headless protocol, with host-owned tools only. ACP's +// merged MCP configuration cannot provide the same configuration ceiling. +type Copilot struct { + Path, DataDir, Executable string + openTools func(context.Context, string, string, Request) (copilotTools, error) +} + +type copilotTools interface { + Catalog() []providerTool + Call(context.Context, string, json.RawMessage) (providerToolResult, error) + Close() error +} + +func (a *Copilot) Run(ctx context.Context, r Request, emit func(Delta) error) (err error) { + if a.Path == "" { + return errors.New("copilot executable is not pinned") + } + openTools := a.openTools + if openTools == nil { + openTools = func(ctx context.Context, dataDir, executable string, r Request) (copilotTools, error) { + return openProviderTools(ctx, dataDir, executable, r) + } + } + bridge, err := openTools(ctx, a.DataDir, a.Executable, r) + if err != nil { + return err + } + defer bridge.Close() + configDir := filepath.Join(a.DataDir, "assistant", "copilot") + if err := secfile.MkdirPrivate(configDir); err != nil { + return err + } + root := filepath.Join(a.DataDir, "tmp") + if err := secfile.MkdirPrivate(root); err != nil { + return err + } + dir, err := os.MkdirTemp(root, "copilot-*") + if err != nil { + return err + } + defer os.RemoveAll(dir) + ctx, cancel := context.WithCancel(ctx) + defer cancel() + input, writeInput := io.Pipe() + output, writeOutput := io.Pipe() + defer input.Close() + defer writeInput.Close() + defer output.Close() + defer writeOutput.Close() + done := make(chan error, 1) + go func() { + err := llm.RunProvider(ctx, a.Path, dir, []string{"--headless", "--stdio", "--no-auto-update", "--disable-builtin-mcps", "--no-custom-instructions", "--no-bash-env"}, nil, input, writeOutput, io.Discard) + writeOutput.CloseWithError(err) + done <- err + }() + defer func() { cancel(); writeInput.Close(); output.Close(); <-done }() + startup := time.AfterFunc(30*time.Second, cancel) + defer startup.Stop() + p := copilotRPC{ctx: ctx, reader: bufio.NewReaderSize(output, 4096), writer: writeInput, emit: emit, bridge: bridge, seen: map[string]bool{}, pending: map[string]bool{}, responses: map[string]copilotMessage{}} + p.cards = stream{emit: emit, cancel: cancel} + defer func() { err = errors.Join(err, p.cards.flushCards()) }() + var connect struct { + ProtocolVersion int `json:"protocolVersion"` + } + if err := p.call("connect", map[string]any{"clientInfo": map[string]string{"name": "driga"}}, &connect); err != nil { + return err + } + if connect.ProtocolVersion != 3 { + return fmt.Errorf("copilot requires SDK protocol 3, got %d", connect.ProtocolVersion) + } + var declarations []map[string]any + p.allowed = map[string]bool{} + var names []string + for _, t := range bridge.Catalog() { + declarations = append(declarations, map[string]any{"name": t.Name, "description": t.Description, "parameters": t.InputSchema, "hasHandler": true}) + names = append(names, t.Name) + p.allowed[t.Name] = true + } + options := map[string]any{ + "clientName": "driga-internal", "workingDirectory": dir, "configDir": configDir, + "availableTools": names, "tools": declarations, "streaming": true, + "mcpServers": map[string]any{}, "customAgents": []any{}, "installedPlugins": []any{}, + "skillDirectories": []string{}, "agentDirectories": []string{}, "hookDirectories": []string{}, + "pluginDirectories": []string{}, "instructionDirectories": []string{}, "includedBuiltinSkills": []string{}, + "enableConfigDiscovery": false, "enableFileHooks": false, "enableHostGitOperations": false, + "enableSkills": false, "enableOnDemandInstructionDiscovery": false, "skipCustomInstructions": true, + "enableSessionTelemetry": false, "enableSessionStore": false, "isExperimentalMode": false, + "skipEmbeddingRetrieval": true, "embeddingCacheStorage": "in-memory", "mcpOAuthTokenStorage": "in-memory", + "customAgentsLocalOnly": true, "coauthorEnabled": false, "manageScheduleEnabled": false, + "memory": map[string]bool{"enabled": false}, "requestPermission": true, + } + method := "session.create" + p.session = uuid.NewString() + options["sessionId"] = p.session + if r.Resume != "" { + if !validCopilotID(r.Resume) { + return errors.New("invalid copilot session ID") + } + method, options["sessionId"] = "session.resume", r.Resume + p.session = r.Resume + } + var session struct { + SessionID string `json:"sessionId"` + } + if err := p.call(method, options, &session); err != nil { + return err + } + if !validCopilotID(session.SessionID) || session.SessionID != p.session { + return errors.New("copilot returned an unexpected session ID") + } + p.session = session.SessionID + patch := map[string]any{"sessionId": p.session, "skipCustomInstructions": true, "customAgentsLocalOnly": true, "coauthorEnabled": false, "manageScheduleEnabled": false, "installedPlugins": []any{}, "includedBuiltinSkills": []string{}, "availableTools": names, "enableFileHooks": false, "enableSkills": false} + var updated struct { + Success bool `json:"success"` + PluginHookCount *int `json:"pluginHookCount"` + } + if err := p.call("session.options.update", patch, &updated); err != nil { + return err + } + if !updated.Success || updated.PluginHookCount == nil || *updated.PluginHookCount != 0 { + return errors.New("copilot did not establish isolated session options") + } + if err := p.call("session.tools.initializeAndValidate", map[string]string{"sessionId": p.session}, nil); err != nil { + return err + } + var metadata struct { + Tools []struct { + Name string `json:"name"` + } `json:"tools"` + } + if err := p.call("session.tools.getCurrentMetadata", map[string]string{"sessionId": p.session}, &metadata); err != nil { + return err + } + if metadata.Tools == nil || len(metadata.Tools) != len(names) { + return errors.New("copilot tool catalog does not match Driga's tools") + } + listed := map[string]bool{} + for _, tool := range metadata.Tools { + if !p.allowed[tool.Name] || listed[tool.Name] { + return fmt.Errorf("copilot offered an unexpected tool %q", tool.Name) + } + listed[tool.Name] = true + } + if err := emit(Delta{SessionID: p.session}); err != nil { + return err + } + if !startup.Stop() || ctx.Err() != nil { + return errors.New("copilot startup timed out") + } + p.started = true + if err := p.call("session.send", map[string]any{"sessionId": p.session, "prompt": r.Prompt}, nil); err != nil { + return err + } + for !p.finished { + message, err := p.read() + if err != nil { + return err + } + if err := p.event(message); err != nil { + return err + } + } + return ctx.Err() +} + +type copilotMessage struct { + JSONRPC string `json:"jsonrpc"` + ID json.RawMessage `json:"id,omitempty"` + Method string `json:"method,omitempty"` + Params json.RawMessage `json:"params,omitempty"` + Result json.RawMessage `json:"result,omitempty"` + Error json.RawMessage `json:"error,omitempty"` +} + +type copilotRPC struct { + ctx context.Context + reader *bufio.Reader + writer io.Writer + next int + session string + started, finished, partial bool + allowed, seen map[string]bool + pending map[string]bool + responses map[string]copilotMessage + bridge copilotTools + emit func(Delta) error + cards stream +} + +func (p *copilotRPC) write(value any) error { + b, err := json.Marshal(value) + if err != nil { + return err + } + if len(b) > maxLine { + return errors.New("copilot request exceeds limit") + } + _, err = fmt.Fprintf(p.writer, "Content-Length: %d\r\n\r\n%s", len(b), b) + return err +} + +func (p *copilotRPC) read() (copilotMessage, error) { + var message copilotMessage + length := -1 + for total := 0; ; { + chunk, err := p.reader.ReadSlice('\n') + line := string(chunk) + total += len(line) + if total > 4096 { + return message, errors.New("copilot header exceeds limit") + } + if err != nil { + return message, fmt.Errorf("copilot stream: %w", err) + } + if line == "\r\n" { + break + } + key, value, ok := strings.Cut(strings.TrimSpace(line), ":") + if !ok { + return message, errors.New("invalid copilot header") + } + if strings.EqualFold(key, "Content-Length") { + if length != -1 { + return message, errors.New("duplicate copilot content length") + } + length, err = strconv.Atoi(strings.TrimSpace(value)) + if err != nil || length < 0 || length > maxLine { + return message, errors.New("invalid copilot content length") + } + } + } + if length < 0 { + return message, errors.New("missing copilot content length") + } + b := make([]byte, length) + if _, err := io.ReadFull(p.reader, b); err != nil { + return message, err + } + if err := json.Unmarshal(b, &message); err != nil { + return message, err + } + if message.JSONRPC != "2.0" { + return message, errors.New("invalid copilot JSON-RPC version") + } + return message, nil +} + +func (p *copilotRPC) call(method string, params any, result any) error { + p.next++ + id := strconv.Itoa(p.next) + p.pending[id] = true + defer delete(p.pending, id) + if err := p.write(map[string]any{"jsonrpc": "2.0", "id": p.next, "method": method, "params": params}); err != nil { + return err + } + for { + message, cached := p.responses[id] + delete(p.responses, id) + var err error + if !cached { + message, err = p.read() + } + if err != nil { + return err + } + if message.Method != "" { + if err := p.event(message); err != nil { + return err + } + continue + } + if string(message.ID) != id { + other := string(message.ID) + if !p.pending[other] || len(p.responses) >= 64 { + return errors.New("unexpected copilot response ID") + } + if _, exists := p.responses[other]; exists { + return errors.New("duplicate copilot response ID") + } + p.responses[other] = message + continue + } + if len(message.Error) != 0 && string(message.Error) != "null" { + return fmt.Errorf("copilot %s failed", method) + } + if result != nil { + return json.Unmarshal(message.Result, result) + } + return nil + } +} + +func (p *copilotRPC) event(message copilotMessage) error { + if len(message.ID) != 0 { + // No native permission, extension or user-input callback can grant authority. + return errors.New("copilot requested an unsupported host capability") + } + if message.Method != "session.event" { + return nil + } + var notice struct { + SessionID string `json:"sessionId"` + Event struct { + Type string `json:"type"` + Data json.RawMessage `json:"data"` + } `json:"event"` + } + if err := json.Unmarshal(message.Params, ¬ice); err != nil { + return err + } + if p.session == "" || notice.SessionID != p.session { + return errors.New("unexpected copilot event session") + } + var data struct { + DeltaContent string `json:"deltaContent"` + Content string `json:"content"` + RequestID string `json:"requestId"` + ToolName string `json:"toolName"` + ToolCallID string `json:"toolCallId"` + Arguments json.RawMessage `json:"arguments"` + } + if err := json.Unmarshal(notice.Event.Data, &data); err != nil { + return err + } + switch notice.Event.Type { + case "assistant.message_delta": + if !p.started { + return errors.New("copilot generated output before prompt") + } + if !p.partial { + p.cards.gap = p.cards.printed + } + p.partial = true + return p.cards.text(data.DeltaContent) + case "assistant.message": + if !p.started { + return errors.New("copilot generated output before prompt") + } + if !p.partial { + p.cards.gap = p.cards.printed + return p.cards.text(data.Content) + } + p.partial = false + case "session.idle": + if p.started { + p.finished = true + } + case "session.error": + return errors.New("copilot turn failed") + case "permission.requested": + return errors.New("copilot requested native permission") + case "external_tool.requested": + if !p.started || !p.allowed[data.ToolName] || !validCopilotID(data.RequestID) || !validCopilotID(data.ToolCallID) || p.seen["request:"+data.RequestID] || p.seen["call:"+data.ToolCallID] || len(p.seen) >= 2048 { + return errors.New("invalid copilot tool call") + } + p.seen["request:"+data.RequestID] = true + p.seen["call:"+data.ToolCallID] = true + if err := p.emit(Delta{Tool: "mcp__driga__" + data.ToolName}); err != nil { + return err + } + if err := p.cards.panel(data.ToolCallID, "mcp__driga__"+data.ToolName, data.Arguments); err != nil { + return err + } + result, err := p.bridge.Call(p.ctx, data.ToolName, data.Arguments) + if err != nil { + return err + } + if err := p.emit(Delta{ToolUseID: data.ToolCallID, ToolResult: result.Text, Failed: result.Failed}); err != nil { + return err + } + var envelope struct { + Content json.RawMessage `json:"content"` + } + _ = json.Unmarshal([]byte(result.Text), &envelope) + if err := p.cards.settle(data.ToolCallID, envelope.Content, result.Failed); err != nil { + return err + } + params := map[string]any{"sessionId": p.session, "requestId": data.RequestID, "result": result.Text} + if result.Failed { + delete(params, "result") + params["error"] = result.Text + } + var accepted struct { + Success bool `json:"success"` + } + if err := p.call("session.tools.handlePendingToolCall", params, &accepted); err != nil { + return err + } + if !accepted.Success { + return errors.New("copilot rejected tool result") + } + } + return nil +} + +func validCopilotID(id string) bool { + if id == "" || len(id) > 256 { + return false + } + for _, c := range id { + if c < 0x21 || c > 0x7e || c == '/' || c == '\\' { + return false + } + } + return true +} diff --git a/internal/chat/copilot_test.go b/internal/chat/copilot_test.go new file mode 100644 index 00000000..81e40060 --- /dev/null +++ b/internal/chat/copilot_test.go @@ -0,0 +1,277 @@ +package chat + +import ( + "bufio" + "context" + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + "runtime" + "strings" + "testing" + "time" +) + +type copilotFixtureTools struct{ calls int } + +func (b *copilotFixtureTools) Catalog() []providerTool { + return []providerTool{{Name: "get_summary", Description: "Read summary", InputSchema: json.RawMessage(`{"type":"object"}`)}} +} +func (b *copilotFixtureTools) Call(ctx context.Context, name string, args json.RawMessage) (providerToolResult, error) { + b.calls++ + if ctx.Err() != nil { + return providerToolResult{}, ctx.Err() + } + if name != "get_summary" || string(args) != `{}` { + return providerToolResult{}, fmt.Errorf("wrong call") + } + return providerToolResult{Text: "fixture summary"}, nil +} +func (b *copilotFixtureTools) Close() error { return nil } + +func fakeCopilot(t *testing.T, mode string) (*Copilot, *copilotFixtureTools, string) { + t.Helper() + if runtime.GOOS == "windows" { + t.Skip("Unix executable shell fixture") + } + executable, err := os.Executable() + if err != nil { + t.Fatal(err) + } + dir := t.TempDir() + path := filepath.Join(dir, "copilot") + if err := os.WriteFile(path, []byte("#!/bin/sh\nexec \"$COPILOT_FIXTURE_EXE\" -test.run=^TestCopilotRuntimeFixture$\n"), 0700); err != nil { + t.Fatal(err) + } + record := filepath.Join(dir, "requests") + t.Setenv("COPILOT_FIXTURE_EXE", executable) + t.Setenv("COPILOT_FIXTURE_MODE", mode) + t.Setenv("COPILOT_FIXTURE_RECORD", record) + t.Setenv("HOME", t.TempDir()) + t.Setenv("USERPROFILE", os.Getenv("HOME")) + t.Setenv("COPILOT_HOME", t.TempDir()) + bridge := &copilotFixtureTools{} + a := &Copilot{Path: path, DataDir: t.TempDir(), openTools: func(context.Context, string, string, Request) (copilotTools, error) { return bridge, nil }} + return a, bridge, record +} + +// The subprocess implements protocol metadata and canned events only. It never +// invokes an installed agent, authentication flow or model. +func TestCopilotRuntimeFixture(t *testing.T) { + mode := os.Getenv("COPILOT_FIXTURE_MODE") + if mode == "" { + return + } + log, err := os.OpenFile(os.Getenv("COPILOT_FIXTURE_RECORD"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) + if err != nil { + os.Exit(20) + } + p := copilotRPC{reader: bufio.NewReaderSize(os.Stdin, 4096), writer: os.Stdout} + session := "fixture-session" + respond := func(m copilotMessage, value any) { + if p.write(map[string]any{"jsonrpc": "2.0", "id": m.ID, "result": value}) != nil { + os.Exit(21) + } + } + event := func(kind string, data any) { + eventSession := session + if mode == "foreign" { + eventSession = "foreign-session" + } + if p.write(map[string]any{"jsonrpc": "2.0", "method": "session.event", "params": map[string]any{"sessionId": eventSession, "event": map[string]any{"type": kind, "data": data}}}) != nil { + os.Exit(22) + } + } + tool := func() { + event("external_tool.requested", map[string]any{"requestId": "request-1", "toolCallId": "call-1", "toolName": "get_summary", "arguments": map[string]any{}}) + } + for { + m, err := p.read() + if err != nil { + os.Exit(0) + } + json.NewEncoder(log).Encode(m) + switch m.Method { + case "connect": + version := 3 + if mode == "protocol" { + version = 2 + } + respond(m, map[string]any{"protocolVersion": version}) + case "session.create", "session.resume": + var options struct { + SessionID string `json:"sessionId"` + } + json.Unmarshal(m.Params, &options) + session = options.SessionID + respond(m, map[string]any{"sessionId": session}) + case "session.options.update": + ack := map[string]any{"success": mode != "options", "pluginHookCount": 0} + if mode == "hooks-missing" { + delete(ack, "pluginHookCount") + } + if mode == "hooks-null" { + ack["pluginHookCount"] = nil + } + if mode == "hooks-active" { + ack["pluginHookCount"] = 1 + } + respond(m, ack) + case "session.tools.initializeAndValidate": + respond(m, map[string]any{}) + case "session.tools.getCurrentMetadata": + name := "get_summary" + if mode == "native" { + name = "bash" + } + respond(m, map[string]any{"tools": []any{map[string]string{"name": name}}}) + case "session.send": + respond(m, map[string]any{"messageId": "message-1"}) + if mode == "cancel" { + continue + } + if mode == "tool" || mode == "duplicate" { + tool() + continue + } + if mode == "permission" { + event("permission.requested", map[string]any{"requestId": "native-1"}) + continue + } + event("assistant.message_delta", map[string]string{"deltaContent": "answer"}) + event("assistant.message", map[string]string{"content": "answer"}) + event("session.idle", map[string]any{}) + case "session.tools.handlePendingToolCall": + respond(m, map[string]bool{"success": true}) + if mode == "duplicate" { + tool() + continue + } + event("assistant.message", map[string]string{"content": "used summary"}) + event("session.idle", map[string]any{}) + default: + os.Exit(23) + } + } +} + +func TestCopilotIsolatedTurnAndResume(t *testing.T) { + a, _, record := fakeCopilot(t, "success") + t.Setenv("DRIGA_CHAT_TOKEN", "must-not-reach-runtime") + var text, session string + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + err := a.Run(ctx, Request{Prompt: "question", Resume: "fixture-session"}, func(d Delta) error { + text += d.Text + if d.SessionID != "" { + session = d.SessionID + } + return nil + }) + if err != nil || text != "answer" || session != "fixture-session" { + t.Fatalf("text=%q session=%q err=%v", text, session, err) + } + raw, err := os.ReadFile(record) + if err != nil { + t.Fatal(err) + } + var requests []copilotMessage + decoder := json.NewDecoder(strings.NewReader(string(raw))) + for { + var m copilotMessage + if err := decoder.Decode(&m); err == io.EOF { + break + } else if err != nil { + t.Fatal(err) + } + requests = append(requests, m) + } + if len(requests) != 6 || requests[1].Method != "session.resume" || requests[5].Method != "session.send" { + t.Fatalf("request sequence: %s", raw) + } + var options map[string]any + json.Unmarshal(requests[1].Params, &options) + for _, key := range []string{"enableConfigDiscovery", "enableFileHooks", "enableHostGitOperations", "enableSkills", "enableSessionStore", "enableOnDemandInstructionDiscovery"} { + if options[key] != false { + t.Fatalf("unsafe %s=%v", key, options[key]) + } + } + if options["configDir"] == os.Getenv("COPILOT_HOME") || options["workingDirectory"] == os.Getenv("HOME") || options["sessionId"] != "fixture-session" { + t.Fatal(options) + } + if got := fmt.Sprint(options["availableTools"]); got != "[get_summary]" { + t.Fatal(got) + } +} + +func TestCopilotFailsBeforePromptWithoutSafetyCeiling(t *testing.T) { + for _, mode := range []string{"protocol", "options", "native", "hooks-missing", "hooks-null", "hooks-active"} { + t.Run(mode, func(t *testing.T) { + a, _, record := fakeCopilot(t, mode) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + if err := a.Run(ctx, Request{Prompt: "private question"}, func(Delta) error { return nil }); err == nil { + t.Fatal("unsafe runtime accepted") + } + raw, _ := os.ReadFile(record) + if strings.Contains(string(raw), "session.send") || strings.Contains(string(raw), "private question") { + t.Fatal("prompt sent before safety validation") + } + }) + } +} + +func TestCopilotHostToolsAndUnexpectedAuthority(t *testing.T) { + for _, mode := range []string{"tool", "duplicate", "foreign", "permission"} { + t.Run(mode, func(t *testing.T) { + a, bridge, _ := fakeCopilot(t, mode) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + err := a.Run(ctx, Request{Prompt: "question"}, func(Delta) error { return nil }) + if (err == nil) != (mode == "tool") { + t.Fatalf("mode %s err=%v", mode, err) + } + want := 0 + if mode == "tool" || mode == "duplicate" { + want = 1 + } + if bridge.calls != want { + t.Fatalf("tool calls=%d want=%d", bridge.calls, want) + } + }) + } +} + +func TestCopilotCancellation(t *testing.T) { + a, _, _ := fakeCopilot(t, "cancel") + ctx, cancel := context.WithCancel(context.Background()) + done := make(chan error, 1) + go func() { + done <- a.Run(ctx, Request{Prompt: "question"}, func(d Delta) error { + if d.SessionID != "" { + cancel() + } + return nil + }) + }() + defer cancel() + select { + case err := <-done: + if err == nil { + t.Fatal("canceled turn succeeded") + } + case <-time.After(4 * time.Second): + t.Fatal("provider did not stop") + } +} + +func TestCopilotRejectsOversizedAndMalformedFrames(t *testing.T) { + for _, raw := range []string{"Content-Length: 1048577\r\n\r\n", strings.Repeat("x", 8192), "Content-Length: 2\r\nContent-Length: 2\r\n\r\n{}", "Content-Length: 2\r\n\r\n{}"} { + p := copilotRPC{reader: bufio.NewReaderSize(strings.NewReader(raw), 4096)} + if _, err := p.read(); err == nil { + t.Fatal("malformed frame accepted") + } + } +} diff --git a/internal/chat/provider.go b/internal/chat/provider.go new file mode 100644 index 00000000..eab43585 --- /dev/null +++ b/internal/chat/provider.go @@ -0,0 +1,115 @@ +package chat + +import ( + "context" + "errors" + "fmt" + "io" + "os/exec" + "strings" + "time" + + "github.com/labstack/driga/internal/llm" +) + +// providers resolves lazily for new conversations. Run routes only the persisted +// provider: a failed or interrupted turn must never be replayed elsewhere. +type providers struct { + preference string + probe func(context.Context, string) (Agent, error) +} + +func NewProvider(dataDir, preference string) Agent { + if preference == "" { + preference = "auto" + } + return &providers{preference: preference, probe: func(ctx context.Context, name string) (Agent, error) { + switch name { + case "claude": + a := &Claude{DataDir: dataDir} + _, err := a.probe(ctx) + return a, err + case "codex", "copilot": + path, err := exec.LookPath(name) + if err != nil { + return nil, err + } + args := []string{"--help"} + if name == "codex" { + args = []string{"exec", "--help"} + } + help, err := providerMetadata(ctx, path, args) + if err != nil { + return nil, err + } + if name == "codex" { + if err := codexVersion(ctx, path); err != nil { + return nil, err + } + for _, flag := range []string{"--ignore-user-config", "--ignore-rules", "--json", "--sandbox", "--strict-config"} { + if !strings.Contains(help, flag) { + return nil, fmt.Errorf("codex lacks %s; upgrade Codex CLI", flag) + } + } + return &Codex{Path: path, DataDir: dataDir}, nil + } + // Headless/stdio are hidden SDK flags. Run verifies their protocol + // handshake before sending a prompt; probe the visible isolation flags. + for _, flag := range []string{"--disable-builtin-mcps", "--no-custom-instructions", "--no-bash-env", "--no-auto-update"} { + if !strings.Contains(help, flag) { + return nil, fmt.Errorf("copilot lacks %s; upgrade Copilot CLI", flag) + } + } + return &Copilot{Path: path, DataDir: dataDir}, nil + default: + return nil, fmt.Errorf("unknown assistant provider %q", name) + } + }} +} + +func (p *providers) Select(ctx context.Context) (string, error) { + names := []string{p.preference} + if p.preference == "auto" { + names = []string{"claude", "codex", "copilot"} + } + var failures []error + for _, name := range names { + if err := ctx.Err(); err != nil { + return "", err + } + if _, err := p.probe(ctx, name); err == nil { + return name, nil + } else { + failures = append(failures, fmt.Errorf("%s: %w", name, err)) + } + } + return "", fmt.Errorf("no compatible assistant available; install and sign in to Claude Code, Codex CLI or Copilot CLI: %w", errors.Join(failures...)) +} + +func (p *providers) Run(ctx context.Context, r Request, emit func(Delta) error) error { + if r.Provider == "" || r.Provider == "auto" { + return errors.New("conversation has no pinned assistant provider; start a new conversation") + } + a, err := p.probe(ctx, r.Provider) + if err != nil { + return fmt.Errorf("conversation requires %s; restore that CLI or start a new conversation: %w", r.Provider, err) + } + return a.Run(ctx, r, emit) +} + +type metadataBuffer struct{ data []byte } + +func (b *metadataBuffer) Write(p []byte) (int, error) { + if len(b.data)+len(p) > 64<<10 { + return 0, errors.New("assistant metadata exceeds limit") + } + b.data = append(b.data, p...) + return len(p), nil +} +func providerMetadata(ctx context.Context, path string, args []string) (string, error) { + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + var out metadataBuffer + err := llm.RunProvider(ctx, path, "", args, nil, nil, &out, io.Discard) + return string(out.data), err +} diff --git a/internal/chat/provider_test.go b/internal/chat/provider_test.go new file mode 100644 index 00000000..0ee854e4 --- /dev/null +++ b/internal/chat/provider_test.go @@ -0,0 +1,222 @@ +package chat + +import ( + "context" + "errors" + "reflect" + "sync" + "testing" + "time" + + "github.com/labstack/driga/internal/store" +) + +type providerAgentFunc func(context.Context, Request, func(Delta) error) error + +func (f providerAgentFunc) Run(ctx context.Context, r Request, emit func(Delta) error) error { + return f(ctx, r, emit) +} + +func TestProviderSelectionOrderAndExplicitOverride(t *testing.T) { + for _, tt := range []struct { + name, preference, available, want string + calls []string + }{ + {"first", "auto", "claude", "claude", []string{"claude"}}, + {"skip incompatible", "auto", "codex", "codex", []string{"claude", "codex"}}, + {"last", "auto", "copilot", "copilot", []string{"claude", "codex", "copilot"}}, + {"none", "auto", "", "", []string{"claude", "codex", "copilot"}}, + {"explicit available", "copilot", "copilot", "copilot", []string{"copilot"}}, + {"explicit unavailable", "claude", "codex", "", []string{"claude"}}, + } { + t.Run(tt.name, func(t *testing.T) { + var calls []string + p := &providers{preference: tt.preference, probe: func(_ context.Context, name string) (Agent, error) { + calls = append(calls, name) + if name != tt.available { + return nil, errors.New("incompatible fixture CLI") + } + return providerAgentFunc(func(context.Context, Request, func(Delta) error) error { return nil }), nil + }} + got, err := p.Select(context.Background()) + if got != tt.want || (err != nil) != (tt.want == "") || !reflect.DeepEqual(calls, tt.calls) { + t.Fatalf("selection=%q err=%v calls=%v; want=%q calls=%v", got, err, calls, tt.want, tt.calls) + } + }) + } +} + +func TestProviderSelectionCancellation(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + p := &providers{preference: "auto", probe: func(context.Context, string) (Agent, error) { + t.Fatal("canceled selection probed a provider") + return nil, nil + }} + if _, err := p.Select(ctx); !errors.Is(err, context.Canceled) { + t.Fatalf("selection err=%v", err) + } + ctx, cancel = context.WithCancel(context.Background()) + p.probe = func(context.Context, string) (Agent, error) { + cancel() + return nil, ctx.Err() + } + if _, err := p.Select(ctx); !errors.Is(err, context.Canceled) { + t.Fatalf("interrupted selection err=%v", err) + } +} + +func TestProviderRunNeverFallsBackOrChangesResume(t *testing.T) { + var calls []string + wantErr := errors.New("provider unavailable") + p := &providers{preference: "auto", probe: func(_ context.Context, name string) (Agent, error) { + calls = append(calls, name) + return nil, wantErr + }} + request := Request{Provider: "codex", Resume: "codex-private-session", Prompt: "private question"} + if err := p.Run(context.Background(), request, func(Delta) error { t.Fatal("failed provider emitted output"); return nil }); !errors.Is(err, wantErr) { + t.Fatalf("run err=%v", err) + } + if !reflect.DeepEqual(calls, []string{"codex"}) { + t.Fatalf("failed turn tried providers %v", calls) + } + p.probe = func(_ context.Context, name string) (Agent, error) { + if name != "codex" { + t.Fatalf("resume routed to %s", name) + } + return providerAgentFunc(func(_ context.Context, got Request, _ func(Delta) error) error { + if got.Provider != request.Provider || got.Resume != request.Resume || got.Prompt != request.Prompt { + t.Fatalf("request changed: %+v", got) + } + return nil + }), nil + } + if err := p.Run(context.Background(), request, func(Delta) error { return nil }); err != nil { + t.Fatal(err) + } + for _, unpinned := range []string{"", "auto"} { + if err := p.Run(context.Background(), Request{Provider: unpinned}, func(Delta) error { return nil }); err == nil { + t.Fatal("unpinned conversation ran") + } + } +} + +func providerBroker(t *testing.T, p Agent) (*Broker, *store.Store) { + t.Helper() + st, err := store.Open("", store.Memory) + if err != nil { + t.Fatal(err) + } + b, err := New(context.Background(), st, p, Options{DataDir: t.TempDir()}) + if err != nil { + st.Close() + t.Fatal(err) + } + t.Cleanup(func() { b.Close(); st.Close() }) + return b, st +} + +func TestProviderBrokerSelectionIsLazyAndFailedCreateHasNoRow(t *testing.T) { + calls := 0 + p := &providers{preference: "auto", probe: func(context.Context, string) (Agent, error) { + calls++ + return nil, errors.New("fixture unavailable") + }} + b, st := providerBroker(t, p) + if calls != 0 { + t.Fatalf("broker startup probed %d providers", calls) + } + if _, err := b.Create(context.Background()); err == nil { + t.Fatal("create succeeded without provider") + } + if rows, err := st.ChatConversations(); err != nil || len(rows) != 0 { + t.Fatalf("failed selection persisted rows=%+v err=%v", rows, err) + } +} + +func TestProviderBrokerProbesOutsideConversationLock(t *testing.T) { + entered, release := make(chan struct{}), make(chan struct{}) + p := &providers{preference: "codex", probe: func(ctx context.Context, _ string) (Agent, error) { + close(entered) + select { + case <-release: + return nil, errors.New("fixture unavailable") + case <-ctx.Done(): + return nil, ctx.Err() + } + }} + b, st := providerBroker(t, p) + if err := st.SaveConversation(context.Background(), store.Conversation{ID: "existing", Agent: "claude", CreatedAt: time.Now(), UpdatedAt: time.Now()}); err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + done := make(chan struct{}) + go func() { defer close(done); _, _ = b.Create(ctx) }() + <-entered + read := make(chan error, 1) + go func() { _, err := b.Read(context.Background(), "existing", 0); read <- err }() + select { + case err := <-read: + if err != nil { + close(release) + <-done + t.Fatal(err) + } + case <-time.After(time.Second): + close(release) + <-done + t.Fatal("provider probe blocked existing conversation reads") + } + close(release) + <-done +} + +func TestProviderBrokerPinsNewAndLegacyConversationRequests(t *testing.T) { + var mu sync.Mutex + var requests []Request + p := &providers{preference: "codex", probe: func(_ context.Context, name string) (Agent, error) { + return providerAgentFunc(func(_ context.Context, r Request, emit func(Delta) error) error { + mu.Lock() + requests = append(requests, r) + mu.Unlock() + return emit(Delta{SessionID: name + "-session", Text: "fixture answer"}) + }), nil + }} + b, st := providerBroker(t, p) + ctx := context.Background() + c, err := b.Create(ctx) + if err != nil || c.Agent != "codex" { + t.Fatalf("new conversation=%+v err=%v", c, err) + } + if err := b.Send(ctx, c.ID, "first", Context{}); err != nil { + t.Fatal(err) + } + settled(t, b, c.ID) + if err := b.Send(ctx, c.ID, "resume", Context{}); err != nil { + t.Fatal(err) + } + settled(t, b, c.ID) + if err := st.SaveConversation(ctx, store.Conversation{ID: "legacy", Agent: "claude", SessionID: "original-claude-id", CreatedAt: time.Now(), UpdatedAt: time.Now()}); err != nil { + t.Fatal(err) + } + if err := b.Send(ctx, "legacy", "continue", Context{}); err != nil { + t.Fatal(err) + } + settled(t, b, "legacy") + b.Close() + next, err := New(ctx, st, p, Options{DataDir: t.TempDir()}) + if err != nil { + t.Fatal(err) + } + defer next.Close() + if err := next.Send(ctx, c.ID, "after broker restart", Context{}); err != nil { + t.Fatal(err) + } + settled(t, next, c.ID) + mu.Lock() + defer mu.Unlock() + if len(requests) != 4 || requests[0].Provider != "codex" || requests[0].Resume != "" || requests[1].Provider != "codex" || requests[1].Resume != "codex-session" || requests[2].Provider != "claude" || requests[2].Resume != "original-claude-id" || requests[3].Provider != "codex" || requests[3].Resume != "codex-session" { + t.Fatalf("routed requests=%+v", requests) + } +} diff --git a/internal/chat/provider_tools.go b/internal/chat/provider_tools.go new file mode 100644 index 00000000..5160429c --- /dev/null +++ b/internal/chat/provider_tools.go @@ -0,0 +1,335 @@ +package chat + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "slices" + "strings" + "sync" + "time" + + "github.com/labstack/driga/internal/platform" + "github.com/labstack/driga/internal/secfile" + "github.com/labstack/driga/internal/self" + "github.com/modelcontextprotocol/go-sdk/jsonrpc" + sdk "github.com/modelcontextprotocol/go-sdk/mcp" +) + +const providerCatalogLimit = 256 << 10 + +type providerTool struct { + Name, Description string + InputSchema json.RawMessage +} +type providerToolResult struct { + Text string + Failed bool +} + +// providerTools is a turn-scoped, host-owned MCP connection. The provider sees +// only this catalog; it never receives the broker capability or an approve tool. +// Adapters must reject duplicate vendor call IDs before invoking Call. +type providerTools struct { + session *sdk.ClientSession + connection *providerToolConnection + catalog []providerTool + allowed map[string]bool + gate chan struct{} + calls int + ctx context.Context + cancel context.CancelFunc + done chan error + closeOnce sync.Once + closeErr error + cleanup func() +} + +func openProviderTools(ctx context.Context, dataDir, executable string, r Request) (*providerTools, error) { + if dataDir == "" { + return nil, errors.New("provider tools require a data directory") + } + if !r.ReadOnly && (r.Socket == "" || r.Conversation == "" || r.Token == "") { + return nil, errors.New("provider tool approval bridge unavailable") + } + env, err := mcpEnvironment(dataDir) + if err != nil { + return nil, err + } + env["DRIGA_CHAT_READ_ONLY"] = "1" + if !r.ReadOnly { + env["DRIGA_CHAT_READ_ONLY"] = "0" + env["DRIGA_CHAT_SOCKET"], env["DRIGA_CHAT_CONVERSATION"], env["DRIGA_CHAT_TOKEN"] = r.Socket, r.Conversation, r.Token + } + if executable == "" { + executable, err = self.Executable() + if err != nil { + return nil, err + } + } + tmp := filepath.Join(env["DRIGA_DATA_DIR"], "tmp") + if err := secfile.MkdirPrivate(tmp); err != nil { + return nil, err + } + cwd, err := os.MkdirTemp(tmp, "provider-tools-") + if err != nil { + return nil, err + } + cleanup := func() { _ = os.RemoveAll(cwd) } + tools, err := startProviderTools(ctx, !r.ReadOnly, func(childCtx context.Context) *exec.Cmd { + cmd := exec.CommandContext(childCtx, executable, "mcp", "--chat") + cmd.Dir = cwd + cmd.Env = providerToolEnvironment(os.Environ(), env) + return cmd + }) + if err != nil { + cleanup() + return nil, err + } + tools.cleanup = cleanup + return tools, nil +} + +func providerToolEnvironment(inherited []string, overrides map[string]string) []string { + env := make([]string, 0, len(inherited)+len(overrides)+1) + for _, entry := range inherited { + key, _, _ := strings.Cut(entry, "=") + upper := strings.ToUpper(key) + if strings.HasPrefix(upper, "DRIGA_CHAT_") || upper == "DRIGA_INTERNAL" { + continue + } + overridden := false + for replacement := range overrides { + if strings.EqualFold(key, replacement) { + overridden = true + break + } + } + if !overridden { + env = append(env, entry) + } + } + for key, value := range overrides { + env = append(env, key+"="+value) + } + return append(env, "DRIGA_INTERNAL=1") +} + +// The factory is a test seam; production always starts our own mcp --chat. +func startProviderTools(ctx context.Context, actions bool, command func(context.Context) *exec.Cmd) (*providerTools, error) { + childCtx, cancel := context.WithCancel(ctx) + stdin, input, err := os.Pipe() + if err != nil { + cancel() + return nil, err + } + output, stdout, err := os.Pipe() + if err != nil { + cancel() + stdin.Close() + input.Close() + return nil, err + } + cmd := command(childCtx) + cmd.Stdin, cmd.Stdout, cmd.Stderr = stdin, stdout, io.Discard + tools := &providerTools{ctx: childCtx, cancel: cancel, done: make(chan error, 1), gate: make(chan struct{}, 1), allowed: map[string]bool{}} + go func() { + err := platform.RunChild(cmd) + _ = stdin.Close() + _ = stdout.Close() + tools.done <- err + }() + transport := &providerToolTransport{IOTransport: sdk.IOTransport{Reader: output, Writer: input, MaxLineLength: maxLine}} + client := sdk.NewClient(&sdk.Implementation{Name: "driga-provider", Version: "1"}, &sdk.ClientOptions{ + Capabilities: &sdk.ClientCapabilities{}, + // Tool execution must never be replayed by automatic input fulfillment. + MultiRoundTrip: &sdk.MultiRoundTripOptions{Disabled: true}, + }) + startup, stopStartup := context.WithTimeout(childCtx, 10*time.Second) + defer stopStartup() + tools.session, err = client.Connect(startup, transport, nil) + tools.connection = transport.connection + if err == nil { + err = tools.discover(startup, actions) + } + if err != nil { + cancel() + _ = output.Close() + _ = input.Close() + _ = tools.Close() + return nil, fmt.Errorf("provider tools unavailable: %w", err) + } + return tools, nil +} + +func (p *providerTools) discover(ctx context.Context, actions bool) error { + allow := append([]string(nil), ReadTools...) + if actions { + allow = append(allow, "list_prompts", "run_command") + allow = append(allow, DashboardWrites...) + } + cursor := "" + cursors, names := map[string]bool{}, map[string]bool{} + total, catalogBytes := 0, 0 + for page := 0; page < 8; page++ { + result, err := p.session.ListTools(ctx, &sdk.ListToolsParams{Cursor: cursor}) + if err != nil { + return err + } + total += len(result.Tools) + if total > 128 { + return errors.New("provider tool catalog exceeds limit") + } + for _, tool := range result.Tools { + if tool == nil || tool.Name == "" || names[tool.Name] { + return errors.New("invalid provider tool catalog") + } + names[tool.Name] = true + if !slices.Contains(allow, tool.Name) { + continue + } + schema, err := json.Marshal(tool.InputSchema) + if err != nil { + return err + } + if len(schema) == 0 || schema[0] != '{' { + return errors.New("invalid provider tool schema") + } + catalogBytes += len(tool.Name) + len(tool.Description) + len(schema) + if catalogBytes > providerCatalogLimit { + return errors.New("provider tool catalog exceeds limit") + } + p.catalog = append(p.catalog, providerTool{tool.Name, tool.Description, schema}) + p.allowed[tool.Name] = true + } + if result.NextCursor == "" { + if len(p.catalog) == 0 { + return errors.New("no supported provider tools available") + } + return nil + } + if cursors[result.NextCursor] { + return errors.New("provider tool catalog repeats a page") + } + cursor = result.NextCursor + cursors[cursor] = true + } + return errors.New("provider tool catalog exceeds page limit") +} + +func (p *providerTools) Catalog() []providerTool { + tools := append([]providerTool(nil), p.catalog...) + for i := range tools { + tools[i].InputSchema = append(json.RawMessage(nil), tools[i].InputSchema...) + } + return tools +} + +func (p *providerTools) Call(ctx context.Context, name string, arguments json.RawMessage) (providerToolResult, error) { + var empty providerToolResult + if !p.allowed[name] { + return empty, fmt.Errorf("provider tool %q unavailable", name) + } + arguments = bytes.TrimSpace(arguments) + if len(arguments) == 0 { + arguments = json.RawMessage(`{}`) + } + if len(arguments) > MaxText || arguments[0] != '{' || !json.Valid(arguments) { + return empty, errors.New("invalid or oversized provider tool arguments") + } + select { + case p.gate <- struct{}{}: + case <-ctx.Done(): + return empty, ctx.Err() + case <-p.ctx.Done(): + return empty, p.ctx.Err() + } + defer func() { <-p.gate }() + if err := p.ctx.Err(); err != nil { + return empty, err + } + if p.calls >= 128 { + return empty, errors.New("provider turn tool limit exceeded") + } + p.calls++ + result, err := p.session.CallTool(ctx, &sdk.CallToolParams{Name: name, Arguments: arguments}) + if err != nil { + return empty, err + } + if result.NeedsInput() { + return empty, errors.New("provider tool requested unsupported input; call was not replayed") + } + // Keep the raw MCP envelope: decoding structuredContent through any can round + // session IDs above 2^53. The SDK still validates the response and its status. + raw := p.connection.result() + if len(raw) == 0 || len(raw) > maxLine { + return empty, errors.New("invalid or oversized provider tool result") + } + return providerToolResult{Text: string(raw), Failed: result.IsError}, nil +} + +func (p *providerTools) Close() error { + p.closeOnce.Do(func() { + p.cancel() + if p.session != nil { + p.closeErr = p.session.Close() + } + <-p.done // RunChild reaps the owned group/job, including cancellation. + if p.cleanup != nil { + p.cleanup() + } + }) + return p.closeErr +} + +type providerToolTransport struct { + sdk.IOTransport + connection *providerToolConnection +} + +func (t *providerToolTransport) Connect(ctx context.Context) (sdk.Connection, error) { + c, err := t.IOTransport.Connect(ctx) + if err != nil { + return nil, err + } + t.connection = &providerToolConnection{Connection: c} + return t.connection, nil +} + +type providerToolConnection struct { + sdk.Connection + mu sync.Mutex + callID jsonrpc.ID + raw json.RawMessage +} + +func (c *providerToolConnection) Write(ctx context.Context, message jsonrpc.Message) error { + if req, ok := message.(*jsonrpc.Request); ok && req.Method == "tools/call" { + c.mu.Lock() + c.callID, c.raw = req.ID, nil + c.mu.Unlock() + } + return c.Connection.Write(ctx, message) +} +func (c *providerToolConnection) Read(ctx context.Context) (jsonrpc.Message, error) { + message, err := c.Connection.Read(ctx) + if response, ok := message.(*jsonrpc.Response); ok { + c.mu.Lock() + if response.ID == c.callID && c.raw == nil { + c.raw = append(json.RawMessage(nil), response.Result...) + } + c.mu.Unlock() + } + return message, err +} +func (c *providerToolConnection) result() json.RawMessage { + c.mu.Lock() + defer c.mu.Unlock() + return append(json.RawMessage(nil), c.raw...) +} diff --git a/internal/chat/provider_tools_test.go b/internal/chat/provider_tools_test.go new file mode 100644 index 00000000..3a6152a0 --- /dev/null +++ b/internal/chat/provider_tools_test.go @@ -0,0 +1,273 @@ +package chat + +import ( + "bufio" + "context" + "encoding/json" + "fmt" + "os" + "os/exec" + "path/filepath" + "slices" + "strings" + "testing" + "time" +) + +func TestProviderToolChild(t *testing.T) { + mode := os.Getenv("DRIGA_TEST_TOOL_CHILD") + if mode == "" { + return + } + scanner := bufio.NewScanner(os.Stdin) + scanner.Buffer(make([]byte, 4096), 2<<20) + for scanner.Scan() { + var request struct { + ID json.RawMessage `json:"id"` + Method string `json:"method"` + Params json.RawMessage `json:"params"` + } + if json.Unmarshal(scanner.Bytes(), &request) != nil { + os.Exit(2) + } + if len(request.ID) == 0 { + continue + } + var result any + switch request.Method { + case "initialize": + result = map[string]any{"protocolVersion": "2025-06-18", "capabilities": map[string]any{"tools": map[string]any{}}, "serverInfo": map[string]any{"name": "fixture", "version": "1"}} + case "tools/list": + names := []string{"get_summary", "list_agents", "list_prompts", "run_command", "create_dashboard", "edit_dashboard", "approve", "delete_dashboard", "replace_dashboard", "restore_dashboard_version", "kill", "cleanup", "unknown"} + if mode == "duplicate" { + names = append(names, "get_summary") + } + catalog := []map[string]any{} + for _, name := range names { + catalog = append(catalog, map[string]any{"name": name, "description": "fixture " + name, "inputSchema": map[string]any{"type": "object"}}) + } + result = map[string]any{"tools": catalog} + if mode == "pages" { + result = map[string]any{"tools": []any{}, "nextCursor": "repeat"} + } + case "tools/call": + if marker := os.Getenv("DRIGA_TEST_TOOL_MARKER"); marker != "" { + f, err := os.OpenFile(marker, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) + if err != nil { + os.Exit(2) + } + fmt.Fprintln(f, string(request.Params)) + f.Close() + } + if mode == "block" { + time.Sleep(time.Hour) + os.Exit(2) + } + if mode == "oversize" { + result = map[string]any{"content": []map[string]string{{"type": "text", "text": strings.Repeat("x", maxLine+1)}}} + break + } + if mode == "input" { + result = json.RawMessage(`{"resultType":"input_required","inputRequests":{},"content":[]}`) + break + } + if mode == "error" { + result = map[string]any{"content": []map[string]string{{"type": "text", "text": "refused by broker"}}, "isError": true} + break + } + result = json.RawMessage(`{"content":[{"type":"text","text":"fixture result"}],"structuredContent":{"id":9007199254740993}}`) + default: + result = map[string]any{} + } + if err := json.NewEncoder(os.Stdout).Encode(map[string]any{"jsonrpc": "2.0", "id": request.ID, "result": result}); err != nil { + os.Exit(2) + } + } + os.Exit(0) +} + +func providerToolFixture(t *testing.T, ctx context.Context, actions bool, mode string) (*providerTools, string, error) { + t.Helper() + marker := filepath.Join(t.TempDir(), "calls") + p, err := startProviderTools(ctx, actions, func(childCtx context.Context) *exec.Cmd { + cmd := exec.CommandContext(childCtx, os.Args[0], "-test.run=^TestProviderToolChild$") + cmd.Env = append(os.Environ(), "DRIGA_TEST_TOOL_CHILD="+mode, "DRIGA_TEST_TOOL_MARKER="+marker) + return cmd + }) + if err == nil { + t.Cleanup(func() { _ = p.Close() }) + } + return p, marker, err +} + +func TestProviderToolCatalogRestrictsAuthority(t *testing.T) { + for _, actions := range []bool{false, true} { + t.Run(fmt.Sprint(actions), func(t *testing.T) { + p, marker, err := providerToolFixture(t, context.Background(), actions, "normal") + if err != nil { + t.Fatal(err) + } + names := []string{} + for _, tool := range p.Catalog() { + names = append(names, tool.Name) + } + want := []string{"get_summary", "list_agents"} + if actions { + want = append(want, "list_prompts", "run_command", "create_dashboard", "edit_dashboard") + } + if !slices.Equal(names, want) { + t.Fatal(names) + } + catalog := p.Catalog() + catalog[0].InputSchema[0] = '!' + if p.Catalog()[0].InputSchema[0] != '{' { + t.Fatal("catalog aliases internal schema") + } + denied := []string{"approve", "delete_dashboard", "replace_dashboard", "restore_dashboard_version", "kill", "cleanup", "unknown", "mcp__driga__get_summary"} + if !actions { + denied = append(denied, "run_command", "list_prompts", "create_dashboard", "edit_dashboard") + } + for _, name := range denied { + if _, err := p.Call(context.Background(), name, json.RawMessage(`{}`)); err == nil { + t.Fatal("unsafe tool accepted", name) + } + } + if _, err := os.Stat(marker); !os.IsNotExist(err) { + t.Fatal("rejected tools reached MCP child", err) + } + result, err := p.Call(context.Background(), "get_summary", json.RawMessage(`{"id":9007199254740993}`)) + if err != nil || result.Failed || !strings.Contains(result.Text, "9007199254740993") { + t.Fatal(result, err) + } + b, err := os.ReadFile(marker) + if err != nil || !strings.Contains(string(b), "9007199254740993") { + t.Fatal("argument integer rounded", string(b), err) + } + }) + } +} + +func TestProviderToolArgumentAndResultLimits(t *testing.T) { + p, marker, err := providerToolFixture(t, context.Background(), true, "normal") + if err != nil { + t.Fatal(err) + } + for _, args := range []string{`[]`, `null`, `{`, `{} {}`, `{"x":"` + strings.Repeat("x", MaxText) + `"}`} { + if _, err := p.Call(context.Background(), "get_summary", json.RawMessage(args)); err == nil { + t.Fatal("invalid arguments accepted") + } + } + if _, err := os.Stat(marker); !os.IsNotExist(err) { + t.Fatal("invalid arguments dispatched", err) + } + large, _, err := providerToolFixture(t, context.Background(), true, "oversize") + if err != nil { + t.Fatal(err) + } + if _, err := large.Call(context.Background(), "get_summary", nil); err == nil { + t.Fatal("oversized result accepted") + } + failed, _, err := providerToolFixture(t, context.Background(), true, "error") + if err != nil { + t.Fatal(err) + } + result, err := failed.Call(context.Background(), "run_command", json.RawMessage(`{}`)) + if err != nil || !result.Failed || !strings.Contains(result.Text, "refused by broker") { + t.Fatal(result, err) + } +} + +func TestProviderToolCatalogRejectsDuplicateAndLoop(t *testing.T) { + for _, mode := range []string{"duplicate", "pages"} { + if p, _, err := providerToolFixture(t, context.Background(), true, mode); err == nil { + p.Close() + t.Fatal("bad catalog accepted", mode) + } + } +} + +func TestProviderToolCancelReapsChild(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + p, marker, err := providerToolFixture(t, ctx, true, "block") + if err != nil { + cancel() + t.Fatal(err) + } + done := make(chan error, 1) + go func() { _, err := p.Call(context.Background(), "run_command", json.RawMessage(`{}`)); done <- err }() + deadline := time.Now().Add(3 * time.Second) + for { + if _, err := os.Stat(marker); err == nil { + break + } + if time.Now().After(deadline) { + cancel() + t.Fatal("tool not dispatched") + } + time.Sleep(5 * time.Millisecond) + } + cancel() + select { + case err := <-done: + if err == nil { + t.Fatal("cancelled call succeeded") + } + case <-time.After(5 * time.Second): + t.Fatal("cancelled child did not unblock call") + } + _ = p.Close() + _ = p.Close() + if _, err := p.Call(context.Background(), "get_summary", nil); err == nil { + t.Fatal("closed turn accepted tool") + } + b, err := os.ReadFile(marker) + if err != nil || strings.Count(string(b), "\n") != 1 { + t.Fatal("cancelled tool replayed", string(b), err) + } +} + +func TestProviderToolEnvironmentRemovesInheritedAuthority(t *testing.T) { + got := providerToolEnvironment([]string{"HOME=/fixture", "DRIGA_CHAT_TOKEN=old", "driga_chat_socket=old", "DRIGA_CHAT_READ_ONLY=0", "DRIGA_INTERNAL=old", "DRIGA_DATA_DIR=old"}, map[string]string{"DRIGA_DATA_DIR": "/data", "DRIGA_CHAT_READ_ONLY": "1"}) + want := []string{"HOME=/fixture", "DRIGA_DATA_DIR=/data", "DRIGA_CHAT_READ_ONLY=1", "DRIGA_INTERNAL=1"} + slices.Sort(got) + slices.Sort(want) + if !slices.Equal(got, want) { + t.Fatal(got) + } + if _, err := openProviderTools(context.Background(), t.TempDir(), os.Args[0], Request{}); err == nil { + t.Fatal("missing bridge accepted") + } +} + +func TestProviderToolDoesNotReplayInputRequest(t *testing.T) { + p, marker, err := providerToolFixture(t, context.Background(), true, "input") + if err != nil { + t.Fatal(err) + } + if _, err := p.Call(context.Background(), "run_command", nil); err == nil || !strings.Contains(err.Error(), "not replayed") { + t.Fatal(err) + } + b, err := os.ReadFile(marker) + if err != nil || strings.Count(string(b), "\n") != 1 { + t.Fatal("tool automatically replayed", string(b), err) + } +} + +func TestProviderToolTurnBudget(t *testing.T) { + p, marker, err := providerToolFixture(t, context.Background(), true, "normal") + if err != nil { + t.Fatal(err) + } + for i := 0; i < 128; i++ { + if _, err := p.Call(context.Background(), "get_summary", nil); err != nil { + t.Fatal(err) + } + } + if _, err := p.Call(context.Background(), "get_summary", nil); err == nil { + t.Fatal("turn budget ignored") + } + b, err := os.ReadFile(marker) + if err != nil || strings.Count(string(b), "\n") != 128 { + t.Fatal("extra request dispatched", err) + } +} diff --git a/internal/chat/transport.go b/internal/chat/transport.go index e8111c5d..68c8b986 100644 --- a/internal/chat/transport.go +++ b/internal/chat/transport.go @@ -426,7 +426,7 @@ func (c *Remote) Read(ctx context.Context, id string, after uint64) (State, erro // Open uses the service when available. The fallback is private to the opening // client, with no persistent driga history or competing collector socket. -func Open(ctx context.Context, dataDir string, snippets bool) (Client, bool, func(), error) { +func Open(ctx context.Context, dataDir string, snippets bool, provider string) (Client, bool, func(), error) { remote, err := Dial(ctx, dataDir) if err == nil { return remote, false, remote.Close, nil @@ -440,7 +440,7 @@ func Open(ctx context.Context, dataDir string, snippets bool) (Client, bool, fun return nil, false, nil, err } collected, _ := store.Open(filepath.Join(dataDir, "driga.db"), store.ReadOnly) - b, err := New(ctx, st, &Claude{DataDir: dataDir}, Options{Snippets: snippets, Ephemeral: true, DataDir: dataDir, ContextStore: collected}) + b, err := New(ctx, st, NewProvider(dataDir, provider), Options{Snippets: snippets, Ephemeral: true, DataDir: dataDir, ContextStore: collected}) if err != nil { if collected != nil { _ = collected.Close() diff --git a/internal/chat/transport_test.go b/internal/chat/transport_test.go index 6ca3cba4..189a3fad 100644 --- a/internal/chat/transport_test.go +++ b/internal/chat/transport_test.go @@ -35,7 +35,7 @@ func TestSocketAndFallback(t *testing.T) { if err != nil || info.Mode().Perm() != 0600 { t.Fatal(info, err) } - c, ephemeral, closeClient, err := Open(ctx, dir, true) + c, ephemeral, closeClient, err := Open(ctx, dir, true, "auto") if err != nil || ephemeral { t.Fatal(ephemeral, err) } @@ -51,7 +51,7 @@ func TestSocketAndFallback(t *testing.T) { t.Fatal("replaced live broker") } fallbackDir := filepath.Join(t.TempDir(), "absent") - c, ephemeral, closeClient, err = Open(ctx, fallbackDir, true) + c, ephemeral, closeClient, err = Open(ctx, fallbackDir, true, "auto") if err != nil || !ephemeral { t.Fatal(ephemeral, err) } diff --git a/internal/cli/ask.go b/internal/cli/ask.go index 5e970c10..726c82e6 100644 --- a/internal/cli/ask.go +++ b/internal/cli/ask.go @@ -17,7 +17,7 @@ import ( type AskCmd struct { AskOptions - Question []string `arg:"" required:"" help:"One-shot Chat question using Claude and driga's read-only tools."` + Question []string `arg:"" required:"" help:"One-shot Chat question using the selected assistant and driga's read-only tools."` } func (a AskCmd) Run(g *Globals) error { @@ -27,7 +27,7 @@ func (a AskCmd) Run(g *Globals) error { if err != nil { return err } - client, ephemeral, closeChat, err := chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets()) + client, ephemeral, closeChat, err := chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets(), cfg.Assistant.Provider) if err != nil { return err } diff --git a/internal/cli/dev_serve.go b/internal/cli/dev_serve.go index 9292c730..58489bc7 100644 --- a/internal/cli/dev_serve.go +++ b/internal/cli/dev_serve.go @@ -57,7 +57,7 @@ func (c DevServeCmd) Run(g *Globals) error { opts := pageOptions(g, &local) // Chat goes to the Driga service when it runs, as the app's does. var closeChat func() - if opts.Chat, _, closeChat, err = chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets()); err != nil { + if opts.Chat, _, closeChat, err = chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets(), cfg.Assistant.Provider); err != nil { return err } defer closeChat() diff --git a/internal/cli/root.go b/internal/cli/root.go index d86d25d5..74dac866 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -62,7 +62,7 @@ type Root struct { Reclaim ReclaimCmd `cmd:"" help:"Review resource reclaim candidates and local action history."` Top TopCmd `cmd:"" help:"Open the interactive session viewer."` App AppCmd `cmd:"" help:"Open the Driga desktop app, or focus it."` - Ask AskCmd `cmd:"" help:"Ask a one-shot Chat question through Claude and driga's read-only tools."` + Ask AskCmd `cmd:"" help:"Ask a one-shot Chat question through the selected assistant and driga's read-only tools."` MCP MCPCmd `cmd:"" name:"mcp" help:"Serve collected views and editable dashboards over MCP stdio."` Doctor DoctorCmd `cmd:"" help:"Check setup and collection health."` Init InitCmd `cmd:"" help:"Guide optional setup."` diff --git a/internal/cli/top.go b/internal/cli/top.go index 85c87a0c..f0a78908 100644 --- a/internal/cli/top.go +++ b/internal/cli/top.go @@ -53,7 +53,7 @@ func (c TopCmd) Run(g *Globals) error { return err } defer closeSource() - chatClient, ephemeral, closeChat, err := chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets()) + chatClient, ephemeral, closeChat, err := chat.Open(ctx, config.DataDir(), cfg.CaptureSnippets(), cfg.Assistant.Provider) if err != nil { return err } diff --git a/internal/collector/chat_provider_self_test.go b/internal/collector/chat_provider_self_test.go new file mode 100644 index 00000000..8a8b3d80 --- /dev/null +++ b/internal/collector/chat_provider_self_test.go @@ -0,0 +1,75 @@ +package collector + +import ( + "context" + "testing" + + "github.com/labstack/driga/internal/model" + "github.com/labstack/driga/internal/spool" + "github.com/labstack/driga/internal/store" +) + +func TestInternalChatExclusionUsesProviderIdentity(t *testing.T) { + for _, provider := range []string{"claude", "codex", "copilot"} { + t.Run(provider, func(t *testing.T) { + d, st, _, a := setup(t) + a.obs = nil + for _, agent := range []string{"claude", "codex", "copilot"} { + obs := model.SessionObs{Adapter: agent, ExternalID: "same-id", Cwd: t.TempDir(), RegistryStatus: "busy", StartedAt: d.now(), LastActivityAt: d.now()} + a.obs = append(a.obs, obs) + if err := st.Tx(context.Background(), func(tx *store.Tx) error { + _, err := tx.UpsertSession(model.Session{SessionObs: obs}) + return err + }); err != nil { + t.Fatal(err) + } + } + if err := st.SaveConversation(context.Background(), store.Conversation{ID: "internal", Agent: provider, SessionID: "same-id", CreatedAt: d.now(), UpdatedAt: d.now()}); err != nil { + t.Fatal(err) + } + for _, agent := range []string{"claude", "codex", "copilot"} { + if err := spool.Append(d.SpoolDir, model.HookEvent{Adapter: agent, SessionID: "same-id", Event: "UserPromptSubmit", TS: d.now(), Cwd: t.TempDir()}); err != nil { + t.Fatal(err) + } + } + pass(t, d, st, Plan{}) + got := sessions(t, st) + if len(got) != 2 { + t.Fatalf("sessions = %+v, want both other providers", got) + } + for _, session := range got { + if session.Adapter == provider { + t.Fatalf("internal %s session was collected: %+v", provider, session) + } + } + // A hook arriving between full passes must remain excluded by the + // lightweight drain path too, without consuming another provider's ID. + if err := spool.Append(d.SpoolDir, model.HookEvent{Adapter: provider, SessionID: "same-id", Event: "UserPromptSubmit", TS: d.now(), Cwd: t.TempDir()}); err != nil { + t.Fatal(err) + } + if err := drainOnly(context.Background(), d, st); err != nil { + t.Fatal(err) + } + if got := sessions(t, st); len(got) != 2 { + t.Fatalf("drain sessions = %+v, want both other providers", got) + } + if got, err := st.Events(provider, "same-id", d.now()); err != nil || len(got) != 0 { + t.Fatalf("internal events = %+v, err=%v", got, err) + } + }) + } +} + +func TestInternalChatEventsPreserveControlRecords(t *testing.T) { + identity := store.ChatSession{Agent: "copilot", SessionID: "internal"} + events := []model.HookEvent{ + {Adapter: "copilot", SessionID: "internal", Event: "UserPromptSubmit"}, + {Adapter: "codex", SessionID: "internal", Event: "UserPromptSubmit"}, + {Adapter: "copilot", SessionID: "internal", Event: "ack"}, + {Adapter: "copilot", SessionID: "internal", Event: "summary"}, + } + got := internalChatEvents(events, map[store.ChatSession]bool{identity: true}) + if len(got) != 3 || got[0].Adapter != "codex" || got[1].Event != "ack" || got[2].Event != "summary" { + t.Fatalf("remaining events = %+v", got) + } +} diff --git a/internal/collector/chat_self_test.go b/internal/collector/chat_self_test.go index 38cffada..f34db970 100644 --- a/internal/collector/chat_self_test.go +++ b/internal/collector/chat_self_test.go @@ -17,7 +17,7 @@ func TestChatOwnSessionIsNotCollected(t *testing.T) { chat.ExternalID, chat.PID, chat.Title = "chat", 0, model.ChatPreamble+" Explain collected state" // Before its first prompt is read, Chat is known by where it runs. data := t.TempDir() - if err := st.SaveConversation(context.Background(), store.Conversation{ID: "our-chat", SessionID: "chat", CreatedAt: d.now(), UpdatedAt: d.now()}); err != nil { + if err := st.SaveConversation(context.Background(), store.Conversation{ID: "our-chat", Agent: "claude", SessionID: "chat", CreatedAt: d.now(), UpdatedAt: d.now()}); err != nil { t.Fatal(err) } early := a.obs[0] diff --git a/internal/collector/daemon.go b/internal/collector/daemon.go index 66626027..28b98d97 100644 --- a/internal/collector/daemon.go +++ b/internal/collector/daemon.go @@ -287,7 +287,7 @@ func run(ctx context.Context, d Deps, dataDir string) error { }); err != nil { return err } - broker, err := chat.New(ctx, st, &chat.Claude{DataDir: dataDir}, chat.Options{CommandPlatform: d.Plat, Snippets: d.Cfg.CaptureSnippets(), DataDir: dataDir}) + broker, err := chat.New(ctx, st, chat.NewProvider(dataDir, d.Cfg.Assistant.Provider), chat.Options{CommandPlatform: d.Plat, Snippets: d.Cfg.CaptureSnippets(), DataDir: dataDir}) if err != nil { return err } @@ -567,10 +567,26 @@ func drainOnly(ctx context.Context, d Deps, st *store.Store) error { return err } batch := collectSpool(d, offsets) + identities, err := st.InternalChatSessions() + if err != nil { + return err + } + internal := make(map[store.ChatSession]bool, len(identities)) + for _, identity := range identities { + internal[identity] = true + } + batch.events = internalChatEvents(batch.events, internal) sessions, err := st.Sessions(store.SessionFilter{IncludeEnded: true}) if err != nil { return err } + kept := sessions[:0] + for _, session := range sessions { + if !internal[store.ChatSession{Agent: session.Adapter, SessionID: session.ExternalID}] { + kept = append(kept, session) + } + } + sessions = kept procs, err := st.Procs() if err != nil { return err @@ -594,6 +610,11 @@ func drainOnly(ctx context.Context, d Deps, st *store.Store) error { } return appendPassChanges(tx, before, after, now) } + for _, identity := range identities { + if err := tx.RemoveInternalChat(identity.Agent, identity.SessionID); err != nil { + return err + } + } hooks, err := writeSpool(d, tx, batch, now, func(name string, err error) error { if err != nil { return tx.SetSourceError(name, scrub.Scrub(err.Error()), now) diff --git a/internal/collector/pass.go b/internal/collector/pass.go index 419f277a..220f80fb 100644 --- a/internal/collector/pass.go +++ b/internal/collector/pass.go @@ -117,8 +117,8 @@ func Pass(ctx context.Context, d Deps, st *store.Store, p Plan) (PassReport, err } return tx.SetSourceOK(name, now) } - for external := range collected.internalChats { - if err := tx.RemoveInternalChat(external); err != nil { + for identity := range collected.internalChats { + if err := tx.RemoveInternalChat(identity.Agent, identity.SessionID); err != nil { return err } } diff --git a/internal/collector/review_regression_test.go b/internal/collector/review_regression_test.go index 43aa675b..99729a1a 100644 --- a/internal/collector/review_regression_test.go +++ b/internal/collector/review_regression_test.go @@ -112,7 +112,7 @@ func TestRegisteredChatIdentityRemovesStoredSession(t *testing.T) { }); err != nil { t.Fatal(err) } - if err := st.SaveConversation(context.Background(), store.Conversation{ID: "our-chat", SessionID: "owned-cli-session", CreatedAt: d.now(), UpdatedAt: d.now()}); err != nil { + if err := st.SaveConversation(context.Background(), store.Conversation{ID: "our-chat", Agent: "claude", SessionID: "owned-cli-session", CreatedAt: d.now(), UpdatedAt: d.now()}); err != nil { t.Fatal(err) } pass(t, d, st, Plan{}) diff --git a/internal/collector/sources.go b/internal/collector/sources.go index 9fdd9906..c96c180d 100644 --- a/internal/collector/sources.go +++ b/internal/collector/sources.go @@ -55,7 +55,7 @@ type sourceResults struct { agents []attention.Agent sessions []model.Session processAliases map[int64]int - internalChats map[string]bool + internalChats map[store.ChatSession]bool original map[int64]model.Session procs []model.Proc procErr error @@ -123,20 +123,19 @@ func collectSources(ctx context.Context, d Deps, st *store.Store, p Plan, state if err != nil { return r, err } - r.internalChats = make(map[string]bool, len(conversations)) + r.internalChats = make(map[store.ChatSession]bool, len(conversations)) for _, conversation := range conversations { - if conversation != "" { - r.internalChats[conversation] = true - } + r.internalChats[conversation] = true } kept := ss[:0] for _, session := range ss { - if session.Adapter != "claude" || !r.internalChats[session.ExternalID] { + if !r.internalChats[store.ChatSession{Agent: session.Adapter, SessionID: session.ExternalID}] { kept = append(kept, session) } } ss = kept r.spool = collectSpool(d, offsets) + r.spool.events = internalChatEvents(r.spool.events, r.internalChats) var knownRepos []model.Repo if p.Git || p.GitIdentity { knownRepos, err = st.Repos() @@ -267,7 +266,7 @@ func collectSources(ctx context.Context, d Deps, st *store.Store, p Plan, state if o.Adapter == "" { o.Adapter = result.name } - if o.Adapter == "claude" && r.internalChats[o.ExternalID] { + if r.internalChats[store.ChatSession{Agent: o.Adapter, SessionID: o.ExternalID}] { continue } if o.Adapter == "claude" && strings.TrimSuffix(o.Origin, "/temporary") == "background" && o.RegistryStatus != "" { @@ -407,6 +406,19 @@ func collectSources(ctx context.Context, d Deps, st *store.Store, p Plan, state return r, ctx.Err() } +// internalChatEvents consumes private assistant hooks without exposing their +// lifecycle or text as monitored user work. Offsets still advance normally. +func internalChatEvents(events []model.HookEvent, identities map[store.ChatSession]bool) []model.HookEvent { + kept := events[:0] + for _, event := range events { + if event.Event != "summary" && event.Event != "ack" && identities[store.ChatSession{Agent: event.Adapter, SessionID: event.SessionID}] { + continue + } + kept = append(kept, event) + } + return kept +} + func claudeConversationClaimed(o model.SessionObs) bool { return o.Adapter == "claude" && !strings.HasPrefix(o.ExternalID, "pid:") && (o.ConversationClaimed || o.RegistryStatus == "busy" || o.SourcePath != "") } diff --git a/internal/config/assistant_test.go b/internal/config/assistant_test.go new file mode 100644 index 00000000..21ee96e6 --- /dev/null +++ b/internal/config/assistant_test.go @@ -0,0 +1,58 @@ +package config + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestAssistantProviderConfiguration(t *testing.T) { + t.Setenv("DRIGA_ASSISTANT_PROVIDER", "") + path := filepath.Join(t.TempDir(), "config.toml") + cfg, sources, err := LoadWithSources(path) + if err != nil || cfg.Assistant.Provider != "auto" || sources["assistant.provider"] != "default" { + t.Fatalf("default provider: %+v sources=%v err=%v", cfg.Assistant, sources, err) + } + for _, provider := range []string{"auto", "claude", "codex", "copilot"} { + t.Run(provider, func(t *testing.T) { + if err := os.WriteFile(path, []byte("[assistant]\nprovider = '"+provider+"'\n[adapters.claude]\nenabled = false\n"), 0600); err != nil { + t.Fatal(err) + } + cfg, sources, err := LoadWithSources(path) + if err != nil || cfg.Assistant.Provider != provider || sources["assistant.provider"] != "file" || cfg.Adapters["claude"].Enabled { + t.Fatalf("file provider: %+v sources=%v err=%v", cfg, sources, err) + } + t.Setenv("DRIGA_ASSISTANT_PROVIDER", "copilot") + cfg, sources, err = LoadWithSources(path) + if err != nil || cfg.Assistant.Provider != "copilot" || sources["assistant.provider"] != "env" { + t.Fatalf("environment override: %+v sources=%v err=%v", cfg.Assistant, sources, err) + } + }) + } +} + +func TestAssistantProviderRejectsUnsupportedValues(t *testing.T) { + for _, value := range []string{"", "gemini", "Claude", "auto,codex", "private-invalid-value"} { + t.Run(value, func(t *testing.T) { + t.Setenv("DRIGA_ASSISTANT_PROVIDER", "") + path := filepath.Join(t.TempDir(), "config.toml") + if err := os.WriteFile(path, []byte("[assistant]\nprovider = '"+value+"'\n"), 0600); err != nil { + t.Fatal(err) + } + if _, err := Load(path); err == nil || !strings.Contains(err.Error(), "assistant.provider") { + t.Fatalf("invalid file provider accepted: %v", err) + } + if value == "" { + return // Empty environment values retain the configured/default value. + } + if err := os.WriteFile(path, nil, 0600); err != nil { + t.Fatal(err) + } + t.Setenv("DRIGA_ASSISTANT_PROVIDER", value) + if _, err := Load(path); err == nil || !strings.Contains(err.Error(), "DRIGA_ASSISTANT_PROVIDER") || strings.Contains(err.Error(), "private-invalid-value") { + t.Fatalf("invalid environment provider accepted or disclosed: %v", err) + } + }) + } +} diff --git a/internal/config/config.go b/internal/config/config.go index dafdf95a..d2333168 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -29,6 +29,7 @@ type Config struct { Fleet FleetConfig Intake IntakeConfig Summaries SummariesConfig + Assistant AssistantConfig Machine MachineConfig Cleanup CleanupConfig Inbox InboxConfig @@ -64,6 +65,9 @@ type SummariesConfig struct { Model string } +// AssistantConfig selects the optional answering CLI independently of monitoring. +type AssistantConfig struct{ Provider string } + // FleetConfig controls optional fleet serving and text sharing. type FleetConfig struct { Serve bool diff --git a/internal/config/settings.go b/internal/config/settings.go index c1a27bb8..1ece2ec0 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -50,6 +50,7 @@ var settings = []Setting{ {"machine.disk_free_min", "Machine.DiskFreeMin", "size", "0", "Low disk free-space limit. Zero uses the smaller of 10% of the volume or 20 GB (decimal). Replaces cleanup.low_disk_* warning thresholds.", "0..18446744073709551615 bytes; optional KiB/MiB/GiB suffix; zero = automatic"}, {"summaries.enabled", "Summaries.Enabled", "bool", false, "Enable optional local Claude summaries.", "true or false"}, {"summaries.model", "Summaries.Model", "string", "haiku", "Model selection passed to the Claude CLI.", "nonempty"}, + {"assistant.provider", "Assistant.Provider", "string", "auto", "Answering assistant; auto prefers Claude, Codex, then Copilot independently of session discovery.", "auto, claude, codex or copilot"}, {"cleanup.worktree_idle", "Cleanup.WorktreeIdle", "duration", "168h", "Idle worktree cleanup eligibility.", "0..2562047h47m16.854775807s; zero = no idle minimum"}, {"cleanup.build_idle", "Cleanup.BuildIdle", "duration", "168h", "Checkout idle time before its build output is a candidate.", "0..2562047h47m16.854775807s; zero = no idle minimum"}, {"cleanup.regenerable", "Cleanup.Regenerable", "list", []string{}, "Extra regenerable directory names, beyond the built-in rules.", "file-only; empty = built-in directories"}, @@ -94,7 +95,7 @@ var runtimeSettings = []RuntimeSetting{ {"DRIGA_CHAT_CONVERSATION", "id", "unset", "Chat conversation of the MCP child's turn."}, {"DRIGA_CHAT_TOKEN", "secret", "unset", "Per-turn token tying the MCP child's approval requests to its turn."}, {"DRIGA_CHAT_READ_ONLY", "marker", "unset", "1 keeps the Chat MCP child read-only."}, - {"DRIGA_INTERNAL", "marker", "unset", "1 suppresses recursive hooks from Driga-owned Claude subprocesses."}, + {"DRIGA_INTERNAL", "marker", "unset", "1 suppresses recursive hooks from Driga-owned assistant subprocesses."}, {"DRIGA_FIXTURE_OUTPUT", "path", "unset", "Fixture generator output directory (tests only)."}, {"DRIGA_COLLECTOR_HEAP_CHILD", "marker", "unset", "1 selects isolated collector heap-test child."}, {"DRIGA_FLEET_HEAP_CHILD", "marker", "unset", "1 selects isolated fleet heap-test child."}, @@ -186,6 +187,10 @@ func (s Setting) assign(c *Config, raw any) error { return fmt.Errorf("expected string") } switch s.Key { + case "assistant.provider": + if text != "auto" && text != "claude" && text != "codex" && text != "copilot" { + return fmt.Errorf("allowed values: %s", s.Range) + } case "ui.theme": if text != "system" && text != "light" && text != "dark" { return fmt.Errorf("allowed values: %s", s.Range) diff --git a/internal/llm/provider.go b/internal/llm/provider.go new file mode 100644 index 00000000..09b6dcdb --- /dev/null +++ b/internal/llm/provider.go @@ -0,0 +1,36 @@ +package llm + +import ( + "context" + "io" + "os" + "os/exec" + "strings" + "time" + + "github.com/labstack/driga/internal/platform" +) + +// RunProvider owns the lifetime of a pinned assistant runtime. Inherited +// conversation authority is removed; callers supply explicit tool bridge scope. +func RunProvider(ctx context.Context, path, dir string, args, extraEnv []string, stdin io.Reader, stdout, stderr io.Writer) error { + cmd := exec.CommandContext(ctx, path, args...) + cmd.Dir, cmd.Stdin, cmd.Stdout, cmd.Stderr = dir, stdin, stdout, stderr + cmd.WaitDelay = 2 * time.Second + for _, entry := range os.Environ() { + key, _, _ := strings.Cut(entry, "=") + key = strings.ToUpper(key) + if key == "DRIGA_INTERNAL" || strings.HasPrefix(key, "DRIGA_CHAT_") || + strings.HasPrefix(key, "CODEX_EXEC_SERVER_") || + strings.HasPrefix(key, "COPILOT_PROVIDER_") || key == "COPILOT_PROVIDERS_CONFIG" || + key == "COPILOT_ALLOW_ALL" || key == "COPILOT_CUSTOM_INSTRUCTIONS_DIRS" || + key == "COPILOT_SKILLS_DIRS" || key == "BASH_ENV" || key == "ENV" || + key == "NODE_OPTIONS" || key == "NODE_PATH" || key == "COPILOT_AUTO_UPDATE" { + continue + } + cmd.Env = append(cmd.Env, entry) + } + cmd.Env = append(cmd.Env, "DRIGA_INTERNAL=1", "COPILOT_AUTO_UPDATE=false") + cmd.Env = append(cmd.Env, extraEnv...) + return platform.RunChild(cmd) +} diff --git a/internal/llm/provider_test.go b/internal/llm/provider_test.go new file mode 100644 index 00000000..175472d3 --- /dev/null +++ b/internal/llm/provider_test.go @@ -0,0 +1,29 @@ +package llm + +import ( + "bytes" + "context" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestRunProviderKeepsAuthHomeButRemovesAmbientAuthority(t *testing.T) { + dir := fake(t, `printf '%s\n' "$DRIGA_INTERNAL" "$COPILOT_HOME" "$COPILOT_AUTO_UPDATE" "$CODEX_EXEC_SERVER_URL" +if [ -n "$DRIGA_CHAT_TOKEN$DRIGA_CHAT_SOCKET$COPILOT_ALLOW_ALL$COPILOT_PROVIDER_API_KEY_COMMAND$BASH_ENV$NODE_OPTIONS$driga_chat_token$Driga_Chat_Socket$copilot_allow_all$Node_Options$CODEX_EXEC_SERVER_NOISE_REGISTRY_URL$codex_exec_server_noise_auth_token$CodeX_Exec_Server_Noise_Environment_Id" ]; then exit 23; fi +/bin/cat`) + authHome := t.TempDir() + t.Setenv("COPILOT_HOME", authHome) + for _, key := range []string{"DRIGA_CHAT_TOKEN", "DRIGA_CHAT_SOCKET", "COPILOT_ALLOW_ALL", "COPILOT_PROVIDER_API_KEY_COMMAND", "BASH_ENV", "NODE_OPTIONS", "driga_chat_token", "Driga_Chat_Socket", "copilot_allow_all", "Node_Options", "CODEX_EXEC_SERVER_NOISE_REGISTRY_URL", "codex_exec_server_noise_auth_token", "CodeX_Exec_Server_Noise_Environment_Id"} { + t.Setenv(key, "fixture-do-not-execute") + } + var out bytes.Buffer + err := RunProvider(context.Background(), filepath.Join(dir, "claude"), t.TempDir(), nil, []string{"CODEX_EXEC_SERVER_URL=none"}, strings.NewReader("input"), &out, os.Stderr) + if err != nil { + t.Fatal(err) + } + if want := "1\n" + authHome + "\nfalse\nnone\ninput"; out.String() != want { + t.Fatalf("output=%q want=%q", out.String(), want) + } +} diff --git a/internal/store/chat.go b/internal/store/chat.go index 462e25e0..c2790710 100644 --- a/internal/store/chat.go +++ b/internal/store/chat.go @@ -101,19 +101,28 @@ func (s *Store) RedactChat(ctx context.Context) error { // InternalChatSessions is the broker's explicit CLI identity set. Unlike the // conversation picker, this query is not capped to its most recent 100 rows. -func (s *Store) InternalChatSessions() ([]string, error) { - rows, err := s.db.QueryContext(s.ctx, "SELECT DISTINCT session_id FROM conversations WHERE machine_id=? AND session_id<>''", s.MachineID()) +func (s *Store) InternalChatSessions() ([]ChatSession, error) { + rows, err := s.db.QueryContext(s.ctx, "SELECT DISTINCT agent, session_id FROM conversations WHERE machine_id=? AND session_id<>'' AND agent IN ('claude', 'codex', 'copilot')", s.MachineID()) if err != nil { return nil, err } defer rows.Close() - var ids []string + var ids []ChatSession for rows.Next() { - var id string - if err := rows.Scan(&id); err != nil { + var id ChatSession + if err := rows.Scan(&id.Agent, &id.SessionID); err != nil { return nil, err } ids = append(ids, id) } return ids, rows.Err() } + +// ChatSession identifies an internal CLI session within its provider namespace. +type ChatSession struct { + Agent, SessionID string +} + +func (s ChatSession) valid() bool { + return s.SessionID != "" && (s.Agent == "claude" || s.Agent == "codex" || s.Agent == "copilot") +} diff --git a/internal/store/chat_provider_test.go b/internal/store/chat_provider_test.go new file mode 100644 index 00000000..db9a5d5e --- /dev/null +++ b/internal/store/chat_provider_test.go @@ -0,0 +1,105 @@ +package store + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/labstack/driga/internal/model" +) + +func TestInternalChatSessionsKeepProviderNamespace(t *testing.T) { + s := openTest(t, "", Memory) + now := time.Now() + for i, agent := range []string{"claude", "codex", "copilot", "", "unknown"} { + if err := s.SaveConversation(context.Background(), Conversation{ID: fmt.Sprint(i), Agent: agent, SessionID: "same-id", CreatedAt: now, UpdatedAt: now}); err != nil { + t.Fatal(err) + } + } + if err := s.SaveConversation(context.Background(), Conversation{ID: "not-started", Agent: "claude", CreatedAt: now, UpdatedAt: now}); err != nil { + t.Fatal(err) + } + got, err := s.InternalChatSessions() + if err != nil { + t.Fatal(err) + } + seen := map[ChatSession]bool{} + for _, identity := range got { + seen[identity] = true + } + if len(got) != 3 || !seen[ChatSession{"claude", "same-id"}] || !seen[ChatSession{"codex", "same-id"}] || !seen[ChatSession{"copilot", "same-id"}] { + t.Fatalf("identities = %+v", got) + } +} + +func TestRemoveInternalChatRejectsUnknownIdentity(t *testing.T) { + s := openTest(t, "", Memory) + mustTx(t, s, func(tx *Tx) error { + for _, agent := range []string{"claude", "codex", "copilot", "unknown", ""} { + if _, err := tx.UpsertSession(model.Session{SessionObs: model.SessionObs{Adapter: agent, ExternalID: "same-id"}}); err != nil { + return err + } + } + for _, agent := range []string{"", "unknown", "claude"} { + external := "same-id" + if agent == "claude" { + external = "" + } + if err := tx.RemoveInternalChat(agent, external); err != nil { + return err + } + } + return nil + }) + var count int + if err := s.db.QueryRow("SELECT COUNT(*) FROM sessions").Scan(&count); err != nil || count != 5 { + t.Fatalf("remaining sessions = %d, err=%v", count, err) + } +} + +func TestRemoveInternalChatKeepsOtherProvidersAndMachines(t *testing.T) { + for _, provider := range []string{"claude", "codex", "copilot"} { + t.Run(provider, func(t *testing.T) { + s := openTest(t, "", Memory) + now := time.Now() + mustTx(t, s, func(tx *Tx) error { + for _, machine := range []string{s.MachineID(), "remote"} { + m := tx.ForMachine(machine) + for _, agent := range []string{"claude", "codex", "copilot"} { + id, err := m.UpsertSession(model.Session{SessionObs: model.SessionObs{Adapter: agent, ExternalID: "same-id"}}) + if err != nil { + return err + } + if err := m.UpsertInboxItem(model.InboxItem{ID: agent, SessionID: id, Kind: "finished", TS: now}); err != nil { + return err + } + if err := m.InsertHandoff(id, now, "finished"); err != nil { + return err + } + e := model.Event{Adapter: agent, ExternalID: "same-id", TS: now, Kind: "Stop"} + if err := m.InsertEvent(e); err != nil { + return err + } + if _, err := m.RecordPanelEvent(e); err != nil { + return err + } + } + } + return tx.RemoveInternalChat(provider, "same-id") + }) + for _, table := range []string{"sessions", "events", "panel_events", "inbox_items", "handoffs"} { + var local, remote int + if err := s.db.QueryRow("SELECT COUNT(*) FROM "+table+" WHERE machine_id=?", s.MachineID()).Scan(&local); err != nil { + t.Fatal(err) + } + if err := s.db.QueryRow("SELECT COUNT(*) FROM " + table + " WHERE machine_id='remote'").Scan(&remote); err != nil { + t.Fatal(err) + } + if local != 2 || remote != 3 { + t.Fatalf("%s rows local=%d remote=%d; want 2 and 3", table, local, remote) + } + } + }) + } +} diff --git a/internal/store/panel_events.go b/internal/store/panel_events.go index 6e087b61..27e440f4 100644 --- a/internal/store/panel_events.go +++ b/internal/store/panel_events.go @@ -64,14 +64,17 @@ func (q *querier) AllPanelEvents(since time.Time) ([]model.Event, error) { // RemoveInternalChat removes only a CLI identity explicitly registered by our // Chat broker. Titles and directories never identify a private Chat process. -func (tx *Tx) RemoveInternalChat(external string) error { +func (tx *Tx) RemoveInternalChat(agent, external string) error { + if !(ChatSession{Agent: agent, SessionID: external}).valid() { + return nil + } for _, table := range []string{"inbox_items", "handoffs"} { - if err := tx.exec("DELETE FROM "+table+" WHERE machine_id=? AND session_id IN (SELECT id FROM sessions WHERE machine_id=? AND adapter='claude' AND external_id=?)", tx.machineID, tx.machineID, external); err != nil { + if err := tx.exec("DELETE FROM "+table+" WHERE machine_id=? AND session_id IN (SELECT id FROM sessions WHERE machine_id=? AND adapter=? AND external_id=?)", tx.machineID, tx.machineID, agent, external); err != nil { return err } } for _, table := range []string{"events", "panel_events", "sessions"} { - if err := tx.exec("DELETE FROM "+table+" WHERE machine_id=? AND adapter='claude' AND external_id=?", tx.machineID, external); err != nil { + if err := tx.exec("DELETE FROM "+table+" WHERE machine_id=? AND adapter=? AND external_id=?", tx.machineID, agent, external); err != nil { return err } } diff --git a/internal/tui/app.go b/internal/tui/app.go index 07ee7f91..f8ed03bf 100644 --- a/internal/tui/app.go +++ b/internal/tui/app.go @@ -78,6 +78,7 @@ type app struct { chatBodies map[string]chatBodyRender chatContext chat.Context chatID string + chatProvider string chatStatus string chatMessages []store.ChatMessage chatMode chat.Mode @@ -347,6 +348,7 @@ func (m *app) update(msg tea.Msg) (tea.Model, tea.Cmd) { oldOffset, oldMax = m.chatOffset, m.chatMaxOffset } m.chatID = msg.state.Conversation.ID + m.chatProvider = msg.state.Conversation.Agent m.chatMessages = msg.state.Messages if msg.state.Reset { m.chatActions = msg.state.Actions diff --git a/internal/tui/chat.go b/internal/tui/chat.go index 68e15297..1ee3c6ec 100644 --- a/internal/tui/chat.go +++ b/internal/tui/chat.go @@ -149,6 +149,7 @@ func (m *app) chatKey(msg tea.KeyPressMsg) tea.Cmd { oldID, oldMode := m.chatID, m.chatMode m.chatGeneration++ m.chatID = "" + m.chatProvider = "" m.chatMessages = nil m.chatActions = nil m.chatAppeared = nil @@ -169,6 +170,7 @@ func (m *app) chatKey(msg tea.KeyPressMsg) tea.Cmd { } m.chatGeneration++ m.chatID = m.chatHistory[index].ID + m.chatProvider = "" m.chatMessages = nil m.chatActions = nil m.chatAppeared = nil @@ -229,7 +231,12 @@ func (m *app) chatView() string { left := max(0, m.chatUntil.Sub(m.opts.Now())) label += fmt.Sprintf(" · %dm left", int((left+time.Minute-1)/time.Minute)) } - header := style.Render("Chat · Driga") + "\n" + dim.Render("answered by Claude Code") + " · " + modeStyle.Render(label) + provider := map[string]string{"claude": "Claude Code", "codex": "Codex", "copilot": "GitHub Copilot CLI"}[m.chatProvider] + caption := "assistant not selected" + if provider != "" { + caption = "answered by " + provider + } + header := style.Render("Chat · Driga") + "\n" + dim.Render(caption) + " · " + modeStyle.Render(label) if m.chatEphemeral { header += "\n" + dim.Render("Conversations end with this client.") } diff --git a/internal/tui/chat_provider_test.go b/internal/tui/chat_provider_test.go new file mode 100644 index 00000000..fb668bdf --- /dev/null +++ b/internal/tui/chat_provider_test.go @@ -0,0 +1,48 @@ +package tui + +import ( + "strings" + "testing" + + tea "charm.land/bubbletea/v2" + "github.com/labstack/driga/internal/chat" + "github.com/labstack/driga/internal/store" +) + +func TestChatProviderCaptionUsesConversationState(t *testing.T) { + for _, tt := range []struct{ provider, caption string }{ + {"claude", "answered by Claude Code"}, + {"codex", "answered by Codex"}, + {"copilot", "answered by GitHub Copilot CLI"}, + {"", "assistant not selected"}, + {"unknown", "assistant not selected"}, + } { + t.Run(tt.provider, func(t *testing.T) { + m := setup(t, fixture(), Options{}).(*app) + m.tab, m.width, m.height = chatTab, 100, 38 + m.Update(chatStateMsg{state: chat.State{Conversation: store.Conversation{ID: "conversation", Agent: tt.provider}}}) + got := m.chatView() + if !strings.Contains(got, tt.caption) { + t.Fatalf("missing %q in %s", tt.caption, got) + } + if tt.provider != "claude" && strings.Contains(got, "answered by Claude Code") { + t.Fatal("caption attributed another provider to Claude") + } + }) + } +} + +func TestChatProviderCaptionClearsWhileSwitching(t *testing.T) { + for _, key := range []rune{'n', 'h'} { + t.Run(string(key), func(t *testing.T) { + m := setup(t, fixture(), Options{}).(*app) + m.tab, m.width, m.height = chatTab, 100, 38 + m.chatID, m.chatProvider = "old", "codex" + m.chatHistory = []store.Conversation{{ID: "old", Agent: "codex"}, {ID: "other", Agent: "claude"}} + m.chatKey(tea.KeyPressMsg{Code: key, Mod: tea.ModCtrl}) + if got := m.chatView(); !strings.Contains(got, "assistant not selected") || strings.Contains(got, "answered by Codex") { + t.Fatalf("stale provider during switch: %s", got) + } + }) + } +} diff --git a/internal/tui/chat_test.go b/internal/tui/chat_test.go index b6fa12f0..fe5c918c 100644 --- a/internal/tui/chat_test.go +++ b/internal/tui/chat_test.go @@ -81,6 +81,7 @@ func TestChatGoldens(t *testing.T) { m.width = width m.height = 38 m.chatEphemeral = true + m.chatProvider = "claude" m.chatContext = chat.Context{Page: "flow", SessionID: 12, Machine: "local"} m.chatMessages = []store.ChatMessage{{ID: "one", Role: "user", Text: "What needs me?", Status: "sent"}, {ID: "two", Role: "tool", Text: "mcp__driga__list_inbox", Status: "used"}, {ID: "three", Role: "assistant", Text: "Session #12 needs input. Its last captured state is waiting.\nUse the session view to inspect the evidence.", Status: "complete"}} m.chatMessages = append(m.chatMessages, store.ChatMessage{ID: "card", Role: "action", Status: "pending", Text: "Bash · touch demo"}) @@ -238,7 +239,7 @@ func TestChatActivityStates(t *testing.T) { m := setup(t, fixture(), Options{Now: func() time.Time { return now }}).(*app) m.tab, m.width, m.height = chatTab, 100, 40 row := store.ChatMessage{ID: "reply", Role: "assistant", Status: "streaming"} - _, cmd := m.Update(chatStateMsg{state: chat.State{Active: true, Messages: []store.ChatMessage{row}}}) + _, cmd := m.Update(chatStateMsg{state: chat.State{Conversation: store.Conversation{Agent: "claude"}, Active: true, Messages: []store.ChatMessage{row}}}) if cmd == nil { t.Fatal("active reply must poll") } diff --git a/internal/web/app/assets/index-Dp2Y4syB.js b/internal/web/app/assets/index-DsNBhmsi.js similarity index 74% rename from internal/web/app/assets/index-Dp2Y4syB.js rename to internal/web/app/assets/index-DsNBhmsi.js index fd82e38b..f65cf5b6 100644 --- a/internal/web/app/assets/index-Dp2Y4syB.js +++ b/internal/web/app/assets/index-DsNBhmsi.js @@ -53,32 +53,32 @@ Error generating stack: `+e.message+` `):[],v=_.length*f;if(g??=v,v>g&&p){var y=Math.floor(g/f);m||=_.length>y,_=_.slice(0,y),v=_.length*f}if(i&&u&&h!=null)for(var b=Qw(h,l,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),x={},S=0;S<_.length;S++)$w(x,_[S],b),_[S]=x.textLine,m||=x.isTruncated;for(var C=g,w=0,T=Rw(l),S=0;S<_.length;S++)w=Math.max(Uw(T,_[S]),w);h??=w;var E=h;return C+=c,E+=s,{lines:_,height:g,outerWidth:E,outerHeight:C,lineHeight:f,calculatedLineHeight:d,contentWidth:w,contentHeight:v,width:h,isTruncated:m}}var $re=function(){function e(){}return e}(),eT=function(){function e(e){this.tokens=[],e&&(this.tokens=e)}return e}(),eie=function(){function e(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return e}();function tie(e,t,n,r,i){var a=new eie,o=oT(e);if(!o)return a;var s=t.padding,c=s?s[1]+s[3]:0,l=s?s[0]+s[2]:0,u=t.width;u==null&&n!=null&&(u=n-c);var d=t.height;d==null&&r!=null&&(d=r-l);for(var f=t.overflow,p=(f===`break`||f===`breakAll`)&&u!=null?{width:u,accumWidth:0,breakAll:f===`breakAll`}:null,m=Zw.lastIndex=0,h;(h=Zw.exec(o))!=null;){var g=h.index;g>m&&tT(a,o.substring(m,g),t,p),tT(a,h[2],t,p,h[1]),m=Zw.lastIndex}md){var F=a.lines.length;O>0?(T.tokens=T.tokens.slice(0,O),C(T,D,E),a.lines=a.lines.slice(0,w+1)):a.lines=a.lines.slice(0,w),a.isTruncated=a.isTruncated||a.lines.length0&&m+r.accumWidth>r.width&&(u=t.split(` `),l=!0),r.accumWidth=m}else{var h=nT(t,c,r.width,r.breakAll,r.accumWidth);r.accumWidth=h.accumWidth+p,d=h.linesWidths,u=h.lines}}u||=t.split(` `);for(var g=Rw(c),_=0;_=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var rie=WS(`,&?/;] `.split(``),function(e,t){return e[t]=!0,e},{});function iie(e){return!nie(e)||!!rie[e]}function nT(e,t,n,r,i){for(var a=[],o=[],s=``,c=``,l=0,u=0,d=Rw(t),f=0;fn:i+u+m>n)?u?(s||c)&&(h?(s||(s=c,c=``,l=0,u=l),a.push(s),o.push(u-l),c+=p,l+=m,s=``,u=l):(c&&(s+=c,c=``,l=0),a.push(s),o.push(u),s=p,u=m)):h?(a.push(c),o.push(l),c=p,l=m):(a.push(p),o.push(m)):(u+=m,h?(c+=p,l+=m):(c&&(s+=c,c=``,l=0),s+=p))}}return c&&(s+=c),s&&(a.push(s),o.push(u)),a.length===1&&(u+=i),{accumWidth:u,lines:a,linesWidths:o}}function rT(e,t,n,r,i,a){if(e.baseX=n,e.baseY=r,e.outerWidth=e.outerHeight=null,t){var o=t.width*2,s=t.height*2;Aw.set(iT,Kw(n,o,i),qw(r,s,a),o,s),Aw.intersect(t,iT,null,aT);var c=aT.outIntersectRect;e.outerWidth=c.width,e.outerHeight=c.height,e.baseX=Kw(c.x,c.width,i,!0),e.baseY=qw(c.y,c.height,a,!0)}}var iT=new Aw(0,0,0,0),aT={outIntersectRect:{},clamp:!0};function oT(e){return e==null?e=``:e+=``}function aie(e){var t=oT(e.text),n=e.font;return sT(e,Uw(Rw(n),t),Jw(n),null)}function sT(e,t,n,r){var i=new Aw(Kw(e.x||0,t,e.textAlign),qw(e.y||0,n,e.textBaseline),t,n),a=r??(cT(e)?e.lineWidth:0);return a>0&&(i.x-=a/2,i.y-=a/2,i.width+=a,i.height+=a),i}function cT(e){var t=e.stroke;return t!=null&&t!==`none`&&e.lineWidth>0}var lT=$C,uT=5e-5;function dT(e){return e>uT||e<-uT}var fT=[],pT=[],mT=QC(),hT=Math.abs,gT=function(){function e(){}return e.prototype.getLocalTransform=function(e){return _T(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return dT(this.rotation)||dT(this.x)||dT(this.y)||dT(this.scaleX-1)||dT(this.scaleY-1)||dT(this.skewX)||dT(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;t||e?(n||=QC(),t?this.getLocalTransform(n):lT(n),e&&(t?tw(n,e,n):ew(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||QC(),iw(this.invTransform,n)):n&&(lT(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(fT);var n=fT[0]<0?-1:1,r=fT[1]<0?-1:1,i=((fT[0]-n)*t+n)/fT[0]||0,a=((fT[1]-r)*t+r)/fT[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||QC(),tw(pT,e.invTransform,t),t=pT);var n=this.originX,r=this.originY;(n||r)&&(mT[4]=n,mT[5]=r,tw(pT,t,mT),pT[4]-=n,pT[5]-=r,t=pT),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&mw(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&mw(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&hT(e[0]-1)>1e-10&&hT(e[3]-1)>1e-10?Math.sqrt(hT(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){bT(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&rw(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),_T=gT.getLocalTransform;function vT(){return new gT}var yT=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function bT(e,t){return Are(e,t,yT)}var xT={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-xT.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?xT.bounceIn(e*2)*.5:xT.bounceOut(e*2-1)*.5+.5}},ST=Math.pow,CT=Math.sqrt,wT=1e-8,TT=1e-4,ET=CT(3),DT=1/3,OT=aw(),kT=aw(),AT=aw();function jT(e){return e>-wT&&ewT||e<-wT}function NT(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function PT(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function FT(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(jT(u)&&jT(d)){if(jT(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}}else{var h=d*d-4*u*f;if(jT(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=CT(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-ST(-y,DT):ST(y,DT),b=b<0?-ST(-b,DT):ST(b,DT);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*CT(u*u*u)),S=Math.acos(x)/3,C=CT(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+ET*Math.sin(S)))/(3*o),T=(-s+C*(w-ET*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function IT(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(jT(o)){if(MT(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(jT(u))i[0]=-a/(2*o);else if(u>0){var d=CT(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function LT(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function oie(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;OT[0]=c,OT[1]=l;for(var v=0;v<1;v+=.05)kT[0]=NT(e,n,i,o,v),kT[1]=NT(t,r,a,s,v),g=pw(OT,kT),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(jT(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=CT(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function BT(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function VT(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function lie(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;OT[0]=o,OT[1]=s;for(var f=0;f<1;f+=.05){kT[0]=RT(e,n,i,f),kT[1]=RT(t,r,a,f);var p=pw(OT,kT);p=0&&p=1?1:FT(0,r,a,1,e,s)&&NT(0,i,o,1,s[0])}}}var fie=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||bC,this.ondestroy=e.ondestroy||bC,this.onrestart=e.onrestart||bC,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused)this._pausedTime+=t;else{var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1){if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0}return!1}},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=XS(e)?e:xT[e]||HT(e)},e}(),UT={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function WT(e){return e=Math.round(e),e<0?0:e>255?255:e}function pie(e){return e=Math.round(e),e<0?0:e>360?360:e}function GT(e){return e<0?0:e>1?1:e}function KT(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?WT(parseFloat(t)/100*255):WT(parseInt(t,10))}function qT(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?GT(parseFloat(t)/100):GT(parseFloat(t))}function JT(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function YT(e,t,n){return e+(t-e)*n}function XT(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function ZT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var QT=new KC(20),$T=null;function eE(e,t){$T&&ZT($T,t),$T=QT.put(e,$T||t.slice())}function tE(e,t){if(e){t||=[];var n=QT.get(e);if(n)return ZT(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in UT)return ZT(t,UT[r]),eE(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){XT(t,0,0,0,1);return}return XT(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),eE(e,t),t}if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){XT(t,0,0,0,1);return}return XT(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),eE(e,t),t}}else{var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?XT(t,+l[0],+l[1],+l[2],1):XT(t,0,0,0,1);u=qT(l.pop());case`rgb`:if(l.length>=3)return XT(t,KT(l[0]),KT(l[1]),KT(l[2]),l.length===3?u:qT(l[3])),eE(e,t),t;XT(t,0,0,0,1);return;case`hsla`:if(l.length!==4){XT(t,0,0,0,1);return}return l[3]=qT(l[3]),nE(l,t),eE(e,t),t;case`hsl`:if(l.length!==3){XT(t,0,0,0,1);return}return nE(l,t),eE(e,t),t;default:return}}XT(t,0,0,0,1)}}}function nE(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=qT(e[1]),i=qT(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],XT(t,WT(JT(o,a,n+1/3)*255),WT(JT(o,a,n)*255),WT(JT(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function rE(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function iE(e,t){var n=tE(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return lE(n,n.length===4?`rgba`:`rgb`)}}function aE(e,t,n){if(t&&t.length&&e>=0&&e<=1){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=WT(YT(o[0],s[0],c)),n[1]=WT(YT(o[1],s[1],c)),n[2]=WT(YT(o[2],s[2],c)),n[3]=GT(YT(o[3],s[3],c)),n}}function oE(e,t,n){if(t&&t.length&&e>=0&&e<=1){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=tE(t[i]),s=tE(t[a]),c=r-i,l=lE([WT(YT(o[0],s[0],c)),WT(YT(o[1],s[1],c)),WT(YT(o[2],s[2],c)),GT(YT(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}function sE(e,t,n,r){var i=tE(e);if(e)return i=rE(i),t!=null&&(i[0]=pie(XS(t)?t(i[0]):t)),n!=null&&(i[1]=qT(XS(n)?n(i[1]):n)),r!=null&&(i[2]=qT(XS(r)?r(i[2]):r)),lE(nE(i),`rgba`)}function cE(e,t){var n=tE(e);if(n&&t!=null)return n[3]=GT(t),lE(n,`rgba`)}function lE(e,t){if(e&&e.length){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function uE(e,t){var n=tE(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var dE=new KC(100);function fE(e){if(ZS(e)){var t=dE.get(e);return t||(t=iE(e,-.1),dE.put(e,t)),t}if(iC(e)){var n=J({},e);return n.colorStops=US(e.colorStops,function(e){return{offset:e.offset,color:iE(e.color,-.1)}}),n}return e}var pE=Math.round;function mE(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=tE(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var hE=1e-4;function gE(e){return e-hE}function _E(e){return pE(e*1e3)/1e3}function vE(e){return pE(e*1e4)/1e4}function yE(e){return`matrix(`+_E(e[0])+`,`+_E(e[1])+`,`+_E(e[2])+`,`+_E(e[3])+`,`+vE(e[4])+`,`+vE(e[5])+`)`}var bE={left:`start`,right:`end`,center:`middle`,middle:`middle`};function xE(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function SE(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function CE(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function wE(e){return e&&!!e.image}function TE(e){return e&&!!e.svgElement}function EE(e){return wE(e)||TE(e)}function DE(e){return e.type===`linear`}function OE(e){return e.type===`radial`}function kE(e){return e&&(e.type===`linear`||e.type===`radial`)}function AE(e){return`url(#`+e+`)`}function jE(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function ME(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*xC,i=sC(e.scaleX,1),a=sC(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+pE(o*xC)+`deg, `+pE(s*xC)+`deg)`),c.join(` `)}var NE=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),PE=Array.prototype.slice;function FE(e,t,n){return(t-e)*n+e}function IE(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=ZE,s=t;if(HS(t)){var c=WE(t);o=c,(c===1&&!$S(t[0])||c===2&&!$S(t[0][0]))&&(a=!0)}else if($S(t)&&!aC(t))o=GE;else if(ZS(t)){if(!isNaN(+t))o=GE;else{var l=tE(t);l&&(s=l,o=JE)}}else if(iC(t)){var u=J({},s);u.colorStops=US(t.colorStops,function(e){return{offset:e.offset,color:tE(e.color)}}),DE(t)?o=YE:OE(t)&&(o=XE),s=u}i===0?this.valType=o:(o!==this.valType||o===ZE)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=XS(n)?n:xT[n]||HT(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=$E(r),c=QE(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?eD:e[s];if(($E(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if($E(i))i===KE?IE(g,f[r],p[r],h):LE(g,f[r],p[r],h);else if(QE(i)){var _=f[r],v=p[r],y=i===YE;e[s]={type:y?`linear`:`radial`,x:FE(_.x,v.x,h),y:FE(_.y,v.y,h),colorStops:US(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:FE(e.offset,n.offset,h),color:UE(IE([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=FE(_.x2,v.x2,h),e[s].y2=FE(_.y2,v.y2,h)):e[s].r=FE(_.r,v.r,h)}else if(c)IE(g,f[r],p[r],h),n||(e[s]=UE(g));else{var b=FE(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===GE?e[n]=e[n]+r:t===JE?(tE(e[n],eD),RE(eD,eD,r,1),e[n]=UE(eD)):t===KE?RE(e[n],e[n],r,1):t===qE&&zE(e[n],e[n],r,1)},e}(),nD=function(){function e(e,t,n,r){this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r?IS(`Can' use additive animation on looped animation.`):(this._additiveAnimators=r,this._allowDiscrete=n)}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,qS(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,HE(c),r),this._trackKeys.push(o)}s.addKeyframe(e,HE(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}(),rD=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o=0:n.inside,y=void 0,b=void 0,x=void 0;v&&this.canBeInsideText()?(y=n.insideFill,b=n.insideStroke,(y==null||y===`auto`)&&(y=this.getInsideTextFill()),(b==null||b===`auto`)&&(b=this.getInsideTextStroke(y),x=!0)):(y=n.outsideFill,b=n.outsideStroke,(y==null||y===`auto`)&&(y=this.getOutsideFill()),(b==null||b===`auto`)&&(b=this.getOutsideStroke(y),x=!0)),y||=`#000`,(y!==g.fill||b!==g.stroke||x!==g.autoStroke||a!==g.align||o!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=b,g.autoStroke=x,g.align=a,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return`#fff`},e.prototype.getInsideTextStroke=function(e){return`#000`},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?cD:sD},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n=typeof t==`string`&&tE(t);n||=[255,255,255,1];for(var r=n[3],i=this.__zr.isDarkMode(),a=0;a<3;a++)n[a]=n[a]*r+(i?0:255)*(1-r);return n[3]=1,lE(n,`rgba`)},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){e===`textConfig`?this.setTextConfig(t):e===`textContent`?this.setTextContent(t):e===`clipPath`?this.setClipPath(t):e===`extra`?(this.extra=this.extra||{},J(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if(typeof e==`string`)this.attrKV(e,t);else if(eC(e))for(var n=qS(e),r=0;r0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(uD,!1,e)},e.prototype.useState=function(e,t,n,r){var i=e===uD;if(this.hasState()||!i){var a=this.currentStates,o=this.stateTransition;if(!(BS(a,e)>=0&&(t||a.length===1))){var s;if(this.stateProxy&&!i&&(s=this.stateProxy(e)),s||=this.states&&this.states[e],!s&&!i)IS(`State `+e+` not exists.`);else{i||this.saveCurrentToNormalState(s);var c=this._textContent,l=wD(this,c,s,r);l&&!this.__inHover&&(this.__inHover=l),this._applyStateObj(e,s,this._normalState,t,ED(this,n,o),o);var u=this._textGuide;return c&&c.useState(e,t,n,!!l),u&&u.useState(e,t,n,!!l),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this.__inHover=0,this.__dirty&=-2),s}}}},e.prototype.useStates=function(e,t,n){if(!e.length)this.clearStates();else{var r=[],i=this.currentStates,a=e.length,o=a===i.length;if(o){for(var s=0;s=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var r=this.currentStates.slice(),i=BS(r,e),a=BS(r,t)>=0;i>=0?a?r.splice(i,1):r[i]=t:n&&!a&&r.push(t),this.useStates(r)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t={},n,r=0;r=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,r=n.length,i=[],a=0;a0&&n.during&&a[0].during(function(e,t){n.during(t)});for(var f=0;f0||i.force&&!o.length){var C=void 0,w=void 0,T=void 0;if(s){w={},f&&(C={});for(var b=0;b0}var DD=`__zr_style_`+Math.round(Math.random()*10),OD={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`#000`,opacity:1,blend:`source-over`},kD={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};OD[DD]=!0;var AD=[`z`,`z2`,`invisible`],mie=[`invisible`],jD=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype._init=function(t){for(var n=qS(t),r=0;r1e-4)s[0]=e-n,s[1]=t-r,c[0]=e+n,c[1]=t+r;else{if(zD[0]=LD(i)*n+e,zD[1]=ID(i)*r+t,BD[0]=LD(a)*n+e,BD[1]=ID(a)*r+t,l(s,zD,BD),u(c,zD,BD),i%=RD,i<0&&(i+=RD),a%=RD,a<0&&(a+=RD),i>a&&!o?a+=RD:ii&&(VD[0]=LD(p)*n+e,VD[1]=ID(p)*r+t,l(s,VD,s),u(c,VD,c))}}var GD={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},KD=[],qD=[],JD=[],YD=[],XD=[],ZD=[],QD=Math.min,$D=Math.max,eO=Math.cos,tO=Math.sin,nO=Math.abs,rO=Math.PI,iO=rO*2,aO=typeof Float32Array<`u`,oO=[];function sO(e){return Math.round(e/rO*1e8)/1e8%2*rO}function yie(e,t){var n=sO(e[0]);n<0&&(n+=iO);var r=n-e[0],i=e[1];i+=r,!t&&i-n>=iO?i=n+iO:t&&n-i>=iO?i=n-iO:!t&&n>i?i=n+(iO-sO(n-i)):t&&n0&&(this._ux=nO(n/aD/e)||0,this._uy=nO(n/aD/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(GD.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=nO(e-this._xi),r=nO(t-this._yi),i=n>this._ux||r>this._uy;if(this.addData(GD.L,e,t),this._ctx&&i&&this._ctx.lineTo(e,t),i)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var a=n*n+r*r;a>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=a)}return this},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){return this._drawPendingPt(),this.addData(GD.C,e,t,n,r,i,a),this._ctx&&this._ctx.bezierCurveTo(e,t,n,r,i,a),this._xi=i,this._yi=a,this},e.prototype.quadraticCurveTo=function(e,t,n,r){return this._drawPendingPt(),this.addData(GD.Q,e,t,n,r),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,r),this._xi=n,this._yi=r,this},e.prototype.arc=function(e,t,n,r,i,a){this._drawPendingPt(),oO[0]=r,oO[1]=i,yie(oO,a),r=oO[0],i=oO[1];var o=i-r;return this.addData(GD.A,e,t,n,n,r,o,0,+!a),this._ctx&&this._ctx.arc(e,t,n,r,i,a),this._xi=eO(i)*n+e,this._yi=tO(i)*n+t,this},e.prototype.arcTo=function(e,t,n,r,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,r,i),this},e.prototype.rect=function(e,t,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,r),this.addData(GD.R,e,t,n,r),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(GD.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){if(this._saveData){var t=e.length;!(this.data&&this.data.length===t)&&aO&&(this.data=new Float32Array(t));for(var n=0;n0&&a))for(var o=0;ol.length&&(this._expandData(),l=this.data);for(var u=0;u0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){JD[0]=JD[1]=XD[0]=XD[1]=Number.MAX_VALUE,YD[0]=YD[1]=ZD[0]=ZD[1]=-Number.MAX_VALUE;for(var e=this.data,t=0,n=0,r=0,i=0,a=0;an||nO(v)>r||d===t-1)&&(m=Math.sqrt(_*_+v*v),i=h,a=g);break;case GD.C:var y=e[d++],b=e[d++],h=e[d++],g=e[d++],x=e[d++],S=e[d++];m=sie(i,a,y,b,h,g,x,S,10),i=x,a=S;break;case GD.Q:var y=e[d++],b=e[d++],h=e[d++],g=e[d++];m=uie(i,a,y,b,h,g,10),i=h,a=g;break;case GD.A:var C=e[d++],w=e[d++],T=e[d++],E=e[d++],D=e[d++],O=e[d++],k=O+D;d+=1,p&&(o=eO(D)*T+C,s=tO(D)*E+w),m=$D(T,E)*QD(iO,Math.abs(O)),i=eO(k)*T+C,a=tO(k)*E+w;break;case GD.R:o=i=e[d++],s=a=e[d++];var A=e[d++],j=e[d++];m=A*2+j*2;break;case GD.Z:var _=o-i,v=s-a;m=Math.sqrt(_*_+v*v),i=o,a=s}m>=0&&(c[u++]=m,l+=m)}return this._pathLen=l,l},e.prototype.rebuildPath=function(e,t){var n=this.data,r=this._ux,i=this._uy,a=this._len,o,s,c,l,u,d,f=t<1,p,m,h=0,g=0,_,v=0,y,b;if(!(f&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,_=t*m,!_)))lo:for(var x=0;x0&&(e.lineTo(y,b),v=0),S){case GD.M:o=c=n[x++],s=l=n[x++],e.moveTo(c,l);break;case GD.L:u=n[x++],d=n[x++];var w=nO(u-c),T=nO(d-l);if(w>r||T>i){if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+u*D,l*(1-D)+d*D);break lo}h+=E}e.lineTo(u,d),c=u,l=d,v=0}else{var O=w*w+T*T;O>v&&(y=u,b=d,v=O)}break;case GD.C:var k=n[x++],A=n[x++],j=n[x++],M=n[x++],N=n[x++],P=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;LT(c,k,j,N,D,KD),LT(l,A,M,P,D,qD),e.bezierCurveTo(KD[1],qD[1],KD[2],qD[2],KD[3],qD[3]);break lo}h+=E}e.bezierCurveTo(k,A,j,M,N,P),c=N,l=P;break;case GD.Q:var k=n[x++],A=n[x++],j=n[x++],M=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;VT(c,k,j,D,KD),VT(l,A,M,D,qD),e.quadraticCurveTo(KD[1],qD[1],KD[2],qD[2]);break lo}h+=E}e.quadraticCurveTo(k,A,j,M),c=j,l=M;break;case GD.A:var F=n[x++],ee=n[x++],I=n[x++],te=n[x++],L=n[x++],ne=n[x++],re=n[x++],ie=!n[x++],ae=I>te?I:te,oe=nO(I-te)>.001,se=L+ne,R=!1;if(f){var E=p[g++];h+E>_&&(se=L+ne*(_-h)/E,R=!0),h+=E}if(oe&&e.ellipse?e.ellipse(F,ee,I,te,re,L,se,ie):e.arc(F,ee,ae,L,se,ie),R)break lo;C&&(o=eO(L)*I+F,s=tO(L)*te+ee),c=eO(se)*I+F,l=tO(se)*te+ee;break;case GD.R:o=c=n[x],s=l=n[x+1],u=n[x++],d=n[x++];var ce=n[x++],le=n[x++];if(f){var E=p[g++];if(h+E>_){var z=_-h;e.moveTo(u,d),e.lineTo(u+QD(z,ce),d),z-=ce,z>0&&e.lineTo(u+ce,d+QD(z,le)),z-=le,z>0&&e.lineTo(u+$D(ce-z,0),d+le),z-=ce,z>0&&e.lineTo(u,d+$D(le-z,0));break lo}h+=E}e.rect(u,d,ce,le);break;case GD.Z:if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+o*D,l*(1-D)+s*D);break lo}h+=E}e.closePath(),c=o,l=s}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=GD,e.initDefaultProps=(function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0})(),e}();function lO(e,t,n,r,i,a,o){if(i===0)return!1;var s=i,c=0,l=e;if(o>t+s&&o>r+s||oe+s&&a>n+s||at+d&&u>r+d&&u>a+d&&u>s+d||ue+d&&l>n+d&&l>i+d&&l>o+d||lt+l&&c>r+l&&c>a+l||ce+l&&s>n+l&&s>i+l||sn||u+li&&(i+=fO);var f=Math.atan2(c,s);return f<0&&(f+=fO),f>=r&&f<=i||f+fO>=r&&f+fO<=i}function pO(e,t,n,r,i,a){if(a>t&&a>r||ai?s:0}var mO=cO.CMD,hO=Math.PI*2,Cie=1e-4;function wie(e,t){return Math.abs(e-t)t&&l>r&&l>a&&l>s||l1&&Tie(),p=NT(t,r,a,s,_O[0]),f>1&&(m=NT(t,r,a,s,_O[1]))),f===2?g<_O[0]?d+=pt&&s>r&&s>a||s=0&&l<=1){for(var u=0,d=RT(t,r,a,l),f=0;fn||s<-n)return 0;var c=Math.sqrt(n*n-s*s);gO[0]=-c,gO[1]=c;var l=Math.abs(r-i);if(l<1e-4)return 0;if(l>=hO-1e-4){r=0,i=hO;var u=a?1:-1;return o>=gO[0]+e&&o<=gO[1]+e?u:0}if(r>i){var d=r;r=i,i=d}r<0&&(r+=hO,i+=hO);for(var f=0,p=0;p<2;p++){var m=gO[p];if(m+e>o){var h=Math.atan2(s,m),u=a?1:-1;h<0&&(h=hO+h),(h>=r&&h<=i||h+hO>=r&&h+hO<=i)&&(h>Math.PI/2&&h1&&(n||(s+=pO(c,l,u,d,r,i))),g&&(c=a[m],l=a[m+1],u=c,d=l),h){case mO.M:u=a[m++],d=a[m++],c=u,l=d;break;case mO.L:if(n){if(lO(c,l,a[m],a[m+1],t,r,i))return!0}else s+=pO(c,l,a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.C:if(n){if(bie(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=Eie(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.Q:if(n){if(xie(c,l,a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=Die(c,l,a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.A:var _=a[m++],v=a[m++],y=a[m++],b=a[m++],x=a[m++],S=a[m++];m+=1;var C=!!(1-a[m++]);f=Math.cos(x)*y+_,p=Math.sin(x)*b+v,g?(u=f,d=p):s+=pO(c,l,f,p,r,i);var w=(r-_)*b/y+_;if(n){if(Sie(_,v,b,x,x+S,C,t,w,i))return!0}else s+=Oie(_,v,b,x,x+S,C,w,i);c=Math.cos(x+S)*y+_,l=Math.sin(x+S)*b+v;break;case mO.R:u=c=a[m++],d=l=a[m++];var T=a[m++],E=a[m++];if(f=u+T,p=d+E,n){if(lO(u,d,f,d,t,r,i)||lO(f,d,f,p,t,r,i)||lO(f,p,u,p,t,r,i)||lO(u,p,u,d,t,r,i))return!0}else s+=pO(f,d,f,p,r,i),s+=pO(u,p,u,d,r,i);break;case mO.Z:if(n){if(lO(c,l,u,d,t,r,i))return!0}else s+=pO(c,l,u,d,r,i);c=u,l=d}}return!n&&!wie(l,d)&&(s+=pO(c,l,u,d,r,i)||0),s!==0}function kie(e,t,n){return vO(e,0,!1,t,n)}function Aie(e,t,n,r){return vO(e,t,!0,n,r)}var yO=zS({fill:`#000`,stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:`butt`,miterLimit:10,strokeNoScale:!1,strokeFirst:!1},OD),jie={style:zS({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},kD.style)},bO=yT.concat([`invisible`,`culling`,`z`,`z2`,`zlevel`,`parent`]),xO=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.update=function(){var n=this;e.prototype.update.call(this);var r=this.style;if(r.decal){var i=this._decalEl=this._decalEl||new t;i.buildPath===t.prototype.buildPath&&(i.buildPath=function(e){n.buildPath(e,n.shape)}),i.silent=!0;var a=i.style;for(var o in r)a[o]!==r[o]&&(a[o]=r[o]);a.fill=r.fill?r.decal:null,a.decal=null,a.shadowColor=null,r.strokeFirst&&(a.stroke=null);for(var s=0;s.5?sD:t>.2?lD:cD}if(e)return cD}return sD},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(ZS(t)){var n=this.__zr;if(!!(n&&n.isDarkMode())==uE(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new cO(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return e!=null&&e!==`none`},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var r=!1;this.path||(r=!0,this.createPathProxy());var i=this.path;(r||this.__dirty&4)&&(i.beginPath(),this.buildPath(i,this.shape,!1),this.pathUpdated()),e=i.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var a=this._rectStroke||=e.clone();if(this.__dirty||n){a.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;s=Math.max(s,c??4)}o>1e-10&&(a.width+=s/o,a.height+=s/o,a.x-=s/o/2,a.y-=s/o/2)}return a}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect(),i=this.style;if(e=n[0],t=n[1],r.contain(e,t)){var a=this.path;if(this.hasStroke()){var o=i.lineWidth,s=i.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),Aie(a,o/s,e,t)))return!0}if(this.hasFill())return kie(a,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&=null,this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate(`shape`,e)},t.prototype.updateDuringAnimation=function(e){e===`style`?this.dirtyStyle():e===`shape`?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){t===`shape`?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||=this.shape={},typeof e==`string`?n[e]=t:J(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&4)},t.prototype.createStyle=function(e){return vC(yO,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=J({},this.shape))},t.prototype._applyStateObj=function(t,n,r,i,a,o){if(e.prototype._applyStateObj.call(this,t,n,r,i,a,o),this.__inHover!==1){var s=!(n&&i),c;if(n&&n.shape?a?i?c=n.shape:(c=J({},r.shape),J(c,n.shape)):(c=J({},i?this.shape:r.shape),J(c,n.shape)):s&&(c=r.shape),c){if(a){this.shape=J({},this.shape);for(var l={},u=qS(c),d=0;di&&(d=s+c,s*=i/d,c*=i/d),l+u>i&&(d=l+u,l*=i/d,u*=i/d),c+l>a&&(d=c+l,c*=a/d,l*=a/d),s+u>a&&(d=s+u,s*=a/d,u*=a/d),e.moveTo(n+s,r),e.lineTo(n+i-c,r),c!==0&&e.arc(n+i-c,r+c,c,-Math.PI/2,0),e.lineTo(n+i,r+a-l),l!==0&&e.arc(n+i-l,r+a-l,l,0,Math.PI/2),e.lineTo(n+u,r+a),u!==0&&e.arc(n+u,r+a-u,u,Math.PI/2,Math.PI),e.lineTo(n,r+s),s!==0&&e.arc(n+s,r+s,s,Math.PI,Math.PI*1.5),e.closePath()}var wO=Math.round;function TO(e,t,n){if(t){var r=t.x1,i=t.x2,a=t.y1,o=t.y2;e.x1=r,e.x2=i,e.y1=a,e.y2=o;var s=n&&n.lineWidth;return s&&(wO(r*2)===wO(i*2)&&(e.x1=e.x2=DO(r,s,!0)),wO(a*2)===wO(o*2)&&(e.y1=e.y2=DO(a,s,!0))),e}}function EO(e,t,n){if(t){var r=t.x,i=t.y,a=t.width,o=t.height;e.x=r,e.y=i,e.width=a,e.height=o;var s=n&&n.lineWidth;return s&&(e.x=DO(r,s,!0),e.y=DO(i,s,!0),e.width=Math.max(DO(r+a,s,!1)-e.x,a===0?0:1),e.height=Math.max(DO(i+o,s,!1)-e.y,o===0?0:1)),e}}function DO(e,t,n){if(!t)return e;var r=wO(e*2);return(r+wO(t))%2==0?r/2:(r+(n?1:-1))/2}var Lie=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Rie={},OO=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new Lie},t.prototype.buildPath=function(e,t){var n,r,i,a;if(this.subPixelOptimize){var o=EO(Rie,t,this.style);n=o.x,r=o.y,i=o.width,a=o.height,o.r=t.r,t=o}else n=t.x,r=t.y,i=t.width,a=t.height;t.r?Iie(e,t):e.rect(n,r,i,a)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(xO);OO.prototype.type=`rect`;var kO={fill:`#000`},AO=2,jO={},zie={style:zS({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},kD.style)},MO=function(e){UC(t,e);function t(t){var n=e.call(this)||this;return n.type=`text`,n._children=[],n._defaultStyle=kO,n.attr(t),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t0,T=0;T=0&&(D=y[E],D.align===`right`);)this._placeToken(D,e,x,m,T,`right`,g),S-=D.width,T-=D.width,E--;for(w+=(s-(w-p)-(h-T)-S)/2;C<=E;)D=y[C],this._placeToken(D,e,x,m,w+D.width/2,`center`,g),w+=D.width,C++;m+=x}},t.prototype._placeToken=function(e,t,n,r,i,a,o){var s=t.rich[e.styleName]||{};s.text=e.text;var c=e.verticalAlign,l=r+n/2;c===`top`?l=r+e.height/2:c===`bottom`&&(l=r+n-e.height/2),!e.isLineHolder&&HO(s)&&this._renderBackground(s,t,a===`right`?i-e.width:a===`center`?i-e.width/2:i,l-e.height/2,e.width,e.height);var u=!!s.backgroundColor,d=e.textPadding;d&&(i=BO(i,a,d),l-=e.height/2-d[0]-e.innerHeight/2);var f=this._getOrCreateChild(SO),p=f.createStyle();f.useStyle(p);var m=this._defaultStyle,h=!1,g=0,_=!1,v=zO(`fill`in s?s.fill:`fill`in t?t.fill:(h=!0,m.fill)),y=RO(`stroke`in s?s.stroke:`stroke`in t?t.stroke:!u&&!o&&(!m.autoStroke||h)?(g=AO,_=!0,m.stroke):null),b=s.textShadowBlur>0||t.textShadowBlur>0;p.text=e.text,p.x=i,p.y=l,b&&(p.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,p.shadowColor=s.textShadowColor||t.textShadowColor||`transparent`,p.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,p.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),p.textAlign=a,p.textBaseline=`middle`,p.font=e.font||`12px sans-serif`,p.opacity=cC(s.opacity,t.opacity,1),FO(p,s),y&&(p.lineWidth=cC(s.lineWidth,t.lineWidth,g),p.lineDash=sC(s.lineDash,t.lineDash),p.lineDashOffset=t.lineDashOffset||0,p.stroke=y),v&&(p.fill=v),f.setBoundingRect(sT(p,e.contentWidth,e.contentHeight,_?0:null))},t.prototype._renderBackground=function(e,t,n,r,i,a){var o=e.backgroundColor,s=e.borderWidth,c=e.borderColor,l=o&&o.image,u=o&&!l,d=e.borderRadius,f=this,p,m;if(u||e.lineHeight||s&&c){p=this._getOrCreateChild(OO),p.useStyle(p.createStyle()),p.style.fill=null;var h=p.shape;h.x=n,h.y=r,h.width=i,h.height=a,h.r=d,p.dirtyShape()}if(u){var g=p.style;g.fill=o||null,g.fillOpacity=sC(e.fillOpacity,1)}else if(l){m=this._getOrCreateChild(CO),m.onload=function(){f.dirtyStyle()};var _=m.style;_.image=o.image,_.x=n,_.y=r,_.width=i,_.height=a}if(s&&c){var g=p.style;g.lineWidth=s,g.stroke=c,g.strokeOpacity=sC(e.strokeOpacity,1),g.lineDash=e.borderDash,g.lineDashOffset=e.borderDashOffset||0,p.strokeContainThreshold=0,p.hasFill()&&p.hasStroke()&&(g.strokeFirst=!0,g.lineWidth*=2)}var v=(p||m).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||`transparent`,v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=cC(e.opacity,t.opacity,1)},t.makeFont=function(e){var t=``;return IO(e)&&(t=[e.fontStyle,e.fontWeight,PO(e.fontSize),e.fontFamily||`sans-serif`].join(` `)),t&&fC(t)||e.textFont||e.font},t}(jD),Bie={left:!0,right:1,center:1},Vie={top:1,bottom:1,middle:1},NO=[`fontStyle`,`fontWeight`,`fontSize`,`fontFamily`];function PO(e){return typeof e==`string`&&(e.indexOf(`px`)!==-1||e.indexOf(`rem`)!==-1||e.indexOf(`em`)!==-1)?e:isNaN(+e)?`12px`:e+`px`}function FO(e,t){for(var n=0;n0){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 tk=Kie;function Kie(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 nk(e,t,n)}function nk(e,t,n){return ZS(e)?rk(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function qie(e){return ZS(e)&&rk(e)}function rk(e){return!!Uie(e).match(/%$/)}function ik(e,t,n){return isNaN(t)?n?``+e:+e:(t=GO(KO(0,t),WO),e=(+e).toFixed(t),n?e:+e)}function ak(e){return e.sort(function(e,t){return e-t}),e}function ok(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(JO(e*t)/t===e)return n}return Jie(e)}function Jie(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 KO(0,(a<0?0:i-1-a)-r)}function sk(e,t,n){var r=qO(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=QO(2*qO(n||1)*qO(r))/$O,a=QO(qO(t))/$O,o=KO(0,XO(-i+a));return isFinite(o)||(o=NaN),o}function ck(e,t){var n=KO(ok(e),ok(t)),r=e+t;return n>WO?r:ik(r,n)}var lk=ZO(2,53)-1;function uk(e){var t=Wie*2;return(e%t+t)%t}function dk(e){return e>-UO&&e=10&&t++,t}function hk(e,t){var n=mk(e),r=ZO(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,ik(e,-n)}function gk(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 Wk(){return[1/0,-1/0]}function Gk(e,t){Jk(t)&&(te[1]&&(e[1]=t))}function Kk(e,t){Jk(t)&&te[1]&&(e[1]=t)}function vae(e,t){Yk(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Jk(e){return e!=null&&isFinite(e)}function Yk(e,t){return Jk(e)&&Jk(t)&&e<=t}function yae(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function Xk(e){Yk(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function Zk(){var e=`__ec_once_`+bae++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bae=vk();function Qk(e,t,n){var r=_C(),i=0;Y(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 xae(e){return e.value+``}function Sae(e){return e+``}function $k(e,t){return sC(t,!0)?e.seriesIndex+2:0}function eA(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 tA(e,t){return{seriesType:e,overallReset:t}}function nA(e){return{overallReset:e}}var rA=Lk(),Cae=function(e,t,n,r){if(r){var i=rA(r);i.dataIndex=n,i.dataType=t,i.seriesIndex=e,i.ssrType=`chart`,r.type===`group`&&r.traverse(function(r){var i=rA(r);i.seriesIndex=e,i.dataIndex=n,i.dataType=t,i.ssrType=`chart`})}},iA=`series`,aA=_C([`tooltip`,`label`,`itemName`,`itemId`,`itemGroupId`,`itemChildGroupId`,`seriesName`]),oA=`original`,sA=`arrayRows`,cA=`objectRows`,lA=`keyedColumns`,uA=`typedArray`,wae=`unknown`,dA=`column`,fA=`Roam`,Tae=[`getDom`,`getZr`,`getWidth`,`getHeight`,`getDevicePixelRatio`,`dispatchAction`,`isSSR`,`isDisposed`,`on`,`off`,`getDataURL`,`getConnectedDataURL`,`getOption`,`getId`,`updateLabelLayout`],pA=function(){function e(e){Y(Tae,function(t){this[t]=JS(e[t],e)},this)}return e}();function mA(e,t){return t.mainType===`series`?e.getViewOfSeriesModel(t):e.getViewOfComponentModel(t)}var hA=1,gA={},_A=Lk(),vA=Lk(),yA=[`emphasis`,`blur`,`select`],bA=[`normal`,`emphasis`,`blur`,`select`],xA=`highlight`,SA=`downplay`,CA=`select`,wA=`unselect`,TA=`toggleSelect`,EA=`selectchanged`;function DA(e){return e!=null&&e!==`none`}function OA(e,t,n){e.onHoverStateChange&&(e.hoverState||0)!==n&&e.onHoverStateChange(t),e.hoverState=n}function kA(e){OA(e,`emphasis`,2)}function AA(e){e.hoverState===2&&OA(e,`normal`,0)}function jA(e){OA(e,`blur`,1)}function MA(e){e.hoverState===1&&OA(e,`normal`,0)}function Eae(e){e.selected=!0}function Dae(e){e.selected=!1}function NA(e,t,n){t(e,n)}function PA(e,t,n){NA(e,t,n),e.isGroup&&e.traverse(function(e){NA(e,t,n)})}function FA(e,t){switch(t){case`emphasis`:e.hoverState=2;break;case`normal`:e.hoverState=0;break;case`blur`:e.hoverState=1;break;case`select`:e.selected=!0}}function Oae(e,t,n,r){for(var i=e.style,a={},o=0;o=0,a=!1;if(e instanceof xO){var o=_A(e),s=i&&o.selectFill||o.normalFill,c=i&&o.selectStroke||o.normalStroke;if(DA(s)||DA(c)){r||={};var l=r.style||{};l.fill===`inherit`?(a=!0,r=J({},r),l=J({},l),l.fill=s):!DA(l.fill)&&DA(s)?(a=!0,r=J({},r),l=J({},l),l.fill=fE(s)):!DA(l.stroke)&&DA(c)&&(a||(r=J({},r),l=J({},l)),l.stroke=fE(c)),r.style=l}}if(r&&r.z2==null){a||(r=J({},r));var u=e.z2EmphasisLift;r.z2=e.z2+(u??10)}return r}function Aae(e,t,n){if(n&&n.z2==null){n=J({},n);var r=e.z2SelectLift;n.z2=e.z2+(r??9)}return n}function jae(e,t,n){var r=BS(e.currentStates,t)>=0,i=e.style.opacity,a=r?null:Oae(e,[`opacity`],t,{opacity:1});n||={};var o=n.style||{};return o.opacity??(n=J({},n),o=J({opacity:r?i:a.opacity*.1},o),n.style=o),n}function IA(e,t){var n=this.states[e];if(this.style){if(e===`emphasis`)return kae(this,e,t,n);if(e===`blur`)return jae(this,e,n);if(e===`select`)return Aae(this,e,n)}return n}function LA(e){e.stateProxy=IA;var t=e.getTextContent(),n=e.getTextGuideLine();t&&(t.stateProxy=IA),n&&(n.stateProxy=IA)}function RA(e,t){!KA(e,t)&&!e.__highByOuter&&PA(e,kA)}function zA(e,t){!KA(e,t)&&!e.__highByOuter&&PA(e,AA)}function BA(e,t){e.__highByOuter|=1<<(t||0),PA(e,kA)}function VA(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&PA(e,AA)}function HA(e){PA(e,jA)}function UA(e){PA(e,MA)}function WA(e){PA(e,Eae)}function GA(e){PA(e,Dae)}function KA(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function qA(e){var t=e.getModel(),n=[],r=[];t.eachComponent(function(t,i){var a=vA(i),o=mA(e,i),s=t===`series`;!s&&r.push(o),a.isBlured&&(o.group.traverse(function(e){MA(e)}),s&&n.push(i)),a.isBlured=!1}),Y(r,function(e){e&&e.toggleBlurSeries&&e.toggleBlurSeries(n,!1,t)})}function JA(e,t,n,r){var i=r.getModel();n||=`coordinateSystem`;function a(e,t){for(var n=0;n0){var a={dataIndex:i,seriesIndex:e.seriesIndex};r!=null&&(a.dataType=r),t.push(a)}})}),t}function QA(e,t,n){nj(e,!0),PA(e,LA),Rae(e,t,n)}function Lae(e){nj(e,!1)}function $A(e,t,n,r){r?Lae(e):QA(e,t,n)}function Rae(e,t,n){var r=rA(e);t==null?r.focus&&=null:(r.focus=t,r.blurScope=n)}var ej=[`emphasis`,`blur`,`select`],zae={itemStyle:`getItemStyle`,lineStyle:`getLineStyle`,areaStyle:`getAreaStyle`};function tj(e,t,n,r){n||=`itemStyle`;for(var i=0;i1&&(o*=cj(m),s*=cj(m));var h=(i===a?-1:1)*cj((o*o*(s*s)-o*o*(p*p)-s*s*(f*f))/(o*o*(p*p)+s*s*(f*f)))||0,g=h*o*p/s,_=h*-s*f/o,v=(e+n)/2+uj(d)*g-lj(d)*_,y=(t+r)/2+lj(d)*g+uj(d)*_,b=mj([1,0],[(f-g)/o,(p-_)/s]),x=[(f-g)/o,(p-_)/s],S=[(-1*f-g)/o,(-1*p-_)/s],C=mj(x,S);if(pj(x,S)<=-1&&(C=dj),pj(x,S)>=1&&(C=0),C<0){var w=Math.round(C/dj*1e6)/1e6;C=dj*2+w%2*dj}u.addData(l,v,y,o,s,b,C,d,a)}var Gae=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Kae=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function qae(e){var t=new cO;if(!e)return t;var n=0,r=0,i=n,a=r,o,s=cO.CMD,c=e.match(Gae);if(!c)return t;for(var l=0;l=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=BS(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var i=this.__zr;i&&r.removeSelfFromZr(i),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=BS(n,e);return r<0||(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh()),this},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;nA*A+j*j&&(w=E,T=D),{cx:w,cy:T,x0:-u,y0:-d,x1:w*(i/x-1),y1:T*(i/x-1)}}function toe(e){var t;if(X(e)){var n=e.length;if(!n)return e;t=n===1?[e[0],e[0],0,0]:n===2?[e[0],e[0],e[1],e[1]]:n===3?e.concat(e[2]):e}else t=[e,e,e,e];return t}function noe(e,t){var n,r=kj(t.r,0),i=kj(t.r0||0,0),a=r>0;if(a||i>0){if(a||(r=i,i=0),i>r){var o=r;r=i,i=o}var s=t.startAngle,c=t.endAngle;if(!(isNaN(s)||isNaN(c))){var l=t.cx,u=t.cy,d=!!t.clockwise,f=Dj(c-s),p=f>Cj&&f%Cj;if(p>jj&&(f=p),!(r>jj))e.moveTo(l,u);else if(f>Cj-jj)e.moveTo(l+r*Tj(s),u+r*wj(s)),e.arc(l,u,r,s,c,!d),i>jj&&(e.moveTo(l+i*Tj(c),u+i*wj(c)),e.arc(l,u,i,c,s,d));else{var m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0,O=void 0,k=void 0,A=r*Tj(s),j=r*wj(s),M=i*Tj(c),N=i*wj(c),P=f>jj;if(P){var F=t.cornerRadius;F&&(n=toe(F),m=n[0],h=n[1],g=n[2],_=n[3]);var ee=Dj(r-i)/2;if(v=Aj(ee,g),y=Aj(ee,_),b=Aj(ee,m),x=Aj(ee,h),w=S=kj(v,y),T=C=kj(b,x),(S>jj||C>jj)&&(E=r*Tj(c),D=r*wj(c),O=i*Tj(s),k=i*wj(s),fjj){var oe=Aj(g,w),se=Aj(_,w),R=Mj(O,k,A,j,r,oe,d),ce=Mj(E,D,M,N,r,se,d);e.moveTo(l+R.cx+R.x0,u+R.cy+R.y0),w0&&e.arc(l+R.cx,u+R.cy,oe,Ej(R.y0,R.x0),Ej(R.y1,R.x1),!d),e.arc(l,u,r,Ej(R.cy+R.y1,R.cx+R.x1),Ej(ce.cy+ce.y1,ce.cx+ce.x1),!d),se>0&&e.arc(l+ce.cx,u+ce.cy,se,Ej(ce.y1,ce.x1),Ej(ce.y0,ce.x0),!d))}else e.moveTo(l+A,u+j),e.arc(l,u,r,s,c,!d);if(!(i>jj)||!P)e.lineTo(l+M,u+N);else if(T>jj){var oe=Aj(m,T),se=Aj(h,T),R=Mj(M,N,E,D,i,-se,d),ce=Mj(A,j,O,k,i,-oe,d);e.lineTo(l+R.cx+R.x0,u+R.cy+R.y0),T0&&e.arc(l+R.cx,u+R.cy,se,Ej(R.y0,R.x0),Ej(R.y1,R.x1),!d),e.arc(l,u,i,Ej(R.cy+R.y1,R.cx+R.x1),Ej(ce.cy+ce.y1,ce.cx+ce.x1),d),oe>0&&e.arc(l+ce.cx,u+ce.cy,oe,Ej(ce.y1,ce.x1),Ej(ce.y0,ce.x0),!d))}else e.lineTo(l+M,u+N),e.arc(l,u,i,c,s,d)}e.closePath()}}}var roe=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),Nj=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new roe},t.prototype.buildPath=function(e,t){noe(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(xO);Nj.prototype.type=`sector`;var ioe=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),Pj=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new ioe},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.PI*2;e.moveTo(n+t.r,r),e.arc(n,r,t.r,0,i,!1),e.moveTo(n+t.r0,r),e.arc(n,r,t.r0,0,i,!0)},t}(xO);Pj.prototype.type=`ring`;function aoe(e,t,n,r){var i=[],a=[],o=[],s=[],c,l,u,d;if(r){u=[1/0,1/0],d=[-1/0,-1/0];for(var f=0,p=e.length;f=2){if(r){var a=aoe(i,r,n,t.smoothConstraint);e.moveTo(i[0][0],i[0][1]);for(var o=i.length,s=0;s<(n?o:o-1);s++){var c=a[s*2],l=a[s*2+1],u=i[(s+1)%o];e.bezierCurveTo(c[0],c[1],l[0],l[1],u[0],u[1])}}else{e.moveTo(i[0][0],i[0][1]);for(var s=1,d=i.length;sYj[1]){if(i=!1,Xj.negativeSize||n)return i;var s=qj(Yj[0]-Jj[1]),c=qj(Jj[0]-Yj[1]);Kj(s,c)>Qj.len()&&(s=c||!Xj.bidirectional)&&(_w.scale(Zj,o,-c*r),Xj.useDir&&Xj.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(e,t,n){for(var r=this._axes[e],i=this._origin,a=t[0].dot(r)+i[e],o=a,s=a,c=1;c0){var d=u.duration,f=u.delay,p=u.easing,m={duration:d,delay:f||0,easing:p,done:a,force:!!a||!!o,setToFinal:!l,scope:e,during:o};s?t.animateFrom(n,m):t.animateTo(n,m)}else t.stopAnimation(),!s&&t.attr(n),o&&o(1),a&&a()}function nM(e,t,n,r,i,a){tM(`update`,e,t,n,r,i,a)}function rM(e,t,n,r,i,a){tM(`enter`,e,t,n,r,i,a)}function iM(e){if(!e.__zr)return!0;for(var t=0;tHj,BezierCurve:()=>Vj,BoundingRect:()=>Aw,Circle:()=>bj,CompoundPath:()=>Uj,Ellipse:()=>xj,Group:()=>yj,HOVER_LAYER_FOR_INCREMENTAL:()=>2,HOVER_LAYER_FROM_THRESHOLD:()=>1,HOVER_LAYER_NO:()=>0,Image:()=>CO,IncrementalDisplayable:()=>hoe,Line:()=>Rj,LinearGradient:()=>Gj,OrientedBoundingRect:()=>$j,Path:()=>xO,Point:()=>_w,Polygon:()=>Ij,Polyline:()=>Lj,RadialGradient:()=>foe,Rect:()=>OO,Ring:()=>Pj,Sector:()=>Nj,Text:()=>MO,WH:()=>dM,XY:()=>uM,applyTransform:()=>SM,calcZ2Range:()=>VM,clipPointsByRect:()=>Coe,clipRectByRect:()=>EM,createIcon:()=>DM,decomposeTransform:()=>GM,ensureCopyRect:()=>RM,ensureCopyTransform:()=>zM,expandOrShrinkRect:()=>AM,extendPath:()=>yoe,extendShape:()=>voe,getCurrentCanvasPainter:()=>qM,getShapeClass:()=>mM,getTransform:()=>xM,groupTransition:()=>TM,initProps:()=>rM,isBoundingRectAxisAligned:()=>IM,isElementRemoved:()=>iM,lineLineIntersect:()=>OM,linePolygonIntersect:()=>woe,makeImage:()=>gM,makePath:()=>hM,mergePath:()=>boe,payloadDisableAnimation:()=>WM,registerShape:()=>pM,removeElement:()=>aM,removeElementWithFadeOut:()=>sM,resizePath:()=>vM,retrieveZInfo:()=>BM,setTooltipConfig:()=>NM,subPixelOptimize:()=>bM,subPixelOptimizeLine:()=>yM,subPixelOptimizeRect:()=>xoe,transformDirection:()=>CM,traverseElements:()=>FM,traverseUpdateZ:()=>HM,updateProps:()=>nM}),lM={},uM=[`x`,`y`],dM=[`width`,`height`];function voe(e){return xO.extend(e)}var fM=Yae;function yoe(e,t){return fM(e,t)}function pM(e,t){lM[e]=t}function mM(e){if(lM.hasOwnProperty(e))return lM[e]}function hM(e,t,n,r){var i=Jae(e,t);return n&&(r===`center`&&(n=_M(n,i.getBoundingRect())),vM(i,n)),i}function gM(e,t,n){var r=new CO({style:{image:e,x:t.x,y:t.y,width:t.width,height:t.height},onload:function(e){if(n===`center`){var i={width:e.width,height:e.height};r.setStyle(_M(t,i))}}});return r}function _M(e,t){var n=t.width/t.height,r=e.height*n,i;r<=e.width?i=e.height:(r=e.width,i=r/n);var a=e.x+e.width/2,o=e.y+e.height/2;return{x:a-r/2,y:o-i/2,width:r,height:i}}var boe=Xae;function vM(e,t){if(e.applyTransform){var n=e.getBoundingRect().calculateTransform(t);e.applyTransform(n)}}function yM(e,t){return TO(e,e,{lineWidth:t}),e}function xoe(e,t){return EO(e,e,t),e}var bM=DO;function xM(e,t){for(var n=$C([]);e&&e!==t;)tw(n,e.getLocalTransform(),n),e=e.parent;return n}function SM(e,t,n){return t&&!HS(t)&&(t=gT.getLocalTransform(t)),n&&(t=iw([],t)),mw([],e,t)}function CM(e,t,n){var r=t[4]===0||t[5]===0||t[0]===0?1:qO(2*t[4]/t[0]),i=t[4]===0||t[5]===0||t[2]===0?1:qO(2*t[4]/t[2]),a=[e===`left`?-r:e===`right`?r:0,e===`top`?-i:e===`bottom`?i:0];return a=SM(a,t,n),qO(a[0])>qO(a[1])?a[0]>0?`right`:`left`:a[1]>0?`bottom`:`top`}function wM(e){return!e.isGroup}function Soe(e){return e.shape!=null}function TM(e,t,n){if(!e||!t)return;function r(e){var t={};return e.traverse(function(e){wM(e)&&e.anid&&(t[e.anid]=e)}),t}function i(e){var t={x:e.x,y:e.y,rotation:e.rotation};return Soe(e)&&(t.shape=LS(e.shape)),t}var a=r(e);t.traverse(function(e){if(wM(e)&&e.anid){var t=a[e.anid];if(t){var r=i(e);e.attr(i(t)),nM(e,r,n,rA(e).dataIndex)}}})}function Coe(e,t){return US(e,function(e){var n=e[0];n=KO(n,t.x),n=GO(n,t.x+t.width);var r=e[1];return r=KO(r,t.y),r=GO(r,t.y+t.height),[n,r]})}function EM(e,t){var n=KO(e.x,t.x),r=GO(e.x+e.width,t.x+t.width),i=KO(e.y,t.y),a=GO(e.y+e.height,t.y+t.height);if(r>=n&&a>=i)return{x:n,y:i,width:r-n,height:a-i}}function DM(e,t,n){var r=J({rectHover:!0},t),i=r.style={strokeNoScale:!0};if(n||={x:-1,y:-1,width:2,height:2},e)return e.indexOf(`image://`)===0?(i.image=e.slice(8),zS(i,n),new CO(r)):hM(e.replace(`path://`,``),r,n,`center`)}function woe(e,t,n,r,i){for(var a=0,o=i[i.length-1];a1)return!1;var g=kM(p,m,u,d)/f;return!(g<0||g>1)}function kM(e,t,n,r){return e*r-n*t}function Toe(e){return e<=1e-6&&e>=-1e-6}function AM(e,t,n,r,i){return t==null||($S(t)?jM[0]=jM[1]=jM[2]=jM[3]=t:(jM[0]=t[0],jM[1]=t[1],jM[2]=t[2],jM[3]=t[3]),r&&(jM[0]=KO(0,jM[0]),jM[1]=KO(0,jM[1]),jM[2]=KO(0,jM[2]),jM[3]=KO(0,jM[3])),n&&(jM[0]=-jM[0],jM[1]=-jM[1],jM[2]=-jM[2],jM[3]=-jM[3]),MM(e,jM,`x`,`width`,3,1,i&&i[0]||0),MM(e,jM,`y`,`height`,0,2,i&&i[1]||0)),e}var jM=[0,0,0,0];function MM(e,t,n,r,i,a,o){var s=t[a]+t[i],c=e[r];e[r]+=s,o=KO(0,GO(o,c)),e[r]=0?-t[i]:t[a]>=0?c+t[a]:qO(s)>1e-8?(c-o)*t[i]/s:0):e[n]-=t[i]}function NM(e){var t=e.itemTooltipOption,n=e.componentModel,r=e.itemName,i=ZS(t)?{formatter:t}:t,a=n.mainType,o=n.componentIndex,s={componentType:a,name:r,$vars:[`name`]};s[a+`Index`]=o;var c=e.formatterParamsExtra;c&&Y(qS(c),function(e){Z(s,e)||(s[e]=c[e],s.$vars.push(e))});var l=rA(e.el);l.componentMainType=a,l.componentIndex=o,l.tooltipConfig={name:r,option:zS({content:r,encodeHTMLContent:!0,formatterParams:s},i)}}function PM(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function FM(e,t){if(e){if(X(e))for(var n=0;nt&&(t=r),rt&&(n=t=0),{min:n,max:t}}function HM(e,t,n){UM(e,t,n,-1/0)}function UM(e,t,n,r){if(e.ignoreModelZ)return r;var i=e.getTextContent(),a=e.getTextGuideLine();if(e.isGroup)for(var o=e.childrenRef(),s=0;s1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;ol&&(l=p)}s[0]=c,s[1]=l}},r=function(){return this._data?this._data.length/this._dimSize:0};FN=(e={},e[sA+`_`+dA]={pure:!0,appendData:i},e[sA+`_row`]={pure:!0,appendData:function(){throw Error(`Do not support appendData when set seriesLayoutBy: "row".`)}},e[cA]={pure:!0,appendData:i},e[lA]={pure:!0,appendData:function(e){var t=this._data;Y(e,function(e,n){for(var r=t[n]||(t[n]=[]),i=0;i<(e||[]).length;i++)r.push(e[i])})}},e[oA]={appendData:i},e[uA]={persistent:!1,pure:!0,appendData:function(e){this._data=e},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(e){for(var t=0;tt},gte:function(e,t){return e>=t}};(function(){function e(e,t){$S(t)||wk(``),this._opFn=Koe[e],this._rvalFloat=_k(t)}return e.prototype.evaluate=function(e){return $S(e)?this._opFn(e,this._rvalFloat):this._opFn(_k(e),this._rvalFloat)},e})();var qoe=function(){function e(e,t){var n=e===`desc`;this._resultLT=n?1:-1,t??=n?`min`:`max`,this._incomparable=t===`min`?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=$S(e)?e:_k(e),r=$S(t)?t:_k(t),i=isNaN(n),a=isNaN(r);if(i&&(n=this._incomparable),a&&(r=this._incomparable),i&&a){var o=ZS(e),s=ZS(t);o&&(n=s?e:0),s&&(r=o?t:0)}return nr?-this._resultLT:0},e}();(function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=_k(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n!==this._rvalTypeof&&(n===`number`||this._rvalTypeof===`number`)&&(t=_k(e)===this._rvalFloat)}return this._isEQ?t:!t},e})();function XN(e){var t=``,n=-1/0,r=-1/0,i=1/0,a=1/0;return e&&(e.g!=null&&(t+=`G`+e.g,n=e.g),e.ge!=null&&(t+=`GE`+e.ge,r=e.ge),e.l!=null&&(t+=`L`+e.l,i=e.l),e.le!=null&&(t+=`LE`+e.le,a=e.le)),{key:t,g:n,ge:r,l:i,le:a}}function ZN(e,t){return t>e.g&&t>=e.ge&&t`u`?Array:Uint32Array,Yoe=typeof Uint16Array>`u`?Array:Uint16Array,QN=typeof Int32Array>`u`?Array:Int32Array,$N=typeof Float64Array>`u`?Array:Float64Array,eP={float:$N,int:QN,ordinal:Array,number:Array,time:$N},tP;function nP(e){return e>65535?Joe:Yoe}function Xoe(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function rP(e,t,n,r,i){var a=eP[n||`float`];if(i){var o=e[t],s=o&&o.length;if(s!==r){for(var c=new a(r),l=0;lh[1]&&(h[1]=m)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var r=this._provider,i=this._chunks,a=this._dimensions,o=a.length,s=this._rawExtent,c=US(a,function(e){return e.property}),l=0;lg[1]&&(g[1]=h)}}!r.persistent&&r.clean&&r.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(n!=null&&ne)i=a-1;else return a}return-1},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,r=this._count;if(n===Array){e=new n(r);for(var i=0;i=l&&g<=u||isNaN(g))&&(o[s++]=p),p++}f=!0}else if(i===2){for(var m=d[r[0]],_=d[r[1]],v=e[r[1]][0],y=e[r[1]][1],h=0;h=l&&g<=u||isNaN(g))&&(b>=v&&b<=y||isNaN(b))&&(o[s++]=p),p++}f=!0}}if(!f){if(i===1)for(var h=0;h=l&&g<=u||isNaN(g))&&(o[s++]=x)}else for(var h=0;he[w][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(h))}}return sg[1]&&(g[1]=h)}}}},e.prototype.lttbDownSample=function(e,t){var n=this.clone([e],!0),r=n._chunks[e],i=this.count(),a=0,o=Math.floor(1/t),s=this.getRawIndex(0),c,l,u,d=new(nP(this._rawCount))(Math.min((Math.ceil(i/o)+2)*2,i));d[a++]=s;for(var f=1;fc&&(c=l,u=v))}T>0&&To&&(m=o-l);for(var h=0;hp&&(p=g,f=l+h)}var _=this.getRawIndex(u),v=this.getRawIndex(f);ul-p&&(s=l-p,o.length=s);for(var m=0;mu[1]&&(u[1]=g),d[f++]=_}return i._count=f,i._indices=d,i._updateGetRawIdx(),i},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,r=this._chunks,i=0,a=this.count();id&&(d=p))}return o[c]=[u,d]},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],r=this._chunks,i=0;i=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,r){return YN(e[r],this._dimensions[r])}tP={arrayRows:e,objectRows:function(e,t,n,r){return YN(e[t],this._dimensions[r])},keyedColumns:e,original:function(e,t,n,r){var i=e&&(e.value==null?e:e.value);return YN(i instanceof Array?i[r]:i,this._dimensions[r])},typedArray:function(e,t,n,r){return e[r]}}}(),e}(),Zoe=Lk(),Qoe={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},aP=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=cP(this.source))},e.prototype.getSourceDimensionIndex=function(e){return sC(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=AN(this.source),n=!lP(e),r=``,i=[],a=0,o=0;a30}var uP=eC,dP=US,$oe=typeof Int32Array>`u`?Array:Int32Array,ese=`e\0\0`,fP=-1,tse=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],nse=[`_approximateExtent`],pP,mP,hP,gP,_P,vP,yP,bP=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;oP(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),X(i)?i=i.slice():uP(i)&&(i=J({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,uP(t)?J(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){uP(e)?J(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?J(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){Cae(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Y(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:dP(this.dimensions,this._getDimInfo,this),this.hostModel),_P(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];XS(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(lC(arguments)))})},e.internalField=function(){pP=function(e){var t=e._invertedIndicesMap;Y(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new $oe(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function xP(e,t){xN(e)||(e=CN(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=_C(),a=[],o=rse(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&lP(o),c=r===e.dimensionsDefine,l=c?cP(e):sP(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=_C(u),f=new QN(o),p=0;p0&&(e.name+=t-1)}),new aP({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function rse(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return Y(t,function(e){var t;eC(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function ise(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var SP={},CP={},wP=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(e,t){this._nonSeriesBoxMasterList=n(SP,!0),this._normalMasterList=n(CP,!1);function n(n,r){var i=[];return Y(n,function(n,r){var a=n.create(e,t);i=i.concat(a||[])}),i}},e.prototype.update=function(e,t){Y(this._normalMasterList,function(n){n.update&&n.update(e,t)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(e,t){e===`matrix`||e===`calendar`?SP[e]=t:CP[e]=t},e.get=function(e){return CP[e]||SP[e]},e}();function ase(e){return!!SP[e]}var ose=_C();function TP(e){var t=e.getShallow(`coord`,!0),n=1;if(t==null){var r=ose.get(e.type);r&&r.getCoord2&&(n=2,t=r.getCoord2(e))}return{coord:t,from:n}}function sse(e,t){var n=e.getShallow(`coordinateSystem`),r=e.getShallow(`coordinateSystemUsage`,!0),i=0;if(n){var a=e.mainType===`series`;r??=a?`data`:`box`,r===`data`?(i=1,a||(i=0)):r===`box`&&(i=2,!a&&!ase(n)&&(i=0))}return{coordSysType:n,kind:i}}function cse(e){var t=e.targetModel,n=e.coordSysType,r=e.coordSysProvider,i=e.isDefaultDataCoordSys;e.allowNotFound;var a=sse(t,!0),o=a.kind,s=a.coordSysType;if(i&&o!==1&&(o=1,s=n),o===0||s!==n)return 0;var c=r(n,t);return c?(o===1?t.coordinateSystem=c:t.boxCoordinateSystem=c,o):0}var lse=function(){function e(e){this.coordSysDims=[],this.axisMap=_C(),this.categoryAxisMap=_C(),this.coordSysName=e}return e}();function use(e){var t=e.get(`coordinateSystem`),n=new lse(t),r=dse[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var dse={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,Bk).models[0],a=e.getReferringComponents(`yAxis`,Bk).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),EP(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),EP(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,Bk).models[0];t.coordSysDims=[`single`],n.set(`single`,i),EP(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,Bk).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),EP(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),EP(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();Y(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),EP(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,Bk).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function EP(e){return e.get(`type`)===`category`}function fse(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;pse(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(Y(a,function(e,t){ZS(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),Y(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),u||!m(e)||p&&(e.coordDim===`x`||e.coordDim===`angle`)||i&&i!==e.coordDim||(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;Y(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function pse(e){return!oP(e.schema)}function DP(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function OP(e,t){return DP(e,t)?e.getCalculationInfo(`stackResultDimension`):t}function mse(e,t){var n=e.get(`coordinateSystem`),r=wP.get(n),i;return t&&t.coordSysDims&&(i=US(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=Woe(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function hse(e,t,n){var r,i;return n&&Y(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function kP(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=CN(e)):(i=r.getSource(),a=i.sourceFormat===oA);var o=use(t),s=mse(t,o),c=n.useEncodeDefaulter,l=XS(c)?c:c?YS(Loe,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=xP(i,u),f=hse(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=fse(t,{schema:d,store:p}),h=new bP(d,t);h.setCalculationInfo(m);var g=f!=null&&gse(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function gse(e){if(e.sourceFormat===`original`)return!X(Ak(_se(e.data||[])))}function _se(e){for(var t=0;t=0&&n.push(e)}),n}}function MP(e,t){return RS(RS({},e,!0),t,!0)}var NP=Math.log(2);function PP(e,t,n,r,i,a){var o=r+`-`+i,s=e.length;if(a.hasOwnProperty(o))return a[o];if(t===1){var c=Math.round(Math.log((1<>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){Y(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function HP(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?FP(s,o):FP(o,s))}function UP(e){return e.nodeName.toUpperCase()===`CANVAS`}var WP=/([&<>"'])/g,GP={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function KP(e){return e==null?``:(e+``).replace(WP,function(e,t){return GP[t]})}var qP={time:{month:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dayOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],dayOfWeekAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]},legend:{selector:{all:`All`,inverse:`Inv`}},toolbox:{brush:{title:{rect:`Box Select`,polygon:`Lasso Select`,lineX:`Horizontally Select`,lineY:`Vertically Select`,keep:`Keep Selections`,clear:`Clear Selections`}},dataView:{title:`Data View`,lang:[`Data View`,`Close`,`Refresh`]},dataZoom:{title:{zoom:`Zoom`,back:`Zoom Reset`}},magicType:{title:{line:`Switch to Line Chart`,bar:`Switch to Bar Chart`,stack:`Stack`,tiled:`Tile`}},restore:{title:`Restore`},saveAsImage:{title:`Save as Image`,lang:[`Right Click to Save Image`]}},series:{typeNames:{pie:`Pie chart`,bar:`Bar chart`,line:`Line chart`,scatter:`Scatter plot`,effectScatter:`Ripple scatter plot`,radar:`Radar chart`,tree:`Tree`,treemap:`Treemap`,boxplot:`Boxplot`,candlestick:`Candlestick`,k:`K line chart`,heatmap:`Heat map`,map:`Map`,parallel:`Parallel coordinate map`,lines:`Line graph`,graph:`Relationship graph`,sankey:`Sankey diagram`,funnel:`Funnel chart`,gauge:`Gauge`,pictorialBar:`Pictorial bar`,themeRiver:`Theme River Map`,sunburst:`Sunburst`,custom:`Custom chart`,chart:`Chart`}},aria:{general:{withTitle:`This is a chart about "{title}"`,withoutTitle:`This is a chart`},series:{single:{prefix:``,withName:` with type {seriesType} named {seriesName}.`,withoutName:` with type {seriesType}.`},multiple:{prefix:`. It consists of {seriesCount} series count.`,withName:` The {seriesId} series is a {seriesType} representing {seriesName}.`,withoutName:` The {seriesId} series is a {seriesType}.`,separator:{middle:``,end:``}}},data:{allData:`The data is as follows: `,partialData:`The first {displayCnt} items are: `,withName:`the data for {name} is {value}`,withoutName:`{value}`,separator:{middle:`, `,end:`. `}}}},JP={time:{month:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],monthAbbr:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],dayOfWeek:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`],dayOfWeekAbbr:[`日`,`一`,`二`,`三`,`四`,`五`,`六`]},legend:{selector:{all:`全选`,inverse:`反选`}},toolbox:{brush:{title:{rect:`矩形选择`,polygon:`圈选`,lineX:`横向选择`,lineY:`纵向选择`,keep:`保持选择`,clear:`清除选择`}},dataView:{title:`数据视图`,lang:[`数据视图`,`关闭`,`刷新`]},dataZoom:{title:{zoom:`区域缩放`,back:`区域缩放还原`}},magicType:{title:{line:`切换为折线图`,bar:`切换为柱状图`,stack:`切换为堆叠`,tiled:`切换为平铺`}},restore:{title:`还原`},saveAsImage:{title:`保存为图片`,lang:[`右键另存为图片`]}},series:{typeNames:{pie:`饼图`,bar:`柱状图`,line:`折线图`,scatter:`散点图`,effectScatter:`涟漪散点图`,radar:`雷达图`,tree:`树图`,treemap:`矩形树图`,boxplot:`箱型图`,candlestick:`K线图`,k:`K线图`,heatmap:`热力图`,map:`地图`,parallel:`平行坐标图`,lines:`线图`,graph:`关系图`,sankey:`桑基图`,funnel:`漏斗图`,gauge:`仪表盘图`,pictorialBar:`象形柱图`,themeRiver:`主题河流图`,sunburst:`旭日图`,custom:`自定义图表`,chart:`图表`}},aria:{general:{withTitle:`这是一个关于“{title}”的图表。`,withoutTitle:`这是一个图表,`},series:{single:{prefix:``,withName:`图表类型是{seriesType},表示{seriesName}。`,withoutName:`图表类型是{seriesType}。`},multiple:{prefix:`它由{seriesCount}个图表系列组成。`,withName:`第{seriesId}个系列是一个表示{seriesName}的{seriesType},`,withoutName:`第{seriesId}个系列是一个{seriesType},`,separator:{middle:`;`,end:`。`}}},data:{allData:`其数据是——`,partialData:`其中,前{displayCnt}项是——`,withName:`{name}的数据是{value}`,withoutName:`{value}`,separator:{middle:`,`,end:``}}}},YP=`ZH`,XP=`EN`,ZP=XP,QP={},$P={},eF=CC.domSupported?function(){return(document.documentElement.lang||navigator.language||navigator.browserLanguage||ZP).toUpperCase().indexOf(YP)>-1?YP:ZP}():ZP;function tF(e,t){e=e.toUpperCase(),$P[e]=new dN(t),QP[e]=t}function nF(e){if(ZS(e)){var t=QP[e.toUpperCase()]||{};return e===YP||e===XP?LS(t):RS(LS(t),LS(QP[ZP]),!1)}return RS(LS(e),LS(QP[ZP]),!1)}function rF(e){return $P[e]}function iF(){return $P[ZP]}tF(XP,qP),tF(YP,JP);var aF=null;function oF(){return aF}function sF(e,t){var n=oF(),r=t.breakOption,i=t.breakParsed;return!i&&n&&(i=n.parseAxisBreakOption(r,e)),i}function cF(e){var t=e.brk;return t?t.breaks:[]}function lF(e){var t=e.brk;return t?t.hasBreaks():!1}var uF=1e3,dF=uF*60,fF=dF*60,pF=fF*24,mF=pF*365,hF={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},gF={year:`{yyyy}`,month:`{MMM}`,day:`{d}`,hour:`{HH}:{mm}`,minute:`{HH}:{mm}`,second:`{HH}:{mm}:{ss}`,millisecond:`{HH}:{mm}:{ss} {SSS}`},_F=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}`,vF=`{yyyy}-{MM}-{dd}`,yF={year:`{yyyy}`,month:`{yyyy}-{MM}`,day:vF,hour:vF+` `+gF.hour,minute:vF+` `+gF.minute,second:vF+` `+gF.second,millisecond:_F},bF=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],xF=[`year`,`half-year`,`quarter`,`month`,`week`,`half-week`,`day`,`half-day`,`quarter-day`,`hour`,`minute`,`second`,`millisecond`];function SF(e){return!ZS(e)&&!XS(e)?CF(e):e}function CF(e){e||={};var t={},n=!0;return Y(bF,function(t){n&&=e[t]==null}),Y(bF,function(r,i){var a=e[r];t[r]={};for(var o=null,s=i;s>=0;s--){var c=bF[s],l=eC(a)&&!X(a)?a[c]:a,u=void 0;X(l)?(u=l.slice(),o=u[0]||``):ZS(l)?(o=l,u=[o]):(o==null?o=gF[r]:hF[c].test(o)||(o=t[c][c][0]+` `+o),u=[o],n&&(u[1]=`{primary|`+o+`}`)),t[r][c]=u}}),t}function wF(e,t){return e+=``,`0000`.substr(0,t-e.length)+e}function TF(e){switch(e){case`half-year`:case`quarter`:return`month`;case`week`:case`half-week`:return`day`;case`half-day`:case`quarter-day`:return`hour`;default:return e}}function EF(e){return e===TF(e)}function bse(e){switch(e){case`year`:case`month`:return`day`;case`millisecond`:return`millisecond`;default:return`second`}}function DF(e,t,n,r){var i=fk(e),a=i[AF(n)](),o=i[jF(n)]()+1,s=Math.floor((o-1)/3)+1,c=i[MF(n)](),l=i[`get`+(n?`UTC`:``)+`Day`](),u=i[NF(n)](),d=(u-1)%12+1,f=i[PF(n)](),p=i[FF(n)](),m=i[IF(n)](),h=u>=12?`pm`:`am`,g=h.toUpperCase(),_=(r instanceof dN?r:rF(r||eF)||iF()).getModel(`time`),v=_.get(`month`),y=_.get(`monthAbbr`),b=_.get(`dayOfWeek`),x=_.get(`dayOfWeekAbbr`);return(t||``).replace(/{a}/g,h+``).replace(/{A}/g,g+``).replace(/{yyyy}/g,a+``).replace(/{yy}/g,wF(a%100+``,2)).replace(/{Q}/g,s+``).replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,wF(o,2)).replace(/{M}/g,o+``).replace(/{dd}/g,wF(c,2)).replace(/{d}/g,c+``).replace(/{eeee}/g,b[l]).replace(/{ee}/g,x[l]).replace(/{e}/g,l+``).replace(/{HH}/g,wF(u,2)).replace(/{H}/g,u+``).replace(/{hh}/g,wF(d+``,2)).replace(/{h}/g,d+``).replace(/{mm}/g,wF(f,2)).replace(/{m}/g,f+``).replace(/{ss}/g,wF(p,2)).replace(/{s}/g,p+``).replace(/{SSS}/g,wF(m,3)).replace(/{S}/g,m+``)}function xse(e,t,n,r,i){var a=null;if(ZS(n))a=n;else if(XS(n)){var o={time:e.time,level:e.time?e.time.level:0},s=oF();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),a=n(e.value,t,o)}else{var c=e.time;if(c){var l=n[c.lowerTimeUnit][c.upperTimeUnit];a=l[Math.min(c.level,l.length-1)]||``}else{var u=OF(e.value,i);a=n[u][u][0]}}return DF(new Date(e.value),a,i,r)}function OF(e,t){var n=fk(e),r=n[jF(t)]()+1,i=n[MF(t)](),a=n[NF(t)](),o=n[PF(t)](),s=n[FF(t)](),c=n[IF(t)]()===0,l=c&&s===0,u=l&&o===0,d=u&&a===0,f=d&&i===1;return f&&r===1?`year`:f?`month`:d?`day`:u?`hour`:l?`minute`:c?`second`:`millisecond`}function kF(e,t,n){switch(t){case`year`:e[LF(n)](0);case`month`:e[RF(n)](1);case`day`:e[zF(n)](0);case`hour`:e[BF(n)](0);case`minute`:e[VF(n)](0);case`second`:e[HF(n)](0)}return e}function AF(e){return e?`getUTCFullYear`:`getFullYear`}function jF(e){return e?`getUTCMonth`:`getMonth`}function MF(e){return e?`getUTCDate`:`getDate`}function NF(e){return e?`getUTCHours`:`getHours`}function PF(e){return e?`getUTCMinutes`:`getMinutes`}function FF(e){return e?`getUTCSeconds`:`getSeconds`}function IF(e){return e?`getUTCMilliseconds`:`getMilliseconds`}function Sse(e){return e?`setUTCFullYear`:`setFullYear`}function LF(e){return e?`setUTCMonth`:`setMonth`}function RF(e){return e?`setUTCDate`:`setDate`}function zF(e){return e?`setUTCHours`:`setHours`}function BF(e){return e?`setUTCMinutes`:`setMinutes`}function VF(e){return e?`setUTCSeconds`:`setSeconds`}function HF(e){return e?`setUTCMilliseconds`:`setMilliseconds`}function UF(e){if(!Xie(e))return ZS(e)?e:`-`;var t=(e+``).split(`.`);return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,`$1,`)+(t.length>1?`.`+t[1]:``)}function WF(e,t){return e=(e||``).toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var GF=uC;function KF(e,t,n){var r=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}`;function i(e){return e&&fC(e)?e:`-`}function a(e){return xk(e)}var o=t===`time`,s=e instanceof Date;if(o||s){var c=o?fk(e):e;if(!isNaN(+c))return DF(c,r,n);if(s)return`-`}if(t===`ordinal`)return QS(e)?i(e):$S(e)&&a(e)?e+``:`-`;var l=_k(e);return a(l)?UF(l):QS(e)?i(e):typeof e==`boolean`?e+``:`-`}var qF=[`a`,`b`,`c`,`d`,`e`,`f`,`g`],JF=function(e,t){return`{`+e+(t??``)+`}`};function YF(e,t,n){X(t)||(t=[t]);var r=t.length;if(!r)return``;for(var i=t[0].$vars||[],a=0;a`:``:{renderMode:a,content:`{`+(n.markerId||`markerX`)+`|} `,style:i===`subItem`?{width:4,height:4,borderRadius:2,backgroundColor:r}:{width:10,height:10,borderRadius:5,backgroundColor:r}}:``}function XF(e,t){return t||=`transparent`,ZS(e)?e:eC(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}var ZF=Y,wse=[`left`,`right`,`top`,`bottom`,`width`,`height`],QF=[[`width`,`left`,`right`],[`height`,`top`,`bottom`]];function $F(e,t,n,r,i){var a=0,o=0;r??=1/0,i??=1/0;var s=0;t.eachChild(function(c,l){var u=c.getBoundingRect(),d=t.childAt(l+1),f=d&&d.getBoundingRect(),p,m;if(e===`horizontal`){var h=u.width+(f?-f.x+u.x:0);p=a+h,p>r||c.newline?(a=0,p=h,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(f?-f.y+u.y:0);m=o+g,m>i||c.newline?(a+=s+n,o=0,m=g,s=u.width):s=Math.max(s,u.width)}c.newline||(c.x=a,c.y=o,c.markRedraw(),e===`horizontal`?a=p+n:o=m+n)})}var eI=$F;YS($F,`vertical`),YS($F,`horizontal`);function Tse(e,t){return{left:e.getShallow(`left`,t),top:e.getShallow(`top`,t),right:e.getShallow(`right`,t),bottom:e.getShallow(`bottom`,t),width:e.getShallow(`width`,t),height:e.getShallow(`height`,t)}}function tI(e,t,n){n=GF(n||0);var r=t.width,i=t.height,a=tk(e.left,r),o=tk(e.top,i),s=tk(e.right,r),c=tk(e.bottom,i),l=tk(e.width,r),u=tk(e.height,i),d=n[2]+n[0],f=n[1]+n[3],p=e.aspect;switch(isNaN(l)&&(l=r-s-f-a),isNaN(u)&&(u=i-c-d-o),p!=null&&(isNaN(l)&&isNaN(u)&&(p>r/i?l=r*.8:u=i*.8),isNaN(l)&&(l=p*u),isNaN(u)&&(u=l/p)),isNaN(a)&&(a=r-s-l-f),isNaN(o)&&(o=i-c-u-d),e.left||e.right){case`center`:a=r/2-l/2-n[3];break;case`right`:a=r-l-f}switch(e.top||e.bottom){case`middle`:case`center`:o=i/2-u/2-n[0];break;case`bottom`:o=i-u-d}a||=0,o||=0,isNaN(l)&&(l=r-f-a-(s||0)),isNaN(u)&&(u=i-d-o-(c||0));var m=new Aw((t.x||0)+a+n[3],(t.y||0)+o+n[0],l,u);return m.margin=n,m}var nI={rect:1,point:2};function rI(e,t,n){var r,i,a,o=e.boxCoordinateSystem,s;if(o){var c=TP(e),l=c.coord,u=c.from;if(o.dataToLayout){a=nI.rect,s=u;var d=o.dataToLayout(l);r=d.contentRect||d.rect}else n&&n.enableLayoutOnlyByCenter&&o.dataToPoint&&(a=nI.point,s=u,i=o.dataToPoint(l))}return a??=nI.rect,a===nI.rect&&(r||={x:0,y:0,width:t.getWidth(),height:t.getHeight()},i=[r.x+r.width/2,r.y+r.height/2]),{type:a,refContainer:r,refPoint:i,boxCoordFrom:s}}function Ese(e,t,n,r,i,a){var o=!i||!i.hv||i.hv[0],s=!i||!i.hv||i.hv[1],c=i&&i.boundingMode||`all`;if(a||=e,a.x=e.x,a.y=e.y,!o&&!s)return!1;var l;if(c===`raw`)l=e.type===`group`?new Aw(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(l=e.getBoundingRect(),e.needLocalTransform()){var u=e.getLocalTransform();l=l.clone(),l.applyTransform(u)}var d=tI(zS({width:l.width,height:l.height},t),n,r),f=o?d.x-l.x:0,p=s?d.y-l.y:0;return c===`raw`?(a.x=f,a.y=p):(a.x+=f,a.y+=p),a===e&&e.markRedraw(),!0}function iI(e){var t=e.layoutMode||e.constructor.layoutMode;return eC(t)?t:t?{type:t}:null}function aI(e,t,n){var r=n&&n.ignoreSize;!X(r)&&(r=[r,r]);var i=o(QF[0],0),a=o(QF[1],1);c(QF[0],e,i),c(QF[1],e,a);function o(n,i){var a={},o=0,c={},l=0,u=2;if(ZF(n,function(t){c[t]=e[t]}),ZF(n,function(e){Z(t,e)&&(a[e]=c[e]=t[e]),s(a,e)&&o++,s(c,e)&&l++}),r[i])return s(t,n[1])?c[n[2]]=null:s(t,n[2])&&(c[n[1]]=null),c;if(l===u||!o)return c;if(o>=u)return a;for(var d=0;d=0;o--)a=RS(a,n[o],!0);t.defaultOption=a}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+`Index`,r=e+`Id`;return Vk(this.ecModel,e,{index:this.get(n,!0),id:this.get(r,!0)},t)},t.prototype.getBoxLayoutParams=function(){return Tse(this,!1)},t.prototype.getZLevelKey=function(){return``},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type=`component`,e.id=``,e.name=``,e.mainType=``,e.subType=``,e.componentIndex=0}(),t}(dN);NC(sI,dN),RC(sI),yse(sI),jP(sI,kse);function kse(e){var t=[];return Y(sI.getClassesByMainType(e),function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])}),t=US(t,function(e){return OC(e).main}),e!==`dataset`&&BS(t,`dataset`)<=0&&t.unshift(`dataset`),t}var cI=Lk(),Ase=Lk(),lI=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var r=Dk(this.get(`color`,!0)),i=this.get(`colorLayer`,!0);return dI(this,cI,r,i,e,t,n)},e.prototype.clearColorPalette=function(){Mse(this,cI)},e}();function uI(e,t,n,r){return dI(e,Ase,Dk(e.get([`aria`,`decal`,`decals`])),null,t,n,r)}function jse(e,t){for(var n=e.length,r=0;rt)return e[r];return e[n-1]}function dI(e,t,n,r,i,a,o){a||=e;var s=t(a),c=s.paletteIdx||0,l=s.paletteNameMap=s.paletteNameMap||{};if(l.hasOwnProperty(i))return l[i];var u=o==null||!r?n:jse(r,o);if(u||=n,u&&u.length){var d=u[c];return i&&(l[i]=d),s.paletteIdx=(c+1)%u.length,d}}function Mse(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var Nse=/\{@(.+?)\}/g,fI=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),r=this.getRawValue(e,t),i=n.getRawIndex(e),a=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,`style`),c=s&&s[n.getItemVisual(e,`drawType`)||`fill`],l=s&&s.stroke,u=this.mainType,d=u===`series`,f=n.userOutput&&n.userOutput.get();return{componentType:u,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:a,dataIndex:i,data:o,dataType:t,value:r,color:c,borderColor:l,dimensionNames:f?f.fullDimensions:null,encode:f?f.encode:null,$vars:[`seriesName`,`name`,`value`]}},e.prototype.getFormattedLabel=function(e,t,n,r,i,a){t||=`normal`;var o=this.getData(n),s=this.getDataParams(e,n);if(a&&(s.value=a.interpolatedValue),r!=null&&X(s.value)&&(s.value=s.value[r]),i||=o.getItemModel(e).get(t===`normal`?[`label`,`formatter`]:[t,`label`,`formatter`]),XS(i))return s.status=t,s.dimensionIndex=r,i(s);if(ZS(i))return YF(i,s).replace(Nse,function(t,n){var r=n.length,i=n;i.charAt(0)===`[`&&i.charAt(r-1)===`]`&&(i=+i.slice(1,r-1));var s=KN(o,e,i);if(a&&X(a.interpolatedValue)){var c=o.getDimensionIndex(i);c>=0&&(s=a.interpolatedValue[c])}return s==null?``:s+``})},e.prototype.getRawValue=function(e,t){return KN(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function pI(e){var t,n;return eC(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function mI(e){return new Pse(e)}var Pse=function(){function e(e){e||={},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t=this._upstream,n=e&&e.skip;if(this._dirty&&t){var r=this.context;r.data=r.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var a=l(this._modBy),o=this._modDataCount||0,s=l(e&&e.modBy),c=e&&e.modDataCount||0;(a!==s||o!==c)&&(i=`reset`);function l(e){return!(e>=1)&&(e=1),e}var u;(this._dirty||i===`reset`)&&(this._dirty=!1,u=this._doReset(n)),this._modBy=s,this._modDataCount=c;var d=e&&e.step;if(this._dueEnd=t?t._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var f=this._dueIndex,p=Math.min(d==null?1/0:this._dueIndex+d,this._dueEnd);if(!n&&(u||f1&&r>0?s:o}};return a;function o(){return t=e?null:a9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+`_`+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),n=!!t.length,r,i;if(vI(e)){var a=e,o=void 0,s=void 0,c=void 0;if(n){var l=t[0];l.prepareSource(),c=l.getSource(),o=c.data,s=c.sourceFormat,i=[l._getVersionSign()]}else o=a.get(`data`,!0),s=nC(o)?uA:oA,i=[];var u=this._getSourceMetaRawOption()||{},d=c&&c.metaRawOption||{},f=sC(u.seriesLayoutBy,d.seriesLayoutBy)||null,p=sC(u.sourceHeader,d.sourceHeader),m=sC(u.dimensions,d.dimensions);r=f!==d.seriesLayoutBy||!!p!=!!d.sourceHeader||m?[SN(o,{seriesLayoutBy:f,sourceHeader:p,dimensions:m},s)]:[]}else{var h=e;if(n){var g=this._applyTransform(t);r=g.sourceList,i=g.upstreamSignList}else r=[SN(h.get(`source`,!0),this._getSourceMetaRawOption(),null)],i=[]}this._setLocalSource(r,i)},e.prototype._applyTransform=function(e){var t=this._sourceHost,n=t.get(`transform`,!0),r=t.get(`fromTransformResult`,!0);r!=null&&e.length!==1&&yI(``);var i,a=[],o=[];return Y(e,function(e){e.prepareSource();var t=e.getSource(r||0);r!=null&&!t&&yI(``),a.push(t),o.push(e._getVersionSign())}),n?i=Hse(n,a,{datasetIndex:t.componentIndex}):r!=null&&(i=[wN(a[0])]),{sourceList:i,upstreamSignList:o}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;tn:i+u+m>n)?u?(s||c)&&(h?(s||(s=c,c=``,l=0,u=l),a.push(s),o.push(u-l),c+=p,l+=m,s=``,u=l):(c&&(s+=c,c=``,l=0),a.push(s),o.push(u),s=p,u=m)):h?(a.push(c),o.push(l),c=p,l=m):(a.push(p),o.push(m)):(u+=m,h?(c+=p,l+=m):(c&&(s+=c,c=``,l=0),s+=p))}}return c&&(s+=c),s&&(a.push(s),o.push(u)),a.length===1&&(u+=i),{accumWidth:u,lines:a,linesWidths:o}}function rT(e,t,n,r,i,a){if(e.baseX=n,e.baseY=r,e.outerWidth=e.outerHeight=null,t){var o=t.width*2,s=t.height*2;Aw.set(iT,Kw(n,o,i),qw(r,s,a),o,s),Aw.intersect(t,iT,null,aT);var c=aT.outIntersectRect;e.outerWidth=c.width,e.outerHeight=c.height,e.baseX=Kw(c.x,c.width,i,!0),e.baseY=qw(c.y,c.height,a,!0)}}var iT=new Aw(0,0,0,0),aT={outIntersectRect:{},clamp:!0};function oT(e){return e==null?e=``:e+=``}function aie(e){var t=oT(e.text),n=e.font;return sT(e,Uw(Rw(n),t),Jw(n),null)}function sT(e,t,n,r){var i=new Aw(Kw(e.x||0,t,e.textAlign),qw(e.y||0,n,e.textBaseline),t,n),a=r??(cT(e)?e.lineWidth:0);return a>0&&(i.x-=a/2,i.y-=a/2,i.width+=a,i.height+=a),i}function cT(e){var t=e.stroke;return t!=null&&t!==`none`&&e.lineWidth>0}var lT=$C,uT=5e-5;function dT(e){return e>uT||e<-uT}var fT=[],pT=[],mT=QC(),hT=Math.abs,gT=function(){function e(){}return e.prototype.getLocalTransform=function(e){return _T(this,e)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return dT(this.rotation)||dT(this.x)||dT(this.y)||dT(this.scaleX-1)||dT(this.scaleY-1)||dT(this.skewX)||dT(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;t||e?(n||=QC(),t?this.getLocalTransform(n):lT(n),e&&(t?tw(n,e,n):ew(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||QC(),iw(this.invTransform,n)):n&&(lT(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(t!=null&&t!==1){this.getGlobalScale(fT);var n=fT[0]<0?-1:1,r=fT[1]<0?-1:1,i=((fT[0]-n)*t+n)/fT[0]||0,a=((fT[1]-r)*t+r)/fT[1]||0;e[0]*=i,e[1]*=i,e[2]*=a,e[3]*=a}},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],r=Math.atan2(e[1],e[0]),i=Math.PI/2+r-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),t=Math.sqrt(t),this.skewX=i,this.skewY=0,this.rotation=-r,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||QC(),tw(pT,e.invTransform,t),t=pT);var n=this.originX,r=this.originY;(n||r)&&(mT[4]=n,mT[5]=r,tw(pT,t,mT),pT[4]-=n,pT[5]-=r,t=pT),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e||=[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],r=this.invTransform;return r&&mw(n,n,r),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],r=this.transform;return r&&mw(n,n,r),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&hT(e[0]-1)>1e-10&&hT(e[3]-1)>1e-10?Math.sqrt(hT(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){bT(this,e)},e.getLocalTransform=function(e,t){t||=[];var n=e.originX||0,r=e.originY||0,i=e.scaleX,a=e.scaleY,o=e.anchorX,s=e.anchorY,c=e.rotation||0,l=e.x,u=e.y,d=e.skewX?Math.tan(e.skewX):0,f=e.skewY?Math.tan(-e.skewY):0;if(n||r||o||s){var p=n+o,m=r+s;t[4]=-p*i-d*m*a,t[5]=-m*a-f*p*i}else t[4]=t[5]=0;return t[0]=i,t[3]=a,t[1]=f*i,t[2]=d*a,c&&rw(t,t,c),t[4]+=n+l,t[5]+=r+u,t},e.initDefaultProps=(function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0})(),e}(),_T=gT.getLocalTransform;function vT(){return new gT}var yT=[`x`,`y`,`originX`,`originY`,`anchorX`,`anchorY`,`rotation`,`scaleX`,`scaleY`,`skewX`,`skewY`];function bT(e,t){return Are(e,t,yT)}var xT={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:1024**(e-1)},exponentialOut:function(e){return e===1?1:1-2**(-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)))},elasticOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*2**(-10*e)*Math.sin((e-t)*(2*Math.PI)/r)+1)},elasticInOut:function(e){var t,n=.1,r=.4;return e===0?0:e===1?1:(!n||n<1?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-.5*(n*2**(10*--e)*Math.sin((e-t)*(2*Math.PI)/r)):n*2**(-10*--e)*Math.sin((e-t)*(2*Math.PI)/r)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-xT.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?xT.bounceIn(e*2)*.5:xT.bounceOut(e*2-1)*.5+.5}},ST=Math.pow,CT=Math.sqrt,wT=1e-8,TT=1e-4,ET=CT(3),DT=1/3,OT=aw(),kT=aw(),AT=aw();function jT(e){return e>-wT&&ewT||e<-wT}function NT(e,t,n,r,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*r+3*a*n)}function PT(e,t,n,r,i){var a=1-i;return 3*(((t-e)*a+2*(n-t)*i)*a+(r-n)*i*i)}function FT(e,t,n,r,i,a){var o=r+3*(t-n)-e,s=3*(n-t*2+e),c=3*(t-e),l=e-i,u=s*s-3*o*c,d=s*c-9*o*l,f=c*c-3*s*l,p=0;if(jT(u)&&jT(d)){if(jT(s))a[0]=0;else{var m=-c/s;m>=0&&m<=1&&(a[p++]=m)}}else{var h=d*d-4*u*f;if(jT(h)){var g=d/u,m=-s/o+g,_=-g/2;m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_)}else if(h>0){var v=CT(h),y=u*s+1.5*o*(-d+v),b=u*s+1.5*o*(-d-v);y=y<0?-ST(-y,DT):ST(y,DT),b=b<0?-ST(-b,DT):ST(b,DT);var m=(-s-(y+b))/(3*o);m>=0&&m<=1&&(a[p++]=m)}else{var x=(2*u*s-3*o*d)/(2*CT(u*u*u)),S=Math.acos(x)/3,C=CT(u),w=Math.cos(S),m=(-s-2*C*w)/(3*o),_=(-s+C*(w+ET*Math.sin(S)))/(3*o),T=(-s+C*(w-ET*Math.sin(S)))/(3*o);m>=0&&m<=1&&(a[p++]=m),_>=0&&_<=1&&(a[p++]=_),T>=0&&T<=1&&(a[p++]=T)}}return p}function IT(e,t,n,r,i){var a=6*n-12*t+6*e,o=9*t+3*r-3*e-9*n,s=3*t-3*e,c=0;if(jT(o)){if(MT(a)){var l=-s/a;l>=0&&l<=1&&(i[c++]=l)}}else{var u=a*a-4*o*s;if(jT(u))i[0]=-a/(2*o);else if(u>0){var d=CT(u),l=(-a+d)/(2*o),f=(-a-d)/(2*o);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function LT(e,t,n,r,i,a){var o=(t-e)*i+e,s=(n-t)*i+t,c=(r-n)*i+n,l=(s-o)*i+o,u=(c-s)*i+s,d=(u-l)*i+l;a[0]=e,a[1]=o,a[2]=l,a[3]=d,a[4]=d,a[5]=u,a[6]=c,a[7]=r}function oie(e,t,n,r,i,a,o,s,c,l,u){var d,f=.005,p=1/0,m,h,g,_;OT[0]=c,OT[1]=l;for(var v=0;v<1;v+=.05)kT[0]=NT(e,n,i,o,v),kT[1]=NT(t,r,a,s,v),g=pw(OT,kT),g=0&&g=0&&l<=1&&(i[c++]=l)}}else{var u=o*o-4*a*s;if(jT(u)){var l=-o/(2*a);l>=0&&l<=1&&(i[c++]=l)}else if(u>0){var d=CT(u),l=(-o+d)/(2*a),f=(-o-d)/(2*a);l>=0&&l<=1&&(i[c++]=l),f>=0&&f<=1&&(i[c++]=f)}}return c}function BT(e,t,n){var r=e+n-2*t;return r===0?.5:(e-t)/r}function VT(e,t,n,r,i){var a=(t-e)*r+e,o=(n-t)*r+t,s=(o-a)*r+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=n}function lie(e,t,n,r,i,a,o,s,c){var l,u=.005,d=1/0;OT[0]=o,OT[1]=s;for(var f=0;f<1;f+=.05){kT[0]=RT(e,n,i,f),kT[1]=RT(t,r,a,f);var p=pw(OT,kT);p=0&&p=1?1:FT(0,r,a,1,e,s)&&NT(0,i,o,1,s[0])}}}var fie=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||bC,this.ondestroy=e.ondestroy||bC,this.onrestart=e.onrestart||bC,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||=(this._startTime=e+this._delay,!0),this._paused)this._pausedTime+=t;else{var n=this._life,r=e-this._startTime-this._pausedTime,i=r/n;i<0&&(i=0),i=Math.min(i,1);var a=this.easingFunc,o=a?a(i):i;if(this.onframe(o),i===1){if(this.loop){var s=r%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}else return!0}return!1}},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=XS(e)?e:xT[e]||HT(e)},e}(),UT={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function WT(e){return e=Math.round(e),e<0?0:e>255?255:e}function pie(e){return e=Math.round(e),e<0?0:e>360?360:e}function GT(e){return e<0?0:e>1?1:e}function KT(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?WT(parseFloat(t)/100*255):WT(parseInt(t,10))}function qT(e){var t=e;return t.length&&t.charAt(t.length-1)===`%`?GT(parseFloat(t)/100):GT(parseFloat(t))}function JT(e,t,n){return n<0?n+=1:n>1&&--n,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function YT(e,t,n){return e+(t-e)*n}function XT(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function ZT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var QT=new KC(20),$T=null;function eE(e,t){$T&&ZT($T,t),$T=QT.put(e,$T||t.slice())}function tE(e,t){if(e){t||=[];var n=QT.get(e);if(n)return ZT(t,n);e+=``;var r=e.replace(/ /g,``).toLowerCase();if(r in UT)return ZT(t,UT[r]),eE(e,t),t;var i=r.length;if(r.charAt(0)===`#`){if(i===4||i===5){var a=parseInt(r.slice(1,4),16);if(!(a>=0&&a<=4095)){XT(t,0,0,0,1);return}return XT(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(r.slice(4),16)/15:1),eE(e,t),t}if(i===7||i===9){var a=parseInt(r.slice(1,7),16);if(!(a>=0&&a<=16777215)){XT(t,0,0,0,1);return}return XT(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(r.slice(7),16)/255:1),eE(e,t),t}}else{var o=r.indexOf(`(`),s=r.indexOf(`)`);if(o!==-1&&s+1===i){var c=r.substr(0,o),l=r.substr(o+1,s-(o+1)).split(`,`),u=1;switch(c){case`rgba`:if(l.length!==4)return l.length===3?XT(t,+l[0],+l[1],+l[2],1):XT(t,0,0,0,1);u=qT(l.pop());case`rgb`:if(l.length>=3)return XT(t,KT(l[0]),KT(l[1]),KT(l[2]),l.length===3?u:qT(l[3])),eE(e,t),t;XT(t,0,0,0,1);return;case`hsla`:if(l.length!==4){XT(t,0,0,0,1);return}return l[3]=qT(l[3]),nE(l,t),eE(e,t),t;case`hsl`:if(l.length!==3){XT(t,0,0,0,1);return}return nE(l,t),eE(e,t),t;default:return}}XT(t,0,0,0,1)}}}function nE(e,t){var n=(parseFloat(e[0])%360+360)%360/360,r=qT(e[1]),i=qT(e[2]),a=i<=.5?i*(r+1):i+r-i*r,o=i*2-a;return t||=[],XT(t,WT(JT(o,a,n+1/3)*255),WT(JT(o,a,n)*255),WT(JT(o,a,n-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function rE(e){if(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=(a+i)/2,c,l;if(o===0)c=0,l=0;else{l=s<.5?o/(a+i):o/(2-a-i);var u=((a-t)/6+o/2)/o,d=((a-n)/6+o/2)/o,f=((a-r)/6+o/2)/o;t===a?c=f-d:n===a?c=1/3+u-f:r===a&&(c=2/3+d-u),c<0&&(c+=1),c>1&&--c}var p=[c*360,l,s];return e[3]!=null&&p.push(e[3]),p}}function iE(e,t){var n=tE(e);if(n){for(var r=0;r<3;r++)t<0?n[r]=n[r]*(1-t)|0:n[r]=(255-n[r])*t+n[r]|0,n[r]>255?n[r]=255:n[r]<0&&(n[r]=0);return lE(n,n.length===4?`rgba`:`rgb`)}}function aE(e,t,n){if(t&&t.length&&e>=0&&e<=1){n||=[];var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=t[i],s=t[a],c=r-i;return n[0]=WT(YT(o[0],s[0],c)),n[1]=WT(YT(o[1],s[1],c)),n[2]=WT(YT(o[2],s[2],c)),n[3]=GT(YT(o[3],s[3],c)),n}}function oE(e,t,n){if(t&&t.length&&e>=0&&e<=1){var r=e*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=tE(t[i]),s=tE(t[a]),c=r-i,l=lE([WT(YT(o[0],s[0],c)),WT(YT(o[1],s[1],c)),WT(YT(o[2],s[2],c)),GT(YT(o[3],s[3],c))],`rgba`);return n?{color:l,leftIndex:i,rightIndex:a,value:r}:l}}function sE(e,t,n,r){var i=tE(e);if(e)return i=rE(i),t!=null&&(i[0]=pie(XS(t)?t(i[0]):t)),n!=null&&(i[1]=qT(XS(n)?n(i[1]):n)),r!=null&&(i[2]=qT(XS(r)?r(i[2]):r)),lE(nE(i),`rgba`)}function cE(e,t){var n=tE(e);if(n&&t!=null)return n[3]=GT(t),lE(n,`rgba`)}function lE(e,t){if(e&&e.length){var n=e[0]+`,`+e[1]+`,`+e[2];return(t===`rgba`||t===`hsva`||t===`hsla`)&&(n+=`,`+e[3]),t+`(`+n+`)`}}function uE(e,t){var n=tE(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var dE=new KC(100);function fE(e){if(ZS(e)){var t=dE.get(e);return t||(t=iE(e,-.1),dE.put(e,t)),t}if(iC(e)){var n=J({},e);return n.colorStops=US(e.colorStops,function(e){return{offset:e.offset,color:iE(e.color,-.1)}}),n}return e}var pE=Math.round;function mE(e){var t;if(!e||e===`transparent`)e=`none`;else if(typeof e==`string`&&e.indexOf(`rgba`)>-1){var n=tE(e);n&&(e=`rgb(`+n[0]+`,`+n[1]+`,`+n[2]+`)`,t=n[3])}return{color:e,opacity:t??1}}var hE=1e-4;function gE(e){return e-hE}function _E(e){return pE(e*1e3)/1e3}function vE(e){return pE(e*1e4)/1e4}function yE(e){return`matrix(`+_E(e[0])+`,`+_E(e[1])+`,`+_E(e[2])+`,`+_E(e[3])+`,`+vE(e[4])+`,`+vE(e[5])+`)`}var bE={left:`start`,right:`end`,center:`middle`,middle:`middle`};function xE(e,t,n){return n===`top`?e+=t/2:n===`bottom`&&(e-=t/2),e}function SE(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function CE(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(`,`)}function wE(e){return e&&!!e.image}function TE(e){return e&&!!e.svgElement}function EE(e){return wE(e)||TE(e)}function DE(e){return e.type===`linear`}function OE(e){return e.type===`radial`}function kE(e){return e&&(e.type===`linear`||e.type===`radial`)}function AE(e){return`url(#`+e+`)`}function jE(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function ME(e){var t=e.x||0,n=e.y||0,r=(e.rotation||0)*xC,i=sC(e.scaleX,1),a=sC(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,c=[];return(t||n)&&c.push(`translate(`+t+`px,`+n+`px)`),r&&c.push(`rotate(`+r+`)`),(i!==1||a!==1)&&c.push(`scale(`+i+`,`+a+`)`),(o||s)&&c.push(`skew(`+pE(o*xC)+`deg, `+pE(s*xC)+`deg)`),c.join(` `)}var NE=(function(){return typeof Buffer<`u`&&typeof Buffer.from==`function`?function(e){return Buffer.from(e).toString(`base64`)}:typeof btoa==`function`&&typeof unescape==`function`&&typeof encodeURIComponent==`function`?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}})(),PE=Array.prototype.slice;function FE(e,t,n){return(t-e)*n+e}function IE(e,t,n,r){for(var i=t.length,a=0;ar?t:e,a=Math.min(n,r),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so)r.length=o;else for(var s=a;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var r=this.keyframes,i=r.length,a=!1,o=ZE,s=t;if(HS(t)){var c=WE(t);o=c,(c===1&&!$S(t[0])||c===2&&!$S(t[0][0]))&&(a=!0)}else if($S(t)&&!aC(t))o=GE;else if(ZS(t)){if(!isNaN(+t))o=GE;else{var l=tE(t);l&&(s=l,o=JE)}}else if(iC(t)){var u=J({},s);u.colorStops=US(t.colorStops,function(e){return{offset:e.offset,color:tE(e.color)}}),DE(t)?o=YE:OE(t)&&(o=XE),s=u}i===0?this.valType=o:(o!==this.valType||o===ZE)&&(a=!0),this.discrete=this.discrete||a;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=XS(n)?n:xT[n]||HT(n)),r.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var r=this.valType,i=n.length,a=n[i-1],o=this.discrete,s=$E(r),c=QE(r),l=0;l=0&&!(a[l].percent<=t);l--);l=d(l,o-2)}else{for(l=u;lt);l++);l=d(l-1,o-2)}p=a[l+1],f=a[l]}if(f&&p){this._lastFr=l,this._lastFrP=t;var m=p.percent-f.percent,h=m===0?1:d((t-f.percent)/m,1);p.easingFunc&&(h=p.easingFunc(h));var g=n?this._additiveValue:c?eD:e[s];if(($E(i)||c)&&!g&&(g=this._additiveValue=[]),this.discrete)e[s]=h<1?f.rawValue:p.rawValue;else if($E(i))i===KE?IE(g,f[r],p[r],h):LE(g,f[r],p[r],h);else if(QE(i)){var _=f[r],v=p[r],y=i===YE;e[s]={type:y?`linear`:`radial`,x:FE(_.x,v.x,h),y:FE(_.y,v.y,h),colorStops:US(_.colorStops,function(e,t){var n=v.colorStops[t];return{offset:FE(e.offset,n.offset,h),color:UE(IE([],e.color,n.color,h))}}),global:v.global},y?(e[s].x2=FE(_.x2,v.x2,h),e[s].y2=FE(_.y2,v.y2,h)):e[s].r=FE(_.r,v.r,h)}else if(c)IE(g,f[r],p[r],h),n||(e[s]=UE(g));else{var b=FE(f[r],p[r],h);n?this._additiveValue=b:e[s]=b}n&&this._addToTarget(e)}}},e.prototype._addToTarget=function(e){var t=this.valType,n=this.propName,r=this._additiveValue;t===GE?e[n]=e[n]+r:t===JE?(tE(e[n],eD),RE(eD,eD,r,1),e[n]=UE(eD)):t===KE?RE(e[n],e[n],r,1):t===qE&&zE(e[n],e[n],r,1)},e}(),nD=function(){function e(e,t,n,r){this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r?IS(`Can' use additive animation on looped animation.`):(this._additiveAnimators=r,this._allowDiscrete=n)}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(e){this._target=e},e.prototype.when=function(e,t,n){return this.whenWithKeys(e,t,qS(t),n)},e.prototype.whenWithKeys=function(e,t,n,r){for(var i=this._tracks,a=0;a0&&s.addKeyframe(0,HE(c),r),this._trackKeys.push(o)}s.addKeyframe(e,HE(t[o]),r)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],r=this._maxTime||0,i=0;i1){var o=a.pop();i.addKeyframe(o.time,e[r]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}(),rD=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,r){this._$handlers||={};var i=this._$handlers;if(typeof t==`function`&&(r=n,n=t,t=null),!n||!e)return this;var a=this._$eventProcessor;t!=null&&a&&a.normalizeQuery&&(t=a.normalizeQuery(t)),i[e]||(i[e]=[]);for(var o=0;o=0:n.inside,y=void 0,b=void 0,x=void 0;v&&this.canBeInsideText()?(y=n.insideFill,b=n.insideStroke,(y==null||y===`auto`)&&(y=this.getInsideTextFill()),(b==null||b===`auto`)&&(b=this.getInsideTextStroke(y),x=!0)):(y=n.outsideFill,b=n.outsideStroke,(y==null||y===`auto`)&&(y=this.getOutsideFill()),(b==null||b===`auto`)&&(b=this.getOutsideStroke(y),x=!0)),y||=`#000`,(y!==g.fill||b!==g.stroke||x!==g.autoStroke||a!==g.align||o!==g.verticalAlign)&&(s=!0,g.fill=y,g.stroke=b,g.autoStroke=x,g.align=a,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return`#fff`},e.prototype.getInsideTextStroke=function(e){return`#000`},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?cD:sD},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n=typeof t==`string`&&tE(t);n||=[255,255,255,1];for(var r=n[3],i=this.__zr.isDarkMode(),a=0;a<3;a++)n[a]=n[a]*r+(i?0:255)*(1-r);return n[3]=1,lE(n,`rgba`)},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){e===`textConfig`?this.setTextConfig(t):e===`textContent`?this.setTextContent(t):e===`clipPath`?this.setClipPath(t):e===`extra`?(this.extra=this.extra||{},J(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if(typeof e==`string`)this.attrKV(e,t);else if(eC(e))for(var n=qS(e),r=0;r0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(uD,!1,e)},e.prototype.useState=function(e,t,n,r){var i=e===uD;if(this.hasState()||!i){var a=this.currentStates,o=this.stateTransition;if(!(BS(a,e)>=0&&(t||a.length===1))){var s;if(this.stateProxy&&!i&&(s=this.stateProxy(e)),s||=this.states&&this.states[e],!s&&!i)IS(`State `+e+` not exists.`);else{i||this.saveCurrentToNormalState(s);var c=this._textContent,l=wD(this,c,s,r);l&&!this.__inHover&&(this.__inHover=l),this._applyStateObj(e,s,this._normalState,t,ED(this,n,o),o);var u=this._textGuide;return c&&c.useState(e,t,n,!!l),u&&u.useState(e,t,n,!!l),i?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this.__inHover=0,this.__dirty&=-2),s}}}},e.prototype.useStates=function(e,t,n){if(!e.length)this.clearStates();else{var r=[],i=this.currentStates,a=e.length,o=a===i.length;if(o){for(var s=0;s=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var r=this.currentStates.slice(),i=BS(r,e),a=BS(r,t)>=0;i>=0?a?r.splice(i,1):r[i]=t:n&&!a&&r.push(t),this.useStates(r)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t={},n,r=0;r=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,r=n.length,i=[],a=0;a0&&n.during&&a[0].during(function(e,t){n.during(t)});for(var f=0;f0||i.force&&!o.length){var C=void 0,w=void 0,T=void 0;if(s){w={},f&&(C={});for(var b=0;b0}var DD=`__zr_style_`+Math.round(Math.random()*10),OD={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:`#000`,opacity:1,blend:`source-over`},kD={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};OD[DD]=!0;var AD=[`z`,`z2`,`invisible`],mie=[`invisible`],jD=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype._init=function(t){for(var n=qS(t),r=0;r1e-4)s[0]=e-n,s[1]=t-r,c[0]=e+n,c[1]=t+r;else{if(zD[0]=LD(i)*n+e,zD[1]=ID(i)*r+t,BD[0]=LD(a)*n+e,BD[1]=ID(a)*r+t,l(s,zD,BD),u(c,zD,BD),i%=RD,i<0&&(i+=RD),a%=RD,a<0&&(a+=RD),i>a&&!o?a+=RD:ii&&(VD[0]=LD(p)*n+e,VD[1]=ID(p)*r+t,l(s,VD,s),u(c,VD,c))}}var GD={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},KD=[],qD=[],JD=[],YD=[],XD=[],ZD=[],QD=Math.min,$D=Math.max,eO=Math.cos,tO=Math.sin,nO=Math.abs,rO=Math.PI,iO=rO*2,aO=typeof Float32Array<`u`,oO=[];function sO(e){return Math.round(e/rO*1e8)/1e8%2*rO}function yie(e,t){var n=sO(e[0]);n<0&&(n+=iO);var r=n-e[0],i=e[1];i+=r,!t&&i-n>=iO?i=n+iO:t&&n-i>=iO?i=n-iO:!t&&n>i?i=n+(iO-sO(n-i)):t&&n0&&(this._ux=nO(n/aD/e)||0,this._uy=nO(n/aD/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(GD.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=nO(e-this._xi),r=nO(t-this._yi),i=n>this._ux||r>this._uy;if(this.addData(GD.L,e,t),this._ctx&&i&&this._ctx.lineTo(e,t),i)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var a=n*n+r*r;a>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=a)}return this},e.prototype.bezierCurveTo=function(e,t,n,r,i,a){return this._drawPendingPt(),this.addData(GD.C,e,t,n,r,i,a),this._ctx&&this._ctx.bezierCurveTo(e,t,n,r,i,a),this._xi=i,this._yi=a,this},e.prototype.quadraticCurveTo=function(e,t,n,r){return this._drawPendingPt(),this.addData(GD.Q,e,t,n,r),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,r),this._xi=n,this._yi=r,this},e.prototype.arc=function(e,t,n,r,i,a){this._drawPendingPt(),oO[0]=r,oO[1]=i,yie(oO,a),r=oO[0],i=oO[1];var o=i-r;return this.addData(GD.A,e,t,n,n,r,o,0,+!a),this._ctx&&this._ctx.arc(e,t,n,r,i,a),this._xi=eO(i)*n+e,this._yi=tO(i)*n+t,this},e.prototype.arcTo=function(e,t,n,r,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,r,i),this},e.prototype.rect=function(e,t,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,r),this.addData(GD.R,e,t,n,r),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(GD.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){if(this._saveData){var t=e.length;!(this.data&&this.data.length===t)&&aO&&(this.data=new Float32Array(t));for(var n=0;n0&&a))for(var o=0;ol.length&&(this._expandData(),l=this.data);for(var u=0;u0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){JD[0]=JD[1]=XD[0]=XD[1]=Number.MAX_VALUE,YD[0]=YD[1]=ZD[0]=ZD[1]=-Number.MAX_VALUE;for(var e=this.data,t=0,n=0,r=0,i=0,a=0;an||nO(v)>r||d===t-1)&&(m=Math.sqrt(_*_+v*v),i=h,a=g);break;case GD.C:var y=e[d++],b=e[d++],h=e[d++],g=e[d++],x=e[d++],S=e[d++];m=sie(i,a,y,b,h,g,x,S,10),i=x,a=S;break;case GD.Q:var y=e[d++],b=e[d++],h=e[d++],g=e[d++];m=uie(i,a,y,b,h,g,10),i=h,a=g;break;case GD.A:var C=e[d++],w=e[d++],T=e[d++],E=e[d++],D=e[d++],O=e[d++],k=O+D;d+=1,p&&(o=eO(D)*T+C,s=tO(D)*E+w),m=$D(T,E)*QD(iO,Math.abs(O)),i=eO(k)*T+C,a=tO(k)*E+w;break;case GD.R:o=i=e[d++],s=a=e[d++];var A=e[d++],j=e[d++];m=A*2+j*2;break;case GD.Z:var _=o-i,v=s-a;m=Math.sqrt(_*_+v*v),i=o,a=s}m>=0&&(c[u++]=m,l+=m)}return this._pathLen=l,l},e.prototype.rebuildPath=function(e,t){var n=this.data,r=this._ux,i=this._uy,a=this._len,o,s,c,l,u,d,f=t<1,p,m,h=0,g=0,_,v=0,y,b;if(!(f&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,_=t*m,!_)))lo:for(var x=0;x0&&(e.lineTo(y,b),v=0),S){case GD.M:o=c=n[x++],s=l=n[x++],e.moveTo(c,l);break;case GD.L:u=n[x++],d=n[x++];var w=nO(u-c),T=nO(d-l);if(w>r||T>i){if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+u*D,l*(1-D)+d*D);break lo}h+=E}e.lineTo(u,d),c=u,l=d,v=0}else{var O=w*w+T*T;O>v&&(y=u,b=d,v=O)}break;case GD.C:var k=n[x++],A=n[x++],j=n[x++],M=n[x++],N=n[x++],P=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;LT(c,k,j,N,D,KD),LT(l,A,M,P,D,qD),e.bezierCurveTo(KD[1],qD[1],KD[2],qD[2],KD[3],qD[3]);break lo}h+=E}e.bezierCurveTo(k,A,j,M,N,P),c=N,l=P;break;case GD.Q:var k=n[x++],A=n[x++],j=n[x++],M=n[x++];if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;VT(c,k,j,D,KD),VT(l,A,M,D,qD),e.quadraticCurveTo(KD[1],qD[1],KD[2],qD[2]);break lo}h+=E}e.quadraticCurveTo(k,A,j,M),c=j,l=M;break;case GD.A:var F=n[x++],ee=n[x++],I=n[x++],te=n[x++],L=n[x++],ne=n[x++],re=n[x++],ie=!n[x++],ae=I>te?I:te,oe=nO(I-te)>.001,se=L+ne,R=!1;if(f){var E=p[g++];h+E>_&&(se=L+ne*(_-h)/E,R=!0),h+=E}if(oe&&e.ellipse?e.ellipse(F,ee,I,te,re,L,se,ie):e.arc(F,ee,ae,L,se,ie),R)break lo;C&&(o=eO(L)*I+F,s=tO(L)*te+ee),c=eO(se)*I+F,l=tO(se)*te+ee;break;case GD.R:o=c=n[x],s=l=n[x+1],u=n[x++],d=n[x++];var ce=n[x++],le=n[x++];if(f){var E=p[g++];if(h+E>_){var z=_-h;e.moveTo(u,d),e.lineTo(u+QD(z,ce),d),z-=ce,z>0&&e.lineTo(u+ce,d+QD(z,le)),z-=le,z>0&&e.lineTo(u+$D(ce-z,0),d+le),z-=ce,z>0&&e.lineTo(u,d+$D(le-z,0));break lo}h+=E}e.rect(u,d,ce,le);break;case GD.Z:if(f){var E=p[g++];if(h+E>_){var D=(_-h)/E;e.lineTo(c*(1-D)+o*D,l*(1-D)+s*D);break lo}h+=E}e.closePath(),c=o,l=s}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=GD,e.initDefaultProps=(function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0})(),e}();function lO(e,t,n,r,i,a,o){if(i===0)return!1;var s=i,c=0,l=e;if(o>t+s&&o>r+s||oe+s&&a>n+s||at+d&&u>r+d&&u>a+d&&u>s+d||ue+d&&l>n+d&&l>i+d&&l>o+d||lt+l&&c>r+l&&c>a+l||ce+l&&s>n+l&&s>i+l||sn||u+li&&(i+=fO);var f=Math.atan2(c,s);return f<0&&(f+=fO),f>=r&&f<=i||f+fO>=r&&f+fO<=i}function pO(e,t,n,r,i,a){if(a>t&&a>r||ai?s:0}var mO=cO.CMD,hO=Math.PI*2,Cie=1e-4;function wie(e,t){return Math.abs(e-t)t&&l>r&&l>a&&l>s||l1&&Tie(),p=NT(t,r,a,s,_O[0]),f>1&&(m=NT(t,r,a,s,_O[1]))),f===2?g<_O[0]?d+=pt&&s>r&&s>a||s=0&&l<=1){for(var u=0,d=RT(t,r,a,l),f=0;fn||s<-n)return 0;var c=Math.sqrt(n*n-s*s);gO[0]=-c,gO[1]=c;var l=Math.abs(r-i);if(l<1e-4)return 0;if(l>=hO-1e-4){r=0,i=hO;var u=a?1:-1;return o>=gO[0]+e&&o<=gO[1]+e?u:0}if(r>i){var d=r;r=i,i=d}r<0&&(r+=hO,i+=hO);for(var f=0,p=0;p<2;p++){var m=gO[p];if(m+e>o){var h=Math.atan2(s,m),u=a?1:-1;h<0&&(h=hO+h),(h>=r&&h<=i||h+hO>=r&&h+hO<=i)&&(h>Math.PI/2&&h1&&(n||(s+=pO(c,l,u,d,r,i))),g&&(c=a[m],l=a[m+1],u=c,d=l),h){case mO.M:u=a[m++],d=a[m++],c=u,l=d;break;case mO.L:if(n){if(lO(c,l,a[m],a[m+1],t,r,i))return!0}else s+=pO(c,l,a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.C:if(n){if(bie(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=Eie(c,l,a[m++],a[m++],a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.Q:if(n){if(xie(c,l,a[m++],a[m++],a[m],a[m+1],t,r,i))return!0}else s+=Die(c,l,a[m++],a[m++],a[m],a[m+1],r,i)||0;c=a[m++],l=a[m++];break;case mO.A:var _=a[m++],v=a[m++],y=a[m++],b=a[m++],x=a[m++],S=a[m++];m+=1;var C=!!(1-a[m++]);f=Math.cos(x)*y+_,p=Math.sin(x)*b+v,g?(u=f,d=p):s+=pO(c,l,f,p,r,i);var w=(r-_)*b/y+_;if(n){if(Sie(_,v,b,x,x+S,C,t,w,i))return!0}else s+=Oie(_,v,b,x,x+S,C,w,i);c=Math.cos(x+S)*y+_,l=Math.sin(x+S)*b+v;break;case mO.R:u=c=a[m++],d=l=a[m++];var T=a[m++],E=a[m++];if(f=u+T,p=d+E,n){if(lO(u,d,f,d,t,r,i)||lO(f,d,f,p,t,r,i)||lO(f,p,u,p,t,r,i)||lO(u,p,u,d,t,r,i))return!0}else s+=pO(f,d,f,p,r,i),s+=pO(u,p,u,d,r,i);break;case mO.Z:if(n){if(lO(c,l,u,d,t,r,i))return!0}else s+=pO(c,l,u,d,r,i);c=u,l=d}}return!n&&!wie(l,d)&&(s+=pO(c,l,u,d,r,i)||0),s!==0}function kie(e,t,n){return vO(e,0,!1,t,n)}function Aie(e,t,n,r){return vO(e,t,!0,n,r)}var yO=zS({fill:`#000`,stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:`butt`,miterLimit:10,strokeNoScale:!1,strokeFirst:!1},OD),jie={style:zS({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},kD.style)},bO=yT.concat([`invisible`,`culling`,`z`,`z2`,`zlevel`,`parent`]),xO=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.update=function(){var n=this;e.prototype.update.call(this);var r=this.style;if(r.decal){var i=this._decalEl=this._decalEl||new t;i.buildPath===t.prototype.buildPath&&(i.buildPath=function(e){n.buildPath(e,n.shape)}),i.silent=!0;var a=i.style;for(var o in r)a[o]!==r[o]&&(a[o]=r[o]);a.fill=r.fill?r.decal:null,a.decal=null,a.shadowColor=null,r.strokeFirst&&(a.stroke=null);for(var s=0;s.5?sD:t>.2?lD:cD}if(e)return cD}return sD},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(ZS(t)){var n=this.__zr;if(!!(n&&n.isDarkMode())==uE(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new cO(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return e!=null&&e!==`none`},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var r=!1;this.path||(r=!0,this.createPathProxy());var i=this.path;(r||this.__dirty&4)&&(i.beginPath(),this.buildPath(i,this.shape,!1),this.pathUpdated()),e=i.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var a=this._rectStroke||=e.clone();if(this.__dirty||n){a.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;s=Math.max(s,c??4)}o>1e-10&&(a.width+=s/o,a.height+=s/o,a.x-=s/o/2,a.y-=s/o/2)}return a}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect(),i=this.style;if(e=n[0],t=n[1],r.contain(e,t)){var a=this.path;if(this.hasStroke()){var o=i.lineWidth,s=i.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),Aie(a,o/s,e,t)))return!0}if(this.hasFill())return kie(a,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&=null,this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate(`shape`,e)},t.prototype.updateDuringAnimation=function(e){e===`style`?this.dirtyStyle():e===`shape`?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){t===`shape`?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||=this.shape={},typeof e==`string`?n[e]=t:J(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&4)},t.prototype.createStyle=function(e){return vC(yO,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=J({},this.shape))},t.prototype._applyStateObj=function(t,n,r,i,a,o){if(e.prototype._applyStateObj.call(this,t,n,r,i,a,o),this.__inHover!==1){var s=!(n&&i),c;if(n&&n.shape?a?i?c=n.shape:(c=J({},r.shape),J(c,n.shape)):(c=J({},i?this.shape:r.shape),J(c,n.shape)):s&&(c=r.shape),c){if(a){this.shape=J({},this.shape);for(var l={},u=qS(c),d=0;di&&(d=s+c,s*=i/d,c*=i/d),l+u>i&&(d=l+u,l*=i/d,u*=i/d),c+l>a&&(d=c+l,c*=a/d,l*=a/d),s+u>a&&(d=s+u,s*=a/d,u*=a/d),e.moveTo(n+s,r),e.lineTo(n+i-c,r),c!==0&&e.arc(n+i-c,r+c,c,-Math.PI/2,0),e.lineTo(n+i,r+a-l),l!==0&&e.arc(n+i-l,r+a-l,l,0,Math.PI/2),e.lineTo(n+u,r+a),u!==0&&e.arc(n+u,r+a-u,u,Math.PI/2,Math.PI),e.lineTo(n,r+s),s!==0&&e.arc(n+s,r+s,s,Math.PI,Math.PI*1.5),e.closePath()}var wO=Math.round;function TO(e,t,n){if(t){var r=t.x1,i=t.x2,a=t.y1,o=t.y2;e.x1=r,e.x2=i,e.y1=a,e.y2=o;var s=n&&n.lineWidth;return s&&(wO(r*2)===wO(i*2)&&(e.x1=e.x2=DO(r,s,!0)),wO(a*2)===wO(o*2)&&(e.y1=e.y2=DO(a,s,!0))),e}}function EO(e,t,n){if(t){var r=t.x,i=t.y,a=t.width,o=t.height;e.x=r,e.y=i,e.width=a,e.height=o;var s=n&&n.lineWidth;return s&&(e.x=DO(r,s,!0),e.y=DO(i,s,!0),e.width=Math.max(DO(r+a,s,!1)-e.x,a===0?0:1),e.height=Math.max(DO(i+o,s,!1)-e.y,o===0?0:1)),e}}function DO(e,t,n){if(!t)return e;var r=wO(e*2);return(r+wO(t))%2==0?r/2:(r+(n?1:-1))/2}var Lie=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Rie={},OO=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new Lie},t.prototype.buildPath=function(e,t){var n,r,i,a;if(this.subPixelOptimize){var o=EO(Rie,t,this.style);n=o.x,r=o.y,i=o.width,a=o.height,o.r=t.r,t=o}else n=t.x,r=t.y,i=t.width,a=t.height;t.r?Iie(e,t):e.rect(n,r,i,a)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(xO);OO.prototype.type=`rect`;var kO={fill:`#000`},AO=2,jO={},zie={style:zS({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},kD.style)},MO=function(e){UC(t,e);function t(t){var n=e.call(this)||this;return n.type=`text`,n._children=[],n._defaultStyle=kO,n.attr(t),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;t0,T=0;T=0&&(D=y[E],D.align===`right`);)this._placeToken(D,e,x,m,T,`right`,g),S-=D.width,T-=D.width,E--;for(w+=(s-(w-p)-(h-T)-S)/2;C<=E;)D=y[C],this._placeToken(D,e,x,m,w+D.width/2,`center`,g),w+=D.width,C++;m+=x}},t.prototype._placeToken=function(e,t,n,r,i,a,o){var s=t.rich[e.styleName]||{};s.text=e.text;var c=e.verticalAlign,l=r+n/2;c===`top`?l=r+e.height/2:c===`bottom`&&(l=r+n-e.height/2),!e.isLineHolder&&HO(s)&&this._renderBackground(s,t,a===`right`?i-e.width:a===`center`?i-e.width/2:i,l-e.height/2,e.width,e.height);var u=!!s.backgroundColor,d=e.textPadding;d&&(i=BO(i,a,d),l-=e.height/2-d[0]-e.innerHeight/2);var f=this._getOrCreateChild(SO),p=f.createStyle();f.useStyle(p);var m=this._defaultStyle,h=!1,g=0,_=!1,v=zO(`fill`in s?s.fill:`fill`in t?t.fill:(h=!0,m.fill)),y=RO(`stroke`in s?s.stroke:`stroke`in t?t.stroke:!u&&!o&&(!m.autoStroke||h)?(g=AO,_=!0,m.stroke):null),b=s.textShadowBlur>0||t.textShadowBlur>0;p.text=e.text,p.x=i,p.y=l,b&&(p.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,p.shadowColor=s.textShadowColor||t.textShadowColor||`transparent`,p.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,p.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),p.textAlign=a,p.textBaseline=`middle`,p.font=e.font||`12px sans-serif`,p.opacity=cC(s.opacity,t.opacity,1),FO(p,s),y&&(p.lineWidth=cC(s.lineWidth,t.lineWidth,g),p.lineDash=sC(s.lineDash,t.lineDash),p.lineDashOffset=t.lineDashOffset||0,p.stroke=y),v&&(p.fill=v),f.setBoundingRect(sT(p,e.contentWidth,e.contentHeight,_?0:null))},t.prototype._renderBackground=function(e,t,n,r,i,a){var o=e.backgroundColor,s=e.borderWidth,c=e.borderColor,l=o&&o.image,u=o&&!l,d=e.borderRadius,f=this,p,m;if(u||e.lineHeight||s&&c){p=this._getOrCreateChild(OO),p.useStyle(p.createStyle()),p.style.fill=null;var h=p.shape;h.x=n,h.y=r,h.width=i,h.height=a,h.r=d,p.dirtyShape()}if(u){var g=p.style;g.fill=o||null,g.fillOpacity=sC(e.fillOpacity,1)}else if(l){m=this._getOrCreateChild(CO),m.onload=function(){f.dirtyStyle()};var _=m.style;_.image=o.image,_.x=n,_.y=r,_.width=i,_.height=a}if(s&&c){var g=p.style;g.lineWidth=s,g.stroke=c,g.strokeOpacity=sC(e.strokeOpacity,1),g.lineDash=e.borderDash,g.lineDashOffset=e.borderDashOffset||0,p.strokeContainThreshold=0,p.hasFill()&&p.hasStroke()&&(g.strokeFirst=!0,g.lineWidth*=2)}var v=(p||m).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||`transparent`,v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=cC(e.opacity,t.opacity,1)},t.makeFont=function(e){var t=``;return IO(e)&&(t=[e.fontStyle,e.fontWeight,PO(e.fontSize),e.fontFamily||`sans-serif`].join(` `)),t&&fC(t)||e.textFont||e.font},t}(jD),Bie={left:!0,right:1,center:1},Vie={top:1,bottom:1,middle:1},NO=[`fontStyle`,`fontWeight`,`fontSize`,`fontFamily`];function PO(e){return typeof e==`string`&&(e.indexOf(`px`)!==-1||e.indexOf(`rem`)!==-1||e.indexOf(`em`)!==-1)?e:isNaN(+e)?`12px`:e+`px`}function FO(e,t){for(var n=0;n0){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 tk=Kie;function Kie(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 nk(e,t,n)}function nk(e,t,n){return ZS(e)?rk(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function qie(e){return ZS(e)&&rk(e)}function rk(e){return!!Uie(e).match(/%$/)}function ik(e,t,n){return isNaN(t)?n?``+e:+e:(t=GO(KO(0,t),WO),e=(+e).toFixed(t),n?e:+e)}function ak(e){return e.sort(function(e,t){return e-t}),e}function ok(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(JO(e*t)/t===e)return n}return Jie(e)}function Jie(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 KO(0,(a<0?0:i-1-a)-r)}function sk(e,t,n){var r=qO(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=QO(2*qO(n||1)*qO(r))/$O,a=QO(qO(t))/$O,o=KO(0,XO(-i+a));return isFinite(o)||(o=NaN),o}function ck(e,t){var n=KO(ok(e),ok(t)),r=e+t;return n>WO?r:ik(r,n)}var lk=ZO(2,53)-1;function uk(e){var t=Wie*2;return(e%t+t)%t}function dk(e){return e>-UO&&e=10&&t++,t}function hk(e,t){var n=mk(e),r=ZO(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,ik(e,-n)}function gk(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 Wk(){return[1/0,-1/0]}function Gk(e,t){Jk(t)&&(te[1]&&(e[1]=t))}function Kk(e,t){Jk(t)&&te[1]&&(e[1]=t)}function vae(e,t){Yk(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Jk(e){return e!=null&&isFinite(e)}function Yk(e,t){return Jk(e)&&Jk(t)&&e<=t}function yae(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function Xk(e){Yk(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function Zk(){var e=`__ec_once_`+bae++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bae=vk();function Qk(e,t,n){var r=_C(),i=0;Y(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 xae(e){return e.value+``}function Sae(e){return e+``}function $k(e,t){return sC(t,!0)?e.seriesIndex+2:0}function eA(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 tA(e,t){return{seriesType:e,overallReset:t}}function nA(e){return{overallReset:e}}var rA=Lk(),Cae=function(e,t,n,r){if(r){var i=rA(r);i.dataIndex=n,i.dataType=t,i.seriesIndex=e,i.ssrType=`chart`,r.type===`group`&&r.traverse(function(r){var i=rA(r);i.seriesIndex=e,i.dataIndex=n,i.dataType=t,i.ssrType=`chart`})}},iA=`series`,aA=_C([`tooltip`,`label`,`itemName`,`itemId`,`itemGroupId`,`itemChildGroupId`,`seriesName`]),oA=`original`,sA=`arrayRows`,cA=`objectRows`,lA=`keyedColumns`,uA=`typedArray`,wae=`unknown`,dA=`column`,fA=`Roam`,Tae=[`getDom`,`getZr`,`getWidth`,`getHeight`,`getDevicePixelRatio`,`dispatchAction`,`isSSR`,`isDisposed`,`on`,`off`,`getDataURL`,`getConnectedDataURL`,`getOption`,`getId`,`updateLabelLayout`],pA=function(){function e(e){Y(Tae,function(t){this[t]=JS(e[t],e)},this)}return e}();function mA(e,t){return t.mainType===`series`?e.getViewOfSeriesModel(t):e.getViewOfComponentModel(t)}var hA=1,gA={},_A=Lk(),vA=Lk(),yA=[`emphasis`,`blur`,`select`],bA=[`normal`,`emphasis`,`blur`,`select`],xA=`highlight`,SA=`downplay`,CA=`select`,wA=`unselect`,TA=`toggleSelect`,EA=`selectchanged`;function DA(e){return e!=null&&e!==`none`}function OA(e,t,n){e.onHoverStateChange&&(e.hoverState||0)!==n&&e.onHoverStateChange(t),e.hoverState=n}function kA(e){OA(e,`emphasis`,2)}function AA(e){e.hoverState===2&&OA(e,`normal`,0)}function jA(e){OA(e,`blur`,1)}function MA(e){e.hoverState===1&&OA(e,`normal`,0)}function Eae(e){e.selected=!0}function Dae(e){e.selected=!1}function NA(e,t,n){t(e,n)}function PA(e,t,n){NA(e,t,n),e.isGroup&&e.traverse(function(e){NA(e,t,n)})}function FA(e,t){switch(t){case`emphasis`:e.hoverState=2;break;case`normal`:e.hoverState=0;break;case`blur`:e.hoverState=1;break;case`select`:e.selected=!0}}function Oae(e,t,n,r){for(var i=e.style,a={},o=0;o=0,a=!1;if(e instanceof xO){var o=_A(e),s=i&&o.selectFill||o.normalFill,c=i&&o.selectStroke||o.normalStroke;if(DA(s)||DA(c)){r||={};var l=r.style||{};l.fill===`inherit`?(a=!0,r=J({},r),l=J({},l),l.fill=s):!DA(l.fill)&&DA(s)?(a=!0,r=J({},r),l=J({},l),l.fill=fE(s)):!DA(l.stroke)&&DA(c)&&(a||(r=J({},r),l=J({},l)),l.stroke=fE(c)),r.style=l}}if(r&&r.z2==null){a||(r=J({},r));var u=e.z2EmphasisLift;r.z2=e.z2+(u??10)}return r}function Aae(e,t,n){if(n&&n.z2==null){n=J({},n);var r=e.z2SelectLift;n.z2=e.z2+(r??9)}return n}function jae(e,t,n){var r=BS(e.currentStates,t)>=0,i=e.style.opacity,a=r?null:Oae(e,[`opacity`],t,{opacity:1});n||={};var o=n.style||{};return o.opacity??(n=J({},n),o=J({opacity:r?i:a.opacity*.1},o),n.style=o),n}function IA(e,t){var n=this.states[e];if(this.style){if(e===`emphasis`)return kae(this,e,t,n);if(e===`blur`)return jae(this,e,n);if(e===`select`)return Aae(this,e,n)}return n}function LA(e){e.stateProxy=IA;var t=e.getTextContent(),n=e.getTextGuideLine();t&&(t.stateProxy=IA),n&&(n.stateProxy=IA)}function RA(e,t){!KA(e,t)&&!e.__highByOuter&&PA(e,kA)}function zA(e,t){!KA(e,t)&&!e.__highByOuter&&PA(e,AA)}function BA(e,t){e.__highByOuter|=1<<(t||0),PA(e,kA)}function VA(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&PA(e,AA)}function HA(e){PA(e,jA)}function UA(e){PA(e,MA)}function WA(e){PA(e,Eae)}function GA(e){PA(e,Dae)}function KA(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function qA(e){var t=e.getModel(),n=[],r=[];t.eachComponent(function(t,i){var a=vA(i),o=mA(e,i),s=t===`series`;!s&&r.push(o),a.isBlured&&(o.group.traverse(function(e){MA(e)}),s&&n.push(i)),a.isBlured=!1}),Y(r,function(e){e&&e.toggleBlurSeries&&e.toggleBlurSeries(n,!1,t)})}function JA(e,t,n,r){var i=r.getModel();n||=`coordinateSystem`;function a(e,t){for(var n=0;n0){var a={dataIndex:i,seriesIndex:e.seriesIndex};r!=null&&(a.dataType=r),t.push(a)}})}),t}function QA(e,t,n){nj(e,!0),PA(e,LA),Rae(e,t,n)}function Lae(e){nj(e,!1)}function $A(e,t,n,r){r?Lae(e):QA(e,t,n)}function Rae(e,t,n){var r=rA(e);t==null?r.focus&&=null:(r.focus=t,r.blurScope=n)}var ej=[`emphasis`,`blur`,`select`],zae={itemStyle:`getItemStyle`,lineStyle:`getLineStyle`,areaStyle:`getAreaStyle`};function tj(e,t,n,r){n||=`itemStyle`;for(var i=0;i1&&(o*=cj(m),s*=cj(m));var h=(i===a?-1:1)*cj((o*o*(s*s)-o*o*(p*p)-s*s*(f*f))/(o*o*(p*p)+s*s*(f*f)))||0,g=h*o*p/s,_=h*-s*f/o,v=(e+n)/2+uj(d)*g-lj(d)*_,y=(t+r)/2+lj(d)*g+uj(d)*_,b=mj([1,0],[(f-g)/o,(p-_)/s]),x=[(f-g)/o,(p-_)/s],S=[(-1*f-g)/o,(-1*p-_)/s],C=mj(x,S);if(pj(x,S)<=-1&&(C=dj),pj(x,S)>=1&&(C=0),C<0){var w=Math.round(C/dj*1e6)/1e6;C=dj*2+w%2*dj}u.addData(l,v,y,o,s,b,C,d,a)}var Gae=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Kae=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function qae(e){var t=new cO;if(!e)return t;var n=0,r=0,i=n,a=r,o,s=cO.CMD,c=e.match(Gae);if(!c)return t;for(var l=0;l=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=BS(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var i=this.__zr;i&&r.removeSelfFromZr(i),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=BS(n,e);return r<0||(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh()),this},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;nA*A+j*j&&(w=E,T=D),{cx:w,cy:T,x0:-u,y0:-d,x1:w*(i/x-1),y1:T*(i/x-1)}}function toe(e){var t;if(X(e)){var n=e.length;if(!n)return e;t=n===1?[e[0],e[0],0,0]:n===2?[e[0],e[0],e[1],e[1]]:n===3?e.concat(e[2]):e}else t=[e,e,e,e];return t}function noe(e,t){var n,r=kj(t.r,0),i=kj(t.r0||0,0),a=r>0;if(a||i>0){if(a||(r=i,i=0),i>r){var o=r;r=i,i=o}var s=t.startAngle,c=t.endAngle;if(!(isNaN(s)||isNaN(c))){var l=t.cx,u=t.cy,d=!!t.clockwise,f=Dj(c-s),p=f>Cj&&f%Cj;if(p>jj&&(f=p),!(r>jj))e.moveTo(l,u);else if(f>Cj-jj)e.moveTo(l+r*Tj(s),u+r*wj(s)),e.arc(l,u,r,s,c,!d),i>jj&&(e.moveTo(l+i*Tj(c),u+i*wj(c)),e.arc(l,u,i,c,s,d));else{var m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0,O=void 0,k=void 0,A=r*Tj(s),j=r*wj(s),M=i*Tj(c),N=i*wj(c),P=f>jj;if(P){var F=t.cornerRadius;F&&(n=toe(F),m=n[0],h=n[1],g=n[2],_=n[3]);var ee=Dj(r-i)/2;if(v=Aj(ee,g),y=Aj(ee,_),b=Aj(ee,m),x=Aj(ee,h),w=S=kj(v,y),T=C=kj(b,x),(S>jj||C>jj)&&(E=r*Tj(c),D=r*wj(c),O=i*Tj(s),k=i*wj(s),fjj){var oe=Aj(g,w),se=Aj(_,w),R=Mj(O,k,A,j,r,oe,d),ce=Mj(E,D,M,N,r,se,d);e.moveTo(l+R.cx+R.x0,u+R.cy+R.y0),w0&&e.arc(l+R.cx,u+R.cy,oe,Ej(R.y0,R.x0),Ej(R.y1,R.x1),!d),e.arc(l,u,r,Ej(R.cy+R.y1,R.cx+R.x1),Ej(ce.cy+ce.y1,ce.cx+ce.x1),!d),se>0&&e.arc(l+ce.cx,u+ce.cy,se,Ej(ce.y1,ce.x1),Ej(ce.y0,ce.x0),!d))}else e.moveTo(l+A,u+j),e.arc(l,u,r,s,c,!d);if(!(i>jj)||!P)e.lineTo(l+M,u+N);else if(T>jj){var oe=Aj(m,T),se=Aj(h,T),R=Mj(M,N,E,D,i,-se,d),ce=Mj(A,j,O,k,i,-oe,d);e.lineTo(l+R.cx+R.x0,u+R.cy+R.y0),T0&&e.arc(l+R.cx,u+R.cy,se,Ej(R.y0,R.x0),Ej(R.y1,R.x1),!d),e.arc(l,u,i,Ej(R.cy+R.y1,R.cx+R.x1),Ej(ce.cy+ce.y1,ce.cx+ce.x1),d),oe>0&&e.arc(l+ce.cx,u+ce.cy,oe,Ej(ce.y1,ce.x1),Ej(ce.y0,ce.x0),!d))}else e.lineTo(l+M,u+N),e.arc(l,u,i,c,s,d)}e.closePath()}}}var roe=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),Nj=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new roe},t.prototype.buildPath=function(e,t){noe(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(xO);Nj.prototype.type=`sector`;var ioe=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),Pj=function(e){UC(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new ioe},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.PI*2;e.moveTo(n+t.r,r),e.arc(n,r,t.r,0,i,!1),e.moveTo(n+t.r0,r),e.arc(n,r,t.r0,0,i,!0)},t}(xO);Pj.prototype.type=`ring`;function aoe(e,t,n,r){var i=[],a=[],o=[],s=[],c,l,u,d;if(r){u=[1/0,1/0],d=[-1/0,-1/0];for(var f=0,p=e.length;f=2){if(r){var a=aoe(i,r,n,t.smoothConstraint);e.moveTo(i[0][0],i[0][1]);for(var o=i.length,s=0;s<(n?o:o-1);s++){var c=a[s*2],l=a[s*2+1],u=i[(s+1)%o];e.bezierCurveTo(c[0],c[1],l[0],l[1],u[0],u[1])}}else{e.moveTo(i[0][0],i[0][1]);for(var s=1,d=i.length;sYj[1]){if(i=!1,Xj.negativeSize||n)return i;var s=qj(Yj[0]-Jj[1]),c=qj(Jj[0]-Yj[1]);Kj(s,c)>Qj.len()&&(s=c||!Xj.bidirectional)&&(_w.scale(Zj,o,-c*r),Xj.useDir&&Xj.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(e,t,n){for(var r=this._axes[e],i=this._origin,a=t[0].dot(r)+i[e],o=a,s=a,c=1;c0){var d=u.duration,f=u.delay,p=u.easing,m={duration:d,delay:f||0,easing:p,done:a,force:!!a||!!o,setToFinal:!l,scope:e,during:o};s?t.animateFrom(n,m):t.animateTo(n,m)}else t.stopAnimation(),!s&&t.attr(n),o&&o(1),a&&a()}function nM(e,t,n,r,i,a){tM(`update`,e,t,n,r,i,a)}function rM(e,t,n,r,i,a){tM(`enter`,e,t,n,r,i,a)}function iM(e){if(!e.__zr)return!0;for(var t=0;tHj,BezierCurve:()=>Vj,BoundingRect:()=>Aw,Circle:()=>bj,CompoundPath:()=>Uj,Ellipse:()=>xj,Group:()=>yj,HOVER_LAYER_FOR_INCREMENTAL:()=>2,HOVER_LAYER_FROM_THRESHOLD:()=>1,HOVER_LAYER_NO:()=>0,Image:()=>CO,IncrementalDisplayable:()=>hoe,Line:()=>Rj,LinearGradient:()=>Gj,OrientedBoundingRect:()=>$j,Path:()=>xO,Point:()=>_w,Polygon:()=>Ij,Polyline:()=>Lj,RadialGradient:()=>foe,Rect:()=>OO,Ring:()=>Pj,Sector:()=>Nj,Text:()=>MO,WH:()=>dM,XY:()=>uM,applyTransform:()=>SM,calcZ2Range:()=>VM,clipPointsByRect:()=>Coe,clipRectByRect:()=>EM,createIcon:()=>DM,decomposeTransform:()=>GM,ensureCopyRect:()=>RM,ensureCopyTransform:()=>zM,expandOrShrinkRect:()=>AM,extendPath:()=>yoe,extendShape:()=>voe,getCurrentCanvasPainter:()=>qM,getShapeClass:()=>mM,getTransform:()=>xM,groupTransition:()=>TM,initProps:()=>rM,isBoundingRectAxisAligned:()=>IM,isElementRemoved:()=>iM,lineLineIntersect:()=>OM,linePolygonIntersect:()=>woe,makeImage:()=>gM,makePath:()=>hM,mergePath:()=>boe,payloadDisableAnimation:()=>WM,registerShape:()=>pM,removeElement:()=>aM,removeElementWithFadeOut:()=>sM,resizePath:()=>vM,retrieveZInfo:()=>BM,setTooltipConfig:()=>NM,subPixelOptimize:()=>bM,subPixelOptimizeLine:()=>yM,subPixelOptimizeRect:()=>xoe,transformDirection:()=>CM,traverseElements:()=>FM,traverseUpdateZ:()=>HM,updateProps:()=>nM}),lM={},uM=[`x`,`y`],dM=[`width`,`height`];function voe(e){return xO.extend(e)}var fM=Yae;function yoe(e,t){return fM(e,t)}function pM(e,t){lM[e]=t}function mM(e){if(lM.hasOwnProperty(e))return lM[e]}function hM(e,t,n,r){var i=Jae(e,t);return n&&(r===`center`&&(n=_M(n,i.getBoundingRect())),vM(i,n)),i}function gM(e,t,n){var r=new CO({style:{image:e,x:t.x,y:t.y,width:t.width,height:t.height},onload:function(e){if(n===`center`){var i={width:e.width,height:e.height};r.setStyle(_M(t,i))}}});return r}function _M(e,t){var n=t.width/t.height,r=e.height*n,i;r<=e.width?i=e.height:(r=e.width,i=r/n);var a=e.x+e.width/2,o=e.y+e.height/2;return{x:a-r/2,y:o-i/2,width:r,height:i}}var boe=Xae;function vM(e,t){if(e.applyTransform){var n=e.getBoundingRect().calculateTransform(t);e.applyTransform(n)}}function yM(e,t){return TO(e,e,{lineWidth:t}),e}function xoe(e,t){return EO(e,e,t),e}var bM=DO;function xM(e,t){for(var n=$C([]);e&&e!==t;)tw(n,e.getLocalTransform(),n),e=e.parent;return n}function SM(e,t,n){return t&&!HS(t)&&(t=gT.getLocalTransform(t)),n&&(t=iw([],t)),mw([],e,t)}function CM(e,t,n){var r=t[4]===0||t[5]===0||t[0]===0?1:qO(2*t[4]/t[0]),i=t[4]===0||t[5]===0||t[2]===0?1:qO(2*t[4]/t[2]),a=[e===`left`?-r:e===`right`?r:0,e===`top`?-i:e===`bottom`?i:0];return a=SM(a,t,n),qO(a[0])>qO(a[1])?a[0]>0?`right`:`left`:a[1]>0?`bottom`:`top`}function wM(e){return!e.isGroup}function Soe(e){return e.shape!=null}function TM(e,t,n){if(!e||!t)return;function r(e){var t={};return e.traverse(function(e){wM(e)&&e.anid&&(t[e.anid]=e)}),t}function i(e){var t={x:e.x,y:e.y,rotation:e.rotation};return Soe(e)&&(t.shape=LS(e.shape)),t}var a=r(e);t.traverse(function(e){if(wM(e)&&e.anid){var t=a[e.anid];if(t){var r=i(e);e.attr(i(t)),nM(e,r,n,rA(e).dataIndex)}}})}function Coe(e,t){return US(e,function(e){var n=e[0];n=KO(n,t.x),n=GO(n,t.x+t.width);var r=e[1];return r=KO(r,t.y),r=GO(r,t.y+t.height),[n,r]})}function EM(e,t){var n=KO(e.x,t.x),r=GO(e.x+e.width,t.x+t.width),i=KO(e.y,t.y),a=GO(e.y+e.height,t.y+t.height);if(r>=n&&a>=i)return{x:n,y:i,width:r-n,height:a-i}}function DM(e,t,n){var r=J({rectHover:!0},t),i=r.style={strokeNoScale:!0};if(n||={x:-1,y:-1,width:2,height:2},e)return e.indexOf(`image://`)===0?(i.image=e.slice(8),zS(i,n),new CO(r)):hM(e.replace(`path://`,``),r,n,`center`)}function woe(e,t,n,r,i){for(var a=0,o=i[i.length-1];a1)return!1;var g=kM(p,m,u,d)/f;return!(g<0||g>1)}function kM(e,t,n,r){return e*r-n*t}function Toe(e){return e<=1e-6&&e>=-1e-6}function AM(e,t,n,r,i){return t==null||($S(t)?jM[0]=jM[1]=jM[2]=jM[3]=t:(jM[0]=t[0],jM[1]=t[1],jM[2]=t[2],jM[3]=t[3]),r&&(jM[0]=KO(0,jM[0]),jM[1]=KO(0,jM[1]),jM[2]=KO(0,jM[2]),jM[3]=KO(0,jM[3])),n&&(jM[0]=-jM[0],jM[1]=-jM[1],jM[2]=-jM[2],jM[3]=-jM[3]),MM(e,jM,`x`,`width`,3,1,i&&i[0]||0),MM(e,jM,`y`,`height`,0,2,i&&i[1]||0)),e}var jM=[0,0,0,0];function MM(e,t,n,r,i,a,o){var s=t[a]+t[i],c=e[r];e[r]+=s,o=KO(0,GO(o,c)),e[r]=0?-t[i]:t[a]>=0?c+t[a]:qO(s)>1e-8?(c-o)*t[i]/s:0):e[n]-=t[i]}function NM(e){var t=e.itemTooltipOption,n=e.componentModel,r=e.itemName,i=ZS(t)?{formatter:t}:t,a=n.mainType,o=n.componentIndex,s={componentType:a,name:r,$vars:[`name`]};s[a+`Index`]=o;var c=e.formatterParamsExtra;c&&Y(qS(c),function(e){Z(s,e)||(s[e]=c[e],s.$vars.push(e))});var l=rA(e.el);l.componentMainType=a,l.componentIndex=o,l.tooltipConfig={name:r,option:zS({content:r,encodeHTMLContent:!0,formatterParams:s},i)}}function PM(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function FM(e,t){if(e){if(X(e))for(var n=0;nt&&(t=r),rt&&(n=t=0),{min:n,max:t}}function HM(e,t,n){UM(e,t,n,-1/0)}function UM(e,t,n,r){if(e.ignoreModelZ)return r;var i=e.getTextContent(),a=e.getTextGuideLine();if(e.isGroup)for(var o=e.childrenRef(),s=0;s1){var l=s.shift();s.length===1&&(n[o]=s[0]),this._update&&this._update(l,a)}else c===1?(n[o]=null,this._update&&this._update(s,a)):this._remove&&this._remove(a)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},r={},i=[],a=[];this._initIndexMap(e,n,i,`_oldKeyGetter`),this._initIndexMap(t,r,a,`_newKeyGetter`);for(var o=0;o1&&d===1)this._updateManyToOne&&this._updateManyToOne(l,c),r[s]=null;else if(u===1&&d>1)this._updateOneToMany&&this._updateOneToMany(l,c),r[s]=null;else if(u===1&&d===1)this._update&&this._update(l,c),r[s]=null;else if(u>1&&d>1)this._updateManyToMany&&this._updateManyToMany(l,c),r[s]=null;else if(u>1)for(var f=0;f1)for(var o=0;ol&&(l=p)}s[0]=c,s[1]=l}},r=function(){return this._data?this._data.length/this._dimSize:0};FN=(e={},e[sA+`_`+dA]={pure:!0,appendData:i},e[sA+`_row`]={pure:!0,appendData:function(){throw Error(`Do not support appendData when set seriesLayoutBy: "row".`)}},e[cA]={pure:!0,appendData:i},e[lA]={pure:!0,appendData:function(e){var t=this._data;Y(e,function(e,n){for(var r=t[n]||(t[n]=[]),i=0;i<(e||[]).length;i++)r.push(e[i])})}},e[oA]={appendData:i},e[uA]={persistent:!1,pure:!0,appendData:function(e){this._data=e},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(e){for(var t=0;tt},gte:function(e,t){return e>=t}};(function(){function e(e,t){$S(t)||wk(``),this._opFn=Koe[e],this._rvalFloat=_k(t)}return e.prototype.evaluate=function(e){return $S(e)?this._opFn(e,this._rvalFloat):this._opFn(_k(e),this._rvalFloat)},e})();var qoe=function(){function e(e,t){var n=e===`desc`;this._resultLT=n?1:-1,t??=n?`min`:`max`,this._incomparable=t===`min`?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=$S(e)?e:_k(e),r=$S(t)?t:_k(t),i=isNaN(n),a=isNaN(r);if(i&&(n=this._incomparable),a&&(r=this._incomparable),i&&a){var o=ZS(e),s=ZS(t);o&&(n=s?e:0),s&&(r=o?t:0)}return nr?-this._resultLT:0},e}();(function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=_k(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n!==this._rvalTypeof&&(n===`number`||this._rvalTypeof===`number`)&&(t=_k(e)===this._rvalFloat)}return this._isEQ?t:!t},e})();function XN(e){var t=``,n=-1/0,r=-1/0,i=1/0,a=1/0;return e&&(e.g!=null&&(t+=`G`+e.g,n=e.g),e.ge!=null&&(t+=`GE`+e.ge,r=e.ge),e.l!=null&&(t+=`L`+e.l,i=e.l),e.le!=null&&(t+=`LE`+e.le,a=e.le)),{key:t,g:n,ge:r,l:i,le:a}}function ZN(e,t){return t>e.g&&t>=e.ge&&t`u`?Array:Uint32Array,Yoe=typeof Uint16Array>`u`?Array:Uint16Array,QN=typeof Int32Array>`u`?Array:Int32Array,$N=typeof Float64Array>`u`?Array:Float64Array,eP={float:$N,int:QN,ordinal:Array,number:Array,time:$N},tP;function nP(e){return e>65535?Joe:Yoe}function Xoe(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function rP(e,t,n,r,i){var a=eP[n||`float`];if(i){var o=e[t],s=o&&o.length;if(s!==r){for(var c=new a(r),l=0;lh[1]&&(h[1]=m)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var r=this._provider,i=this._chunks,a=this._dimensions,o=a.length,s=this._rawExtent,c=US(a,function(e){return e.property}),l=0;lg[1]&&(g[1]=h)}}!r.persistent&&r.clean&&r.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(n!=null&&ne)i=a-1;else return a}return-1},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,r=this._count;if(n===Array){e=new n(r);for(var i=0;i=l&&g<=u||isNaN(g))&&(o[s++]=p),p++}f=!0}else if(i===2){for(var m=d[r[0]],_=d[r[1]],v=e[r[1]][0],y=e[r[1]][1],h=0;h=l&&g<=u||isNaN(g))&&(b>=v&&b<=y||isNaN(b))&&(o[s++]=p),p++}f=!0}}if(!f){if(i===1)for(var h=0;h=l&&g<=u||isNaN(g))&&(o[s++]=x)}else for(var h=0;he[w][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(h))}}return sg[1]&&(g[1]=h)}}}},e.prototype.lttbDownSample=function(e,t){var n=this.clone([e],!0),r=n._chunks[e],i=this.count(),a=0,o=Math.floor(1/t),s=this.getRawIndex(0),c,l,u,d=new(nP(this._rawCount))(Math.min((Math.ceil(i/o)+2)*2,i));d[a++]=s;for(var f=1;fc&&(c=l,u=v))}T>0&&To&&(m=o-l);for(var h=0;hp&&(p=g,f=l+h)}var _=this.getRawIndex(u),v=this.getRawIndex(f);ul-p&&(s=l-p,o.length=s);for(var m=0;mu[1]&&(u[1]=g),d[f++]=_}return i._count=f,i._indices=d,i._updateGetRawIdx(),i},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,r=this._chunks,i=0,a=this.count();id&&(d=p))}return o[c]=[u,d]},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],r=this._chunks,i=0;i=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,r){return YN(e[r],this._dimensions[r])}tP={arrayRows:e,objectRows:function(e,t,n,r){return YN(e[t],this._dimensions[r])},keyedColumns:e,original:function(e,t,n,r){var i=e&&(e.value==null?e:e.value);return YN(i instanceof Array?i[r]:i,this._dimensions[r])},typedArray:function(e,t,n,r){return e[r]}}}(),e}(),Zoe=Lk(),Qoe={float:`f`,int:`i`,ordinal:`o`,number:`n`,time:`t`},aP=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||=cP(this.source))},e.prototype.getSourceDimensionIndex=function(e){return sC(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=AN(this.source),n=!lP(e),r=``,i=[],a=0,o=0;a30}var uP=eC,dP=US,$oe=typeof Int32Array>`u`?Array:Int32Array,ese=`e\0\0`,fP=-1,tse=[`hasItemOption`,`_nameList`,`_idList`,`_invertedIndicesMap`,`_dimSummary`,`userOutput`,`_rawData`,`_dimValueGetter`,`_nameDimIdx`,`_idDimIdx`,`_nameRepeatCount`],nse=[`_approximateExtent`],pP,mP,hP,gP,_P,vP,yP,bP=function(){function e(e,t){this.type=`list`,this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=[`cloneShallow`,`downSample`,`minmaxDownSample`,`lttbDownSample`,`map`],this.CHANGABLE_METHODS=[`filterSelf`,`selectRange`],this.DOWNSAMPLE_METHODS=[`downSample`,`minmaxDownSample`,`lttbDownSample`];var n,r=!1;oP(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(r=!0,n=e),n||=[`x`,`y`];for(var i={},a=[],o={},s=!1,c={},l=0;l=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,i=this._idList;if(n.getSource().sourceFormat===`original`&&!n.pure)for(var a=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,r=n[e];r||=n[e]={};var i=r[t];return i??(i=this.getVisual(t),X(i)?i=i.slice():uP(i)&&(i=J({},i)),r[t]=i),i},e.prototype.setItemVisual=function(e,t,n){var r=this._itemVisuals[e]||{};this._itemVisuals[e]=r,uP(t)?J(r,t):r[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){uP(e)?J(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?J(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){Cae(this.hostModel&&this.hostModel.seriesIndex,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Y(this._graphicEls,function(n,r){n&&e&&e.call(t,n,r)})},e.prototype.cloneShallow=function(t){return t||=new e(this._schema?this._schema:dP(this.dimensions,this._getDimInfo,this),this.hostModel),_P(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];XS(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(lC(arguments)))})},e.internalField=function(){pP=function(e){var t=e._invertedIndicesMap;Y(t,function(n,r){var i=e._dimInfos[r],a=i.ordinalMeta,o=e._store;if(a){n=t[r]=new $oe(a.categories.length);for(var s=0;s1&&(s+=`__ec__`+l),r[t]=s}}}(),e}();function xP(e,t){xN(e)||(e=CN(e)),t||={};var n=t.coordDimensions||[],r=t.dimensionsDefine||e.dimensionsDefine||[],i=_C(),a=[],o=rse(e,n,r,t.dimensionsCount),s=t.canOmitUnusedDimensions&&lP(o),c=r===e.dimensionsDefine,l=c?cP(e):sP(r),u=t.encodeDefine;!u&&t.encodeDefaulter&&(u=t.encodeDefaulter(e,o));for(var d=_C(u),f=new QN(o),p=0;p0&&(e.name+=t-1)}),new aP({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function rse(e,t,n,r){var i=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,r||0);return Y(t,function(e){var t;eC(e)&&(t=e.dimsDef)&&(i=Math.max(i,t.length))}),i}function ise(e,t,n){if(n||t.hasKey(e)){for(var r=0;t.hasKey(e+r);)r++;e+=r}return t.set(e,!0),e}var SP={},CP={},wP=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(e,t){this._nonSeriesBoxMasterList=n(SP,!0),this._normalMasterList=n(CP,!1);function n(n,r){var i=[];return Y(n,function(n,r){var a=n.create(e,t);i=i.concat(a||[])}),i}},e.prototype.update=function(e,t){Y(this._normalMasterList,function(n){n.update&&n.update(e,t)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(e,t){e===`matrix`||e===`calendar`?SP[e]=t:CP[e]=t},e.get=function(e){return CP[e]||SP[e]},e}();function ase(e){return!!SP[e]}var ose=_C();function TP(e){var t=e.getShallow(`coord`,!0),n=1;if(t==null){var r=ose.get(e.type);r&&r.getCoord2&&(n=2,t=r.getCoord2(e))}return{coord:t,from:n}}function sse(e,t){var n=e.getShallow(`coordinateSystem`),r=e.getShallow(`coordinateSystemUsage`,!0),i=0;if(n){var a=e.mainType===`series`;r??=a?`data`:`box`,r===`data`?(i=1,a||(i=0)):r===`box`&&(i=2,!a&&!ase(n)&&(i=0))}return{coordSysType:n,kind:i}}function cse(e){var t=e.targetModel,n=e.coordSysType,r=e.coordSysProvider,i=e.isDefaultDataCoordSys;e.allowNotFound;var a=sse(t,!0),o=a.kind,s=a.coordSysType;if(i&&o!==1&&(o=1,s=n),o===0||s!==n)return 0;var c=r(n,t);return c?(o===1?t.coordinateSystem=c:t.boxCoordinateSystem=c,o):0}var lse=function(){function e(e){this.coordSysDims=[],this.axisMap=_C(),this.categoryAxisMap=_C(),this.coordSysName=e}return e}();function use(e){var t=e.get(`coordinateSystem`),n=new lse(t),r=dse[t];if(r)return r(e,n,n.axisMap,n.categoryAxisMap),n}var dse={cartesian2d:function(e,t,n,r){var i=e.getReferringComponents(`xAxis`,Bk).models[0],a=e.getReferringComponents(`yAxis`,Bk).models[0];t.coordSysDims=[`x`,`y`],n.set(`x`,i),n.set(`y`,a),EP(i)&&(r.set(`x`,i),t.firstCategoryDimIndex=0),EP(a)&&(r.set(`y`,a),t.firstCategoryDimIndex??=1)},singleAxis:function(e,t,n,r){var i=e.getReferringComponents(`singleAxis`,Bk).models[0];t.coordSysDims=[`single`],n.set(`single`,i),EP(i)&&(r.set(`single`,i),t.firstCategoryDimIndex=0)},polar:function(e,t,n,r){var i=e.getReferringComponents(`polar`,Bk).models[0],a=i.findAxisModel(`radiusAxis`),o=i.findAxisModel(`angleAxis`);t.coordSysDims=[`radius`,`angle`],n.set(`radius`,a),n.set(`angle`,o),EP(a)&&(r.set(`radius`,a),t.firstCategoryDimIndex=0),EP(o)&&(r.set(`angle`,o),t.firstCategoryDimIndex??=1)},geo:function(e,t,n,r){t.coordSysDims=[`lng`,`lat`]},parallel:function(e,t,n,r){var i=e.ecModel,a=i.getComponent(`parallel`,e.get(`parallelIndex`)),o=t.coordSysDims=a.dimensions.slice();Y(a.parallelAxisIndex,function(e,a){var s=i.getComponent(`parallelAxis`,e),c=o[a];n.set(c,s),EP(s)&&(r.set(c,s),t.firstCategoryDimIndex??=a)})},matrix:function(e,t,n,r){var i=e.getReferringComponents(`matrix`,Bk).models[0];t.coordSysDims=[`x`,`y`];var a=i.getDimensionModel(`x`),o=i.getDimensionModel(`y`);n.set(`x`,a),n.set(`y`,o),r.set(`x`,a),r.set(`y`,o)}};function EP(e){return e.get(`type`)===`category`}function fse(e,t,n){n||={};var r=n.byIndex,i=n.stackedCoordDimension,a,o,s;pse(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var c=!!(e&&e.get(`stack`)),l,u,d,f,p=!0;function m(e){return e.type!==`ordinal`&&e.type!==`time`}if(Y(a,function(e,t){ZS(e)&&(a[t]=e={name:e}),m(e)||(p=!1)}),Y(a,function(e,t){c&&!e.isExtraCoord&&(!r&&!l&&e.ordinalMeta&&(l=e),u||!m(e)||p&&(e.coordDim===`x`||e.coordDim===`angle`)||i&&i!==e.coordDim||(u=e))}),u&&!r&&!l&&(r=!0),u){d=`__\0ecstackresult_`+e.id,f=`__\0ecstackedover_`+e.id,l&&(l.createInvertedIndices=!0);var h=u.coordDim,g=u.type,_=0;Y(a,function(e){e.coordDim===h&&_++});var v={name:d,coordDim:h,coordDimIndex:_,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},y={name:f,coordDim:f,coordDimIndex:_+1,type:g,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(v.storeDimIndex=s.ensureCalculationDimension(f,g),y.storeDimIndex=s.ensureCalculationDimension(d,g)),o.appendCalculationDimension(v),o.appendCalculationDimension(y)):(a.push(v),a.push(y))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:r,stackedOverDimension:f,stackResultDimension:d}}function pse(e){return!oP(e.schema)}function DP(e,t){return!!t&&t===e.getCalculationInfo(`stackedDimension`)}function OP(e,t){return DP(e,t)?e.getCalculationInfo(`stackResultDimension`):t}function mse(e,t){var n=e.get(`coordinateSystem`),r=wP.get(n),i;return t&&t.coordSysDims&&(i=US(t.coordSysDims,function(e){var n={name:e},r=t.axisMap.get(e);return r&&(n.type=Woe(r.get(`type`))),n})),i||=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||[`x`,`y`],i}function hse(e,t,n){var r,i;return n&&Y(e,function(e,a){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(r??=a,e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),e.otherDims.itemName!=null&&(i=!0)}),!i&&r!=null&&(e[r].otherDims.itemName=0),r}function kP(e,t,n){n||={};var r=t.getSourceManager(),i,a=!1;e?(a=!0,i=CN(e)):(i=r.getSource(),a=i.sourceFormat===oA);var o=use(t),s=mse(t,o),c=n.useEncodeDefaulter,l=XS(c)?c:c?YS(Loe,s,t):null,u={coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:l,canOmitUnusedDimensions:!a},d=xP(i,u),f=hse(d.dimensions,n.createInvertedIndices,o),p=a?null:r.getSharedDataStore(d),m=fse(t,{schema:d,store:p}),h=new bP(d,t);h.setCalculationInfo(m);var g=f!=null&&gse(i)?function(e,t,n,r){return r===f?n:this.defaultDimValueGetter(e,t,n,r)}:null;return h.hasItemOption=!1,h.initData(a?i:p,null,g),h}function gse(e){if(e.sourceFormat===`original`)return!X(Ak(_se(e.data||[])))}function _se(e){for(var t=0;t=0&&n.push(e)}),n}}function MP(e,t){return RS(RS({},e,!0),t,!0)}var NP=Math.log(2);function PP(e,t,n,r,i,a){var o=r+`-`+i,s=e.length;if(a.hasOwnProperty(o))return a[o];if(t===1){var c=Math.round(Math.log((1<>1)%2;s.cssText=[`position: absolute`,`visibility: hidden`,`padding: 0`,`margin: 0`,`border-width: 0`,`user-select: none`,`width:0`,`height:0`,r[c]+`:0`,i[l]+`:0`,r[1-c]+`:auto`,i[1-l]+`:auto`,``].join(`!important;`),e.appendChild(o),n.push(o)}return t.clearMarkers=function(){Y(n,function(e){e.parentNode&&e.parentNode.removeChild(e)})},n}function HP(e,t,n){for(var r=n?`invTrans`:`trans`,i=t[r],a=t.srcCoords,o=[],s=[],c=!0,l=0;l<4;l++){var u=e[l].getBoundingClientRect(),d=2*l,f=u.left,p=u.top;o.push(f,p),c=c&&a&&f===a[d]&&p===a[d+1],s.push(e[l].offsetLeft,e[l].offsetTop)}return c&&i?i:(t.srcCoords=o,t[r]=n?FP(s,o):FP(o,s))}function UP(e){return e.nodeName.toUpperCase()===`CANVAS`}var WP=/([&<>"'])/g,GP={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function KP(e){return e==null?``:(e+``).replace(WP,function(e,t){return GP[t]})}var qP={time:{month:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],monthAbbr:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],dayOfWeek:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],dayOfWeekAbbr:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]},legend:{selector:{all:`All`,inverse:`Inv`}},toolbox:{brush:{title:{rect:`Box Select`,polygon:`Lasso Select`,lineX:`Horizontally Select`,lineY:`Vertically Select`,keep:`Keep Selections`,clear:`Clear Selections`}},dataView:{title:`Data View`,lang:[`Data View`,`Close`,`Refresh`]},dataZoom:{title:{zoom:`Zoom`,back:`Zoom Reset`}},magicType:{title:{line:`Switch to Line Chart`,bar:`Switch to Bar Chart`,stack:`Stack`,tiled:`Tile`}},restore:{title:`Restore`},saveAsImage:{title:`Save as Image`,lang:[`Right Click to Save Image`]}},series:{typeNames:{pie:`Pie chart`,bar:`Bar chart`,line:`Line chart`,scatter:`Scatter plot`,effectScatter:`Ripple scatter plot`,radar:`Radar chart`,tree:`Tree`,treemap:`Treemap`,boxplot:`Boxplot`,candlestick:`Candlestick`,k:`K line chart`,heatmap:`Heat map`,map:`Map`,parallel:`Parallel coordinate map`,lines:`Line graph`,graph:`Relationship graph`,sankey:`Sankey diagram`,funnel:`Funnel chart`,gauge:`Gauge`,pictorialBar:`Pictorial bar`,themeRiver:`Theme River Map`,sunburst:`Sunburst`,custom:`Custom chart`,chart:`Chart`}},aria:{general:{withTitle:`This is a chart about "{title}"`,withoutTitle:`This is a chart`},series:{single:{prefix:``,withName:` with type {seriesType} named {seriesName}.`,withoutName:` with type {seriesType}.`},multiple:{prefix:`. It consists of {seriesCount} series count.`,withName:` The {seriesId} series is a {seriesType} representing {seriesName}.`,withoutName:` The {seriesId} series is a {seriesType}.`,separator:{middle:``,end:``}}},data:{allData:`The data is as follows: `,partialData:`The first {displayCnt} items are: `,withName:`the data for {name} is {value}`,withoutName:`{value}`,separator:{middle:`, `,end:`. `}}}},JP={time:{month:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],monthAbbr:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],dayOfWeek:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`],dayOfWeekAbbr:[`日`,`一`,`二`,`三`,`四`,`五`,`六`]},legend:{selector:{all:`全选`,inverse:`反选`}},toolbox:{brush:{title:{rect:`矩形选择`,polygon:`圈选`,lineX:`横向选择`,lineY:`纵向选择`,keep:`保持选择`,clear:`清除选择`}},dataView:{title:`数据视图`,lang:[`数据视图`,`关闭`,`刷新`]},dataZoom:{title:{zoom:`区域缩放`,back:`区域缩放还原`}},magicType:{title:{line:`切换为折线图`,bar:`切换为柱状图`,stack:`切换为堆叠`,tiled:`切换为平铺`}},restore:{title:`还原`},saveAsImage:{title:`保存为图片`,lang:[`右键另存为图片`]}},series:{typeNames:{pie:`饼图`,bar:`柱状图`,line:`折线图`,scatter:`散点图`,effectScatter:`涟漪散点图`,radar:`雷达图`,tree:`树图`,treemap:`矩形树图`,boxplot:`箱型图`,candlestick:`K线图`,k:`K线图`,heatmap:`热力图`,map:`地图`,parallel:`平行坐标图`,lines:`线图`,graph:`关系图`,sankey:`桑基图`,funnel:`漏斗图`,gauge:`仪表盘图`,pictorialBar:`象形柱图`,themeRiver:`主题河流图`,sunburst:`旭日图`,custom:`自定义图表`,chart:`图表`}},aria:{general:{withTitle:`这是一个关于“{title}”的图表。`,withoutTitle:`这是一个图表,`},series:{single:{prefix:``,withName:`图表类型是{seriesType},表示{seriesName}。`,withoutName:`图表类型是{seriesType}。`},multiple:{prefix:`它由{seriesCount}个图表系列组成。`,withName:`第{seriesId}个系列是一个表示{seriesName}的{seriesType},`,withoutName:`第{seriesId}个系列是一个{seriesType},`,separator:{middle:`;`,end:`。`}}},data:{allData:`其数据是——`,partialData:`其中,前{displayCnt}项是——`,withName:`{name}的数据是{value}`,withoutName:`{value}`,separator:{middle:`,`,end:``}}}},YP=`ZH`,XP=`EN`,ZP=XP,QP={},$P={},eF=CC.domSupported?function(){return(document.documentElement.lang||navigator.language||navigator.browserLanguage||ZP).toUpperCase().indexOf(YP)>-1?YP:ZP}():ZP;function tF(e,t){e=e.toUpperCase(),$P[e]=new dN(t),QP[e]=t}function nF(e){if(ZS(e)){var t=QP[e.toUpperCase()]||{};return e===YP||e===XP?LS(t):RS(LS(t),LS(QP[ZP]),!1)}return RS(LS(e),LS(QP[ZP]),!1)}function rF(e){return $P[e]}function iF(){return $P[ZP]}tF(XP,qP),tF(YP,JP);var aF=null;function oF(){return aF}function sF(e,t){var n=oF(),r=t.breakOption,i=t.breakParsed;return!i&&n&&(i=n.parseAxisBreakOption(r,e)),i}function cF(e){var t=e.brk;return t?t.breaks:[]}function lF(e){var t=e.brk;return t?t.hasBreaks():!1}var uF=1e3,dF=uF*60,fF=dF*60,pF=fF*24,mF=pF*365,hF={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},gF={year:`{yyyy}`,month:`{MMM}`,day:`{d}`,hour:`{HH}:{mm}`,minute:`{HH}:{mm}`,second:`{HH}:{mm}:{ss}`,millisecond:`{HH}:{mm}:{ss} {SSS}`},_F=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}`,vF=`{yyyy}-{MM}-{dd}`,yF={year:`{yyyy}`,month:`{yyyy}-{MM}`,day:vF,hour:vF+` `+gF.hour,minute:vF+` `+gF.minute,second:vF+` `+gF.second,millisecond:_F},bF=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],xF=[`year`,`half-year`,`quarter`,`month`,`week`,`half-week`,`day`,`half-day`,`quarter-day`,`hour`,`minute`,`second`,`millisecond`];function SF(e){return!ZS(e)&&!XS(e)?CF(e):e}function CF(e){e||={};var t={},n=!0;return Y(bF,function(t){n&&=e[t]==null}),Y(bF,function(r,i){var a=e[r];t[r]={};for(var o=null,s=i;s>=0;s--){var c=bF[s],l=eC(a)&&!X(a)?a[c]:a,u=void 0;X(l)?(u=l.slice(),o=u[0]||``):ZS(l)?(o=l,u=[o]):(o==null?o=gF[r]:hF[c].test(o)||(o=t[c][c][0]+` `+o),u=[o],n&&(u[1]=`{primary|`+o+`}`)),t[r][c]=u}}),t}function wF(e,t){return e+=``,`0000`.substr(0,t-e.length)+e}function TF(e){switch(e){case`half-year`:case`quarter`:return`month`;case`week`:case`half-week`:return`day`;case`half-day`:case`quarter-day`:return`hour`;default:return e}}function EF(e){return e===TF(e)}function bse(e){switch(e){case`year`:case`month`:return`day`;case`millisecond`:return`millisecond`;default:return`second`}}function DF(e,t,n,r){var i=fk(e),a=i[AF(n)](),o=i[jF(n)]()+1,s=Math.floor((o-1)/3)+1,c=i[MF(n)](),l=i[`get`+(n?`UTC`:``)+`Day`](),u=i[NF(n)](),d=(u-1)%12+1,f=i[PF(n)](),p=i[FF(n)](),m=i[IF(n)](),h=u>=12?`pm`:`am`,g=h.toUpperCase(),_=(r instanceof dN?r:rF(r||eF)||iF()).getModel(`time`),v=_.get(`month`),y=_.get(`monthAbbr`),b=_.get(`dayOfWeek`),x=_.get(`dayOfWeekAbbr`);return(t||``).replace(/{a}/g,h+``).replace(/{A}/g,g+``).replace(/{yyyy}/g,a+``).replace(/{yy}/g,wF(a%100+``,2)).replace(/{Q}/g,s+``).replace(/{MMMM}/g,v[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,wF(o,2)).replace(/{M}/g,o+``).replace(/{dd}/g,wF(c,2)).replace(/{d}/g,c+``).replace(/{eeee}/g,b[l]).replace(/{ee}/g,x[l]).replace(/{e}/g,l+``).replace(/{HH}/g,wF(u,2)).replace(/{H}/g,u+``).replace(/{hh}/g,wF(d+``,2)).replace(/{h}/g,d+``).replace(/{mm}/g,wF(f,2)).replace(/{m}/g,f+``).replace(/{ss}/g,wF(p,2)).replace(/{s}/g,p+``).replace(/{SSS}/g,wF(m,3)).replace(/{S}/g,m+``)}function xse(e,t,n,r,i){var a=null;if(ZS(n))a=n;else if(XS(n)){var o={time:e.time,level:e.time?e.time.level:0},s=oF();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),a=n(e.value,t,o)}else{var c=e.time;if(c){var l=n[c.lowerTimeUnit][c.upperTimeUnit];a=l[Math.min(c.level,l.length-1)]||``}else{var u=OF(e.value,i);a=n[u][u][0]}}return DF(new Date(e.value),a,i,r)}function OF(e,t){var n=fk(e),r=n[jF(t)]()+1,i=n[MF(t)](),a=n[NF(t)](),o=n[PF(t)](),s=n[FF(t)](),c=n[IF(t)]()===0,l=c&&s===0,u=l&&o===0,d=u&&a===0,f=d&&i===1;return f&&r===1?`year`:f?`month`:d?`day`:u?`hour`:l?`minute`:c?`second`:`millisecond`}function kF(e,t,n){switch(t){case`year`:e[LF(n)](0);case`month`:e[RF(n)](1);case`day`:e[zF(n)](0);case`hour`:e[BF(n)](0);case`minute`:e[VF(n)](0);case`second`:e[HF(n)](0)}return e}function AF(e){return e?`getUTCFullYear`:`getFullYear`}function jF(e){return e?`getUTCMonth`:`getMonth`}function MF(e){return e?`getUTCDate`:`getDate`}function NF(e){return e?`getUTCHours`:`getHours`}function PF(e){return e?`getUTCMinutes`:`getMinutes`}function FF(e){return e?`getUTCSeconds`:`getSeconds`}function IF(e){return e?`getUTCMilliseconds`:`getMilliseconds`}function Sse(e){return e?`setUTCFullYear`:`setFullYear`}function LF(e){return e?`setUTCMonth`:`setMonth`}function RF(e){return e?`setUTCDate`:`setDate`}function zF(e){return e?`setUTCHours`:`setHours`}function BF(e){return e?`setUTCMinutes`:`setMinutes`}function VF(e){return e?`setUTCSeconds`:`setSeconds`}function HF(e){return e?`setUTCMilliseconds`:`setMilliseconds`}function UF(e){if(!Xie(e))return ZS(e)?e:`-`;var t=(e+``).split(`.`);return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,`$1,`)+(t.length>1?`.`+t[1]:``)}function WF(e,t){return e=(e||``).toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var GF=uC;function KF(e,t,n){var r=`{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}`;function i(e){return e&&fC(e)?e:`-`}function a(e){return xk(e)}var o=t===`time`,s=e instanceof Date;if(o||s){var c=o?fk(e):e;if(!isNaN(+c))return DF(c,r,n);if(s)return`-`}if(t===`ordinal`)return QS(e)?i(e):$S(e)&&a(e)?e+``:`-`;var l=_k(e);return a(l)?UF(l):QS(e)?i(e):typeof e==`boolean`?e+``:`-`}var qF=[`a`,`b`,`c`,`d`,`e`,`f`,`g`],JF=function(e,t){return`{`+e+(t??``)+`}`};function YF(e,t,n){X(t)||(t=[t]);var r=t.length;if(!r)return``;for(var i=t[0].$vars||[],a=0;a`:``:{renderMode:a,content:`{`+(n.markerId||`markerX`)+`|} `,style:i===`subItem`?{width:4,height:4,borderRadius:2,backgroundColor:r}:{width:10,height:10,borderRadius:5,backgroundColor:r}}:``}function XF(e,t){return t||=`transparent`,ZS(e)?e:eC(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}var ZF=Y,wse=[`left`,`right`,`top`,`bottom`,`width`,`height`],QF=[[`width`,`left`,`right`],[`height`,`top`,`bottom`]];function $F(e,t,n,r,i){var a=0,o=0;r??=1/0,i??=1/0;var s=0;t.eachChild(function(c,l){var u=c.getBoundingRect(),d=t.childAt(l+1),f=d&&d.getBoundingRect(),p,m;if(e===`horizontal`){var h=u.width+(f?-f.x+u.x:0);p=a+h,p>r||c.newline?(a=0,p=h,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(f?-f.y+u.y:0);m=o+g,m>i||c.newline?(a+=s+n,o=0,m=g,s=u.width):s=Math.max(s,u.width)}c.newline||(c.x=a,c.y=o,c.markRedraw(),e===`horizontal`?a=p+n:o=m+n)})}var eI=$F;YS($F,`vertical`),YS($F,`horizontal`);function Tse(e,t){return{left:e.getShallow(`left`,t),top:e.getShallow(`top`,t),right:e.getShallow(`right`,t),bottom:e.getShallow(`bottom`,t),width:e.getShallow(`width`,t),height:e.getShallow(`height`,t)}}function tI(e,t,n){n=GF(n||0);var r=t.width,i=t.height,a=tk(e.left,r),o=tk(e.top,i),s=tk(e.right,r),c=tk(e.bottom,i),l=tk(e.width,r),u=tk(e.height,i),d=n[2]+n[0],f=n[1]+n[3],p=e.aspect;switch(isNaN(l)&&(l=r-s-f-a),isNaN(u)&&(u=i-c-d-o),p!=null&&(isNaN(l)&&isNaN(u)&&(p>r/i?l=r*.8:u=i*.8),isNaN(l)&&(l=p*u),isNaN(u)&&(u=l/p)),isNaN(a)&&(a=r-s-l-f),isNaN(o)&&(o=i-c-u-d),e.left||e.right){case`center`:a=r/2-l/2-n[3];break;case`right`:a=r-l-f}switch(e.top||e.bottom){case`middle`:case`center`:o=i/2-u/2-n[0];break;case`bottom`:o=i-u-d}a||=0,o||=0,isNaN(l)&&(l=r-f-a-(s||0)),isNaN(u)&&(u=i-d-o-(c||0));var m=new Aw((t.x||0)+a+n[3],(t.y||0)+o+n[0],l,u);return m.margin=n,m}var nI={rect:1,point:2};function rI(e,t,n){var r,i,a,o=e.boxCoordinateSystem,s;if(o){var c=TP(e),l=c.coord,u=c.from;if(o.dataToLayout){a=nI.rect,s=u;var d=o.dataToLayout(l);r=d.contentRect||d.rect}else n&&n.enableLayoutOnlyByCenter&&o.dataToPoint&&(a=nI.point,s=u,i=o.dataToPoint(l))}return a??=nI.rect,a===nI.rect&&(r||={x:0,y:0,width:t.getWidth(),height:t.getHeight()},i=[r.x+r.width/2,r.y+r.height/2]),{type:a,refContainer:r,refPoint:i,boxCoordFrom:s}}function Ese(e,t,n,r,i,a){var o=!i||!i.hv||i.hv[0],s=!i||!i.hv||i.hv[1],c=i&&i.boundingMode||`all`;if(a||=e,a.x=e.x,a.y=e.y,!o&&!s)return!1;var l;if(c===`raw`)l=e.type===`group`?new Aw(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(l=e.getBoundingRect(),e.needLocalTransform()){var u=e.getLocalTransform();l=l.clone(),l.applyTransform(u)}var d=tI(zS({width:l.width,height:l.height},t),n,r),f=o?d.x-l.x:0,p=s?d.y-l.y:0;return c===`raw`?(a.x=f,a.y=p):(a.x+=f,a.y+=p),a===e&&e.markRedraw(),!0}function iI(e){var t=e.layoutMode||e.constructor.layoutMode;return eC(t)?t:t?{type:t}:null}function aI(e,t,n){var r=n&&n.ignoreSize;!X(r)&&(r=[r,r]);var i=o(QF[0],0),a=o(QF[1],1);c(QF[0],e,i),c(QF[1],e,a);function o(n,i){var a={},o=0,c={},l=0,u=2;if(ZF(n,function(t){c[t]=e[t]}),ZF(n,function(e){Z(t,e)&&(a[e]=c[e]=t[e]),s(a,e)&&o++,s(c,e)&&l++}),r[i])return s(t,n[1])?c[n[2]]=null:s(t,n[2])&&(c[n[1]]=null),c;if(l===u||!o)return c;if(o>=u)return a;for(var d=0;d=0;o--)a=RS(a,n[o],!0);t.defaultOption=a}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+`Index`,r=e+`Id`;return Vk(this.ecModel,e,{index:this.get(n,!0),id:this.get(r,!0)},t)},t.prototype.getBoxLayoutParams=function(){return Tse(this,!1)},t.prototype.getZLevelKey=function(){return``},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type=`component`,e.id=``,e.name=``,e.mainType=``,e.subType=``,e.componentIndex=0}(),t}(dN);NC(sI,dN),RC(sI),yse(sI),jP(sI,kse);function kse(e){var t=[];return Y(sI.getClassesByMainType(e),function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])}),t=US(t,function(e){return OC(e).main}),e!==`dataset`&&BS(t,`dataset`)<=0&&t.unshift(`dataset`),t}var cI=Lk(),Ase=Lk(),lI=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var r=Dk(this.get(`color`,!0)),i=this.get(`colorLayer`,!0);return dI(this,cI,r,i,e,t,n)},e.prototype.clearColorPalette=function(){Mse(this,cI)},e}();function uI(e,t,n,r){return dI(e,Ase,Dk(e.get([`aria`,`decal`,`decals`])),null,t,n,r)}function jse(e,t){for(var n=e.length,r=0;rt)return e[r];return e[n-1]}function dI(e,t,n,r,i,a,o){a||=e;var s=t(a),c=s.paletteIdx||0,l=s.paletteNameMap=s.paletteNameMap||{};if(l.hasOwnProperty(i))return l[i];var u=o==null||!r?n:jse(r,o);if(u||=n,u&&u.length){var d=u[c];return i&&(l[i]=d),s.paletteIdx=(c+1)%u.length,d}}function Mse(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var Nse=/\{@(.+?)\}/g,fI=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),r=this.getRawValue(e,t),i=n.getRawIndex(e),a=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,`style`),c=s&&s[n.getItemVisual(e,`drawType`)||`fill`],l=s&&s.stroke,u=this.mainType,d=u===`series`,f=n.userOutput&&n.userOutput.get();return{componentType:u,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:a,dataIndex:i,data:o,dataType:t,value:r,color:c,borderColor:l,dimensionNames:f?f.fullDimensions:null,encode:f?f.encode:null,$vars:[`seriesName`,`name`,`value`]}},e.prototype.getFormattedLabel=function(e,t,n,r,i,a){t||=`normal`;var o=this.getData(n),s=this.getDataParams(e,n);if(a&&(s.value=a.interpolatedValue),r!=null&&X(s.value)&&(s.value=s.value[r]),i||=o.getItemModel(e).get(t===`normal`?[`label`,`formatter`]:[t,`label`,`formatter`]),XS(i))return s.status=t,s.dimensionIndex=r,i(s);if(ZS(i))return YF(i,s).replace(Nse,function(t,n){var r=n.length,i=n;i.charAt(0)===`[`&&i.charAt(r-1)===`]`&&(i=+i.slice(1,r-1));var s=KN(o,e,i);if(a&&X(a.interpolatedValue)){var c=o.getDimensionIndex(i);c>=0&&(s=a.interpolatedValue[c])}return s==null?``:s+``})},e.prototype.getRawValue=function(e,t){return KN(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function pI(e){var t,n;return eC(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function mI(e){return new Pse(e)}var Pse=function(){function e(e){e||={},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t=this._upstream,n=e&&e.skip;if(this._dirty&&t){var r=this.context;r.data=r.outputData=t.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var a=l(this._modBy),o=this._modDataCount||0,s=l(e&&e.modBy),c=e&&e.modDataCount||0;(a!==s||o!==c)&&(i=`reset`);function l(e){return!(e>=1)&&(e=1),e}var u;(this._dirty||i===`reset`)&&(this._dirty=!1,u=this._doReset(n)),this._modBy=s,this._modDataCount=c;var d=e&&e.step;if(this._dueEnd=t?t._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var f=this._dueIndex,p=Math.min(d==null?1/0:this._dueIndex+d,this._dueEnd);if(!n&&(u||f1&&r>0?s:o}};return a;function o(){return t=e?null:a9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+`_`+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,t=this._getUpstreamSourceManagers(),n=!!t.length,r,i;if(vI(e)){var a=e,o=void 0,s=void 0,c=void 0;if(n){var l=t[0];l.prepareSource(),c=l.getSource(),o=c.data,s=c.sourceFormat,i=[l._getVersionSign()]}else o=a.get(`data`,!0),s=nC(o)?uA:oA,i=[];var u=this._getSourceMetaRawOption()||{},d=c&&c.metaRawOption||{},f=sC(u.seriesLayoutBy,d.seriesLayoutBy)||null,p=sC(u.sourceHeader,d.sourceHeader),m=sC(u.dimensions,d.dimensions);r=f!==d.seriesLayoutBy||!!p!=!!d.sourceHeader||m?[SN(o,{seriesLayoutBy:f,sourceHeader:p,dimensions:m},s)]:[]}else{var h=e;if(n){var g=this._applyTransform(t);r=g.sourceList,i=g.upstreamSignList}else r=[SN(h.get(`source`,!0),this._getSourceMetaRawOption(),null)],i=[]}this._setLocalSource(r,i)},e.prototype._applyTransform=function(e){var t=this._sourceHost,n=t.get(`transform`,!0),r=t.get(`fromTransformResult`,!0);r!=null&&e.length!==1&&yI(``);var i,a=[],o=[];return Y(e,function(e){e.prepareSource();var t=e.getSource(r||0);r!=null&&!t&&yI(``),a.push(t),o.push(e._getVersionSign())}),n?i=Hse(n,a,{datasetIndex:t.componentIndex}):r!=null&&(i=[wN(a[0])]),{sourceList:i,upstreamSignList:o}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),t=0;t1||n>0&&!e.noHeader;return Y(e.blocks,function(e){var n=OI(e);n>=t&&(t=n+ +(r&&(!n||EI(e)&&!e.noHeader)))}),t}return 0}function Jse(e,t,n,r){var i=t.noHeader,a=Xse(OI(t)),o=[],s=t.blocks||[];dC(!s||X(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Z(l,c)){var u=new qoe(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}Y(s,function(n,i){var s=t.valueFormatter,c=DI(n)(s?J(J({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):AI(r,o.join(``),i?n:a.html);if(i)return d;var f=KF(t.header,`ordinal`,e.useUTC),p=wI(r,e.renderMode).nameStyle,m=CI(r);return e.renderMode===`richText`?jI(e,f,p)+a.richText+d:AI(r,`
`+KP(f)+`
`+d,n)}function Yse(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=X(e)?e:[e],US(e,function(e,t){return KF(e,X(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||Q.color.secondary,i),f=a?``:KF(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=wI(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:jI(e,f,v))+(o?``:$se(e,m,h,g,y)):AI(r,(s?``:d)+(a?``:Zse(f,!s,v))+(o?``:Qse(m,h,g,y)),n)}}function kI(e,t,n,r,i,a){if(e)return DI(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function Xse(e){return{html:Kse[e],richText:qse[e]}}function AI(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=CI(e);return`
`+t+r+`
`}function Zse(e,t,n){var r=t?`margin-left:2px`:``;return``+KP(e)+``}function Qse(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=X(e)?e:[e],``+US(e,function(e){return KP(e)}).join(`  `)+``}function jI(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function $se(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(X(t)?t.join(` `):t,a)}function ece(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return XF(n)}function MI(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var NI=function(){function e(){this.richTextStyles={},this._nextStyleNameId=vk()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=Cse({color:t,type:e,renderMode:n,markerId:r});return ZS(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};X(t)?Y(t,function(e){return J(n,e)}):J(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function tce(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=X(s),l=ece(t,n),u,d,f,p;if(o>1||c&&!o){var m=nce(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=KN(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=Pk(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return TI(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[TI(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!fC(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function nce(e,t,n,r,i){var a=t.getData(),o=WS(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?Y(r,function(e){u(KN(a,n,e),e)}):Y(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(TI(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var PI=Lk();function FI(e,t){return e.getName(t)||e.getId(t)}var II=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=mI({count:ice,reset:ace}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(PI(this).sourceManager=new Wse(this)).prepareSource();var r=this.getInitialData(e,n);RI(r,this),this.dataTask.context.data=r,PI(this).dataBeforeProcessed=r,LI(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=iI(this),r=n?oI(e):{},i=this.subType;sI.hasClass(i)&&(i+=`Series`),RS(e,t.getTheme().get(this.subType)),RS(e,this.getDefaultOption()),Ok(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&aI(e,r,n)},t.prototype.mergeOption=function(e,t){e=RS(this.option,e,!0),this.fillDataTextStyle(e.data);var n=iI(this);n&&aI(this.option,e,n);var r=PI(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);RI(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,PI(this).dataBeforeProcessed=i,LI(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!nC(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return tce({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if(CC.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=lI.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`)this.option.selectedMap={},this._selectedDataIndicesMap={};else for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[FI(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){eC(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return sI.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(sI);VS(II,fI),VS(II,lI),NC(II,sI);function LI(e){var t=e.name;Pk(e)||(e.name=rce(e)||t)}function rce(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return Y(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function ice(e){return e.model.getRawData().count()}function ace(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),oce}function oce(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function RI(e,t){Y(Lre(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,YS(sce,t))})}function sce(e,t){var n=zI(e);return n&&n.setOutputEnd((t||this).count()),t}function zI(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}var cce=xO.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),lce={line:Rj,rect:OO,roundRect:OO,square:OO,circle:bj,diamond:xO.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:xO.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:xO.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:cce},uce={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},BI={};Y(lce,function(e,t){BI[t]=new e});var dce=xO.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=Xw(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=BI[r];i||=(r=`rect`,BI[r]),uce[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function fce(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||Q.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function VI(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?gM(e.slice(8),new Aw(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?hM(e.slice(7),{},new Aw(t,n,r,i),o?`center`:`cover`):new dce({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=fce,a&&c.setColor(a),c}function HI(e){return X(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function UI(e,t){if(e!=null)return X(e)||(e=[e,e]),[tk(e[0],t[0])||0,tk(sC(e[1],e[0]),t[1])||0]}var pce=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e){return kP(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new yj,n=VI(`line`,0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var r=this.getData().getVisual(`symbol`),i=this.getData().getVisual(`symbolRotate`),a=r===`none`?`circle`:r,o=e.itemHeight*.8,s=VI(a,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);return t.add(s),s.setStyle(e.itemStyle),s.rotation=(e.iconRotate===`inherit`?i:e.iconRotate||0)*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),a.indexOf(`empty`)>-1&&(s.style.stroke=s.style.fill,s.style.fill=Q.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(II);function WI(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=KN(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var KI=function(e){vS(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=VI(e,-1,-1,2,2,null,a);o.attr({z2:sC(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=mce,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){BA(this.childAt(0))},t.prototype.downplay=function(){VA(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):nM(f,p,o,n),cM(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,rM(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=ZM(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=UI(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof CO){var S=a.style;a.useStyle(J({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(J({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;XM(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):WI(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),$A(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=rA(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&aM(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();aM(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return HI(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(yj);function mce(e,t){this.parent.drift(e,t)}function qI(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function JI(e){return e!=null&&!eC(e)&&(e={isIgnore:e}),e||{}}function YI(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:ZM(t),cursorStyle:t.get(`cursor`)}}function XI(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var ZI=function(){function e(e){this.group=new yj,this._SymbolCtor=e||KI}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=JI(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=YI(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);qI(e,i,r,t)&&XI(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!qI(e,p,u,t))n.remove(f);else{var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):nM(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i0?n=r[0]:r[1]<0&&(n=r[1]),n}function $I(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function eL(e,t){return!isFinite(e)||!isFinite(t)}var gce=typeof Float32Array<`u`?Float32Array:void 0,_ce=typeof Float64Array<`u`?Float64Array:void 0;function tL(e){return nL({ctor:gce},e).arr}function nL(e,t){var n=e.arr,r=e.ctor;if(t>lk&&(t=lk),!n||e.typed&&n.length=i||h<0)break;if(eL(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||eL(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,F=void 0;if(s===`x`){P=Math.abs(A),F=Math.abs(j);var ee=E>0?1:-1;p=_-ee*P*o,m=v,O=_+ee*F*o,k=v}else if(s===`y`){P=Math.abs(M),F=Math.abs(N);var I=D>0?1:-1;p=_,m=v-I*P*o,O=_,k=v+I*F*o}else P=Math.sqrt(A*A+M*M),F=Math.sqrt(j*j+N*N),T=F/(F+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=rL(O,iL(S,_)),k=rL(k,iL(C,v)),O=iL(O,rL(S,_)),k=iL(k,rL(C,v)),E=O-_,D=k-v,p=_-E*P/F,m=v-D*P/F,p=rL(p,iL(l,_)),m=rL(m,iL(u,v)),p=iL(p,rL(l,_)),m=iL(m,rL(u,v)),E=_-p,D=v-m,O=_+E*F/P,k=v+D*F/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var oL=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),bce=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new oL},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&eL(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?FT(i,u,f,m,e,s):FT(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?NT(a,d,p,h,b):NT(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(xO),xce=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(oL),Sce=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new xce},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&eL(n[a*2-2],n[a*2-1]);a--);for(;i=0,a=e.fill||Q.color.neutral99;yL(r,t);var o=r.textFill==null;return i?o&&(r.textFill=n.insideFill||Q.color.neutral00,!r.textStroke&&n.insideStroke&&(r.textStroke=n.insideStroke),!r.textStroke&&(r.textStroke=a),r.textStrokeWidth??=2):(o&&(r.textFill=e.fill||n.outsideFill||Q.color.neutral00),!r.textStroke&&n.outsideStroke&&(r.textStroke=n.outsideStroke)),r.text=t.text,r.rich=t.rich,Y(t.rich,function(e){yL(e,e)}),r}function yL(e,t){t&&(Z(t,`fill`)&&(e.textFill=t.fill),Z(t,`stroke`)&&(e.textStroke=t.fill),Z(t,`lineWidth`)&&(e.textStrokeWidth=t.lineWidth),Z(t,`font`)&&(e.font=t.font),Z(t,`fontStyle`)&&(e.fontStyle=t.fontStyle),Z(t,`fontWeight`)&&(e.fontWeight=t.fontWeight),Z(t,`fontSize`)&&(e.fontSize=t.fontSize),Z(t,`fontFamily`)&&(e.fontFamily=t.fontFamily),Z(t,`align`)&&(e.textAlign=t.align),Z(t,`verticalAlign`)&&(e.textVerticalAlign=t.verticalAlign),Z(t,`lineHeight`)&&(e.textLineHeight=t.lineHeight),Z(t,`width`)&&(e.textWidth=t.width),Z(t,`height`)&&(e.textHeight=t.height),Z(t,`backgroundColor`)&&(e.textBackgroundColor=t.backgroundColor),Z(t,`padding`)&&(e.textPadding=t.padding),Z(t,`borderColor`)&&(e.textBorderColor=t.borderColor),Z(t,`borderWidth`)&&(e.textBorderWidth=t.borderWidth),Z(t,`borderRadius`)&&(e.textBorderRadius=t.borderRadius),Z(t,`shadowColor`)&&(e.textBoxShadowColor=t.shadowColor),Z(t,`shadowBlur`)&&(e.textBoxShadowBlur=t.shadowBlur),Z(t,`shadowOffsetX`)&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Z(t,`shadowOffsetY`)&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Z(t,`textShadowColor`)&&(e.textShadowColor=t.textShadowColor),Z(t,`textShadowBlur`)&&(e.textShadowBlur=t.textShadowBlur),Z(t,`textShadowOffsetX`)&&(e.textShadowOffsetX=t.textShadowOffsetX),Z(t,`textShadowOffsetY`)&&(e.textShadowOffsetY=t.textShadowOffsetY))}var bL=function(){function e(){}return e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();RC(bL);var kce=0,xL=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++kce,this._onCollect=e.onCollect}return e.createByAxisModel=function(t){var n=t.option,r=n.data,i=r&&US(r,Ace);return new e({categories:i,needCollect:!i,deduplication:n.dedplication!==!1})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!ZS(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,this._onCollect&&this._onCollect(e,t),t;var r=this._getOrCreateMap();return t=r.get(e),t??(n?(t=this.categories.length,this.categories[t]=e,r.set(e,t),this._onCollect&&this._onCollect(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||=_C(this.categories)},e}();function Ace(e){return eC(e)&&e.value!=null?e.value:e+``}var SL=qS({needTransform:1,normalize:1,scale:1,transformIn:1,transformOut:1,contain:1,getExtent:1,getExtentUnsafe:1,setExtent:1,setExtent2:1,getFilter:1,sanitize:1,getDefaultStartValue:1,freeze:1});function CL(e,t,n){var r;e||={};var i=oF();if(i){var a=i.createBreakScaleMapper(t,n);a.hasBreaks()&&(Y(SL,function(t){a[t]&&(e[t]=JS(a[t],a))}),r=a)}return r??Mce(e,n),{brk:r,mapper:e}}function wL(e,t){Y(SL,function(n){e[n]=t[n]})}function TL(e,t){e.freeze=bC}function EL(e){return e.getExtentUnsafe(0,2)}function DL(e,t){return e.getExtentUnsafe(1,t)||e.getExtentUnsafe(0,t)}function jce(e){var t=DL(e,3);return t[1]-t[0]}function OL(e){var t=e.getExtentUnsafe(0,3);return t[1]-t[0]}function Mce(e,t){var n=e||{},r=[];return n._extents=r,r[0]=t?t.slice():Wk(),J(n,Nce),n}var Nce={needTransform:function(){return!1},normalize:function(e){var t=this._extents[1]||this._extents[0];return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])},scale:function(e){var t=this._extents[1]||this._extents[0];return e*(t[1]-t[0])+t[0]},transformIn:function(e){return e},transformOut:function(e){return e},contain:function(e){var t=DL(this,null);return e>=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){kL(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),kL(r,e,t,n)},freeze:function(){}};function kL(e,t,n,r){Yk(n,r)&&(e[t][0]=n,e[t][1]=r)}function AL(e){return jL(e)||NL(e)}function jL(e){return e.type===`interval`}function ML(e){return e.type===`time`}function NL(e){return e.type===`log`}function PL(e){return e.type===`ordinal`}function FL(e){var t=mk(e),n=ZO(10,t),r=JO(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,ik(r*n,-t)}function IL(e){return ok(e)+2}function LL(e,t){return QO(e)/QO(t)}function RL(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var UL=function(e){vS(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,wL(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new xL({}),X(i)&&(i=new xL({categories:US(i,function(e){return eC(e)?e.value:e})})),r._ordinalMeta=i;var a=CL(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,TL(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:ZS(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=JO(e),e},t.prototype.getTicks=function(){var e=[];return HL(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null)this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;else{for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=GO(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=GO(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=ik(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=ik(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?ik(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return WL(this,e,cF(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=ok(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),UF(ik(e.value,n,!0))},t.type=`interval`,t}(bL);bL.registerClass(GL);var KL=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function ZL(e){var t=30*pF;return e/=t,e>6?6:e>3?3:e>2?2:1}function QL(e){return e/=fF,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function $L(e,t){return e/=t?dF:uF,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function eR(e){return KO(hk(e,!0),1)}function tR(e,t,n){var r=Math.max(0,BS(bF,t)-1);return kF(new Date(e),bF[r],n).getTime()}function nR(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function rR(e,t,n,r,i,a){var o=xF,s=0;function c(e,t,n,i,o,c,l){for(var u=nR(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!YL(TF(e),r[0],r[1],n)){s&&(i=[{value:tR(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=GS(US(u,function(e){return GS(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=JL.length,l=Math.min(KL(JL,a,0,c),c-1),u=JL[l][1],d=JL[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};bL.registerClass(qL);var aR=0,oR=1,sR=2,cR=function(e){vS(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=GL.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[aR]=i[oR]=a[aR]=a[oR]=NaN,wL(r,t.mapperMethods);var s=oF(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},sR,l),r.powStub=new GL({breakParsed:l.original}),r.intervalStub=new GL({breakParsed:l.transformed}),TL(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=oF(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return US(i.getTicks(e||{}),function(e){var i=e.value,o=RL(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,cF(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return WL(this,e,cF(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(LL(e,this.base))},scale:function(e){return RL(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=LL(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return lR.depth=n,uR.lookup=this._lookup,RL(n===2?e:this.intervalStub.transformOut(e,lR),this.base,uR)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!Yk(t,n)||t<=0||n<=0)){var r=dR,i=dR;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[aR]=t,r[oR]=n);var o=this.base;this.intervalStub.setExtent2(e,i[aR]=LL(t,o),i[oR]=LL(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return Yk(t[0],t[1])&&xk(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(bL);bL.registerClass(cR);var lR={},uR={},dR=[],fR={value:1,category:1,time:1,log:1},pR=Lk();function mR(e){var t=e.get(`type`);return(t==null||!Z(fR,t)&&!bL.getClass(t))&&(t=`value`),t}function hR(e,t,n){var r=oF(),i;switch(r&&(i=ER(e,t,n)),t){case`category`:return new UL({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:Wk()});case`time`:return new qL({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new cR({logBase:e.get(`logBase`),breakOption:i});case`value`:return new GL({breakOption:i});default:return new((bL.getClass(t))||GL)({})}}function gR(e,t,n){var r=n?DL(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return Yk(i,a)?i===t||a===t?2:it?1:3:3}function _R(e){pR(e).noOnMyZero=!0}function vR(e){return pR(e).noOnMyZero}function yR(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=SF(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(ZS(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(XS(t)){if(e.type===`category`)return function(n,r){return t(bR(e,n),n.value-e.scale.getExtent()[0],null)};var r=oF();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(bR(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function bR(e,t){var n=e.scale;return PL(n)?n.getLabel(t):t.value}function xR(e){return e.get(`interval`)??`auto`}function SR(e){return e.type===`category`&&xR(e.getLabelModel())===0}function CR(e,t){var n={};return Y(e.mapDimensionsAll(t),function(t){n[OP(e,t)]=!0}),qS(n)}function wR(e){return e===`middle`||e===`center`}function TR(e){return e.getShallow(`show`)}function ER(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!oF()||!n||!DR(t)?void 0:r}function DR(e){return e!==`category`}function OR(e,t,n,r,i,a){var o=NL(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=BL(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function kR(e,t){return PL(e)?e.getRawOrdinalNumber(t.value):t.value}function AR(e,t){return PL(e)&&!!t.get(`boundaryGap`)}function jR(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function RR(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=US(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=LR(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;Y(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new Gj(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function zR(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&BR(a,t))){var o=t.mapDimension(a.dim),s={};return Y(a.getViewLabels(),function(e){e.tick.offInterval||(s[kR(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function BR(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function VR(e){for(var t=e.length/2;t>0&&eL(e[t*2-2],e[t*2-1]);t--);return t-1}function HR(e,t){return[e[t*2],e[t*2+1]]}function UR(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}}return{range:[s,c],t:(t-a)/(o-a)}}function WR(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}rA(f).seriesIndex=e.seriesIndex,$A(f,k,A,j);var N=PR(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var F=a.getCalculationInfo(`stackedOnSeries`),ee=0;p.useStyle(zS(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),F&&(ee=PR(F.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:ee,smoothMonotone:P,connectNulls:x}),tj(p,e,`areaStyle`),rA(p).seriesIndex=e.seriesIndex,$A(p,k,A,j)}var I=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=I)}),this._polyline.onHoverStateChange=I,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var te=e.get(`triggerEvent`),L=e.get(`triggerLineEvent`),ne=L===!0||te===!0||te===`line`,re=L===!0||te===!0||te===`area`;this.packEventData(e,f,ne),p&&this.packEventData(e,p,re)},t.prototype.packEventData=function(e,t,n){rA(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=Ik(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(eL(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new KI(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else lL.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=Ik(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else lL.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;FA(this._polyline,e),t&&FA(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new bce({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new Sce({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);XS(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=XS(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=XS(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(WR(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new MO({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=VR(o);c>=0&&(XM(a,ZM(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?WI(i,e):GI(i,n)},enableTextSetter:!0},KR(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=UR(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=HR(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=_ae(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=HR(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=aN(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=yce(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=IR(u.stackedOnCurrent,u.current,n,i,o),d=IR(u.current,null,n,i,o),m=IR(u.stackedOnNext,u.next,n,i,o),p=IR(u.next,null,n,i,o)),NR(d,p)>3e3||c&&NR(f,m)>3e3)s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));else{s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),nM(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),nM(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;ZS(i)?p=YR[i]:XS(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,XR))}}}}}function QR(e){e.registerChartView(qR),e.registerSeriesModel(pce),e.registerLayout(JR(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,ZR(`line`))}var $R=Lk(),ez=Lk(),tz={estimate:1,determine:2};function nz(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function rz(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:US(az(n,r),function(t,n){return{formattedLabel:yR(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?oz(e,t):lz(e)}function iz(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:az(i,r)}:e.type===`category`?cz(e,t):{ticks:r.getTicks(n)}}function az(e,t){var n=t.getExtent(),r=[];return Y(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),Qk(r,Sae,null),ak(r),US(r,function(e){return{value:e}})}function oz(e,t){var n=e.getLabelModel(),r=sz(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function sz(e,t,n){var r=dz(e),i=xR(t),a=n.kind===tz.estimate;if(!a){var o=pz(r,i);if(o)return o}var s,c;XS(i)?s=bz(e,i,!1):(c=i===`auto`?hz(e,n):i,s=bz(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return mz(r,i,l),!0}):mz(r,i,l),l}function cz(e,t){var n=uz(e),r=xR(t),i=pz(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),XS(r))a=bz(e,r,!0);else if(r===`auto`){var s=sz(e,e.getLabelModel(),nz(tz.determine));o=s.labelCategoryInterval,a=US(s.labels,function(e){return e.tick})}else o=r,a=bz(e,o,!0);return mz(n,r,{ticks:a,tickCategoryInterval:o})}function lz(e){var t=e.scale.getTicks(),n=yR(e);return{labels:US(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var uz=fz(`axisTick`),dz=fz(`axisLabel`);function fz(e){return function(t){return ez(t)[e]||(ez(t)[e]={list:[]})}}function pz(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=Gw(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===tz.estimate?(t.out.noPxChangeTryDetermine.push(JS(_z,null,e,S,c)),S):vz(e,S,c)??S}function _z(e,t,n){return vz(e,t,n)==null}function vz(e,t,n){var r=$R(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function yz(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function bz(e,t,n){var r=yR(e),i=e.scale,a=[],o=XS(t);return HL(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var xz=Lk();function Sz(e){xz(e).prepare={}}function Cz(e){xz(e).fullUpdate={}}function wz(e){return xz(e).prepare}function Tz(e){return xz(e).fullUpdate}var Ez=Zk(),Dz=Lk(),Oz=Lk();function kz(e,t){var n=e.model,r=Dz(Tz(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function Az(e,t){return Nz(kz(e,t))}function jz(e,t){var n=[];return Mz(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),xk(n)&&n>0&&xk(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*Kz,e.w2=e.w*n/r)}var Xz=[0,1],Zz=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),ek(e,Xz,Qz(this),t)},e.prototype.coordToData=function(e,t){var n=ek(e,Qz(this),Xz,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=US(iz(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(kR(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=$z(this,n,r);return US(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(PL(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),US(this.scale.getMinorTicks(e),function(e){return US(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=nz(tz.determine),rz(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return qz(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=nz(tz.determine),gz(this,e)},e}();function Qz(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function $z(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=qz(e).w;if(!i)return!1;Y(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var eB=function(e){vS(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(Zz),tB=[`label`,`labelLine`,`layoutOption`,`priority`,`defaultAttr`,`marginForce`,`minMarginForce`,`marginDefault`,`suggestIgnore`],nB=1,rB=2,iB=nB|rB;function aB(e,t,n){n||=iB,t?e.dirty|=n:e.dirty&=~n}function oB(e,t){return t||=iB,e.dirty==null||!!(e.dirty&t)}function sB(e){if(e)return oB(e)&&Pce(e,e.label,e),e}function Pce(e,t,n){var r=t.getComputedTransform();e.transform=zM(e.transform,r);var i=e.localRect=RM(e.localRect,t.getBoundingRect()),a=t.style,o=a.margin,s=n&&n.marginForce,c=n&&n.minMarginForce,l=n&&n.marginDefault,u=a.__marginType;u==null&&l&&(o=l,u=oN.textMargin);for(var d=0;d<4;d++)cB[d]=u===oN.minMargin&&c&&c[d]!=null?c[d]:s&&s[d]!=null?s[d]:o?o[d]:0;u===oN.textMargin&&AM(i,cB,!1,!1);var f=e.rect=RM(e.rect,i);return r&&f.applyTransform(r),u===oN.minMargin&&AM(f,cB,!1,!1),e.axisAligned=IM(r),(e.label=e.label||{}).ignore=t.ignore,aB(e,!1),aB(e,!0,rB),e}var cB=[0,0,0,0];function Fce(e,t,n){return e.transform=zM(e.transform,n),e.localRect=RM(e.localRect,t),e.rect=RM(e.rect,t),n&&e.rect.applyTransform(n),e.axisAligned=IM(n),e.obb=void 0,(e.label=e.label||{}).ignore=!1,e}function Ice(e,t){if(e){e.label.x+=t.x,e.label.y+=t.y,e.label.markRedraw();var n=e.transform;n&&(n[4]+=t.x,n[5]+=t.y);var r=e.rect;r&&(r.x+=t.x,r.y+=t.y);var i=e.obb;i&&i.fromBoundingRect(e.localRect,n)}}function lB(e,t){for(var n=0;n.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new Aw(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var _B=QC(),vB=new Aw(0,0,0,0),yB=function(e,t,n,r,i,a){if(wR(e.nameLocation)){var o=a.stOccupiedRect;o&&bB(Fce({},o,a.transGroup.transform),r,i)}else xB(a.labelInfoList,a.dirVec,r,i)};function bB(e,t,n){var r=new _w;dB(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&Ice(t,r)}function xB(e,t,n,r){for(var i=_w.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):dk(r-pB)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),Uce=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],Wce={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(mw(u,u,l),mw(d,d,l));var p=J({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&lF(r.axis.scale))fB().buildAxisBreakLine(r,i,a,m);else{var h=new Rj(J({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));yM(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);ZS(g)&&(g=[g,g]),(ZS(_)||$S(_))&&(_=[_,_]);var v=UI(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];Y([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=VI(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){EB(t,i,s)&&CB(e,t,n,r,i,a,o,tz.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){EB(t,i,s)&&CB(e,t,n,r,i,a,o,tz.determine);var c=Jce(e,i,a,r);qce(e,t.labelLayoutList,c),Yce(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(AB(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new _w(0,0),_=new _w(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=QC();_.transform(rw(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*pB/180);var b,x;wR(u)?b=SB.innerTextLayout(e.rotation,y??e.rotation,d):(b=Gce(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=oC(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new MO({x:g.x,y:g.y,rotation:b.rotation,silent:SB.isLabelSilent(r),style:QM(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(NM({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=SB.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,rA(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=sB({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:wR(u)?Bce[E]:Vce[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function CB(e,t,n,r,i,a,o,s){DB(t)||Xce(e,t,i,s,r,o);var c=t.labelLayoutList;Zce(e,r,c,a),ele(r,e.rotation,c);var l=e.optionHideOverlap;Kce(r,c,l),l&&Lce(GS(c,function(e){return e&&!e.label.ignore})),Hce(e,n,r,c)}function Gce(e,t,n,r){var i=uk(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return dk(i-pB/2)?(o=c?`bottom`:`top`,a=`center`):dk(i-pB*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=ipB/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function Kce(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(SR(r))return;function a(e,a,o){var s=sB(t[a]),c=sB(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=mB(s.label).labelInfo.tick;if(ML(l)&&u.notNice||PL(l)&&u.offInterval){wB(s.label);return}}if(e===!1||s.suggestIgnore)wB(s.label);else if(c.suggestIgnore)wB(c.label);else{var d=.1;if(!n){var f=[0,0,0,0];s=lB({marginForce:f},s),c=lB({marginForce:f},c)}dB(s,c,null,{touchThreshold:d})&&wB(e?c.label:s.label)}}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function qce(e,t,n){e.showMinorTicks||Y(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=PB(e,t.get(`startValue`,!0)),x=b!=null;!xk(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),xk(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),NB(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),NB(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function NB(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),Xk(t))}function PB(e,t){return t==null?null:aC(t)?NaN:e.parse(t)}function sle(e,t){var n;if(PL(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=X(r)?r:[r,r]}return[FB(n[0]),FB(n[1])]}function FB(e){return Yw(typeof e==`boolean`?0:e,1)||0}function IB(e){var t=ale(e.scale);return t.extent||=Wk(),t}function cle(e,t){IB(e).dimIdxInCoord=t.get(e.dim)}function LB(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||lle(n,e,i,r,t)}function lle(e,t,n,r,i){var a=IB(t),o=a.extent,s=!1;Pz(t,function(r){if(r.boxCoordinateSystem){var i=TP(r).coord,c=a.dimIdxInCoord;if(c>=0&&X(i)){var l=i[c];l!=null&&!X(l)&&Gk(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;Y(CR(u,n),function(e){vae(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=fle(e,t,r);RB(e,new MB(e,r,o,s,c),i),a.extent=null}function ule(e,t){var n=e.scale;RB(n,new MB(n,e.model,t,!1,!1),ole)}function RB(e,t,n){e.rawExtentInfo=t,t.from=n}function dle(e,t){zB.set(e,t)}var zB=_C();function BB(e,t,n,r,i){e.rawExtentInfo||ule({scale:e,model:t},i||Wk());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function fle(e,t,n){var r=AR(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return Rz(t,function(e){a=!!zB.get(e)||a}),a}function ple(e,t,n,r){if(n.ctnShp){var i;if(Rz(e,function(t){var n=zB.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],Kk(i,a[0]),qk(i,a[1]),_R(e))}}),i){var a=t.getExtent();if(PL(t))e.onBand||t.setExtent2(1,GO(a[0],a[0]+i[0]),KO(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=GO(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=KO(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function mle(){Bz(`liPosMinGap`,hle)}function hle(e,t,n){var r=_C(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=XN(u);function f(n){Iz(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),i&&i.hasKey(t.uid)||(o=!0),p+=n.count()}),i&&i.keys().length===r.keys().length||(o=!0),!o&&a!=null)t.liPosMinGap=a;else{nL(VB,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}}var VB=nL({ctor:_ce},50);function gle(e){return function(t,n){var r=qz(t,{fromStat:{key:e}});if(xk(r.w2))return[-r.w2/2,r.w2/2]}}function HB(e,t){return e+`|&`+t}function _le(e){return mle(),{liPosMinGap:!PL(e.scale)}}function vle(e,t,n,r){Wz(e,{key:t,seriesType:n,coordSysType:r,getMetrics:_le})}function yle(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var UB={left:0,right:0,top:0,bottom:0},WB=[`25%`,`25%`],GB=`cartesian2d`,ble=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=oI(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&aI(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&aI(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:UB,outerBoundsContain:`all`,outerBoundsClampWidth:WB[0],outerBoundsClampHeight:WB[1],backgroundColor:Q.color.transparent,borderWidth:1,borderColor:Q.color.neutral30},t}(sI),xle=Zk(),KB=`__ec_stack_`;function qB(e){return e.get(`stack`)||KB+e.seriesIndex}function Sle(e){if(PL(e.axis.scale)){for(var t=qz(e.axis),n=[],r=0;ro&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=KO(u,0);var d=0,f;Y(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return Y(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function Tle(e){return{seriesType:e,overallReset:function(t){var n=HB(e,GB);Lz(t,n,function(t){var r=Cle(t,e);Fz(t,n,function(e){var t=r.columnMap[qB(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function Ele(e){return{seriesType:e,plan:sL(),reset:function(e){if(tle(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=DP(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(yle(i))),p=YB(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&tL(r*3),c=p&&s&&tL(r*3),l=p&&tL(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,qO(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(II);II.registerClass(XB);var kle=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return kP(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=eA(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=MP(XB.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:Q.color.primary,borderWidth:2}},realtimeSort:!1}),t}(XB),ZB=`\0__throttleOriginMethod`,QB=`\0__throttleRate`,$B=`\0__throttleType`;function eV(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function tV(e,t,n,r){var i=e[t];if(i){var a=i[ZB]||i,o=i[$B];if(i[QB]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=eV(a,n,r===`debounce`),i[ZB]=a,i[$B]=r,i[QB]=n}return i}}function nV(e,t){var n=e[t];n&&n[ZB]&&(n.clear&&n.clear(),e[t]=n[ZB])}var Ale=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),rV=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new Ale},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){sM(t,e,rA(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(lL),cV={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=oV(t.x,e.x),s=sV(t.x+t.width,i),c=oV(t.y,e.y),l=sV(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=sV(t.r,e.r),a=oV(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},lV={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new OO({shape:J({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?rV:Nj,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=jle(mV(i),{isRoundCap:l===rV}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?nM:rM)(u,{shape:p},a)}return u}};function Fle(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function uV(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?nM:rM)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?nM:rM)(n,{shape:l},u,i)}function dV(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function Rle(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function mV(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function hV(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;J(u,Nle(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?Ule(i,a.coordinateSystem):Wle(i,a.coordinateSystem),p=ZM(r);XM(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:WI(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,Mle(e,h===`outside`?f:h,mV(o),r.get([`label`,`rotate`]))}koe(m,p,a.getRawValue(n),function(e){return GI(t,e)});var g=r.getModel([`emphasis`]);$A(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),tj(e,r),Rle(i)&&(e.style.fill=`none`,e.style.stroke=`none`,Y(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function zle(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var Ble=function(){function e(){}return e}(),gV=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new Ble},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function Vle(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function yV(e,t,n){if(hL(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function Hle(e,t,n){return new(e.type===`polar`?Nj:OO)({shape:yV(t,n,e),silent:!0,z2:0})}function Ule(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function Wle(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function Gle(e){e.registerChartView(Ple),e.registerSeriesModel(kle),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Tle(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,Ele(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,ZR(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),Ole(e)}function bV(e,t,n,r,i){var a=e+t;n.isSilent(a)||r.eachComponent({mainType:`series`,subType:`pie`},function(e){for(var t=e.seriesIndex,r=e.option.selectedMap,o=i.selected,s=0;s=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&CV(e,i,t,n)}else{CV(e,t,t,n);var a=Xle(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&Jle.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function Xle(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function Zle(e,t,n,r){e.addEventListener(t,n,r)}function Qle(e,t,n,r){e.removeEventListener(t,n,r)}var DV=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function OV(e){return e.which===2||e.which===3}var $le=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=kV(r)/kV(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=eue(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},jV=`silent`;function tue(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:nue}}function nue(){DV(this.event)}var rue=function(e){UC(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(rD),MV=function(){function e(e,t){this.x=e,this.y=t}return e}(),iue=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],NV=new Aw(0,0,0,0),PV=function(e){UC(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new MV(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new rue,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new qle(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Y(iue,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=IV(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new MV(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new MV(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=tue(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new MV(e,t);if(FV(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new Aw(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u===n||u.ignore||u.ignoreCoarsePointer||u.parent&&u.parent.ignoreCoarsePointer||(NV.copy(u.getBoundingRect()),u.transform&&NV.applyTransform(u.transform),NV.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function aue(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||jV}return!1}function FV(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=aue(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==jV)){t.target=o;break}}}function IV(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var LV=32,RV=7;function oue(e){for(var t=0;e>=LV;)t|=e&1,e>>=1;return e+t}function zV(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function sue(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function VV(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function HV(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function cue(e,t){var n=RV,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=RV||m>=RV);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else{for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-VV(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=RV||g>=RV);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),BV(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}}var WV=!1;function GV(){WV||(WV=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function KV(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var lue=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=KV}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)}},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),qV=CC.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function JV(){return new Date().getTime()}var uue=function(e){UC(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){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=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=JV()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)&&(r.ondestroy(),this.removeClip(r)),r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(qV(t),!e._paused&&e.update())}qV(t)},t.prototype.start=function(){this._running||(this._time=JV(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=JV(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=JV()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new nD(e,t.loop);return this.addAnimator(n),n},t}(rD),due=300,YV=CC.domSupported,XV=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:US(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),ZV={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},QV=!1;function $V(e){var t=e.pointerType;return t===`pen`||t===`touch`}function fue(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function eH(e){e&&(e.zrByTouch=!0)}function pue(e,t){return EV(e.dom,new mue(e,t),!0)}function tH(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var mue=function(){function e(e,t){this.stopPropagation=bC,this.stopImmediatePropagation=bC,this.preventDefault=bC,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),nH={mousedown:function(e){e=EV(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=EV(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=EV(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=EV(this.dom,e);var t=e.toElement||e.relatedTarget;tH(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){QV=!0,e=EV(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){QV||(e=EV(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=EV(this.dom,e),eH(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),nH.mousemove.call(this,e),nH.mousedown.call(this,e)},touchmove:function(e){e=EV(this.dom,e),eH(e),this.handler.processGesture(e,`change`),nH.mousemove.call(this,e)},touchend:function(e){e=EV(this.dom,e),eH(e),this.handler.processGesture(e,`end`),nH.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!Fk(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[vH],e},t.prototype.setTheme=function(e){this._theme=new dN(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function Fue(e,t){return e.join(`,`)===t.join(`,`)}var CH=Y,wH=eC,TH=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function EH(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=TH.length;n0?e[n-1].seriesModel:null)}),Gue(e))})}function Gue(e){Y(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=ck(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var BH=function(){function e(){this.group=new yj,this.uid=AP(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();jC(BH),RC(BH);var VH=Lk(),HH={itemStyle:zC(uN,!0),lineStyle:zC(lN,!0)},Kue={lineStyle:`stroke`,itemStyle:`fill`};function UH(e,t){return e.visualStyleMapper||HH[t]||(console.warn(`Unknown style type '`+t+`'.`),HH.itemStyle)}function WH(e,t){return e.visualDrawType||Kue[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var que={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=UH(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=WH(e,r),c=a[s],l=XS(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||XS(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||XS(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=J({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},GH=new dN,Jue={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=UH(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){GH.option=n[r];var o=i(GH);J(e.ensureUniqueItemVisual(t,`style`),o),GH.option.decal&&(e.setItemVisual(t,`decal`,GH.option.decal),GH.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},Yue={performRawSeries:!0,overallReset:function(e){var t=_C();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();VH(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=VH(e).scope,a=WH(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},KH=Math.PI;function Xue(e,t){t||={},zS(t,{text:`loading`,textColor:Q.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:Q.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new yj,r=new OO({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new MO({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new OO({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new Hj({shape:{startAngle:-KH/2,endAngle:-KH/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:KH*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:KH*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var qH=function(){function e(e,t,n,r){this._stageTaskMap=_C(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):eA(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=_C();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;Y(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});dC(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;Y(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=_C(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||mI({plan:tde,reset:nde,count:ide}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||mI({reset:Zue});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=_C(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;dC(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):Y(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,mI({reset:Que,onDirty:ede})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return XS(e)&&(e={overallReset:e,seriesType:ade(e)}),e.uid=AP(`stageHandler`),t&&(e.visualType=t),e},e}();function Zue(e){e.overallReset(e.ecModel,e.api,e.payload)}function Que(e){return e.dirtyOnOverallProgress&&$ue}function $ue(){this.agent.dirty(),this.getDownstream().dirty()}function ede(){this.agent&&this.agent.dirty()}function tde(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function nde(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Dk(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?US(t,function(e,t){return JH(t)}):rde}var rde=JH(0);function JH(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),iU=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],aU=iU.concat([`symbolKeepAspect`]),sde={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&fU(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function pU(e,t,n){for(var r=t.type===`radial`?vde(e,t,n):_de(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:$S(e)?[e]:X(e)?e:null}function gU(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&bde(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=US(n,function(e){return e/i}),r/=i)}return[n,r]}var xde=new cO(!0);function _U(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function vU(e){return typeof e==`string`&&e!==`none`}function yU(e){var t=e.fill;return t!=null&&t!==`none`}function bU(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function xU(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function SU(e,t,n){var r=YC(t.image,t.__image,n);if(ZC(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*xC),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function Sde(e,t,n,r,i){var a,o=_U(n),s=yU(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||xde,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?pU(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?pU(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?SU(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?SU(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=gU(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&xU(e,n),s&&bU(e,n)):(s&&bU(e,n),o&&xU(e,n)),T&&e.setLineDash([])}function Cde(e,t,n){var r=t.__image=YC(n.image,t.__image,t,t.onload);if(r&&ZC(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function wde(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=gU(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(_U(n)&&e.strokeText(i,n.x,n.y),yU(n)&&e.fillText(i,n.x,n.y)):(yU(n)&&e.fillText(i,n.x,n.y),_U(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var CU=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],wU=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function TU(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){MU(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?OD.opacity:o}(r||t.blend!==n.blend)&&(a||=(MU(e,i),!0),e.globalCompositeOperation=t.blend||OD.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[YU]){if(this._disposed)this.id;else{var r,i,a;if(eC(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[YU]=!0,TW(this),!this._model||t){var o=new jue(this._api),s=this._theme,c=this._model=new yH;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},MW);var l={seriesTransition:a,optionChanged:!0};if(n)this[ZU]={silent:r,updateParams:l},this[YU]=!1,this.getZr().wakeUp();else{try{sW(this),uW.update.call(this,null,l)}catch(e){throw this[ZU]=null,this[YU]=!1,e}this._ssr||this._zr.flush(),this[ZU]=null,this[YU]=!1,mW.call(this,r),hW.call(this,r)}}}},t.prototype.setTheme=function(e,t){if(!this[YU]){if(this._disposed)this.id;else{var n=this._model;if(n){var r=t&&t.silent,i=null;this[ZU]&&(r??=this[ZU].silent,i=this[ZU].updateParams,this[ZU]=null),this[YU]=!0,TW(this);try{this._updateTheme(e),n.setTheme(this._theme),sW(this),uW.update.call(this,{type:`setTheme`},i)}catch(e){throw this[YU]=!1,e}this[YU]=!1,mW.call(this,r),hW.call(this,r)}}}},t.prototype._updateTheme=function(e){ZS(e)&&(e=PW[e]),e&&(e=LS(e),e&&zH(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||CC.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return Y(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed)this.id;else{e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;Y(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return Y(r,function(e){e.group.ignore=!1}),a}},t.prototype.getConnectedDataURL=function(e){if(this._disposed)this.id;else{var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(LW[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Y(IW,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(LS(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=TS.createCanvas(),h=lH(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return Y(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new OO({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),Y(u,function(e){var t=new CO({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)}},t.prototype.convertToPixel=function(e,t,n){return dW(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return dW(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return dW(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed)this.id;else{var n=this._model,r;return Y(Rk(n,e),function(e,n){n.indexOf(`Models`)>=0&&Y(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r}},t.prototype.getVisual=function(e,t){var n=this._model,r=Rk(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?sU(i,t):oU(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;Y(Jde,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&cU(i,function(e){var t=rA(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=J({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;Y(AW,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),Kle(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?this.id:this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)this.id;else{this._disposed=!0,this.getDom()&&Uk(this.getDom(),RW,``);var e=this,t=e._api,n=e._model;Y(e._componentsViews,function(e){e.dispose(n,t)}),Y(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete IW[e.id]}},t.prototype.resize=function(e){if(!this[YU]){if(this._disposed)this.id;else{this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[ZU]&&(r??=this[ZU].silent,n=!0,this[ZU]=null),this[YU]=!0,TW(this);try{n&&sW(this),uW.update.call(this,{type:`resize`,animation:J({duration:0},e&&e.animation)})}catch(e){throw this[YU]=!1,e}this[YU]=!1,mW.call(this,r),hW.call(this,r)}}}},t.prototype.showLoading=function(e,t){if(this._disposed)this.id;else if(eC(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),FW[e]){var n=FW[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){this._disposed?this.id:(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=J({},e);return t.type=kW[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)this.id;else if(eC(t)||(t={silent:!!t}),OW[e.type]&&this._model){if(this[YU])this._pendingActions.push(e);else{var n=t.silent;pW.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&CC.browser.weChat&&this._throttledZrFlush(),mW.call(this,n),hW.call(this,n)}}},t.prototype.updateLabelLayout=function(){lU.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)this.id;else{var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},t.internalField=function(){sW=function(e){Sz(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),cW(e,!0),cW(e,!1),t.plan()},cW=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;csC(t.get(`hoverLayerThreshold`),mH.hoverLayerThreshold)&&!CC.node&&!CC.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=BM(e);t.eachRendered(function(e){return HM(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!iM(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(iM(e))return;if(e instanceof xO&&Vae(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}xW=function(e){return new(function(t){vS(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){BA(t,n),CW(e)},n.prototype.leaveEmphasis=function(t,n){VA(t,n),CW(e)},n.prototype.enterBlur=function(t){HA(t),CW(e)},n.prototype.leaveBlur=function(t){UA(t),CW(e)},n.prototype.enterSelect=function(t){WA(t),CW(e)},n.prototype.leaveSelect=function(t){GA(t),CW(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[XU]},n.prototype.usingTHL=function(){return e._usingTHL},n}(pA))(e)},SW=function(e){function t(e,t){for(var n=0;n=0)){GW.push(n);var o=qH.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function qW(e,t){FW[e]=t}function nfe(e,t,n){var r=dde(`registerMap`);r&&r(e,t,n)}var rfe=Vse;WW(GU,que),WW(qU,Jue),WW(qU,Yue),WW(GU,sde),WW(qU,cde),WW(JU,Mde),BW(zH),VW(Ide,Uue),qW(`default`,Xue),UW({type:xA,event:xA,update:xA},bC),UW({type:SA,event:SA,update:SA},bC),UW({type:CA,event:EA,update:CA,action:bC,refineEvent:JW,publishNonRefinedEvent:!0}),UW({type:wA,event:EA,update:wA,action:bC,refineEvent:JW,publishNonRefinedEvent:!0}),UW({type:TA,event:EA,update:TA,action:bC,refineEvent:JW,publishNonRefinedEvent:!0});function JW(e,t,n,r){return{eventContent:{selected:Iae(n),isFromClick:t.isFromClick||!1}}}zW(`default`,{}),zW(`dark`,rU);var YW=[],ife={registerPreprocessor:BW,registerProcessor:VW,registerPostInit:Qde,registerPostUpdate:$de,registerUpdateLifecycle:HW,registerAction:UW,registerCoordinateSystem:efe,registerLayout:tfe,registerVisual:WW,registerTransform:rfe,registerLoading:qW,registerMap:nfe,registerImpl:ude,PRIORITY:Gde,ComponentModel:sI,ComponentView:BH,SeriesModel:II,ChartView:lL,registerComponentModel:function(e){sI.registerClass(e)},registerComponentView:function(e){BH.registerClass(e)},registerSeriesModel:function(e){II.registerClass(e)},registerChartView:function(e){lL.registerClass(e)},registerCustomSeries:function(e,t){fde(e,t)},registerSubTypeDefaulter:function(e,t){sI.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){xue(e,t)}};function XW(e){X(e)?Y(e,function(e){XW(e)}):BS(YW,e)>=0||(YW.push(e),XS(e)&&(e={install:e}),e.install(ife))}var afe=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),ZW=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents(`grid`,Bk).models[0]},t.type=`cartesian2dAxis`,t}(sI);VS(ZW,afe);var QW={show:!0,z:0,inverse:!1,name:``,nameLocation:`end`,nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:`...`,placeholder:`.`},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:`auto`,onZeroAxisIndex:null,lineStyle:{color:Q.color.axisLine,width:1,type:`solid`},symbol:[`none`,`none`],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:Q.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:Q.color.axisSplitLine,width:1,type:`solid`}},splitArea:{show:!1,areaStyle:{color:[Q.color.backgroundTint,Q.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:Q.color.neutral00,borderColor:Q.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:`auto`}},ofe=RS({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:`auto`,show:`auto`},axisLabel:{interval:`auto`}},QW),$W=RS({boundaryGap:[0,0],axisLine:{show:`auto`},axisTick:{show:`auto`},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:Q.color.axisMinorSplitLine,width:1}}},QW),sfe={category:ofe,value:$W,time:RS({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:`bold`}}},splitLine:{show:!1}},$W),log:zS({logBase:10},$W)};function eG(e,t,n,r){Y(fR,function(i,a){var o=RS(RS({},sfe[a],!0),r,!0),s=function(e){vS(n,e);function n(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t+`Axis.`+a,n}return n.prototype.mergeDefaultAndTheme=function(e,t){var n=iI(this),r=n?oI(e):{};RS(e,t.getTheme().get(a+`Axis`)),RS(e,this.getDefaultOption()),e.type=tG(e),n&&aI(e,r,n)},n.prototype.optionUpdated=function(){this.option.type===`category`&&(this.__ordinalMeta=xL.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if(t.type===`category`)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.updateAxisBreaks=function(e){var t=fB();return t?t.updateModelAxisBreak(this,e):{breaks:[]}},n.type=t+`Axis.`+a,n.defaultOption=o,n}(n);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+`Axis`,tG)}function tG(e){return e.type||(e.data?`category`:`value`)}var cfe=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return US(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),GS(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),nG=[`x`,`y`];function rG(e){return(e.type===`interval`||e.type===`time`)&&!lF(e)}var lfe=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=GB,t.dimensions=nG,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(rG(e)&&rG(t)){var n=DL(e,null),r=DL(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=iw([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new Aw(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return mw(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return mw(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new Aw(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(cfe);function ufe(e,t){var n=e.scale,r=e.model,i=BB(n,r,r.ecModel,e,null),a=NL(n),o=NL(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=qO(l[0].value-l[1].value),g=qO(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=ik(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=ik(XO(C[0]/E)*E,D),O=ik(YO(C[1]/E)*E,D);var e=JO((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=YO(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}OR(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function iG(e,t){var n=NL(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=zL(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?ffe(r,t):dfe(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=IL(d)),i[0]||(s[0]=ik(YO(s[0]/u)*u,l)),i[1]||(s[1]=ik(XO(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),OR(e,i,o,s,a,c)}function dfe(e,t){var n=VL(t.splitNumber,5),r=OL(e),i=t.minInterval,a=t.maxInterval,o=hk(r/n,!0);i!=null&&oa&&(o=a);var s=IL(o),c=e.getExtent(),l=[ik(XO(c[0]/o)*o,s),ik(YO(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function ffe(e,t){var n=VL(t.splitNumber,10),r=e.getExtent(),i=OL(e),a=KO(pk(i),1);n/i*a<=.5&&(a*=10);var o=IL(a),s=[ik(XO(r[0]/a)*a,o),ik(YO(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function aG(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;pfe(t,n,r,i,null)}function pfe(e,t,n,r,i){var a=BB(e,t,r,n,i),o=jL(e)||ML(e);mfe(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&ple(n,e,a,r)}function mfe(e,t){hfe[e.type](e,t)}var hfe={interval:iG,log:iG,time:iR,ordinal:bC},oG=[[3,1],[0,2]],gfe=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=nG,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;Y(this._axesList,function(e){LB(e,1);var t=e.scale;PL(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=qS(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):aG(i)}Y(n,function(e){vfe(e,e.__alignTo)?aG(e):ufe(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};Y(n.x,function(e){sG(n,`y`,e,i)}),Y(n.y,function(e){sG(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=rI(e,t),i=this._rect=tI(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(uG(a,i),!n){var c=mG(i,o,a,s,t),l=void 0;if(s)fG?(fG(this._axesList,i),uG(a,i)):l=pG(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=gG(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=pG(d,f,p,i,a,c,r))}hG(i,a,tz.determine,null,l,r),Y(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}eC(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];AL(a.scale)&&ER(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&Y(r,function(e){e.__alignTo=n})}function vfe(e,t){return lF(e.scale)||lF(t.scale)||t.scale.getTicks().length<2}function yfe(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function uG(e,t){Y(e.x,function(e){return dG(e,t.x,t.width)}),Y(e.y,function(e){return dG(e,t.y,t.height)})}function dG(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),yfe(e,t)}var fG;function pG(e,t,n,r,i,a,o){hG(r,i,tz.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=KS(s,function(e){return e>0})==null;return AM(r,s,!0,!0,n),uG(i,r),c;function l(e){Y(i[uM[e]],function(t){if(TR(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!aC(t)&&t>1e-4&&(e/=t),e}}function mG(e,t,n,r,i){var a=new gB(_G);return Y(n,function(n){return Y(n,function(n){if(TR(n.model)){var o=!r;n.axisBuilder=rle(e,t,n.model,i,a,o)}})}),a}function hG(e,t,n,r,i,a){var o=n===tz.determine;Y(t,function(t){return Y(t,function(t){TR(t.model)&&(ile(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[uM[1-t]]=e[dM[t]]<=a.refContainer[dM[t]]*.5?0:1-t==1?2:1}Y(t,function(e,t){return Y(e,function(e){TR(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function gG(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=tI(e.get(`outerBounds`,!0)||UB,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||BS([`all`,`axisLabel`],a)<0?`all`:a,s=[nk(sC(e.get(`outerBoundsClampWidth`,!0),WB[0]),t.width),nk(sC(e.get(`outerBoundsClampHeight`,!0),WB[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var _G=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;yB(e,t,n,r,i,a),wR(e.nameLocation)||Y(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&xB(e.labelInfoList,e.dirVec,r,i)})};function vG(e,t){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return yG(n,e,t),n.seriesInvolved&&xG(n,e),n}function yG(e,t,n){var r=t.getComponent(`tooltip`),i=t.getComponent(`axisPointer`),a=i.get(`link`,!0)||[],o=[];Y(n.getCoordinateSystems(),function(n){if(!n.axisPointerEnabled)return;var s=OG(n.model),c=e.coordSysAxesInfo[s]={};e.coordSysMap[s]=n;var l=n.model.getModel(`tooltip`,r);if(Y(n.getAxes(),YS(p,!1,null)),n.getTooltipAxes&&r&&l.get(`show`)){var u=l.get(`trigger`)===`axis`,d=l.get([`axisPointer`,`type`])===`cross`,f=n.getTooltipAxes(l.get([`axisPointer`,`axis`]));(u||d)&&Y(f.baseAxes,YS(p,!d||`cross`,u)),d&&Y(f.otherAxes,YS(p,`cross`,!1))}function p(r,s,u){var d=u.model.getModel(`axisPointer`,i),f=d.get(`show`);if(f&&(f!==`auto`||r||DG(d))){s??=d.get(`triggerTooltip`),d=r?bG(u,l,i,t,r,s):d;var p=d.get(`snap`),m=d.get(`triggerEmphasis`),h=OG(u.model),g=s||p||u.type===`category`,_=e.axesInfo[h]={key:h,axis:u,coordSys:n,axisPointerModel:d,triggerTooltip:s,triggerEmphasis:m,involveSeries:g,snap:p,useHandle:DG(d),seriesModels:[],linkGroup:null};c[h]=_,e.seriesInvolved=e.seriesInvolved||g;var v=SG(a,u);if(v!=null){var y=o[v]||(o[v]={axesInfo:{}});y.axesInfo[h]=_,y.mapper=a[v].mapper,_.linkGroup=y}}}})}function bG(e,t,n,r,i,a){var o=t.getModel(`axisPointer`),s=[`type`,`snap`,`lineStyle`,`shadowStyle`,`label`,`animation`,`animationDurationUpdate`,`animationEasingUpdate`,`z`],c={};Y(s,function(e){c[e]=LS(o.get(e))}),c.snap=e.type!==`category`&&!!a,o.get(`type`)===`cross`&&(c.type=`line`);var l=c.label||={};if(l.show??=!1,i===`cross`&&(l.show=o.get([`label`,`show`])??!0,!a)){var u=c.lineStyle=o.get(`crossStyle`);u&&zS(l,u.textStyle)}return e.model.getModel(`axisPointer`,new dN(c,n,r))}function xG(e,t){t.eachSeries(function(t){var n=t.coordinateSystem,r=t.get([`tooltip`,`trigger`],!0),i=t.get([`tooltip`,`show`],!0);n&&n.model&&r!==`none`&&r!==!1&&r!==`item`&&i!==!1&&t.get([`axisPointer`,`show`],!0)!==!1&&Y(e.coordSysAxesInfo[OG(n.model)],function(e){var r=e.axis;n.getAxis(r.dim)===r&&(e.seriesModels.push(t),e.seriesDataCount??=0,e.seriesDataCount+=t.getData().count())})})}function SG(e,t){for(var n=t.model,r=t.dim,i=0;i=0||e===t}function wG(e){var t=TG(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=DG(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(UG(this._zr,`globalPan`)||qG(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(DV(r.event),r.__ecRoamConsumed=!0,eK(e,t,n,r,i))},t}(rD);function qG(e){return e.__ecRoamConsumed}var JG=Lk();function YG(e){var t=JG(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function XG(e,t,n,r){for(var i=YG(e).roam,a=i[t]=i[t]||[],o=0;o1e-6;GK[0]=o?(i[0]-r.x)/a:i[0],GK[1]=o?(i[1]-r.y)/a:i[1],mw(GK,GK,e.mtRawInv);var s=VK(e,GK);KK(t,s,a),Y(n,function(e){e!==t&&KK(e,s.slice(),a)})}var GK=[];function KK(e,t,n){var r=e.option;r.center=t,r.zoom=n}function qK(e,t){if(t){var n=t.min||0,r=t.max||1/0;e=Math.max(Math.min(r,e),n)}return e}function JK(e,t,n,r,i,a,o,s){if(!IK(e)){n.disable();return}n.enable(sC(e.get(`roam`),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get(`roamTrigger`),isInSelf:r,isInClip:function(e,t,n){return!i||i.contain(t,n)}}});function c(n){var r=e.mainType,i=WM(zS({type:QK(r,e.subType,fA)},n));s&&(i.componentType=r),i[r+`Id`]=e.id,t.dispatchAction(i)}n.off(`pan`).off(`zoom`).on(`pan`,function(e){a&&a(`pan`),c({dx:e.dx,dy:e.dy})}).on(`zoom`,function(e){a&&a(`zoom`),c({zoom:e.scale,originX:e.originX,originY:e.originY})})}function YK(e){return function(t,n,r){return XK.copy(e.getBoundingRect()),XK.applyTransform(e.getComputedTransform()),XK.contain(n,r)}}var XK=new Aw(0,0,0,0);function ZK(e,t,n){var r=QK(t,n,fA);e.registerAction({type:r,event:r,update:`none`},function(e,r,i){r.eachComponent(Hk(e,t,n),function(t){FK(e,t),LK(e,t,r,i)})})}function QK(e,t,n){return(e===`series`?t===`map`?`geo`:t:e)+n}function $K(e,t,n,r,i,a,o){var s=new iK(null,UK(e.ecModel,t));return hK(s,n,r,i,a),o?gK(s,o.x,o.y,o.width,o.height):gK(s,n,r,i,a),mK(s,e),s}var eq=Lk();function tq(e){var t=e.mainData,n=e.datas;n||(n={main:t},e.datasAttr={main:`data`}),e.datas=e.mainData=null,cq(t,n,e),Y(n,function(n){Y(t.TRANSFERABLE_METHODS,function(t){n.wrapMethod(t,YS(nq,e))})}),t.wrapMethod(`cloneShallow`,YS(iq,e)),Y(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,YS(rq,e))}),dC(n[t.dataType]===t)}function nq(e,t){if(sq(this)){var n=J({},eq(this).datas);n[this.dataType]=t,cq(t,n,e)}else lq(t,this.dataType,eq(this).mainData,e);return t}function rq(e,t){return e.struct&&e.struct.update(),t}function iq(e,t){return Y(eq(t).datas,function(n,r){n!==t&&lq(n.cloneShallow(),r,t,e)}),t}function aq(e){var t=eq(this).mainData;return e==null||t==null?t:eq(t).datas[e]}function oq(){var e=eq(this).mainData;return e==null?[{data:e}]:US(qS(eq(e).datas),function(t){return{type:t,data:eq(e).datas[t]}})}function sq(e){return eq(e).mainData===e}function cq(e,t,n){eq(e).datas={},Y(t,function(t,r){lq(t,r,e,n)})}function lq(e,t,n,r){eq(n).datas[t]=e,eq(e).mainData=n,e.dataType=t,r.struct&&(e[r.structAttr]=r.struct,r.struct[r.datasAttr[t]]=e),e.getLinkedData=aq,e.getLinkedDataAll=oq}var uq=Y,dq=eC,fq=-1,pq=function(){function e(t){var n=t.mappingMethod,r=t.type,i=this.option=LS(t);this.type=r,this.mappingMethod=n,this._normalizeData=Tq[n];var a=e.visualHandlers[r];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[n],n===`piecewise`?(gq(i),mq(i)):n===`category`?i.categories?hq(i):gq(i,!0):(dC(n!==`linear`||i.dataExtent),gq(i))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return JS(this._normalizeData,this)},e.listVisualTypes=function(){return qS(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){eC(e)?Y(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,r){var i,a=X(t)?[]:eC(t)?{}:(i=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(r,e,t);i?a=o:a[t]=o}),a},e.retrieveVisuals=function(t){var n={},r;return t&&uq(e.visualHandlers,function(e,i){t.hasOwnProperty(i)&&(n[i]=t[i],r=!0)}),r?n:null},e.prepareVisualTypes=function(e){if(X(e))e=e.slice();else if(dq(e)){var t=[];uq(e,function(e,n){t.push(n)}),e=t}else return[];return e.sort(function(e,t){return t===`color`&&e!==`color`&&e.indexOf(`color`)===0?1:-1}),e},e.dependsOn=function(e,t){return t===`color`?!!(e&&e.indexOf(t)===0):e===t},e.findPieceIndex=function(e,t,n){for(var r,i=1/0,a=0,o=t.length;a=0;a--)r[a]??(delete n[t[a]],t.pop())}function gq(e,t){var n=e.visual,r=[];eC(n)?uq(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),wq(e,r)}function _q(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:Sq([0,1])}}function vq(e){var t=this.option.visual;return t[Math.round(ek(e,[0,1],[0,t.length-1],!0))]||{}}function yq(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function bq(e){var t=this.option.visual;return t[this.option.loop&&e!==fq?e%t.length:e]}function xq(){return this.option.visual[0]}function Sq(e){return{linear:function(t){return ek(t,e,this.option.visual,!0)},category:bq,piecewise:function(t,n){var r=Cq.call(this,n);return r??=ek(t,e,this.option.visual,!0),r},fixed:xq}}function Cq(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[pq.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function wq(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=US(t,function(e){return tE(e)||[0,0,0,1]})),t}var Tq={linear:function(e){return ek(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=pq.findPieceIndex(e,t,!0);if(n!=null)return ek(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??fq},fixed:bC};function Eq(e,t,n){return e?t<=n:t=0&&e.call(t,n[i],i)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,r=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&e.call(t,n[i],i)},e.prototype.breadthFirstTraverse=function(e,t,n,r){if(t instanceof kq||(t=this._nodesMap[Dq(t)]),t){for(var i=n===`out`?`outEdges`:n===`in`?`inEdges`:`edges`,a=0;a=0&&n.node2.dataIndex>=0});for(var i=0,a=r.length;i=0&&!e.hasKey(p)&&(e.set(p,!0),a.push(f.node1))}for(s=0;s=0&&!e.hasKey(v)&&(e.set(v,!0),o.push(_.node2))}}}return{edge:e.keys(),node:t.keys()}},e}(),Aq=function(){function e(e,t,n){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=n??-1}return e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.edgeData.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var e=_C(),t=_C();e.set(this.dataIndex,!0);for(var n=[this.node1],r=[this.node2],i=0;i=0&&!e.hasKey(u)&&(e.set(u,!0),n.push(l.node1))}for(i=0;i=0&&!e.hasKey(m)&&(e.set(m,!0),r.push(p.node2))}return{edge:e.keys(),node:t.keys()}},e}();function jq(e,t){return{getValue:function(n){var r=this[e][t];return r.getStore().get(r.getDimensionIndex(n||`value`),this.dataIndex)},setVisual:function(n,r){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,n,r)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,r){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,r)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}VS(kq,jq(`hostGraph`,`data`)),VS(Aq,jq(`hostGraph`,`edgeData`));function Mq(e,t,n,r,i){for(var a=new Oq(r),o=0;o `+f)),l++)}var p=n.get(`coordinateSystem`),m;if(p===`cartesian2d`||p===`polar`||p===`matrix`)m=kP(e,n);else{var h=wP.get(p),g=h&&h.dimensions||[];BS(g,`value`)<0&&g.concat([`value`]);var _=xP(e,{coordDimensions:g,encodeDefine:n.getEncode()}).dimensions;m=new bP(_,n),m.initData(e)}var v=new bP([`value`],n);return v.initData(c,s),i&&i(m,v),tq({mainData:m,struct:a,structAttr:`graph`,datas:{node:m,edge:v},datasAttr:{node:`data`,edge:`edgeData`}}),a.update(),a}var Nq=Rj.prototype,Pq=Vj.prototype,Fq=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return e}();(function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Fq);function Iq(e){return isNaN(+e.cpx1)||isNaN(+e.cpy1)}var Lq=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-line`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Fq},t.prototype.buildPath=function(e,t){Iq(t)?Nq.buildPath.call(this,e,t):Pq.buildPath.call(this,e,t)},t.prototype.pointAt=function(e){return Iq(this.shape)?Nq.pointAt.call(this,e):Pq.pointAt.call(this,e)},t.prototype.tangentAt=function(e){var t=this.shape,n=Iq(t)?[t.x2-t.x1,t.y2-t.y1]:Pq.tangentAt.call(this,e);return dw(n,n)},t}(xO),Rq=[`fromSymbol`,`toSymbol`];function zq(e){return`_`+e+`Type`}function Bq(e,t,n){var r=t.getItemVisual(n,e);if(!r||r===`none`)return r;var i=t.getItemVisual(n,e+`Size`),a=t.getItemVisual(n,e+`Rotate`),o=t.getItemVisual(n,e+`Offset`),s=t.getItemVisual(n,e+`KeepAspect`),c=HI(i),l=UI(o||0,c);return r+c+l+(a||``)+(s||``)}function Vq(e,t,n){var r=t.getItemVisual(n,e);if(r&&r!==`none`){var i=t.getItemVisual(n,e+`Size`),a=t.getItemVisual(n,e+`Rotate`),o=t.getItemVisual(n,e+`Offset`),s=t.getItemVisual(n,e+`KeepAspect`),c=HI(i),l=UI(o||0,c),u=VI(r,-c[0]/2+l[0],-c[1]/2+l[1],c[0],c[1],null,s);return u.__specifiedRotation=a==null||isNaN(a)?void 0:a*Math.PI/180||0,u.name=e,u}}function Hq(e){var t=new Lq({name:`line`,subPixelOptimize:!0});return Uq(t.shape,e),t}function Uq(e,t){e.x1=t[0][0],e.y1=t[0][1],e.x2=t[1][0],e.y2=t[1][1],e.percent=1;var n=t[2];n?(e.cpx1=n[0],e.cpy1=n[1]):(e.cpx1=NaN,e.cpy1=NaN)}var Wq=function(e){vS(t,e);function t(t,n,r){var i=e.call(this)||this;return i._createLine(t,n,r),i}return t.prototype._createLine=function(e,t,n){var r=e.hostModel,i=e.getItemLayout(t),a=e.getItemVisual(t,`z2`),o=Hq(i);o.shape.percent=0,rM(o,{z2:sC(a,0),shape:{percent:1}},r,t),this.add(o),Y(Rq,function(n){var r=Vq(n,e,t);this.add(r),this[zq(n)]=Bq(n,e,t)},this),this._updateCommonStl(e,t,n)},t.prototype.updateData=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=e.getItemLayout(t),o={shape:{}};Uq(o.shape,a),nM(i,o,r,t),Y(Rq,function(n){var r=Bq(n,e,t),i=zq(n);if(this[i]!==r){this.remove(this.childOfName(n));var a=Vq(n,e,t);this.add(a)}this[i]=r},this),this._updateCommonStl(e,t,n)},t.prototype.getLinePath=function(){return this.childAt(0)},t.prototype._updateCommonStl=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=n&&n.emphasisLineStyle,o=n&&n.blurLineStyle,s=n&&n.selectLineStyle,c=n&&n.labelStatesModels,l=n&&n.emphasisDisabled,u=n&&n.focus,d=n&&n.blurScope;if(!n||e.hasItemOption){var f=e.getItemModel(t),p=f.getModel(`emphasis`);a=p.getModel(`lineStyle`).getLineStyle(),o=f.getModel([`blur`,`lineStyle`]).getLineStyle(),s=f.getModel([`select`,`lineStyle`]).getLineStyle(),l=p.get(`disabled`),u=p.get(`focus`),d=p.get(`blurScope`),c=ZM(f)}var m=e.getItemVisual(t,`style`),h=m.stroke;i.useStyle(m),i.style.fill=null,i.style.strokeNoScale=!0,i.ensureState(`emphasis`).style=a,i.ensureState(`blur`).style=o,i.ensureState(`select`).style=s,Y(Rq,function(e){var t=this.childOfName(e);if(t){t.setColor(h),t.style.opacity=m.opacity;for(var n=0;n0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(yj),Gq=function(){function e(e){this.group=new yj,this._LineCtor=e||Wq}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=qq(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=qq(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!Kq(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function qq(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:ZM(t)}}function Jq(e){return isNaN(e[0])||isNaN(e[1])}function Yq(e){return e&&!Jq(e[0])&&!Jq(e[1])}function Xq(e,t,n,r,i,a){e||=0;var o=ck(n[1],-n[0]);if(i!=null&&(i=Qq(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),r===`all`){var s=Math.abs(ck(t[1],-t[0]));s=Qq(s,[0,o]),i=a=Qq(s,[i,a]),r=0}t[0]=Qq(t[0],n),t[1]=Qq(t[1],n);var c=Zq(t,r);t[r]+=e;var l=i||0,u=n.slice();c.sign<0?u[0]=ck(u[0],l):u[1]=ck(u[1],-l),t[r]=Qq(t[r],u);var d=Zq(t,r);return i!=null&&(d.sign!==c.sign||d.spana&&(t[1-r]=ck(t[r],d.sign*a)),t}function Zq(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function Qq(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var $q=`sankey`,eJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){var n=e.edges||e.links||[],r=e.data||e.nodes||[],i=e.levels||[];this.levelModels=[];for(var a=this.levelModels,o=0;o=0&&(a[i[o].depth]=new dN(i[o],this,t));return Mq(r,n,this,!0,s).data;function s(e,t){e.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getData().getItemLayout(t);if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e}),t.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getGraph().getEdgeByIndex(t).node1.getLayout();if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e})}},t.prototype.setNodePosition=function(e,t){var n=(this.option.data||this.option.nodes)[e];n.localX=t[0],n.localY=t[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function r(e){return isNaN(e)||e==null}if(n===`edge`){var i=this.getDataParams(e,n),a=i.data,o=i.value;return TI(`nameValue`,{name:a.source+` -- `+a.target,value:o,noValue:r(o)})}var s=this.getGraph().getNodeByIndex(e).getLayout().value,c=this.getDataParams(e,n).data.name;return TI(`nameValue`,{name:c==null?null:c+``,value:s,noValue:r(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var r=e.prototype.getDataParams.call(this,t,n);return r.value==null&&n===`node`&&(r.value=this.getGraph().getNodeByIndex(t).getLayout().value),r},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type=`series.`+$q,t.layoutMode=`box`,t.defaultOption={z:2,coordinateSystemUsage:`box`,left:`5%`,top:`5%`,right:`20%`,bottom:`5%`,orient:`horizontal`,nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:`global`,center:null,zoom:1,label:{show:!0,position:`right`,fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:`justify`,lineStyle:{color:Q.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:Q.color.primary}},animationEasing:`linear`,animationDuration:1e3},t}(II),tJ=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),nJ=function(e){vS(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new tJ},t.prototype.buildPath=function(e,t){var n=t.extent;e.moveTo(t.x1,t.y1),e.bezierCurveTo(t.cpx1,t.cpy1,t.cpx2,t.cpy2,t.x2,t.y2),t.orient===`vertical`?(e.lineTo(t.x2+n,t.y2),e.bezierCurveTo(t.cpx2+n,t.cpy2,t.cpx1+n,t.cpy1,t.x1+n,t.y1)):(e.lineTo(t.x2,t.y2+n),e.bezierCurveTo(t.cpx2,t.cpy2+n,t.cpx1,t.cpy1+n,t.x1,t.y1+n)),e.closePath()},t.prototype.highlight=function(){BA(this)},t.prototype.downplay=function(){VA(this)},t}(xO),rJ=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=$q,t._mainGroup=new yj,t}return t.prototype.init=function(e,t){this._controller=new KG(t.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(e,t,n){var r=e.getGraph(),i=this._mainGroup,a=e.layoutInfo,o=a.width,s=a.height,c=e.getData(),l=e.getData(`edge`),u=e.get(`orient`);i.removeAll(),i.x=a.x,i.y=a.y,this._updateViewCoordSys(e,n),JK(e,n,this._controller,YK(i),null),r.eachEdge(function(t){var n=new nJ,r=rA(n);r.dataIndex=t.dataIndex,r.seriesIndex=e.seriesIndex,r.dataType=`edge`;var a=t.getModel(),c=a.getModel(`lineStyle`),d=c.get(`curveness`),f=t.node1.getLayout(),p=t.node1.getModel(),m=p.get(`localX`),h=p.get(`localY`),g=t.node2.getLayout(),_=t.node2.getModel(),v=_.get(`localX`),y=_.get(`localY`),b=t.getLayout(),x,S,C,w,T,E,D,O;n.shape.extent=Math.max(1,b.dy),n.shape.orient=u,u===`vertical`?(x=(m==null?f.x:m*o)+b.sy,S=(h==null?f.y:h*s)+f.dy,C=(v==null?g.x:v*o)+b.ty,w=y==null?g.y:y*s,T=x,E=S*(1-d)+w*d,D=C,O=S*d+w*(1-d)):(x=(m==null?f.x:m*o)+f.dx,S=(h==null?f.y:h*s)+b.sy,C=v==null?g.x:v*o,w=(y==null?g.y:y*s)+b.ty,T=x*(1-d)+C*d,E=S,D=x*d+C*(1-d),O=w),n.setShape({x1:x,y1:S,x2:C,y2:w,cpx1:T,cpy1:E,cpx2:D,cpy2:O}),n.useStyle(c.getItemStyle()),iJ(n.style,u,t);var k=``+a.get(`value`),A=ZM(a,`edgeLabel`);XM(n,A,{labelFetcher:{getFormattedLabel:function(t,n,r,i,a,o){return e.getFormattedLabel(t,n,`edge`,i,cC(a,A.normal&&A.normal.get(`formatter`),k),o)}},labelDataIndex:t.dataIndex,defaultText:k}),n.setTextConfig({position:`inside`});var j=a.getModel(`emphasis`);tj(n,a,`lineStyle`,function(e){var n=e.getItemStyle();return iJ(n,u,t),n}),i.add(n),l.setItemGraphicEl(t.dataIndex,n);var M=j.get(`focus`);$A(n,M===`adjacency`?t.getAdjacentDataIndices():M===`trajectory`?t.getTrajectoryDataIndices():M,j.get(`blurScope`),j.get(`disabled`))}),r.eachNode(function(t){var n=t.getLayout(),r=t.getModel(),a=r.get(`localX`),l=r.get(`localY`),u=r.getModel(`emphasis`),d=r.get([`itemStyle`,`borderRadius`])||0,f=new OO({shape:{x:a==null?n.x:a*o,y:l==null?n.y:l*s,width:n.dx,height:n.dy,r:d},style:r.getModel(`itemStyle`).getItemStyle(),z2:10});XM(f,ZM(r),{labelFetcher:{getFormattedLabel:function(t,n){return e.getFormattedLabel(t,n,`node`)}},labelDataIndex:t.dataIndex,defaultText:t.id}),f.disableLabelAnimation=!0,f.setStyle(`fill`,t.getVisual(`color`)),f.setStyle(`decal`,t.getVisual(`style`).decal),tj(f,r),i.add(f),c.setItemGraphicEl(t.dataIndex,f),rA(f).dataType=`node`;var p=u.get(`focus`);$A(f,p===`adjacency`?t.getAdjacentDataIndices():p===`trajectory`?t.getTrajectoryDataIndices():p,u.get(`blurScope`),u.get(`disabled`))}),c.eachItemGraphicEl(function(t,r){c.getItemModel(r).get(`draggable`)&&(t.drift=function(t,i){this.shape.x+=t,this.shape.y+=i,this.dirty(),n.dispatchAction({type:`dragNode`,seriesId:e.id,dataIndex:c.getRawIndex(r),localX:this.shape.x/o,localY:this.shape.y/s})},t.draggable=!0,t.cursor=`move`)}),!this._data&&e.isAnimationEnabled()&&i.setClipPath(aJ(i.getBoundingRect(),e,function(){i.removeClipPath()})),this._data=e.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(e,t,n){jK(this.group,2,t.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(e,t){var n=e.layoutInfo,r=e.coordinateSystem=$K(e,t,n.x,n.y,n.width,n.height);jK(this.group,2,r,this._firstRender?null:e)},t.type=$q,t}(lL);function iJ(e,t,n){switch(e.fill){case`source`:e.fill=n.node1.getVisual(`color`),e.decal=n.node1.getVisual(`style`).decal;break;case`target`:e.fill=n.node2.getVisual(`color`),e.decal=n.node2.getVisual(`style`).decal;break;case`gradient`:var r=n.node1.getVisual(`color`),i=n.node2.getVisual(`color`);ZS(r)&&ZS(i)&&(e.fill=new Gj(0,0,+(t===`horizontal`),+(t===`vertical`),[{color:r,offset:0},{color:i,offset:1}]))}}function aJ(e,t,n){var r=new OO({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return rM(r,{shape:{width:e.width+20}},t,n),r}var oJ=tA($q,sJ);function sJ(e,t){e.eachSeriesByType($q,function(e){var n=e.get(`nodeWidth`),r=e.get(`nodeGap`),i=rI(e,t).refContainer,a=tI(e.getBoxLayoutParams(),i);e.layoutInfo=a;var o=a.width,s=a.height,c=e.getGraph(),l=c.nodes,u=c.edges;lJ(l),cJ(l,u,n,r,o,s,GS(l,function(e){return e.getLayout().value===0}).length===0?e.get(`layoutIterations`):0,e.get(`orient`),e.get(`nodeAlign`))})}function cJ(e,t,n,r,i,a,o,s,c){uJ(e,t,n,i,a,s,c),hJ(e,t,a,i,r,o,s),OJ(e,s)}function lJ(e){Y(e,function(e){var t=EJ(e.outEdges,TJ),n=EJ(e.inEdges,TJ),r=e.getValue()||0,i=Math.max(t,n,r);e.setLayout({value:i},!0)})}function uJ(e,t,n,r,i,a,o){for(var s=[],c=[],l=[],u=[],d=0,f=0;f=0;_&&g.depth>p&&(p=g.depth),h.setLayout({depth:_?g.depth:d},!0),a===`vertical`?h.setLayout({dy:n},!0):h.setLayout({dx:n},!0);for(var v=0;vd-1?p:d-1;o&&o!==`left`&&fJ(e,o,a,C),mJ(e,a===`vertical`?(i-n)/C:(r-n)/C,a)}function dJ(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function fJ(e,t,n,r){if(t===`right`){for(var i=[],a=e,o=0;a.length;){for(var s=0;s0;a--)c*=.99,yJ(s,c,o),vJ(s,i,n,r,o),DJ(s,c,o),vJ(s,i,n,r,o)}function gJ(e,t){var n=[],r=t===`vertical`?`y`:`x`,i=gae(e,function(e){return e.getLayout()[r]});return ak(i.keys),Y(i.keys,function(e){n.push(i.buckets.get(e))}),n}function _J(e,t,n,r,i,a){var o=1/0;Y(e,function(e){var t=e.length,s=0;Y(e,function(e){s+=e.getLayout().value});var c=a===`vertical`?(r-(t-1)*i)/s:(n-(t-1)*i)/s;c0&&(o=s.getLayout()[a]+c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0)),l=s.getLayout()[a]+s.getLayout()[d]+t;var p=i===`vertical`?r:n;if(c=l-t-p,c>0){o=s.getLayout()[a]-c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0),l=o;for(var f=u-2;f>=0;--f)s=e[f],c=s.getLayout()[a]+s.getLayout()[d]+t-l,c>0&&(o=s.getLayout()[a]-c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0)),l=s.getLayout()[a]}})}function yJ(e,t,n){Y(e.slice().reverse(),function(e){Y(e,function(e){if(e.outEdges.length){var r=EJ(e.outEdges,bJ,n)/EJ(e.outEdges,TJ);if(isNaN(r)){var i=e.outEdges.length;r=i?EJ(e.outEdges,xJ,n)/i:0}if(n===`vertical`){var a=e.getLayout().x+(r-wJ(e,n))*t;e.setLayout({x:a},!0)}else{var o=e.getLayout().y+(r-wJ(e,n))*t;e.setLayout({y:o},!0)}}})})}function bJ(e,t){return wJ(e.node2,t)*e.getValue()}function xJ(e,t){return wJ(e.node2,t)}function SJ(e,t){return wJ(e.node1,t)*e.getValue()}function CJ(e,t){return wJ(e.node1,t)}function wJ(e,t){return t===`vertical`?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function TJ(e){return e.getValue()}function EJ(e,t,n){for(var r=0,i=e.length,a=-1;++aa&&(a=t)}),Y(n,function(t){var n=new pq({type:`color`,mappingMethod:`linear`,dataExtent:[i,a],visual:e.get(`color`)}).mapValueToVisual(t.getLayout().value),r=t.getModel().get([`itemStyle`,`color`]);r==null?(t.setVisual(`color`,n),t.setVisual(`style`,{fill:n})):(t.setVisual(`color`,r),t.setVisual(`style`,{fill:r}))})}r.length&&Y(r,function(e){var t=e.getModel().get(`lineStyle`);e.setVisual(`style`,t)})})}function jJ(e){e.registerChartView(rJ),e.registerSeriesModel(eJ),e.registerLayout(oJ),e.registerVisual(kJ),e.registerAction({type:`dragNode`,event:`dragnode`,update:`update`},function(e,t){t.eachComponent({mainType:iA,subType:$q,query:e},function(t){t.setNodePosition(e.dataIndex,[e.localX,e.localY])})}),ZK(e,iA,$q)}var MJ=256,NJ=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=TS.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,r,i,a){var o=this._getBrush(),s=this._getGradient(i,`inRange`),c=this._getGradient(i,`outOfRange`),l=this.pointSize+this.blurSize,u=this.canvas,d=u.getContext(`2d`),f=e.length;u.width=t,u.height=n;for(var p=0;p0){var E=a(v)?s:c;v>0&&(v=v*w+C),b[x++]=E[T],b[x++]=E[T+1],b[x++]=E[T+2],b[x++]=E[T+3]*v*256}else x+=4}return d.putImageData(y,0,0),u},e.prototype._getBrush=function(){var e=this._brushCanvas||=TS.createCanvas(),t=this.pointSize+this.blurSize,n=t*2;e.width=n,e.height=n;var r=e.getContext(`2d`);return r.clearRect(0,0,n,n),r.shadowOffsetX=n,r.shadowBlur=this.blurSize,r.shadowColor=Q.color.neutral99,r.beginPath(),r.arc(-t,t,this.pointSize,0,Math.PI*2,!0),r.closePath(),r.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,r=n[t]||(n[t]=new Uint8ClampedArray(1024)),i=[0,0,0,0],a=0,o=0;o<256;o++)e[t](o/255,!0,i),r[a++]=i[0],r[a++]=i[1],r[a++]=i[2],r[a++]=i[3];return r},e}();function PJ(e,t,n){var r=e[1]-e[0];t=US(t,function(t){return{interval:[(t.interval[0]-e[0])/r,(t.interval[1]-e[0])/r]}});var i=t.length,a=0;return function(e){for(var r=a;r=0;r--){var o=t[r].interval;if(o[0]<=e&&e<=o[1]){a=r;break}}return r>=0&&r=t[0]&&e<=t[1]}}var IJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r;t.eachComponent(`visualMap`,function(t){t.eachTargetSeries(function(n){n===e&&(r=t)})}),this._progressiveEls=null,this.group.removeAll();var i=e.coordinateSystem;i.type===`cartesian2d`||i.type===`calendar`||i.type===`matrix`?this._renderOnGridLike(e,n,0,e.getData().count()):gL(i)&&this._renderOnGeo(i,e,r,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,r){var i=t.coordinateSystem;i&&(gL(i)?this.render(t,n,r):(this._progressiveEls=[],this._renderOnGridLike(t,r,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){FM(this._progressiveEls||this.group,e)},t.prototype._renderOnGridLike=function(e,t,n,r,i){var a=e.coordinateSystem,o=hL(a,`cartesian2d`),s=hL(a,`matrix`),c,l,u,d;if(o){var f=a.getAxis(`x`),p=a.getAxis(`y`);c=qz(f).w+.5,l=qz(p).w+.5,u=f.scale.getExtent(),d=p.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel([`emphasis`,`itemStyle`]).getItemStyle(),_=e.getModel([`blur`,`itemStyle`]).getItemStyle(),v=e.getModel([`select`,`itemStyle`]).getItemStyle(),y=e.get([`itemStyle`,`borderRadius`]),b=ZM(e),x=e.getModel(`emphasis`),S=x.get(`focus`),C=x.get(`blurScope`),w=x.get(`disabled`),T=o||s?[h.mapDimension(`x`),h.mapDimension(`y`),h.mapDimension(`value`)]:[h.mapDimension(`time`),h.mapDimension(`value`)],E=n;Eu[1]||Ad[1])continue;var j=a.dataToPoint([k,A]);D=new OO({shape:{x:j[0]-c/2,y:j[1]-l/2,width:c,height:l},style:O})}else if(s){var M=a.dataToLayout([h.get(T[0],E),h.get(T[1],E)]).rect;if(aC(M.x))continue;D=new OO({z2:1,shape:M,style:O})}else{if(isNaN(h.get(T[1],E)))continue;var N=a.dataToLayout([h.get(T[0],E)]),M=N.contentRect||N.rect;if(aC(M.x)||aC(M.y))continue;D=new OO({z2:1,shape:M,style:O})}if(h.hasItemOption){var P=h.getItemModel(E),F=P.getModel(`emphasis`);g=F.getModel(`itemStyle`).getItemStyle(),_=P.getModel([`blur`,`itemStyle`]).getItemStyle(),v=P.getModel([`select`,`itemStyle`]).getItemStyle(),y=P.get([`itemStyle`,`borderRadius`]),S=F.get(`focus`),C=F.get(`blurScope`),w=F.get(`disabled`),b=ZM(P)}D.shape.r=y;var ee=e.getRawValue(E),I=`-`;ee&&ee[2]!=null&&(I=ee[2]+``),XM(D,b,{labelFetcher:e,labelDataIndex:E,defaultOpacity:O.opacity,defaultText:I}),D.ensureState(`emphasis`).style=g,D.ensureState(`blur`).style=_,D.ensureState(`select`).style=v,$A(D,S,C,w),D.incremental=$k(e,i),i&&(D.states.emphasis.hoverLayer=2),m.add(D),h.setItemGraphicEl(E,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(e,t,n,r){var i=n.targetVisuals.inRange,a=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new NJ;s.blurSize=t.get(`blurSize`),s.pointSize=t.get(`pointSize`),s.minOpacity=t.get(`minOpacity`),s.maxOpacity=t.get(`maxOpacity`);var c=e.getViewRect().clone(),l=e.getRoamTransform();c.applyTransform(l);var u=Math.max(c.x,0),d=Math.max(c.y,0),f=Math.min(c.width+c.x,r.getWidth()),p=Math.min(c.height+c.y,r.getHeight()),m=f-u,h=p-d,g=[o.mapDimension(`lng`),o.mapDimension(`lat`),o.mapDimension(`value`)],_=o.mapArray(g,function(t,n,r){var i=e.dataToPoint([t,n]);return i[0]-=u,i[1]-=d,i.push(r),i}),v=n.getExtent(),y=n.type===`visualMap.continuous`?FJ(v,n.option.range):PJ(v,n.getPieceList(),n.option.selected);s.update(_,m,h,i.color.getNormalizer(),{inRange:i.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var b=new CO({style:{width:m,height:h,x:u,y:d,image:s.canvas},silent:!0});this.group.add(b)},t.type=`heatmap`,t}(lL),LJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return kP(null,this,{generateCoord:`value`})},t.prototype.preventIncremental=function(){var e=wP.get(this.get(`coordinateSystem`));if(e&&e.dimensions)return e.dimensions[0]===`lng`&&e.dimensions[1]===`lat`},t.type=`series.heatmap`,t.dependencies=[`grid`,`geo`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:Q.color.primary}}},t}(II);function RJ(e){e.registerChartView(IJ),e.registerSeriesModel(LJ)}var zJ={color:`fill`,borderColor:`stroke`},BJ={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},VJ=Lk(),HJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get(`zlevel`,!0),this.currentZ=this.get(`z`,!0)},t.prototype.getInitialData=function(e,t){return kP(null,this)},t.prototype.getDataParams=function(t,n,r){var i=e.prototype.getDataParams.call(this,t,n);return r&&(i.info=VJ(r).info),i},t.type=`series.custom`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,clip:!1},t}(II);function UJ(e,t){return t||=[0,0],US([`x`,`y`],function(n,r){var i=this.getAxis(n),a=t[r],o=e[r]/2;return i.type===`category`?qz(i).w:Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function WJ(e){var t=e.master.getRect();return{coordSys:{type:`cartesian2d`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:JS(UJ,e)}}}function GJ(e,t){return t||=[0,0],US([0,1],function(n){var r=t[n],i=e[n]/2,a=[],o=[];return a[n]=r-i,o[n]=r+i,a[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(a)[n]-this.dataToPoint(o)[n])},this)}function KJ(e){var t=e.view,n=t.getBoundingRect();return{coordSys:{type:`geo`,x:n.x,y:n.y,width:n.width,height:n.height,zoom:oK(t)},api:{coord:function(t){return e.dataToPoint(t)},size:JS(GJ,e)}}}function qJ(e,t){var n=this.getAxis(),r=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return n.type===`category`?qz(n).w:Math.abs(n.dataToCoord(r-i)-n.dataToCoord(r+i))}function JJ(e){var t=e.getRect();return{coordSys:{type:`singleAxis`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:JS(qJ,e)}}}function YJ(e,t){return t||=[0,0],US([`Radius`,`Angle`],function(n,r){var i=`get`+n+`Axis`,a=this[i](),o=t[r],s=e[r]/2,c=a.type===`category`?qz(a).w:Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return n===`Angle`&&(c=c*Math.PI/180),c},this)}function XJ(e){var t=e.getRadiusAxis(),n=e.getAngleAxis(),r=t.getExtent();return r[0]>r[1]&&r.reverse(),{coordSys:{type:`polar`,cx:e.cx,cy:e.cy,r:r[1],r0:r[0]},api:{coord:function(r){var i=t.dataToRadius(r[0]),a=n.dataToAngle(r[1]),o=e.coordToPoint([i,a]);return o.push(i,a*Math.PI/180),o},size:JS(YJ,e)}}}function ZJ(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:`calendar`,x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}function QJ(e){var t=e.getRect();return{coordSys:{type:`matrix`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}var $J={position:[`x`,`y`],scale:[`scaleX`,`scaleY`],origin:[`originX`,`originY`]},eY=qS($J);WS(yT,function(e,t){return e[t]=1,e},{}),yT.join(`, `);var tY=[``,`style`,`shape`,`extra`],nY=Lk();function rY(e,t,n,r,i){var a=e+`Animation`,o=eM(e,r,i)||{},s=nY(t).userDuring;return o.duration>0&&(o.during=s?JS(pY,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),J(o,n[a]),o}function iY(e,t,n,r){r||={};var i=r.dataIndex,a=r.isInit,o=r.clearStyle,s=n.isAnimationEnabled(),c=nY(e),l=t.style;c.userDuring=t.during;var u={},d={};if(_Y(e,t,d),e.type===`compound`)for(var f=e.shape.paths,p=t.shape.paths,m=0;m0&&e.animateFrom(g,_)}else lY(e,t,i||0,n,u)}aY(e,t),l?e.dirty():e.markRedraw()}function aY(e,t){for(var n=nY(e).leaveToProps,r=0;r0&&e.animateFrom(i,a)}}function uY(e,t){Z(t,`silent`)&&(e.silent=t.silent),Z(t,`ignore`)&&(e.ignore=t.ignore),e instanceof jD&&Z(t,`invisible`)&&(e.invisible=t.invisible),e instanceof xO&&Z(t,`autoBatch`)&&(e.autoBatch=t.autoBatch)}var dY={},fY={setTransform:function(e,t){return dY.el[e]=t,this},getTransform:function(e){return dY.el[e]},setShape:function(e,t){var n=dY.el,r=n.shape||={};return r[e]=t,n.dirtyShape&&n.dirtyShape(),this},getShape:function(e){var t=dY.el.shape;if(t)return t[e]},setStyle:function(e,t){var n=dY.el,r=n.style;return r&&(r[e]=t,n.dirtyStyle&&n.dirtyStyle()),this},getStyle:function(e){var t=dY.el.style;if(t)return t[e]},setExtra:function(e,t){var n=dY.el.extra||(dY.el.extra={});return n[e]=t,this},getExtra:function(e){var t=dY.el.extra;if(t)return t[e]}};function pY(){var e=this,t=e.el;if(t){var n=nY(t).userDuring,r=e.userDuring;n===r?(dY.el=t,r(fY)):e.el=e.userDuring=null}}function mY(e,t,n,r){var i=n[e];if(i){var a=t[e],o;if(a){var s=n.transition,c=i.transition;if(c){if(!o&&(o=r[e]={}),sY(c))J(o,a);else for(var l=Dk(c),u=0;u=0){!o&&(o=r[e]={});for(var p=qS(a),u=0;u=0)){var f=e.getAnimationStyleProps(),p=f?f.style:null;if(p){!a&&(a=r.style={});for(var m=qS(n),l=0;l=0?t.getStore().get(i,n):void 0}var a=t.get(r.name,n),o=r&&r.ordinalMeta;return o?o.categories[a]:a}function C(n,r){r??=u;var i=t.getItemVisual(r,`style`),a=i&&i.fill,o=i&&i.opacity,s=y(r,TY).getItemStyle();a!=null&&(s.fill=a),o!=null&&(s.opacity=o);var c={inheritColor:ZS(a)?a:Q.color.neutral99},l=b(r,TY),d=QM(l,null,c,!1,!0);d.text=l.getShallow(`show`)?sC(e.getFormattedLabel(r,TY),WI(t,r)):null;var f=$M(l,c,!1);return E(n,s),s=vL(s,d,f),n&&T(s,n),s.legacy=!0,s}function w(n,r){r??=u;var i=y(r,wY).getItemStyle(),a=b(r,wY),o=QM(a,null,null,!0,!0);o.text=a.getShallow(`show`)?cC(e.getFormattedLabel(r,wY),e.getFormattedLabel(r,TY),WI(t,r)):null;var s=$M(a,null,!0);return E(n,i),i=vL(i,o,s),n&&T(i,n),i.legacy=!0,i}function T(e,t){for(var n in t)Z(t,n)&&(e[n]=t[n])}function E(e,t){e&&(e.textFill&&(t.textFill=e.textFill),e.textPosition&&(t.textPosition=e.textPosition))}function D(e,n){if(n??=u,Z(zJ,e)){var r=t.getItemVisual(n,`style`);return r?r[zJ[e]]:null}if(Z(BJ,e))return t.getItemVisual(n,e)}function O(e){if(o.type===`cartesian2d`)return Sle(zS({axis:o.getBaseAxis()},e))}function k(){return n.getCurrentSeriesIndices()}function A(e){return iN(e,n)}}function GY(e){var t={};return Y(e.dimensions,function(n){var r=e.getDimensionInfo(n);if(!r.isExtraCoord){var i=r.coordDim,a=t[i]=t[i]||[];a[r.coordDimIndex]=e.getDimensionIndex(n)}}),t}function KY(e,t,n,r,i,a,o){if(!r)a.remove(t);else{var s=qY(e,t,n,r,i,a);return s&&o.setItemGraphicEl(n,s),s&&$A(s,r.focus,r.blurScope,r.emphasisDisabled),s}}function qY(e,t,n,r,i,a){var o=-1,s=t;t&&JY(t,r,i)&&(o=BS(a.childrenRef(),t),t=null);var c=!t,l=t;l?l.clearStates():(l=zY(r),s&&LY(s,l)),r.morph===!1?l.disableMorphing=!0:l.disableMorphing&&(l.disableMorphing=!1),r.tooltipDisabled&&(l.tooltipDisabled=!0),NY.normal.cfg=NY.normal.conOpt=NY.emphasis.cfg=NY.emphasis.conOpt=NY.blur.cfg=NY.blur.conOpt=NY.select.cfg=NY.select.conOpt=null,NY.isLegacy=!1,XY(l,n,r,i,c,NY),YY(l,n,r,i,c),BY(e,l,n,r,NY,i,c),Z(r,`info`)&&(VJ(l).info=r.info);for(var u=0;u=0?a.replaceAt(l,o):a.add(l),l}function JY(e,t,n){var r=VJ(e),i=t.type,a=t.shape,o=t.style;return n.isUniversalTransitionEnabled()||i!=null&&i!==r.customGraphicType||i===`path`&&sX(a)&&oX(a)!==r.customPathData||i===`image`&&Z(o,`image`)&&o.image!==r.customImagePath}function YY(e,t,n,r,i){var a=n.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&JY(o,a,r)&&(o=null),o||(o=zY(a),e.setClipPath(o)),BY(null,o,t,a,null,r,i)}}function XY(e,t,n,r,i,a){if(!(e.isGroup||e.type===`compoundPath`)){ZY(n,null,a),ZY(n,wY,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,c=a.blur.conOpt,l=a.select.conOpt;if(o!=null||s!=null||l!=null||c!=null){var u=e.getTextContent();if(o===!1)u&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:`text`},u?u.clearStates():(u=zY(o),e.setTextContent(u)),BY(null,u,t,o,null,r,i);for(var d=o&&o.style,f=0;f=u;p--)tX(t,t.childAt(p),i)}}}function tX(e,t,n){t&&oY(t,VJ(e).option,n)}function nX(e){new mN(e.oldChildren,e.newChildren,rX,rX,e).add(iX).update(iX).remove(aX).execute()}function rX(e,t){return(e&&e.name)??MY+t}function iX(e,t){var n=this.context,r=e==null?null:n.newChildren[e],i=t==null?null:n.oldChildren[t];qY(n.api,i,n.dataIndex,r,n.seriesModel,n.group)}function aX(e){var t=this.context,n=t.oldChildren[e];n&&oY(n,VJ(n).option,t.seriesModel)}function oX(e){return e&&(e.pathData||e.d)}function sX(e){return e&&(Z(e,`pathData`)||Z(e,`d`))}function cX(e){e.registerChartView(RY),e.registerSeriesModel(HJ)}var lX=Lk(),uX=LS,dX=JS,fX=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`)o&&o.hide(),s&&s.hide();else{o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new yj,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=YS(pX,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}_X(o,t,!0),this._renderHandle(i)}}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&qz(r).w>o)return!0;if(a){var s=TG(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=lX(e).pointerEl=new _oe[i.type](uX(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=lX(e).labelEl=new MO(uX(t.label));e.add(i),hX(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=lX(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=lX(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),hX(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`)r&&n.remove(r),this._handle=null;else{var o;this._handle||(o=!0,r=this._handle=DM(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){DV(e.event)},onmousedown:dX(this._onHandleDragMove,this,0,0),drift:dX(this._onHandleDragMove,this),ondragend:dX(this._onHandleDragEnd,this)}),n.add(r)),_X(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);X(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,tV(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}}},e.prototype._moveHandleToValue=function(e,t){pX(this._axisPointerModel,!t&&this._moveAnimation,this._handle,gX(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(gX(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(gX(r)),lX(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),nV(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function pX(e,t,n,r){mX(lX(n).lastProp,r)||(lX(n).lastProp=r,t?nM(n,r,e):(n.stopAnimation(),n.attr(r)))}function mX(e,t){if(eC(e)&&eC(t)){var n=!0;return Y(t,function(t,r){n&&=mX(e[r],t)}),!!n}return e===t}function hX(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function gX(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function _X(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function vX(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function yX(e,t,n,r,i){var a=xX(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=GF(o.get(`padding`)||0),c=o.getFont(),l=Gw(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),bX(u,d,f,r);var h=o.get(`backgroundColor`);h&&h!==`auto`||(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:QM(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function bX(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function xX(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:bR(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Y(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),ZS(o)?a=o.replace(`{value}`,a):XS(o)&&(a=o(s))}return a}function SX(e,t,n){var r=QC();return rw(r,r,n.rotation),nw(r,r,n.position),SM([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function CX(e,t,n,r,i,a){var o=SB.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),yX(t,r,i,a,{position:SX(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function wX(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function TX(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function EX(e,t,n){return qz(e,{fromStat:{sers:US(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function DX(e,t,n){return[KO(GO(t[0],t[1]),e-n/2),GO(e+n/2,KO(t[0],t[1]))]}var OX=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=kX(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=vX(r),f=AX[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}CX(t,e,jB(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=jB(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=SX(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=kX(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=GO(o[1],l[c]),l[c]=KO(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(fX);function kX(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var AX={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:wX([t,r[0]],[t,r[1]],jX(e))}},shadow:function(e,t,n,r,i,a){var o=EX(e,i,a),s=r[1]-r[0],c=DX(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:TX([l,r[0]],[u-l,s],jX(e))}}};function jX(e){return e.dim===`x`?0:1}var MX=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:Q.color.border,width:1,type:`dashed`},shadowStyle:{color:Q.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:Q.color.neutral00,padding:[5,7,5,7],backgroundColor:Q.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:Q.color.accent40,throttle:40}},t}(sI),NX=Lk(),PX=Y;function FX(e,t,n){if(!CC.node){var r=t.getZr();NX(r).records||(NX(r).records={}),IX(r,t);var i=NX(r).records[e]||(NX(r).records[e]={});i.handler=n}}function IX(e,t){if(NX(e).initialized)return;NX(e).initialized=!0,n(`click`,YS(zX,`click`)),n(`mousemove`,YS(zX,`mousemove`)),n(`mousewheel`,YS(zX,`mousewheel`)),n(`globalout`,RX);function n(n,r){e.on(n,function(n){var i=BX(t);PX(NX(e).records,function(e){e&&r(e,n,i.dispatchAction)}),LX(i.pendings,t)})}}function LX(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function RX(e,t,n){e.handler(`leave`,null,n)}function zX(e,t,n,r){t.handler(e,n,r)}function BX(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function VX(e,t){if(!CC.node){var n=t.getZr();(NX(n).records||{})[e]&&(NX(n).records[e]=null)}}var HX=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;FX(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){VX(`axisPointer`,t)},t.prototype.dispose=function(e,t){VX(`axisPointer`,t)},t.type=`axisPointer`,t}(BH);function UX(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=Ik(a,e);if(o==null||o<0||X(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(US(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var WX=Lk();function GX(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||JS(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){tZ(i)&&(i=UX({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=tZ(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||tZ(i),f={},p={},m={list:[],map:{}},h={showPointer:YS(JX,p),showTooltip:YS(YX,m)};Y(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);Y(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=$X(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&KX(e,o,h,!1,f)}})});var g={};return Y(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&Y(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,eZ(t),eZ(e)))),g[e.key]=a}})}),Y(g,function(e,t){KX(u[t],e,h,!0,f)}),XX(p,u,f),ZX(m,i,e,o),QX(u,o,n),f}}function KX(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries)n.showPointer(e,t);else{var o=qX(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&J(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}}function qX(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return Y(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(xk(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),Y(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function JX(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function YX(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=OG(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function XX(e,t,n){var r=n.axesInfo=[];Y(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function ZX(e,t,n,r){if(tZ(t)||!e.list.length)r({type:`hideTip`});else{var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}}function QX(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=WX(r)[i]||{},o=WX(r)[i]={};Y(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&Y(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}Y(a,function(e,t){!o[t]&&c.push(l(e))}),Y(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function $X(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function eZ(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function tZ(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function nZ(e){AG.registerAxisPointerClass(`CartesianAxisPointer`,OX),e.registerComponentModel(MX),e.registerComponentView(HX),e.registerPreprocessor(function(e){if(e){e.axisPointer&&e.axisPointer.length!==0||(e.axisPointer={});var t=e.axisPointer.link;t&&!X(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=vG(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},GX)}function rZ(e){XW(VG),XW(nZ)}var iZ=[`x`,`y`,`radius`,`angle`,`single`],aZ=Lk(),oZ=[`cartesian2d`,`polar`,`singleAxis`];function sZ(e){return BS(oZ,e.get(`coordinateSystem`))>=0}function cZ(e){return e+`Axis`}function lZ(e,t){var n=_C(),r=[],i=_C();e.eachComponent({mainType:`dataZoom`,query:t},function(e){i.get(e.uid)||s(e)});var a;do a=!1,e.eachComponent(`dataZoom`,o);while(a);function o(e){!i.get(e.uid)&&c(e)&&(s(e),a=!0)}function s(e){i.set(e.uid,!0),r.push(e),l(e)}function c(e){var t=!1;return e.eachTargetAxis(function(e,r){var i=n.get(e);i&&i[r]&&(t=!0)}),t}function l(e){e.eachTargetAxis(function(e,t){(n.get(e)||n.set(e,[]))[t]=!0})}return r}function uZ(e){var t=e.ecModel,n={infoList:[],infoMap:_C()};return e.eachTargetAxis(function(e,r){var i=t.getComponent(cZ(e),r);if(i){var a=i.getCoordSysModel();if(a){var o=a.uid,s=n.infoMap.get(o);s||(s={model:a,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(i)}}}),n}function dZ(e){var t=aZ(wz(e));return t.axisProxyMap||=_C()}function fZ(e){if(e)return dZ(e.ecModel).get(e.uid)}function pZ(e,t){dZ(e.ecModel).set(e.uid,t)}function mZ(e,t){var n=t.getAxisModel().axis.__alignTo;return n&&e.getAxisProxy(n.dim,n.model.componentIndex)?fZ(n.model):null}var hZ=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),gZ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=_Z(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=_Z(e);RS(this.option,e,!0),RS(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;Y([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=_C();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return Y(iZ,function(n){var r=this.getReferringComponents(cZ(n),pae);if(r.specified){t=!0;var i=new hZ;Y(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new hZ;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,Bk).models[0];o&&Y(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,Bk).models[0]&&a.add(e.componentIndex)})}}}r&&Y(iZ,function(t){if(r){var i=n.findComponents({mainType:cZ(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new hZ;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);Y([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(cZ(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){Y(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return fZ(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(cZ(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Y([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;Y([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return fZ(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;ra[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else Y(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});Y(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;Y([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=ek(i,[0,100],n,!0)-n[0]):i=ek(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),bZ={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(cZ(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!fZ(i)){var o=new yZ(t,r,a,e);n.push(o),pZ(i,o)}});var r=_C();return Y(n,function(e){Y(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=mZ(e,i);a?n.push([i,a]):i.reset(e,null)}),Y(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}};function xZ(e){e.registerAction(`dataZoom`,function(e,t){Y(lZ(t,e),function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var SZ=Zk();function CZ(e){SZ(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,bZ),xZ(e),e.registerSubTypeDefaulter(`dataZoom`,function(){return`slider`})})}function wZ(e,t){var n=GF(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new OO({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var TZ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:Q.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:Q.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:Q.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:Q.color.tertiary,fontSize:14}},t}(sI);function EZ(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function DZ(e){if(CC.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function xfe(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+(CC.transformSupported?``+NZ+i:`,left`+i+`,top`+i)),MZ+`:`+a}function IZ(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!CC.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=CC.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+NZ+`:`+o+`;`:[[`top`,0],[`left`,0],[OZ,o]]}function Sfe(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=sC(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),Y([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function Cfe(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=MI(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(xfe(a,n,r)),o&&i.push(`background-color:`+o),Y([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=WF(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(Sfe(d)),f!=null&&i.push(`padding:`+GF(f).join(`px `)+`px`),i.join(`;`)+`;`}function LZ(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&RP(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var wfe=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,CC.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(ZS(i)?document.querySelector(i):rC(i)?i:XS(i)&&i(e.getDom()));LZ(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;EV(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=jZ(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=PZ+Cfe(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+IZ(i[0],i[1],!0)+(`border-color:`+XF(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null)a.innerHTML=``;else{var o=``;if(ZS(i)&&n.get(`trigger`)===`item`&&!EZ(n)&&(o=bfe(n,r,i)),ZS(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,X(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!CC.node&&n.getDom()){var i=HZ(r,n);this._ticket=``;var a=r.dataByCoordSys,o=jfe(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=Efe;c.x=r.x,c.y=r.y,c.update(),rA(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=UX(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide(HZ(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&VZ([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(rA(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;cU(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(rA(e).dataIndex==null?rA(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=JS(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=VZ([t.tooltipOption],r),o=this._renderMode,s=[],c=TI(`section`,{blocks:[],noHeader:!0}),l=[],u=new NI;Y(e,function(e){Y(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=xX(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=TI(`section`,{header:f,noHeader:!fC(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),Y(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=bR(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,XF(m.color),o);var h=pI(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=VZ([a],r).get(`valueFormatter`);p.blocks.push(_?J({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=kI(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` +`];function EI(e,t){return t.type=e,t}function DI(e){return e.type===`section`}function OI(e){return DI(e)?qse:Jse}function kI(e){if(DI(e)){var t=0,n=e.blocks.length,r=n>1||n>0&&!e.noHeader;return Y(e.blocks,function(e){var n=kI(e);n>=t&&(t=n+ +(r&&(!n||DI(e)&&!e.noHeader)))}),t}return 0}function qse(e,t,n,r){var i=t.noHeader,a=Yse(kI(t)),o=[],s=t.blocks||[];dC(!s||X(s)),s||=[];var c=e.orderMode;if(t.sortBlocks&&c){s=s.slice();var l={valueAsc:`asc`,valueDesc:`desc`};if(Z(l,c)){var u=new qoe(l[c],null);s.sort(function(e,t){return u.evaluate(e.sortParam,t.sortParam)})}else c===`seriesDesc`&&s.reverse()}Y(s,function(n,i){var s=t.valueFormatter,c=OI(n)(s?J(J({},e),{valueFormatter:s}):e,n,i>0?a.html:0,r);c!=null&&o.push(c)});var d=e.renderMode===`richText`?o.join(a.richText):jI(r,o.join(``),i?n:a.html);if(i)return d;var f=KF(t.header,`ordinal`,e.useUTC),p=wI(r,e.renderMode).nameStyle,m=CI(r);return e.renderMode===`richText`?MI(e,f,p)+a.richText+d:jI(r,`
`+KP(f)+`
`+d,n)}function Jse(e,t,n,r){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,c=t.name,l=e.useUTC,u=t.valueFormatter||e.valueFormatter||function(e){return e=X(e)?e:[e],US(e,function(e,t){return KF(e,X(p)?p[t]:p,l)})};if(!(a&&o)){var d=s?``:e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||Q.color.secondary,i),f=a?``:KF(c,`ordinal`,l),p=t.valueType,m=o?[]:u(t.value,t.rawDataIndex),h=!s||!a,g=!s&&a,_=wI(r,i),v=_.nameStyle,y=_.valueStyle;return i===`richText`?(s?``:d)+(a?``:MI(e,f,v))+(o?``:Qse(e,m,h,g,y)):jI(r,(s?``:d)+(a?``:Xse(f,!s,v))+(o?``:Zse(m,h,g,y)),n)}}function AI(e,t,n,r,i,a){if(e)return OI(e)({useUTC:i,renderMode:n,orderMode:r,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,a)}function Yse(e){return{html:Kse[e],richText:TI[e]}}function jI(e,t,n){var r=`
`,i=`margin: `+n+`px 0 0`,a=CI(e);return`
`+t+r+`
`}function Xse(e,t,n){var r=t?`margin-left:2px`:``;return``+KP(e)+``}function Zse(e,t,n,r){var i=t?`float:right;margin-left:`+(n?`10px`:`20px`):``;return e=X(e)?e:[e],``+US(e,function(e){return KP(e)}).join(`  `)+``}function MI(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function Qse(e,t,n,r,i){var a=[i],o=r?10:20;return n&&a.push({padding:[0,0,0,o],align:`right`}),e.markupStyleCreator.wrapRichTextStyle(X(t)?t.join(` `):t,a)}function $se(e,t){var n=e.getData().getItemVisual(t,`style`)[e.visualDrawType];return XF(n)}function NI(e,t){return e.get(`padding`)??(t===`richText`?[8,10]:10)}var PI=function(){function e(){this.richTextStyles={},this._nextStyleNameId=vk()}return e.prototype._generateStyleName=function(){return`__EC_aUTo_`+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var r=n===`richText`?this._generateStyleName():null,i=Cse({color:t,type:e,renderMode:n,markerId:r});return ZS(i)?i:(this.richTextStyles[r]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};X(t)?Y(t,function(e){return J(n,e)}):J(n,t);var r=this._generateStyleName();return this.richTextStyles[r]=n,`{`+r+`|`+e+`}`},e}();function ece(e){var t=e.series,n=e.dataIndex,r=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll(`defaultedTooltip`),o=a.length,s=t.getRawValue(n),c=X(s),l=$se(t,n),u,d,f,p;if(o>1||c&&!o){var m=tce(s,t,n,a,l);u=m.inlineValues,d=m.inlineValueTypes,f=m.blocks,p=m.inlineValues[0]}else if(o){var h=i.getDimensionInfo(a[0]);p=u=KN(i,n,a[0]),d=h.type}else p=u=c?s[0]:s;var g=Pk(t),_=g&&t.name||``,v=i.getName(n),y=r?_:v;return EI(`section`,{header:_,noHeader:r||!g,sortParam:p,blocks:[EI(`nameValue`,{markerType:`item`,markerColor:l,name:y,noName:!fC(y),value:u,valueType:d,rawDataIndex:i.getRawIndex(n)})].concat(f||[])})}function tce(e,t,n,r,i){var a=t.getData(),o=WS(e,function(e,t,n){var r=a.getDimensionInfo(n);return e||=r&&r.tooltip!==!1&&r.displayName!=null},!1),s=[],c=[],l=[];r.length?Y(r,function(e){u(KN(a,n,e),e)}):Y(e,u);function u(e,t){var n=a.getDimensionInfo(t);n&&n.otherDims.tooltip!==!1&&(o?l.push(EI(`nameValue`,{markerType:`subItem`,markerColor:i,name:n.displayName,value:e,valueType:n.type})):(s.push(e),c.push(n.type)))}return{inlineValues:s,inlineValueTypes:c,blocks:l}}var FI=Lk();function II(e,t){return e.getName(t)||e.getId(t)}var LI=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=mI({count:rce,reset:ice}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(FI(this).sourceManager=new Wse(this)).prepareSource();var r=this.getInitialData(e,n);zI(r,this),this.dataTask.context.data=r,FI(this).dataBeforeProcessed=r,RI(this),this._initSelectedMapFromData(r)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=iI(this),r=n?oI(e):{},i=this.subType;sI.hasClass(i)&&(i+=`Series`),RS(e,t.getTheme().get(this.subType)),RS(e,this.getDefaultOption()),Ok(e,`label`,[`show`]),this.fillDataTextStyle(e.data),n&&aI(e,r,n)},t.prototype.mergeOption=function(e,t){e=RS(this.option,e,!0),this.fillDataTextStyle(e.data);var n=iI(this);n&&aI(this.option,e,n);var r=FI(this).sourceManager;r.dirty(),r.prepareSource();var i=this.getInitialData(e,t);zI(i,this),this.dataTask.dirty(),this.dataTask.context.data=i,FI(this).dataBeforeProcessed=i,RI(this),this._initSelectedMapFromData(i)},t.prototype.fillDataTextStyle=function(e){if(e&&!nC(e))for(var t=[`show`],n=0;n=0&&u<0)&&(l=v,u=_,d=0),_===u&&(c[d++]=m))}return c.length=d,c},t.prototype.formatTooltip=function(e,t,n){return ece({series:this,dataIndex:e,multipleSeries:t})},t.prototype.isAnimationEnabled=function(){var e=this.ecModel;if(CC.node&&!(e&&e.ssr))return!1;var t=this.getShallow(`animation`);return t&&this.getData().count()>this.getShallow(`animationThreshold`)&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var r=this.ecModel,i=lI.prototype.getColorFromPalette.call(this,e,t,n);return i||=r.getColorFromPalette(e,t,n),i},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get(`progressive`)},t.prototype.getProgressiveThreshold=function(){return this.get(`progressiveThreshold`)},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var r=this.option.selectedMode,i=this.getData(t);if(r===`series`||n===`all`)this.option.selectedMap={},this._selectedDataIndicesMap={};else for(var a=0;a=0&&n.push(i)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var r=this.getData(t);return(n===`all`||n[II(r,e)])&&!r.getItemModel(e).get([`select`,`disabled`])},t.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var e=this.option.universalTransition;return e?e===!0||e&&e.enabled:!1},t.prototype._innerSelect=function(e,t){var n,r,i=this.option,a=i.selectedMode,o=t.length;if(a&&o){if(a===`series`)i.selectedMap=`all`;else if(a===`multiple`){eC(i.selectedMap)||(i.selectedMap={});for(var s=i.selectedMap,c=0;c0&&this._innerSelect(e,t)}},t.registerClass=function(e){return sI.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type=`series.__base__`,e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol=`circle`,e.visualStyleAccessPath=`itemStyle`,e.visualDrawType=`fill`}(),t}(sI);VS(LI,fI),VS(LI,lI),NC(LI,sI);function RI(e){var t=e.name;Pk(e)||(e.name=nce(e)||t)}function nce(e){var t=e.getRawData(),n=t.mapDimensionsAll(`seriesName`),r=[];return Y(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&r.push(n.displayName)}),r.join(` `)}function rce(e){return e.model.getRawData().count()}function ice(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),ace}function ace(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function zI(e,t){Y(Lre(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,YS(oce,t))})}function oce(e,t){var n=BI(e);return n&&n.setOutputEnd((t||this).count()),t}function BI(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var r=n.currentTask;if(r){var i=r.agentStubMap;i&&(r=i.get(e.uid))}return r}}var sce=xO.extend({type:`triangle`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r+a),e.lineTo(n-i,r+a),e.closePath()}}),cce={line:Rj,rect:OO,roundRect:OO,square:OO,circle:bj,diamond:xO.extend({type:`diamond`,shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,r=t.cy,i=t.width/2,a=t.height/2;e.moveTo(n,r-a),e.lineTo(n+i,r),e.lineTo(n,r+a),e.lineTo(n-i,r),e.closePath()}}),pin:xO.extend({type:`pin`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,r=t.y,i=t.width/5*3,a=Math.max(i,t.height),o=i/2,s=o*o/(a-o),c=r-a+o+s,l=Math.asin(s/o),u=Math.cos(l)*o,d=Math.sin(l),f=Math.cos(l),p=o*.6,m=o*.7;e.moveTo(n-u,c+s),e.arc(n,c,o,Math.PI-l,Math.PI*2+l),e.bezierCurveTo(n+u-d*p,c+s+f*p,n,r-m,n,r),e.bezierCurveTo(n,r-m,n-u+d*p,c+s+f*p,n-u,c+s),e.closePath()}}),arrow:xO.extend({type:`arrow`,shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,r=t.width,i=t.x,a=t.y,o=r/3*2;e.moveTo(i,a),e.lineTo(i+o,a+n),e.lineTo(i,a+n/4*3),e.lineTo(i-o,a+n),e.lineTo(i,a),e.closePath()}}),triangle:sce},lce={line:function(e,t,n,r,i){i.x1=e,i.y1=t+r/2,i.x2=e+n,i.y2=t+r/2},rect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r},roundRect:function(e,t,n,r,i){i.x=e,i.y=t,i.width=n,i.height=r,i.r=Math.min(n,r)/4},square:function(e,t,n,r,i){var a=Math.min(n,r);i.x=e,i.y=t,i.width=a,i.height=a},circle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.r=Math.min(n,r)/2},diamond:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r},pin:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},arrow:function(e,t,n,r,i){i.x=e+n/2,i.y=t+r/2,i.width=n,i.height=r},triangle:function(e,t,n,r,i){i.cx=e+n/2,i.cy=t+r/2,i.width=n,i.height=r}},VI={};Y(cce,function(e,t){VI[t]=new e});var uce=xO.extend({type:`symbol`,shape:{symbolType:``,x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var r=Xw(e,t,n),i=this.shape;return i&&i.symbolType===`pin`&&t.position===`inside`&&(r.y=n.y+n.height*.4),r},buildPath:function(e,t,n){var r=t.symbolType;if(r!==`none`){var i=VI[r];i||=(r=`rect`,VI[r]),lce[r](t.x,t.y,t.width,t.height,i.shape),i.buildPath(e,i.shape,n)}}});function dce(e,t){if(this.type!==`image`){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||Q.color.neutral00,n.lineWidth=2):this.shape.symbolType===`line`?n.stroke=e:n.fill=e,this.markRedraw()}}function HI(e,t,n,r,i,a,o){var s=e.indexOf(`empty`)===0;s&&(e=e.substr(5,1).toLowerCase()+e.substr(6));var c=e.indexOf(`image://`)===0?gM(e.slice(8),new Aw(t,n,r,i),o?`center`:`cover`):e.indexOf(`path://`)===0?hM(e.slice(7),{},new Aw(t,n,r,i),o?`center`:`cover`):new uce({shape:{symbolType:e,x:t,y:n,width:r,height:i}});return c.__isEmptyBrush=s,c.setColor=dce,a&&c.setColor(a),c}function UI(e){return X(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function WI(e,t){if(e!=null)return X(e)||(e=[e,e]),[tk(e[0],t[0])||0,tk(sC(e[1],e[0]),t[1])||0]}var fce=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e){return kP(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new yj,n=HI(`line`,0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var r=this.getData().getVisual(`symbol`),i=this.getData().getVisual(`symbolRotate`),a=r===`none`?`circle`:r,o=e.itemHeight*.8,s=HI(a,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);return t.add(s),s.setStyle(e.itemStyle),s.rotation=(e.iconRotate===`inherit`?i:e.iconRotate||0)*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),a.indexOf(`empty`)>-1&&(s.style.stroke=s.style.fill,s.style.fill=Q.color.neutral00,s.style.lineWidth=2),t},t.type=`series.line`,t.dependencies=[`grid`,`polar`],t.defaultOption={z:3,coordinateSystem:`cartesian2d`,legendHoverLink:!0,clip:!0,label:{position:`top`},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:`solid`},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:`emptyCircle`,symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:`auto`,connectNulls:!1,sampling:`none`,animationEasing:`linear`,progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:`clone`},triggerLineEvent:!1,triggerEvent:!1},t}(LI);function GI(e,t){var n=e.mapDimensionsAll(`defaultedLabel`),r=n.length;if(r===1){var i=KN(e,t,n[0]);return i==null?null:i+``}if(r){for(var a=[],o=0;o=0&&r.push(t[a])}return r.join(` `)}var qI=function(e){vS(t,e);function t(t,n,r,i){var a=e.call(this)||this;return a.updateData(t,n,r,i),a}return t.prototype._createSymbol=function(e,t,n,r,i,a){this.removeAll();var o=HI(e,-1,-1,2,2,null,a);o.attr({z2:sC(i,100),culling:!0,scaleX:r[0]/2,scaleY:r[1]/2}),o.drift=pce,this._symbolType=e,this.add(o)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){BA(this.childAt(0))},t.prototype.downplay=function(){VA(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?`move`:n.cursor},t.prototype.updateData=function(e,n,r,i){this.silent=!1;var a=e.getItemVisual(n,`symbol`)||`circle`,o=e.hostModel,s=t.getSymbolSize(e,n),c=t.getSymbolZ2(e,n),l=a!==this._symbolType,u=i&&i.disableAnimation;if(l){var d=e.getItemVisual(n,`symbolKeepAspect`);this._createSymbol(a,e,n,s,c,d)}else{var f=this.childAt(0);f.silent=!1;var p={scaleX:s[0]/2,scaleY:s[1]/2};u?f.attr(p):nM(f,p,o,n),cM(f)}if(this._updateCommon(e,n,s,r,i),l){var f=this.childAt(0);if(!u){var p={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:f.style.opacity}};f.scaleX=f.scaleY=0,f.style.opacity=0,rM(f,p,o,n)}}u&&this.childAt(0).stopAnimation(`leave`)},t.prototype._updateCommon=function(e,t,n,r,i){var a=this.childAt(0),o=e.hostModel,s,c,l,u,d,f,p,m,h;if(r&&(s=r.emphasisItemStyle,c=r.blurItemStyle,l=r.selectItemStyle,u=r.focus,d=r.blurScope,p=r.labelStatesModels,m=r.hoverScale,h=r.cursorStyle,f=r.emphasisDisabled),!r||e.hasItemOption){var g=r&&r.itemModel?r.itemModel:e.getItemModel(t),_=g.getModel(`emphasis`);s=_.getModel(`itemStyle`).getItemStyle(),l=g.getModel([`select`,`itemStyle`]).getItemStyle(),c=g.getModel([`blur`,`itemStyle`]).getItemStyle(),u=_.get(`focus`),d=_.get(`blurScope`),f=_.get(`disabled`),p=ZM(g),m=_.getShallow(`scale`),h=g.getShallow(`cursor`)}var v=e.getItemVisual(t,`symbolRotate`);a.attr(`rotation`,(v||0)*Math.PI/180||0);var y=WI(e.getItemVisual(t,`symbolOffset`),n);y&&(a.x=y[0],a.y=y[1]),h&&a.attr(`cursor`,h);var b=e.getItemVisual(t,`style`),x=b.fill;if(a instanceof CO){var S=a.style;a.useStyle(J({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else a.__isEmptyBrush?a.useStyle(J({},b)):a.useStyle(b),a.style.decal=null,a.setColor(x,i&&i.symbolInnerColor),a.style.strokeNoScale=!0;var C=e.getItemVisual(t,`liftZ`),w=this._z2;C==null?w!=null&&(a.z2=w,this._z2=null):w??(this._z2=a.z2,a.z2+=C);var T=i&&i.useNameLabel;XM(a,p,{labelFetcher:o,labelDataIndex:t,defaultText:E,inheritColor:x,defaultOpacity:b.opacity});function E(t){return T?e.getName(t):GI(e,t)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var D=a.ensureState(`emphasis`);D.style=s,a.ensureState(`select`).style=l,a.ensureState(`blur`).style=c;var O=m==null||m===!0?Math.max(1.1,3/this._sizeY):isFinite(m)&&m>0?+m:1;D.scaleX=this._sizeX*O,D.scaleY=this._sizeY*O,this.setSymbolScale(1),$A(this,u,d,f)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var r=this.childAt(0),i=rA(this).dataIndex,a=n&&n.animation;if(this.silent=r.silent=!0,n&&n.fadeLabel){var o=r.getTextContent();o&&aM(o,{style:{opacity:0}},t,{dataIndex:i,removeOpt:a,cb:function(){r.removeTextContent()}})}else r.removeTextContent();aM(r,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:i,cb:e,removeOpt:a})},t.getSymbolSize=function(e,t){return UI(e.getItemVisual(t,`symbolSize`))},t.getSymbolZ2=function(e,t){return e.getItemVisual(t,`z2`)},t}(yj);function pce(e,t){this.parent.drift(e,t)}function JI(e,t,n,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r&&r.isIgnore&&r.isIgnore(n))&&!(r&&r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&e.getItemVisual(n,`symbol`)!==`none`}function YI(e){return e!=null&&!eC(e)&&(e={isIgnore:e}),e||{}}function XI(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{emphasisItemStyle:n.getModel(`itemStyle`).getItemStyle(),blurItemStyle:t.getModel([`blur`,`itemStyle`]).getItemStyle(),selectItemStyle:t.getModel([`select`,`itemStyle`]).getItemStyle(),focus:n.get(`focus`),blurScope:n.get(`blurScope`),emphasisDisabled:n.get(`disabled`),hoverScale:n.get(`scale`),labelStatesModels:ZM(t),cursorStyle:t.get(`cursor`)}}function ZI(e,t,n,r,i,a,o){var s=new e(t,n,r,i);return s.setPosition(a),t.setItemGraphicEl(n,s),o.add(s),s}var QI=function(){function e(e){this.group=new yj,this._SymbolCtor=e||qI}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=YI(t);var n=this.group,r=e.hostModel,i=this._data,a=this._SymbolCtor,o=t.disableAnimation,s=this._seriesScope=XI(e),c={disableAnimation:o},l=t.getSymbolPoint||function(t){return e.getItemLayout(t)};i||n.removeAll(),e.diff(i).add(function(r){var i=l(r);JI(e,i,r,t)&&ZI(a,e,r,s,c,i,n)}).update(function(u,d){var f=i.getItemGraphicEl(d),p=l(u);if(!JI(e,p,u,t))n.remove(f);else{var m=e.getItemVisual(u,`symbol`)||`circle`,h=f&&f.getSymbolType&&f.getSymbolType();if(!f||h&&h!==m)n.remove(f),f=new a(e,u,s,c),f.setPosition(p);else{f.updateData(e,u,s,c);var g={x:p[0],y:p[1]};o?f.attr(g):nM(f,g,r)}n.add(f),e.setItemGraphicEl(u,f)}}).remove(function(e){var t=i.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},r)}).execute(),this._getSymbolPoint=l,this._data=e},e.prototype.updateLayout=function(e){var t=this._data;if(t)for(var n=this,r=t.getStore(),i=0,a=r.count();i0?n=r[0]:r[1]<0&&(n=r[1]),n}function eL(e,t,n,r){var i=NaN;e.stacked&&(i=n.get(n.getCalculationInfo(`stackedOverDimension`),r)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=n.get(e.baseDim,r),o[1-a]=i,t.dataToPoint(o)}function tL(e,t){return!isFinite(e)||!isFinite(t)}var hce=typeof Float32Array<`u`?Float32Array:void 0,gce=typeof Float64Array<`u`?Float64Array:void 0;function nL(e){return rL({ctor:hce},e).arr}function rL(e,t){var n=e.arr,r=e.ctor;if(t>lk&&(t=lk),!n||e.typed&&n.length=i||h<0)break;if(tL(_,v)){if(c){h+=a;continue}break}if(h===n)e[a>0?`moveTo`:`lineTo`](_,v),d=_,f=v;else{var y=_-l,b=v-u;if(y*y+b*b<.5){h+=a;continue}if(o>0){for(var x=h+a,S=t[x*2],C=t[x*2+1];S===_&&C===v&&g=r||tL(S,C))p=_,m=v;else{E=S-l,D=C-u;var A=_-l,j=S-_,M=v-u,N=C-v,P=void 0,F=void 0;if(s===`x`){P=Math.abs(A),F=Math.abs(j);var ee=E>0?1:-1;p=_-ee*P*o,m=v,O=_+ee*F*o,k=v}else if(s===`y`){P=Math.abs(M),F=Math.abs(N);var I=D>0?1:-1;p=_,m=v-I*P*o,O=_,k=v+I*F*o}else P=Math.sqrt(A*A+M*M),F=Math.sqrt(j*j+N*N),T=F/(F+P),p=_-E*o*(1-T),m=v-D*o*(1-T),O=_+E*o*T,k=v+D*o*T,O=iL(O,aL(S,_)),k=iL(k,aL(C,v)),O=aL(O,iL(S,_)),k=aL(k,iL(C,v)),E=O-_,D=k-v,p=_-E*P/F,m=v-D*P/F,p=iL(p,aL(l,_)),m=iL(m,aL(u,v)),p=aL(p,iL(l,_)),m=aL(m,iL(u,v)),E=_-p,D=v-m,O=_+E*F/P,k=v+D*F/P}e.bezierCurveTo(d,f,p,m,_,v),d=O,f=k}else e.lineTo(_,v)}l=_,u=v,h+=a}return g}var sL=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),yce=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polyline`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new sL},t.prototype.buildPath=function(e,t){var n=t.points,r=0,i=n.length/2;if(t.connectNulls){for(;i>0&&tL(n[i*2-2],n[i*2-1]);i--);for(;r=0){var _=o?(d-a)*g+a:(u-i)*g+i;return o?[e,_]:[_,e]}i=u,a=d;break;case r.C:u=n[c++],d=n[c++],f=n[c++],p=n[c++],m=n[c++],h=n[c++];var v=o?FT(i,u,f,m,e,s):FT(a,d,p,h,e,s);if(v>0)for(var y=0;y=0){var _=o?NT(a,d,p,h,b):NT(i,u,f,m,b);return o?[e,_]:[_,e]}}i=m,a=h}}},t}(xO),bce=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(sL),xce=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-polygon`,n}return t.prototype.getDefaultShape=function(){return new bce},t.prototype.buildPath=function(e,t){var n=t.points,r=t.stackedOnPoints,i=0,a=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;a>0&&tL(n[a*2-2],n[a*2-1]);a--);for(;i=0,a=e.fill||Q.color.neutral99;bL(r,t);var o=r.textFill==null;return i?o&&(r.textFill=n.insideFill||Q.color.neutral00,!r.textStroke&&n.insideStroke&&(r.textStroke=n.insideStroke),!r.textStroke&&(r.textStroke=a),r.textStrokeWidth??=2):(o&&(r.textFill=e.fill||n.outsideFill||Q.color.neutral00),!r.textStroke&&n.outsideStroke&&(r.textStroke=n.outsideStroke)),r.text=t.text,r.rich=t.rich,Y(t.rich,function(e){bL(e,e)}),r}function bL(e,t){t&&(Z(t,`fill`)&&(e.textFill=t.fill),Z(t,`stroke`)&&(e.textStroke=t.fill),Z(t,`lineWidth`)&&(e.textStrokeWidth=t.lineWidth),Z(t,`font`)&&(e.font=t.font),Z(t,`fontStyle`)&&(e.fontStyle=t.fontStyle),Z(t,`fontWeight`)&&(e.fontWeight=t.fontWeight),Z(t,`fontSize`)&&(e.fontSize=t.fontSize),Z(t,`fontFamily`)&&(e.fontFamily=t.fontFamily),Z(t,`align`)&&(e.textAlign=t.align),Z(t,`verticalAlign`)&&(e.textVerticalAlign=t.verticalAlign),Z(t,`lineHeight`)&&(e.textLineHeight=t.lineHeight),Z(t,`width`)&&(e.textWidth=t.width),Z(t,`height`)&&(e.textHeight=t.height),Z(t,`backgroundColor`)&&(e.textBackgroundColor=t.backgroundColor),Z(t,`padding`)&&(e.textPadding=t.padding),Z(t,`borderColor`)&&(e.textBorderColor=t.borderColor),Z(t,`borderWidth`)&&(e.textBorderWidth=t.borderWidth),Z(t,`borderRadius`)&&(e.textBorderRadius=t.borderRadius),Z(t,`shadowColor`)&&(e.textBoxShadowColor=t.shadowColor),Z(t,`shadowBlur`)&&(e.textBoxShadowBlur=t.shadowBlur),Z(t,`shadowOffsetX`)&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Z(t,`shadowOffsetY`)&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Z(t,`textShadowColor`)&&(e.textShadowColor=t.textShadowColor),Z(t,`textShadowBlur`)&&(e.textShadowBlur=t.textShadowBlur),Z(t,`textShadowOffsetX`)&&(e.textShadowOffsetX=t.textShadowOffsetX),Z(t,`textShadowOffsetY`)&&(e.textShadowOffsetY=t.textShadowOffsetY))}var xL=function(){function e(){}return e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();RC(xL);var Oce=0,SL=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++Oce,this._onCollect=e.onCollect}return e.createByAxisModel=function(t){var n=t.option,r=n.data,i=r&&US(r,kce);return new e({categories:i,needCollect:!i,deduplication:n.dedplication!==!1})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!ZS(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,this._onCollect&&this._onCollect(e,t),t;var r=this._getOrCreateMap();return t=r.get(e),t??(n?(t=this.categories.length,this.categories[t]=e,r.set(e,t),this._onCollect&&this._onCollect(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||=_C(this.categories)},e}();function kce(e){return eC(e)&&e.value!=null?e.value:e+``}var CL=qS({needTransform:1,normalize:1,scale:1,transformIn:1,transformOut:1,contain:1,getExtent:1,getExtentUnsafe:1,setExtent:1,setExtent2:1,getFilter:1,sanitize:1,getDefaultStartValue:1,freeze:1});function wL(e,t,n){var r;e||={};var i=oF();if(i){var a=i.createBreakScaleMapper(t,n);a.hasBreaks()&&(Y(CL,function(t){a[t]&&(e[t]=JS(a[t],a))}),r=a)}return r??jce(e,n),{brk:r,mapper:e}}function TL(e,t){Y(CL,function(n){e[n]=t[n]})}function EL(e,t){e.freeze=bC}function DL(e){return e.getExtentUnsafe(0,2)}function OL(e,t){return e.getExtentUnsafe(1,t)||e.getExtentUnsafe(0,t)}function Ace(e){var t=OL(e,3);return t[1]-t[0]}function kL(e){var t=e.getExtentUnsafe(0,3);return t[1]-t[0]}function jce(e,t){var n=e||{},r=[];return n._extents=r,r[0]=t?t.slice():Wk(),J(n,Mce),n}var Mce={needTransform:function(){return!1},normalize:function(e){var t=this._extents[1]||this._extents[0];return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])},scale:function(e){var t=this._extents[1]||this._extents[0];return e*(t[1]-t[0])+t[0]},transformIn:function(e){return e},transformOut:function(e){return e},contain:function(e){var t=OL(this,null);return e>=t[0]&&e<=t[1]},getExtent:function(){return this._extents[0].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){AL(this._extents,0,e,t)},setExtent2:function(e,t,n){var r=this._extents;r[e]||(r[e]=r[0].slice()),AL(r,e,t,n)},freeze:function(){}};function AL(e,t,n,r){Yk(n,r)&&(e[t][0]=n,e[t][1]=r)}function jL(e){return ML(e)||PL(e)}function ML(e){return e.type===`interval`}function NL(e){return e.type===`time`}function PL(e){return e.type===`log`}function FL(e){return e.type===`ordinal`}function IL(e){var t=mk(e),n=ZO(10,t),r=JO(e/n);return r?r===2?r=3:r===3?r=5:r*=2:r=1,ik(r*n,-t)}function LL(e){return ok(e)+2}function RL(e,t){return QO(e)/QO(t)}function zL(e,t,n){var r=n&&n.lookup;if(r){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==r[0]&&c(r[0],!0,!0);for(var s=i;s<=r[1];s+=o)c(s,!1,s===r[0]||s===r[1]);s-o!==r[1]&&c(r[1],!0,!0);function c(e,t,r){n({value:e,offInterval:t},r)}}var WL=function(e){vS(t,e);function t(n){var r=e.call(this)||this;r.type=`ordinal`,r.parse=t.parse,TL(r,t.decoratedMethods);var i=n.ordinalMeta;i||=new SL({}),X(i)&&(i=new SL({categories:US(i,function(e){return eC(e)?e.value:e})})),r._ordinalMeta=i;var a=wL(null,null,n.extent||[0,i.categories.length-1]);return r._mapper=a.mapper,EL(r,a.mapper),r}return t.parse=function(e){return e==null?e=NaN:ZS(e)?(e=this._ordinalMeta.getOrdinal(e),e??=NaN):e=JO(e),e},t.prototype.getTicks=function(){var e=[];return UL(this,0,function(t){e.push(t)}),e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(e==null)this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;else{for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],r=this._ticksByOrdinalNumber=[],i=0,a=this._ordinalMeta.categories.length,o=GO(a,t.length);i=0&&e=0&&e=0&&eo[0]&&mi[1]||!isFinite(p)||!isFinite(i[1]))break}else{if(m>f)break;p=GO(p,i[1]),m===f&&(p=i[1])}if(l.push({value:p}),p=ik(p+n,a),s){var h=s.calcNiceTickMultiple(p,d);h>=0&&(p=ik(p+h*n,a))}if(l.length>0&&p===l[l.length-1].value)break;if(l.length>u)return[]}var g=l.length?l[l.length-1].value:i[1];return r[1]>g&&l.push({value:e.expandToNicedExtent?ik(g+n,a):r[1]}),c&&o.pruneTicksByBreak(e.pruneByBreak,l,s.breaks,function(e){return e.value},t.interval,r),c&&e.breakTicks!==`none`&&o.addBreaksToTicks(l,s.breaks,r),l},t.prototype.getMinorTicks=function(e){return GL(this,e,cF(this),this._cfg.interval)},t.prototype.getLabel=function(e,t){if(e==null)return``;var n=t&&t.precision;return n==null?n=ok(e.value)||0:n===`auto`&&(n=this._cfg.intervalPrecision),UF(ik(e.value,n,!0))},t.type=`interval`,t}(xL);xL.registerClass(KL);var qL=function(e,t,n,r){for(;n>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function QL(e){var t=30*pF;return e/=t,e>6?6:e>3?3:e>2?2:1}function $L(e){return e/=fF,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function eR(e,t){return e/=t?dF:uF,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function tR(e){return KO(hk(e,!0),1)}function nR(e,t,n){var r=Math.max(0,BS(bF,t)-1);return kF(new Date(e),bF[r],n).getTime()}function rR(e,t){var n=new Date(0);n[e](1);var r=n.getTime();n[e](1+t);var i=n.getTime()-r;return function(e,t){return Math.max(0,Math.round((t-e)/i))}}function iR(e,t,n,r,i,a){var o=xF,s=0;function c(e,t,n,i,o,c,l){for(var u=rR(o,e),d=t,f=new Date(d);d3e3));)if(f[o](f[i]()+e),d=f.getTime(),a){var p=a.calcNiceTickMultiple(d,u);p>0&&(f[o](f[i]()+p*e),d=f.getTime())}l.push({value:d,notAdd:d>r[1]})}function l(e,i,a){var o=[],s=!i.length;if(!XL(TF(e),r[0],r[1],n)){s&&(i=[{value:nR(r[0],e,n)},{value:r[1]}]);for(var l=0;l=r[0]&&u<=r[1]&&c(f,u,d,p,m,h,o),e===`year`&&a.length>1&&l===0&&a.unshift({value:a[0].value-f})}}for(var l=0;l=r[0]&&v<=r[1]&&f++)}var y=i/t;if(f>y*1.5&&p>y/1.5||(u.push(g),f>y||e===o[m]))break}d=[]}}for(var b=GS(US(u,function(e){return GS(e,function(e){return e.value>=r[0]&&e.value<=r[1]&&!e.notAdd})}),function(e){return e.length>0}),x=b.length-1,S=[],m=0;mr[0])&&S.unshift({value:r[0],time:{level:0,upperTimeUnit:O,lowerTimeUnit:O},notNice:!0}),(!D||D.values&&(a=s);var c=YL.length,l=Math.min(qL(YL,a,0,c),c-1),u=YL[l][1],d=YL[Math.max(l-1,0)][0];e.setTimeInterval({approxInterval:a,interval:u,minLevelUnit:d})};xL.registerClass(JL);var oR=0,sR=1,cR=2,lR=function(e){vS(t,e);function t(n){var r=e.call(this)||this;r.type=`log`,r.parse=KL.parse,r.base=n.logBase||10;var i=[],a=[],o=r._lookup={from:i,to:a};i[oR]=i[sR]=a[oR]=a[sR]=NaN,TL(r,t.mapperMethods);var s=oF(),c=n.breakOption,l={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(c,r,{noNegative:!0},cR,l),r.powStub=new KL({breakParsed:l.original}),r.intervalStub=new KL({breakParsed:l.transformed}),EL(r,r.intervalStub),r}return t.prototype.getTicks=function(e){var t=this.base,n=this.powStub,r=oF(),i=this.intervalStub,a={lookup:{from:i.getExtent(),to:n.getExtent()}};return US(i.getTicks(e||{}),function(e){var i=e.value,o=zL(i,t,a),s;if(r){var c=r.getTicksBreakOutwardTransform(this,e,cF(n),this._lookup);c&&(s=c.vBreak,o=c.tickVal)}return{value:o,break:s}},this)},t.prototype.getMinorTicks=function(e){return GL(this,e,cF(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(e,t){return this.intervalStub.getLabel(e,t)},t.type=`log`,t.mapperMethods={needTransform:function(){return!0},normalize:function(e){return this.intervalStub.normalize(RL(e,this.base))},scale:function(e){return zL(this.intervalStub.scale(e),this.base,null)},transformIn:function(e,t){return e=RL(e,this.base),t&&t.depth===2?e:this.intervalStub.transformIn(e,t)},transformOut:function(e,t){var n=t?t.depth:null;return uR.depth=n,dR.lookup=this._lookup,zL(n===2?e:this.intervalStub.transformOut(e,uR),this.base,dR)},contain:function(e){return this.powStub.contain(e)},setExtent:function(e,t){this.setExtent2(0,e,t)},setExtent2:function(e,t,n){if(!(!Yk(t,n)||t<=0||n<=0)){var r=fR,i=fR;if(e===0){var a=this._lookup;r=a.to,i=a.from}this.powStub.setExtent2(e,r[oR]=t,r[sR]=n);var o=this.base;this.intervalStub.setExtent2(e,i[oR]=RL(t,o),i[sR]=RL(n,o))}},getFilter:function(){return{g:0}},sanitize:function(e,t){return Yk(t[0],t[1])&&xk(e)&&e<=0&&(e=t[0]),e},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(e,t){return t===null?this.powStub.getExtentUnsafe(e,null):this.intervalStub.getExtentUnsafe(e,t)}},t}(xL);xL.registerClass(lR);var uR={},dR={},fR=[],pR={value:1,category:1,time:1,log:1},mR=Lk();function hR(e){var t=e.get(`type`);return(t==null||!Z(pR,t)&&!xL.getClass(t))&&(t=`value`),t}function gR(e,t,n){var r=oF(),i;switch(r&&(i=DR(e,t,n)),t){case`category`:return new WL({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:Wk()});case`time`:return new JL({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get(`useUTC`),breakOption:i});case`log`:return new lR({logBase:e.get(`logBase`),breakOption:i});case`value`:return new KL({breakOption:i});default:return new((xL.getClass(t))||KL)({})}}function _R(e,t,n){var r=n?OL(e,null):e.getExtentUnsafe(0,null),i=r[0],a=r[1];return Yk(i,a)?i===t||a===t?2:it?1:3:3}function vR(e){mR(e).noOnMyZero=!0}function yR(e){return mR(e).noOnMyZero}function bR(e){var t=e.getLabelModel().get(`formatter`);if(e.type===`time`){var n=SF(t);return function(t,r){return e.scale.getFormattedLabel(t,r,n)}}if(ZS(t))return function(n){var r=e.scale.getLabel(n);return t.replace(`{value}`,r??``)};if(XS(t)){if(e.type===`category`)return function(n,r){return t(xR(e,n),n.value-e.scale.getExtent()[0],null)};var r=oF();return function(n,i){var a=null;return r&&(a=r.makeAxisLabelFormatterParamBreak(a,n.break)),t(xR(e,n),i,a)}}return function(t){return e.scale.getLabel(t)}}function xR(e,t){var n=e.scale;return FL(n)?n.getLabel(t):t.value}function SR(e){return e.get(`interval`)??`auto`}function CR(e){return e.type===`category`&&SR(e.getLabelModel())===0}function wR(e,t){var n={};return Y(e.mapDimensionsAll(t),function(t){n[OP(e,t)]=!0}),qS(n)}function TR(e){return e===`middle`||e===`center`}function ER(e){return e.getShallow(`show`)}function DR(e,t,n){var r=e.get(`breaks`,!0);if(r!=null)return!oF()||!n||!OR(t)?void 0:r}function OR(e){return e!==`category`}function kR(e,t,n,r,i,a){var o=PL(e),s=o?e.intervalStub:e;if(s.setExtent(r[0],r[1]),o){var c=e.powStub,l={depth:2},u=e.transformOut(r[0],l),d=e.transformOut(r[1],l),f=VL(n,r);t[0]&&!f[0]&&(u=i[0]),t[1]&&!f[1]&&(d=i[1]),c.setExtent(u,d)}s.setConfig(a)}function AR(e,t){return FL(e)?e.getRawOrdinalNumber(t.value):t.value}function jR(e,t){return FL(e)&&!!t.get(`boundaryGap`)}function MR(e,t){if(e.length===t.length){for(var n=0;nt){a?n.push(o(a,c,t)):i&&n.push(o(i,c,0),o(i,c,t));break}else i&&=(n.push(o(i,c,0)),null),n.push(c),a=c}return n}function zR(e,t,n){var r=e.getVisual(`visualMeta`);if(r&&r.length&&e.count()&&t.type===`cartesian2d`){for(var i,a,o=r.length-1;o>=0;o--){var s=e.getDimensionInfo(r[o].dimension);if(i=s&&s.coordDim,i===`x`||i===`y`){a=r[o];break}}if(a){var c=t.getAxis(i),l=US(a.stops,function(e){return{coord:c.toGlobalCoord(c.dataToCoord(e.value)),color:e.color}}),u=l.length,d=a.outerColors.slice();u&&l[0].coord>l[u-1].coord&&(l.reverse(),d.reverse());var f=RR(l,i===`x`?n.getWidth():n.getHeight()),p=f.length;if(!p&&u)return l[0].coord<0?d[1]?d[1]:l[u-1].color:d[0]?d[0]:l[0].color;var m=10,h=f[0].coord-m,g=f[p-1].coord+m,_=g-h;if(_<.001)return`transparent`;Y(f,function(e){e.offset=(e.coord-h)/_}),f.push({offset:p?f[p-1].offset:.5,color:d[1]||`transparent`}),f.unshift({offset:p?f[0].offset:.5,color:d[0]||`transparent`});var v=new Gj(0,0,0,0,f,!0);return v[i]=h,v[i+`2`]=g,v}}}function BR(e,t,n){var r=e.get(`showAllSymbol`),i=r===`auto`;if(!r||i){var a=n.getAxesByScale(`ordinal`)[0];if(a&&!(i&&VR(a,t))){var o=t.mapDimension(a.dim),s={};return Y(a.getViewLabels(),function(e){e.tick.offInterval||(s[AR(a.scale,e.tick)]=1)}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function VR(e,t){var n=e.getExtent(),r=Math.abs(n[1]-n[0])/e.scale.count();isNaN(r)&&(r=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;or)return!1;return!0}function HR(e){for(var t=e.length/2;t>0&&tL(e[t*2-2],e[t*2-1]);t--);return t-1}function UR(e,t){return[e[t*2],e[t*2+1]]}function WR(e,t,n){for(var r=e.length/2,i=n===`x`?0:1,a,o,s=0,c=-1,l=0;l=t||a>=t&&o<=t){c=l;break}s=l,a=o}}return{range:[s,c],t:(t-a)/(o-a)}}function GR(e){if(e.get([`endLabel`,`show`]))return!0;for(var t=0;t0&&e.get([`emphasis`,`lineStyle`,`width`])===`bolder`){var M=f.getState(`emphasis`).style;M.lineWidth=+f.style.lineWidth+1}rA(f).seriesIndex=e.seriesIndex,$A(f,k,A,j);var N=FR(e.get(`smooth`)),P=e.get(`smoothMonotone`);if(f.setShape({smooth:N,smoothMonotone:P,connectNulls:x}),p){var F=a.getCalculationInfo(`stackedOnSeries`),ee=0;p.useStyle(zS(s.getAreaStyle(),{fill:E,opacity:.7,lineJoin:`bevel`,decal:a.getVisual(`style`).decal})),F&&(ee=FR(F.get(`smooth`))),p.setShape({smooth:N,stackedOnSmooth:ee,smoothMonotone:P,connectNulls:x}),tj(p,e,`areaStyle`),rA(p).seriesIndex=e.seriesIndex,$A(p,k,A,j)}var I=this._changePolyState;a.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=I)}),this._polyline.onHoverStateChange=I,this._data=a,this._coordSys=r,this._stackedOnPoints=y,this._points=c,this._step=w,this._valueOrigin=_;var te=e.get(`triggerEvent`),L=e.get(`triggerLineEvent`),ne=L===!0||te===!0||te===`line`,re=L===!0||te===!0||te===`area`;this.packEventData(e,f,ne),p&&this.packEventData(e,p,re)},t.prototype.packEventData=function(e,t,n){rA(t).eventData=n?{componentType:`series`,componentSubType:`line`,componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:`line`,selfType:t===this._polygon?`area`:`line`}:null},t.prototype.highlight=function(e,t,n,r){var i=e.getData(),a=Ik(i,r);if(this._changePolyState(`emphasis`),!(a instanceof Array)&&a!=null&&a>=0){var o=i.getLayout(`points`),s=i.getItemGraphicEl(a);if(!s){var c=o[a*2],l=o[a*2+1];if(tL(c,l)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,l))return;var u=e.get(`zlevel`)||0,d=e.get(`z`)||0;s=new qI(i,a),s.x=c,s.y=l,s.setZ(u,d);var f=s.getSymbolPath().getTextContent();f&&(f.zlevel=u,f.z=d,f.z2=this._polyline.z2+1),s.__temp=!0,i.setItemGraphicEl(a,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else uL.prototype.highlight.call(this,e,t,n,r)},t.prototype.downplay=function(e,t,n,r){var i=e.getData(),a=Ik(i,r);if(this._changePolyState(`normal`),a!=null&&a>=0){var o=i.getItemGraphicEl(a);o&&(o.__temp?(i.setItemGraphicEl(a,null),this.group.remove(o)):o.downplay())}else uL.prototype.downplay.call(this,e,t,n,r)},t.prototype._changePolyState=function(e){var t=this._polygon;FA(this._polyline,e),t&&FA(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new yce({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new xce({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var r,i,a=t.getBaseAxis(),o=a.inverse;t.type===`cartesian2d`?(r=a.isHorizontal(),i=!1):t.type===`polar`&&(r=a.dim===`angle`,i=!0);var s=e.hostModel,c=s.get(`animationDuration`);XS(c)&&(c=c(null));var l=s.get(`animationDelay`)||0,u=XS(l)?l(null):l;e.eachItemGraphicEl(function(e,a){var s=e;if(s){var d=[e.x,e.y],f=void 0,p=void 0,m=void 0;if(n){if(i){var h=n,g=t.pointToCoord(d);r?(f=h.startAngle,p=h.endAngle,m=-g[1]/180*Math.PI):(f=h.r0,p=h.r,m=g[0])}else{var _=n;r?(f=_.x,p=_.x+_.width,m=e.x):(f=_.y+_.height,p=_.y,m=e.y)}}var v=p===f?0:(m-f)/(p-f);o&&(v=1-v);var y=XS(l)?l(a):c*v+u,b=s.getSymbolPath(),x=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:y}),x&&x.animateFrom({style:{opacity:0}},{duration:300,delay:y}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var r=e.getModel(`endLabel`);if(GR(e)){var i=e.getData(),a=this._polyline,o=i.getLayout(`points`);if(!o){a.removeTextContent(),this._endLabel=null;return}var s=this._endLabel;s||(s=this._endLabel=new MO({z2:200}),s.ignoreClip=!0,a.setTextContent(this._endLabel),a.disableLabelAnimation=!0);var c=HR(o);c>=0&&(XM(a,ZM(e,`endLabel`),{inheritColor:n,labelFetcher:e,labelDataIndex:c,defaultText:function(e,t,n){return n==null?GI(i,e):KI(i,n)},enableTextSetter:!0},qR(r,t)),a.textConfig.position=null)}else this._endLabel&&=(this._polyline.removeTextContent(),null)},t.prototype._endLabelOnDuring=function(e,t,n,r,i,a,o){var s=this._endLabel,c=this._polyline;if(s){e<1&&r.originalX==null&&(r.originalX=s.x,r.originalY=s.y);var l=n.getLayout(`points`),u=n.hostModel,d=u.get(`connectNulls`),f=a.get(`precision`),p=a.get(`distance`)||0,m=o.getBaseAxis(),h=m.isHorizontal(),g=m.inverse,_=t.shape,v=g?h?_.x:_.y+_.height:h?_.x+_.width:_.y,y=(h?p:0)*(g?-1:1),b=(h?0:-p)*(g?-1:1),x=h?`x`:`y`,S=WR(l,v,x),C=S.range,w=C[1]-C[0],T=void 0;if(w>=1){if(w>1&&!d){var E=UR(l,C[0]);s.attr({x:E[0]+y,y:E[1]+b}),i&&(T=u.getRawValue(C[0]))}else{var E=c.getPointOn(v,x);E&&s.attr({x:E[0]+y,y:E[1]+b});var D=u.getRawValue(C[0]),O=u.getRawValue(C[1]);i&&(T=_ae(n,f,D,O,S.t))}r.lastFrameIndex=C[0]}else{var k=e===1||r.lastFrameIndex>0?C[0]:0,E=UR(l,k);i&&(T=u.getRawValue(k)),s.attr({x:E[0]+y,y:E[1]+b})}if(i){var A=aN(s);typeof A.setLabelText==`function`&&A.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,r,i,a,o){var s=this._polyline,c=this._polygon,l=e.hostModel,u=vce(this._data,e,this._stackedOnPoints,t,this._coordSys,n,this._valueOrigin,a),d=u.current,f=u.stackedOnCurrent,p=u.next,m=u.stackedOnNext;if(i&&(f=LR(u.stackedOnCurrent,u.current,n,i,o),d=LR(u.current,null,n,i,o),m=LR(u.stackedOnNext,u.next,n,i,o),p=LR(u.next,null,n,i,o)),PR(d,p)>3e3||c&&PR(f,m)>3e3)s.stopAnimation(),s.setShape({points:p}),c&&(c.stopAnimation(),c.setShape({points:p,stackedOnPoints:m}));else{s.shape.__points=u.current,s.shape.points=d;var h={shape:{points:p}};u.current!==d&&(h.shape.__points=u.next),s.stopAnimation(),nM(s,h,l),c&&(c.setShape({points:d,stackedOnPoints:f}),c.stopAnimation(),nM(c,{shape:{stackedOnPoints:m}},l),s.shape.points!==c.shape.points&&(c.shape.points=s.shape.points));for(var g=[],_=u.status,v=0;v<_.length;v++)if(_[v].cmd===`=`){var y=e.getItemGraphicEl(_[v].idx1);y&&g.push({el:y,ptIdx:v})}s.animators&&s.animators.length&&s.animators[0].during(function(){c&&c.dirtyShape();for(var e=s.shape.__points,t=0;tt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;n10&&a.type===`cartesian2d`&&i){var s=a.getBaseAxis(),c=a.getOtherAxis(s),l=s.getExtent(),u=n.getDevicePixelRatio(),d=Math.abs(l[1]-l[0])*(u||1),f=Math.round(o/d);if(isFinite(f)&&f>1){i===`lttb`?e.setData(r.lttbDownSample(r.mapDimension(c.dim),1/f)):i===`minmax`&&e.setData(r.minmaxDownSample(r.mapDimension(c.dim),1/f));var p=void 0;ZS(i)?p=XR[i]:XS(i)&&(p=i),p&&e.setData(r.downSample(r.mapDimension(c.dim),1/f,p,ZR))}}}}}function $R(e){e.registerChartView(JR),e.registerSeriesModel(fce),e.registerLayout(YR(`line`,!0)),e.registerVisual({seriesType:`line`,reset:function(e){var t=e.getData(),n=e.getModel(`lineStyle`).getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual(`style`).fill),t.setVisual(`legendLineStyle`,n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QR(`line`))}var ez=Lk(),tz=Lk(),nz={estimate:1,determine:2};function rz(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function iz(e,t){var n=e.getLabelModel().get(`customValues`);if(n){var r=e.scale;return{labels:US(oz(n,r),function(t,n){return{formattedLabel:bR(e)(t,n),rawLabel:r.getLabel(t),tick:t}})}}return e.type===`category`?sz(e,t):uz(e)}function az(e,t,n){var r=e.scale,i=e.getTickModel().get(`customValues`);return i?{ticks:oz(i,r)}:e.type===`category`?lz(e,t):{ticks:r.getTicks(n)}}function oz(e,t){var n=t.getExtent(),r=[];return Y(e,function(e){e=t.parse(e),e>=n[0]&&e<=n[1]&&r.push(e)}),Qk(r,Sae,null),ak(r),US(r,function(e){return{value:e}})}function sz(e,t){var n=e.getLabelModel(),r=cz(e,n,t);return!n.get(`show`)||e.scale.isBlank()?{labels:[]}:r}function cz(e,t,n){var r=fz(e),i=SR(t),a=n.kind===nz.estimate;if(!a){var o=mz(r,i);if(o)return o}var s,c;XS(i)?s=xz(e,i,!1):(c=i===`auto`?gz(e,n):i,s=xz(e,c,!1));var l={labels:s,labelCategoryInterval:c};return a?n.out.noPxChangeTryDetermine.push(function(){return hz(r,i,l),!0}):hz(r,i,l),l}function lz(e,t){var n=dz(e),r=SR(t),i=mz(n,r);if(i)return i;var a,o;if((!t.get(`show`)||e.scale.isBlank())&&(a=[]),XS(r))a=xz(e,r,!0);else if(r===`auto`){var s=cz(e,e.getLabelModel(),rz(nz.determine));o=s.labelCategoryInterval,a=US(s.labels,function(e){return e.tick})}else o=r,a=xz(e,o,!0);return hz(n,r,{ticks:a,tickCategoryInterval:o})}function uz(e){var t=e.scale.getTicks(),n=bR(e);return{labels:US(t,function(t,r){return{formattedLabel:n(t,r),rawLabel:e.scale.getLabel(t),tick:t}})}}var dz=pz(`axisTick`),fz=pz(`axisLabel`);function pz(e){return function(t){return tz(t)[e]||(tz(t)[e]={list:[]})}}function mz(e,t){for(var n=0;nu&&(l=Math.max(1,Math.floor(c/u)));for(var d=s[0],f=e.dataToCoord(d+1)-e.dataToCoord(d),p=Math.abs(f*Math.cos(a)),m=Math.abs(f*Math.sin(a)),h=0,g=0;d<=s[1];d+=l){var _=0,v=0,y=Gw(i({value:d}),r.font,`center`,`top`);_=y.width*1.3,v=y.height*1.3,h=Math.max(h,_,7),g=Math.max(g,v,7)}var b=h/p,x=g/m;isNaN(b)&&(b=1/0),isNaN(x)&&(x=1/0);var S=Math.max(0,Math.floor(Math.min(b,x)));return n===nz.estimate?(t.out.noPxChangeTryDetermine.push(JS(vz,null,e,S,c)),S):yz(e,S,c)??S}function vz(e,t,n){return yz(e,t,n)==null}function yz(e,t,n){var r=ez(e.model),i=e.getExtent(),a=r.lastAutoInterval,o=r.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-n)<=1&&a>t&&r.axisExtent0===i[0]&&r.axisExtent1===i[1])return a;r.lastTickCount=n,r.lastAutoInterval=t,r.axisExtent0=i[0],r.axisExtent1=i[1]}function bz(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get(`rotate`)||0,font:t.getFont()}}function xz(e,t,n){var r=bR(e),i=e.scale,a=[],o=XS(t);return UL(i,o?0:t,function(e,s){var c=i.getLabel(e);if(o){var l=!!t(e.value,c);if(e.offInterval=!l,!l&&!s)return}a.push(n?e:{formattedLabel:r(e),rawLabel:c,tick:e})}),a}var Sz=Lk();function Cz(e){Sz(e).prepare={}}function wz(e){Sz(e).fullUpdate={}}function Tz(e){return Sz(e).prepare}function Ez(e){return Sz(e).fullUpdate}var Dz=Zk(),Oz=Lk(),kz=Lk();function Az(e,t){var n=e.model,r=Oz(Ez(n.ecModel)).keyed,i=r&&r.get(t);return i&&i.get(n.uid)}function jz(e,t){return Pz(Az(e,t))}function Mz(e,t){var n=[];return Nz(e.model.ecModel,function(e){for(var r=0;r0?(t>o&&(o=t),a=!1):t===-2&&(a=!0))}),xk(n)&&n>0&&xk(o)?(e.w=r/n*o,e.w2=o):a&&(e.w=r*qz,e.w2=e.w*n/r)}var Zz=[0,1],Qz=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]);return e>=n&&e<=r},e.prototype.containData=function(e){return this.scale.contain(this.scale.parse(e))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this.scale;return e=n.normalize(n.parse(e)),ek(e,Zz,$z(this),t)},e.prototype.coordToData=function(e,t){var n=ek(e,$z(this),Zz,t);return this.scale.scale(n)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){e||={};var t=e.tickModel||this.getTickModel(),n=US(az(this,t,{breakTicks:e.breakTicks,pruneByBreak:e.pruneByBreak}).ticks,function(e){return{coord:this.dataToCoord(AR(this.scale,e)),tick:e}},this),r=t.get(`alignWithLabel`),i=eB(this,n,r);return US(n,function(e){return{coord:e.coord,tickValue:e.tick.value,onBand:i}})},e.prototype.getMinorTicksCoords=function(){if(FL(this.scale))return[];var e=this.model.getModel(`minorTick`).get(`splitNumber`);return e>0&&e<100||(e=5),US(this.scale.getMinorTicks(e),function(e){return US(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(e){return e||=rz(nz.determine),iz(this,e).labels},e.prototype.getLabelModel=function(){return this.model.getModel(`axisLabel`)},e.prototype.getTickModel=function(){return this.model.getModel(`axisTick`)},e.prototype.getBandWidth=function(){return Jz(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(e){return e||=rz(nz.determine),_z(this,e)},e}();function $z(e){var t=e.getExtent();if(e.onBand){var n=(t[1]-t[0])/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function eB(e,t,n){var r=t.length;if(!e.onBand||n||!r)return!1;var i=Jz(e).w;if(!i)return!1;Y(t,function(e){e.coord-=i/2});var a=e.scale.getExtent(),o=t[r-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}var tB=function(e){vS(t,e);function t(t,n,r,i,a){var o=e.call(this,t,n,r)||this;return o.index=0,o.type=i||`value`,o.position=a||`bottom`,o}return t.prototype.isHorizontal=function(){var e=this.position;return e===`top`||e===`bottom`},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e[this.dim===`x`?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if(this.type!==`category`)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(Qz),nB=[`label`,`labelLine`,`layoutOption`,`priority`,`defaultAttr`,`marginForce`,`minMarginForce`,`marginDefault`,`suggestIgnore`],rB=1,iB=2,aB=rB|iB;function oB(e,t,n){n||=aB,t?e.dirty|=n:e.dirty&=~n}function sB(e,t){return t||=aB,e.dirty==null||!!(e.dirty&t)}function cB(e){if(e)return sB(e)&&Nce(e,e.label,e),e}function Nce(e,t,n){var r=t.getComputedTransform();e.transform=zM(e.transform,r);var i=e.localRect=RM(e.localRect,t.getBoundingRect()),a=t.style,o=a.margin,s=n&&n.marginForce,c=n&&n.minMarginForce,l=n&&n.marginDefault,u=a.__marginType;u==null&&l&&(o=l,u=oN.textMargin);for(var d=0;d<4;d++)lB[d]=u===oN.minMargin&&c&&c[d]!=null?c[d]:s&&s[d]!=null?s[d]:o?o[d]:0;u===oN.textMargin&&AM(i,lB,!1,!1);var f=e.rect=RM(e.rect,i);return r&&f.applyTransform(r),u===oN.minMargin&&AM(f,lB,!1,!1),e.axisAligned=IM(r),(e.label=e.label||{}).ignore=t.ignore,oB(e,!1),oB(e,!0,iB),e}var lB=[0,0,0,0];function Pce(e,t,n){return e.transform=zM(e.transform,n),e.localRect=RM(e.localRect,t),e.rect=RM(e.rect,t),n&&e.rect.applyTransform(n),e.axisAligned=IM(n),e.obb=void 0,(e.label=e.label||{}).ignore=!1,e}function Fce(e,t){if(e){e.label.x+=t.x,e.label.y+=t.y,e.label.markRedraw();var n=e.transform;n&&(n[4]+=t.x,n[5]+=t.y);var r=e.rect;r&&(r.x+=t.x,r.y+=t.y);var i=e.obb;i&&i.fromBoundingRect(e.localRect,n)}}function uB(e,t){for(var n=0;n.1?`x`:`y`,u=a.transGroup[l];if(o.sort(function(e,t){return Math.abs(e.label[l]-u)-Math.abs(t.label[l]-u)}),c&&s){var d=i.getExtent(),f=Math.min(d[0],d[1]),p=Math.max(d[0],d[1])-f;s.union(new Aw(f,0,p,1))}a.stOccupiedRect=s,a.labelInfoList=o}var vB=QC(),yB=new Aw(0,0,0,0),bB=function(e,t,n,r,i,a){if(TR(e.nameLocation)){var o=a.stOccupiedRect;o&&xB(Pce({},o,a.transGroup.transform),r,i)}else SB(a.labelInfoList,a.dirVec,r,i)};function xB(e,t,n){var r=new _w;fB(e,t,r,{direction:Math.atan2(n.y,n.x),bidirectional:!1,touchThreshold:.05})&&Fce(t,r)}function SB(e,t,n,r){for(var i=_w.dot(r,t)>=0,a=0,o=e.length;a0?`top`:`bottom`,i=`center`):dk(r-mB)?(a=n>0?`bottom`:`top`,i=`center`):(a=`middle`,i=r>0&&r0?`right`:`left`:n>0?`left`:`right`),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+`Index`]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get(`tooltip`);return e.get(`silent`)||!(e.get(`triggerEvent`)||t&&t.show)},e}(),Hce=[`axisLine`,`axisTickLabelEstimate`,`axisTickLabelDetermine`,`axisName`],Uce={axisLine:function(e,t,n,r,i,a,o){var s=r.get([`axisLine`,`show`]);if(s===`auto`&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),s){var c=r.axis.getExtent(),l=a.transform,u=[c[0],0],d=[c[1],0],f=u[0]>d[0];l&&(mw(u,u,l),mw(d,d,l));var p=J({lineCap:`round`},r.getModel([`axisLine`,`lineStyle`]).getLineStyle()),m={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:p};if(r.get([`axisLine`,`breakLine`])&&lF(r.axis.scale))pB().buildAxisBreakLine(r,i,a,m);else{var h=new Rj(J({shape:{x1:u[0],y1:u[1],x2:d[0],y2:d[1]}},m));yM(h.shape,h.style.lineWidth),h.anid=`line`,i.add(h)}var g=r.get([`axisLine`,`symbol`]);if(g!=null){var _=r.get([`axisLine`,`symbolSize`]);ZS(g)&&(g=[g,g]),(ZS(_)||$S(_))&&(_=[_,_]);var v=WI(r.get([`axisLine`,`symbolOffset`])||0,_),y=_[0],b=_[1];Y([{rotate:e.rotation+Math.PI/2,offset:v[0],r:0},{rotate:e.rotation-Math.PI/2,offset:v[1],r:Math.sqrt((u[0]-d[0])*(u[0]-d[0])+(u[1]-d[1])*(u[1]-d[1]))}],function(t,n){if(g[n]!==`none`&&g[n]!=null){var r=HI(g[n],-y/2,-b/2,y,b,p.stroke,!0),a=t.r+t.offset,o=f?d:u;r.attr({rotation:t.rotate,x:o[0]+a*Math.cos(e.rotation),y:o[1]-a*Math.sin(e.rotation),silent:!0,z2:11}),i.add(r)}})}}},axisTickLabelEstimate:function(e,t,n,r,i,a,o,s){DB(t,i,s)&&wB(e,t,n,r,i,a,o,nz.estimate)},axisTickLabelDetermine:function(e,t,n,r,i,a,o,s){DB(t,i,s)&&wB(e,t,n,r,i,a,o,nz.determine);var c=qce(e,i,a,r);Kce(e,t.labelLayoutList,c),Jce(e,i,a,r,e.tickDirection)},axisName:function(e,t,n,r,i,a,o,s){var c=n.ensureRecord(r);t.nameEl&&=(i.remove(t.nameEl),c.nameLayout=c.nameLocation=null);var l=e.axisName;if(jB(l)){var u=e.nameLocation,d=e.nameDirection,f=r.getModel(`nameTextStyle`),p=r.get(`nameGap`)||0,m=r.axis.getExtent(),h=r.axis.inverse?-1:1,g=new _w(0,0),_=new _w(0,0);u===`start`?(g.x=m[0]-h*p,_.x=-h):u===`end`?(g.x=m[1]+h*p,_.x=h):(g.x=(m[0]+m[1])/2,g.y=e.labelOffset+d*p,_.y=d);var v=QC();_.transform(rw(v,v,e.rotation));var y=r.get(`nameRotate`);y!=null&&(y=y*mB/180);var b,x;TR(u)?b=CB.innerTextLayout(e.rotation,y??e.rotation,d):(b=Wce(e.rotation,u,y||0,m),x=e.raw.axisNameAvailableWidth,x!=null&&(x=Math.abs(x/Math.sin(b.rotation)),!isFinite(x)&&(x=null)));var S=f.getFont(),C=r.get(`nameTruncate`,!0)||{},w=C.ellipsis,T=oC(e.raw.nameTruncateMaxWidth,C.maxWidth,x),E=s.nameMarginLevel||0,D=new MO({x:g.x,y:g.y,rotation:b.rotation,silent:CB.isLabelSilent(r),style:QM(f,{text:l,font:S,overflow:`truncate`,width:T,ellipsis:w,fill:f.getTextColor()||r.get([`axisLine`,`lineStyle`,`color`]),align:f.get(`align`)||b.textAlign,verticalAlign:f.get(`verticalAlign`)||b.textVerticalAlign}),z2:1});if(NM({el:D,componentModel:r,itemName:l}),D.__fullText=l,D.anid=`name`,r.get(`triggerEvent`)){var O=CB.makeAxisEventDataBase(r);O.targetType=`axisName`,O.name=l,rA(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var k=c.nameLayout=cB({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:TR(u)?zce[E]:Bce[E]});if(c.nameLocation=u,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&k){var A=n.ensureRecord(r);n.resolveAxisNameOverlap(e,n,r,k,_,A)}}}};function wB(e,t,n,r,i,a,o,s){OB(t)||Yce(e,t,i,s,r,o);var c=t.labelLayoutList;Xce(e,r,c,a),$ce(r,e.rotation,c);var l=e.optionHideOverlap;Gce(r,c,l),l&&Ice(GS(c,function(e){return e&&!e.label.ignore})),Vce(e,n,r,c)}function Wce(e,t,n,r){var i=uk(n-e),a,o,s=r[0]>r[1],c=t===`start`&&!s||t!==`start`&&s;return dk(i-mB/2)?(o=c?`bottom`:`top`,a=`center`):dk(i-mB*1.5)?(o=c?`top`:`bottom`,a=`center`):(o=`middle`,a=imB/2?c?`left`:`right`:c?`right`:`left`),{rotation:i,textAlign:a,textVerticalAlign:o}}function Gce(e,t,n){var r=e.axis,i=e.get([`axisLabel`,`customValues`]);if(CR(r))return;function a(e,a,o){var s=cB(t[a]),c=cB(t[o]),l=r.scale;if(s&&c){if(e==null){if(!n&&i)return;var u=hB(s.label).labelInfo.tick;if(NL(l)&&u.notNice||FL(l)&&u.offInterval){TB(s.label);return}}if(e===!1||s.suggestIgnore)TB(s.label);else if(c.suggestIgnore)TB(c.label);else{var d=.1;if(!n){var f=[0,0,0,0];s=uB({marginForce:f},s),c=uB({marginForce:f},c)}fB(s,c,null,{touchThreshold:d})&&TB(e?c.label:s.label)}}}var o=e.get([`axisLabel`,`showMinLabel`]),s=e.get([`axisLabel`,`showMaxLabel`]),c=t.length;a(o,0,1),a(s,c-1,c-2)}function Kce(e,t,n){e.showMinorTicks||Y(t,function(e){if(e&&e.label.ignore)for(var t=0;t0&&u[1]>0&&!d[0]&&(u[0]=0),u[0]<0&&u[1]<0&&!d[1]&&(u[1]=0));var y=!1;u[0]>u[1]&&(u.reverse(),y=!0);var b=FB(e,t.get(`startValue`,!0)),x=b!=null;!xk(b)&&r&&(b=e.getDefaultStartValue?e.getDefaultStartValue():0),xk(b)&&(x||!_||v)&&(bu[1]&&!d[1]&&(u[1]=b,d[1]=!0)),PB(this._i={scale:e,dataMM:l,noZoomEffMM:u,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:b,isBlank:g,incl0:v,tggAxInv:y,ctnShp:i},u)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var e=this._i,t=e.zoomMM,n=e.noZoomEffMM,r=e.zoomFixMM,i=e.fixMM,a={fixMM:i,zoomFixMM:r,isBlank:e.isBlank,incl0:e.incl0,tggAxInv:e.tggAxInv,ctnShp:e.ctnShp,effMM:n.slice()},o=a.effMM;return t[0]!=null&&(o[0]=t[0],i[0]=r[0]=!0),t[1]!=null&&(o[1]=t[1],i[1]=r[1]=!0),PB(e,o),a},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(e,t){this._i.zoomMM[e]=t},e}();function PB(e,t){var n=e.scale,r=e.dataMM;n.sanitize&&(t[0]=n.sanitize(t[0],r),t[1]=n.sanitize(t[1],r),Xk(t))}function FB(e,t){return t==null?null:aC(t)?NaN:e.parse(t)}function ole(e,t){var n;if(FL(e))n=[0,0];else{var r=t.get(`boundaryGap`);typeof r==`boolean`&&(r=null),n=X(r)?r:[r,r]}return[IB(n[0]),IB(n[1])]}function IB(e){return Yw(typeof e==`boolean`?0:e,1)||0}function LB(e){var t=ile(e.scale);return t.extent||=Wk(),t}function sle(e,t){LB(e).dimIdxInCoord=t.get(e.dim)}function RB(e,t){var n=e.scale,r=e.model,i=e.dim;n.rawExtentInfo||cle(n,e,i,r,t)}function cle(e,t,n,r,i){var a=LB(t),o=a.extent,s=!1;Fz(t,function(r){if(r.boxCoordinateSystem){var i=TP(r).coord,c=a.dimIdxInCoord;if(c>=0&&X(i)){var l=i[c];l!=null&&!X(l)&&Gk(o,e.parse(l))}}else if(r.coordinateSystem){var u=r.getData();if(u){var d=e.getFilter?e.getFilter():null;Y(wR(u,n),function(e){vae(o,u.getApproximateExtent(e,d))})}r.__requireStartValue&&r.__requireStartValue(t)&&(s=!0)}});var c=dle(e,t,r);zB(e,new NB(e,r,o,s,c),i),a.extent=null}function lle(e,t){var n=e.scale;zB(n,new NB(n,e.model,t,!1,!1),ale)}function zB(e,t,n){e.rawExtentInfo=t,t.from=n}function ule(e,t){BB.set(e,t)}var BB=_C();function VB(e,t,n,r,i){e.rawExtentInfo||lle({scale:e,model:t},i||Wk());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),r&&a.tggAxInv&&n&&!n.get(`legacyMinMaxDontInverseAxis`)&&(r.inverse=!r.inverse),a}function dle(e,t,n){var r=jR(e,n),i=n.get(`containShape`,!0);if(i==null&&!r&&(i=!0),!i)return!1;var a=!1;return zz(t,function(e){a=!!BB.get(e)||a}),a}function fle(e,t,n,r){if(n.ctnShp){var i;if(zz(e,function(t){var n=BB.get(t);if(n){var a=n(e,r);a&&(i||=[0,0],Kk(i,a[0]),qk(i,a[1]),vR(e))}}),i){var a=t.getExtent();if(FL(t))e.onBand||t.setExtent2(1,GO(a[0],a[0]+i[0]),KO(a[1],a[1]+i[1]));else{var o=a.slice();n.zoomFixMM[0]||(o[0]=GO(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),n.zoomFixMM[1]||(o[1]=KO(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(1,o[0],o[1])}}}}function ple(){Vz(`liPosMinGap`,mle)}function mle(e,t,n){var r=_C(),i=n.serUids,a=n.liPosMinGap,o,s=t.axis,c=s.scale,l=c.needTransform(),u=c.getFilter?c.getFilter():null,d=XN(u);function f(n){Lz(e,t.sers,function(e){var t=e.getRawData(),r=t.getDimensionIndex(t.mapDimension(s.dim));r>=0&&n(r,e,t.getStore())})}var p=0;if(f(function(e,t,n){r.set(t.uid,1),i&&i.hasKey(t.uid)||(o=!0),p+=n.count()}),i&&i.keys().length===r.keys().length||(o=!0),!o&&a!=null)t.liPosMinGap=a;else{rL(HB,p);var m=0;f(function(e,t,n){for(var r=0,i=n.count();r0&&v0?-2:-1,n.serUids=r}}var HB=rL({ctor:gce},50);function hle(e){return function(t,n){var r=Jz(t,{fromStat:{key:e}});if(xk(r.w2))return[-r.w2/2,r.w2/2]}}function UB(e,t){return e+`|&`+t}function gle(e){return ple(),{liPosMinGap:!FL(e.scale)}}function _le(e,t,n,r){Gz(e,{key:t,seriesType:n,coordSysType:r,getMetrics:gle})}function vle(e){return e.scale.rawExtentInfo.makeRenderInfo().startValue}var WB={left:0,right:0,top:0,bottom:0},GB=[`25%`,`25%`],KB=`cartesian2d`,yle=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(t,n){var r=oI(t.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),r&&t.outerBounds&&aI(t.outerBounds,r)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&t.outerBounds&&aI(this.option.outerBounds,t.outerBounds)},t.type=`grid`,t.dependencies=[`xAxis`,`yAxis`],t.layoutMode=`box`,t.defaultOption={show:!1,z:0,left:`15%`,top:65,right:`10%`,bottom:80,containLabel:!1,outerBoundsMode:`auto`,outerBounds:WB,outerBoundsContain:`all`,outerBoundsClampWidth:GB[0],outerBoundsClampHeight:GB[1],backgroundColor:Q.color.transparent,borderWidth:1,borderColor:Q.color.neutral30},t}(sI),ble=Zk(),qB=`__ec_stack_`;function JB(e){return e.get(`stack`)||qB+e.seriesIndex}function xle(e){if(FL(e.axis.scale)){for(var t=Jz(e.axis),n=[],r=0;ro&&(o=a),o!==u&&(t.width=o,n-=o+l*o,r--)}}),u=(n-c)/(r+(r-1)*l),u=KO(u,0);var d=0,f;Y(o,function(e){var t=s[e];t.width||=u,f=t,d+=t.width*(1+l)}),f&&(d-=f.width*l);var p={},m=-d/2;return Y(o,function(e){var n=s[e];p[e]=p[e]||{bandWidth:t,offset:m,width:n.width},m+=n.width*(1+l)}),p}function wle(e){return{seriesType:e,overallReset:function(t){var n=UB(e,KB);Rz(t,n,function(t){var r=Sle(t,e);Iz(t,n,function(e){var t=r.columnMap[JB(e)];e.getData().setLayout({bandWidth:t.bandWidth,offset:t.offset,size:t.width})})})}}}function Tle(e){return{seriesType:e,plan:cL(),reset:function(e){if(ele(e)){var t=e.getData(),n=e.coordinateSystem,r=n.getBaseAxis(),i=n.getOtherAxis(r),a=t.getDimensionIndex(t.mapDimension(i.dim)),o=t.getDimensionIndex(t.mapDimension(r.dim)),s=e.get(`showBackground`,!0),c=t.mapDimension(i.dim),l=t.getCalculationInfo(`stackResultDimension`),u=DP(t,c)&&!!t.getCalculationInfo(`stackedOnSeries`),d=i.isHorizontal(),f=i.toGlobalCoord(i.dataToCoord(vle(i))),p=XB(e),m=e.get(`barMinHeight`)||0,h=l&&t.getDimensionIndex(l),g=t.getLayout(`size`),_=t.getLayout(`offset`);return{progress:function(e,t){for(var r=e.count,i=p&&nL(r*3),c=p&&s&&nL(r*3),l=p&&nL(r),v=n.master.getRect(),y=d?v.width:v.height,b,x=t.getStore(),S=0;(b=e.next())!=null;){var C=x.get(u?h:a,b),w=x.get(o,b),T=f,E=void 0;u&&(E=+C-x.get(a,b));var D=void 0,O=void 0,k=void 0,A=void 0;if(d){var j=n.dataToPoint([C,w]);u&&(T=n.dataToPoint([E,w])[0]),D=T,O=j[1]+_,k=j[0]-T,A=g,qO(k)s){u=(p+l)/2;break}f===1&&(d=m-r[0].tickValue)}u??(l?l&&(u=r[r.length-1].coord):u=r[0].coord),a[n]=e.toGlobalCoord(u)}});else{var o=this.getData(),s=o.getLayout(`offset`),c=o.getLayout(`size`),l=+!r.getBaseAxis().isHorizontal();a[l]+=s+c/2}return a}return[NaN,NaN]},t.prototype.__requireStartValue=function(e){return this.getBaseAxis()!==e},t.type=`series.__base_bar__`,t.defaultOption={z:2,coordinateSystem:`cartesian2d`,legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:`mod`,defaultBarGap:`10%`},t}(LI);LI.registerClass(ZB);var Ole=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(){return kP(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get(`realtimeSort`,!0)||null})},t.prototype.getProgressive=function(){return this.get(`large`)?this.get(`progressive`):!1},t.prototype.__preparePipelineContext=function(e,t){var n=eA(this,e,t);return n.progressiveRender&&(n.large=!0),n},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type=`series.bar`,t.dependencies=[`grid`,`polar`],t.defaultOption=MP(ZB.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:`rgba(180, 180, 180, 0.2)`,borderColor:null,borderWidth:0,borderType:`solid`,borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:Q.color.primary,borderWidth:2}},realtimeSort:!1}),t}(ZB),QB=`\0__throttleOriginMethod`,$B=`\0__throttleRate`,eV=`\0__throttleType`;function tV(e,t,n){var r,i=0,a=0,o=null,s,c,l,u;t||=0;function d(){a=new Date().getTime(),o=null,e.apply(c,l||[])}var f=function(){var e=[...arguments];r=new Date().getTime(),c=this,l=e;var f=u||t,p=u||n;u=null,s=r-(p?i:a)-f,clearTimeout(o),p?o=setTimeout(d,f):s>=0?d():o=setTimeout(d,-s),i=r};return f.clear=function(){o&&=(clearTimeout(o),null)},f.debounceNextCall=function(e){u=e},f}function nV(e,t,n,r){var i=e[t];if(i){var a=i[QB]||i,o=i[eV];if(i[$B]!==n||o!==r){if(n==null||!r)return e[t]=a;i=e[t]=tV(a,n,r===`debounce`),i[QB]=a,i[eV]=r,i[$B]=n}return i}}function rV(e,t){var n=e[t];n&&n[QB]&&(n.clear&&n.clear(),e[t]=n[QB])}var kle=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),iV=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`sausage`,n}return t.prototype.getDefaultShape=function(){return new kle},t.prototype.buildPath=function(e,t){var n=t.cx,r=t.cy,i=Math.max(t.r0||0,0),a=Math.max(t.r,0),o=(a-i)*.5,s=i+o,c=t.startAngle,l=t.endAngle,u=t.clockwise,d=Math.PI*2,f=u?l-cMath.PI/2&&ua)return!0;a=l}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,r=n.getExtent(),i=Math.max(0,r[0]),a=Math.min(r[1],n.getOrdinalMeta().categories.length-1);i<=a;++i)if(e.ordinalNumbers[i]!==n.getRawOrdinalNumber(i))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,r){if(this._isOrderChangedWithinSameData(e,t,n)){var i=this._dataSort(e,n,t);this._isOrderDifferentInView(i,n)&&(this._removeOnRenderedListener(r),r.dispatchAction({type:`changeAxisOrder`,componentType:n.dim+`Axis`,axisId:n.index,sortInfo:i}))}},t.prototype._dispatchInitSort=function(e,t,n){var r=t.baseAxis,i=this._dataSort(e,r,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:`changeAxisOrder`,componentType:r.dim+`Axis`,isInitSort:!0,axisId:r.index,sortInfo:i})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&=(e.getZr().off(`rendered`,this._onRendered),null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){sM(t,e,rA(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=`bar`,t}(uL),lV={cartesian2d:function(e,t){var n=t.width<0?-1:1,r=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=sV(t.x,e.x),s=cV(t.x+t.width,i),c=sV(t.y,e.y),l=cV(t.y+t.height,a),u=si?s:o,t.y=d&&c>a?l:c,t.width=u?0:s-o,t.height=d?0:l-c,n<0&&(t.x+=t.width,t.width=-t.width),r<0&&(t.y+=t.height,t.height=-t.height),u||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}var i=cV(t.r,e.r),a=sV(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(n<0){var r=t.r;t.r=t.r0,t.r0=r}return o}},uV={cartesian2d:function(e,t,n,r,i,a,o,s,c){var l=new OO({shape:J({},r),z2:1});if(l.__dataIndex=n,l.name=`item`,a){var u=l.shape,d=i?`height`:`width`;u[d]=0}return l},polar:function(e,t,n,r,i,a,o,s,c){var l=!i&&c?iV:Nj,u=new l({shape:r,z2:1});if(u.name=`item`,u.calculateTextPosition=Ale(hV(i),{isRoundCap:l===iV}),a){var d=u.shape,f=i?`r`:`endAngle`,p={};d[f]=i?r.r0:r.startAngle,p[f]=r[f],(s?nM:rM)(u,{shape:p},a)}return u}};function Ple(e,t){var n=e.get(`realtimeSort`,!0),r=t.getBaseAxis();if(n&&r.type===`category`&&t.type===`cartesian2d`)return{baseAxis:r,otherAxis:t.getOtherAxis(r)}}function dV(e,t,n,r,i,a,o,s){var c,l;a?(l={x:r.x,width:r.width},c={y:r.y,height:r.height}):(l={y:r.y,height:r.height},c={x:r.x,width:r.width}),s||(o?nM:rM)(n,{shape:c},t,i,null);var u=t?e.baseAxis.model:null;(o?nM:rM)(n,{shape:l},u,i)}function fV(e,t){for(var n=0;n0?1:-1,o=r.height>0?1:-1;return{x:r.x+a*i/2,y:r.y+o*i/2,width:r.width-a*i,height:r.height-o*i}},polar:function(e,t,n){var r=e.getItemLayout(t);return{cx:r.cx,cy:r.cy,r0:r.r0,r:r.r,startAngle:r.startAngle,endAngle:r.endAngle,clockwise:r.clockwise}}};function Lle(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function hV(e){return function(e){var t=e?`Arc`:`Angle`;return function(e){switch(e){case`start`:case`insideStart`:case`end`:case`insideEnd`:return e+t;default:return e}}}(e)}function gV(e,t,n,r,i,a,o,s){var c=t.getItemVisual(n,`style`);if(!s){var l=r.get([`itemStyle`,`borderRadius`])||0;e.setShape(`r`,l)}else if(!a.get(`roundCap`)){var u=e.shape;J(u,Mle(r.getModel(`itemStyle`),u,!0)),e.setShape(u)}e.useStyle(c);var d=r.getShallow(`cursor`);d&&e.attr(`cursor`,d);var f=s?o?i.r>=i.r0?`endArc`:`startArc`:i.endAngle>=i.startAngle?`endAngle`:`startAngle`:o?Hle(i,a.coordinateSystem):Ule(i,a.coordinateSystem),p=ZM(r);XM(e,p,{labelFetcher:a,labelDataIndex:n,defaultText:GI(a.getData(),n),inheritColor:c.fill,defaultOpacity:c.opacity,defaultOutsidePosition:f});var m=e.getTextContent();if(s&&m){var h=r.get([`label`,`position`]);e.textConfig.inside=h===`middle`||null,jle(e,h===`outside`?f:h,hV(o),r.get([`label`,`rotate`]))}koe(m,p,a.getRawValue(n),function(e){return KI(t,e)});var g=r.getModel([`emphasis`]);$A(e,g.get(`focus`),g.get(`blurScope`),g.get(`disabled`)),tj(e,r),Lle(i)&&(e.style.fill=`none`,e.style.stroke=`none`,Y(e.states,function(e){e.style&&(e.style.fill=e.style.stroke=`none`)}))}function Rle(e,t){var n=e.get([`itemStyle`,`borderColor`]);if(!n||n===`none`)return 0;var r=e.get([`itemStyle`,`borderWidth`])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(r,i,a)}var zle=function(){function e(){}return e}(),_V=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`largeBar`,n}return t.prototype.getDefaultShape=function(){return new zle},t.prototype.buildPath=function(e,t){for(var n=t.points,r=this.baseDimIdx,i=1-this.baseDimIdx,a=[],o=[],s=this.barWidth,c=0;c=0?n:null},30,!1);function Ble(e,t,n){for(var r=e.baseDimIdx,i=1-r,a=e.shape.points,o=e.largeDataIndices,s=[],c=[],l=e.barWidth,u=0,d=a.length/3;u=s[0]&&t<=s[0]+c[0]&&n>=s[1]&&n<=s[1]+c[1])return o[u]}return-1}function bV(e,t,n){if(gL(n,`cartesian2d`)){var r=t,i=n.getArea();return{x:e?r.x:i.x,y:e?i.y:r.y,width:e?r.width:i.width,height:e?i.height:r.height}}var i=n.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}function Vle(e,t,n){return new(e.type===`polar`?Nj:OO)({shape:bV(t,n,e),silent:!0,z2:0})}function Hle(e,t){return e.height===0?t.getOtherAxis(t.getBaseAxis()).inverse?`bottom`:`top`:e.height>0?`bottom`:`top`}function Ule(e,t){return e.width===0?t.getOtherAxis(t.getBaseAxis()).inverse?`left`:`right`:e.width>=0?`right`:`left`}function Wle(e){e.registerChartView(Nle),e.registerSeriesModel(Ole),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,wle(`bar`)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,Tle(`bar`)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QR(`bar`)),e.registerAction({type:`changeAxisOrder`,event:`changeAxisOrder`,update:`update`},function(e,t){var n=e.componentType||`series`;t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})}),Dle(e)}function xV(e,t,n,r,i){var a=e+t;n.isSilent(a)||r.eachComponent({mainType:`series`,subType:`pie`},function(e){for(var t=e.seriesIndex,r=e.option.selectedMap,o=i.selected,s=0;s=0){var i=r===`touchend`?t.changedTouches[0]:t.targetTouches[0];i&&wV(e,i,t,n)}else{wV(e,t,t,n);var a=Yle(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var o=t.button;return t.which==null&&o!==void 0&&qle.test(t.type)&&(t.which=o&1?1:o&2?3:o&4?2:0),t}function Yle(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,r=e.deltaY;if(n==null||r==null)return t;var i=Math.abs(r===0?n:r),a=r>0?-1:r<0?1:n>0?-1:1;return 3*i*a}function Xle(e,t,n,r){e.addEventListener(t,n,r)}function Zle(e,t,n,r){e.removeEventListener(t,n,r)}var OV=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function kV(e){return e.which===2||e.which===3}var Qle=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var r=e.touches;if(r){for(var i={points:[],touches:[],target:t,event:e},a=0,o=r.length;a1&&r&&r.length>1){var a=AV(r)/AV(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=$le(r);return t.pinchX=o[0],t.pinchY=o[1],{type:`pinch`,target:e[0].target,event:t}}}}},MV=`silent`;function eue(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:tue}}function tue(){OV(this.event)}var nue=function(e){UC(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.handler=null,t}return t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(rD),NV=function(){function e(e,t){this.x=e,this.y=t}return e}(),rue=[`click`,`dblclick`,`mousewheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],PV=new Aw(0,0,0,0),FV=function(e){UC(t,e);function t(t,n,r,i,a){var o=e.call(this)||this;return o._hovered=new NV(0,0),o.storage=t,o.painter=n,o.painterRoot=i,o._pointerSize=a,r||=new nue,o.proxy=null,o.setHandlerProxy(r),o._draggingMgr=new Kle(o),o}return t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Y(rue,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,r=LV(this,t,n),i=this._hovered,a=i.target;a&&!a.__zr&&(i=this.findHover(i.x,i.y),a=i.target);var o=this._hovered=r?new NV(t,n):this.findHover(t,n),s=o.target,c=this.proxy;c.setCursor&&c.setCursor(s?s.cursor:`default`),a&&s!==a&&this.dispatchToElement(i,`mouseout`,e),this.dispatchToElement(o,`mousemove`,e),s&&s!==a&&this.dispatchToElement(o,`mouseover`,e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;t!==`only_globalout`&&this.dispatchToElement(this._hovered,`mouseout`,e),t!==`no_globalout`&&this.trigger(`globalout`,{type:`globalout`,event:e})},t.prototype.resize=function(){this._hovered=new NV(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){e||={};var r=e.target;if(!(r&&r.silent)){for(var i=`on`+t,a=eue(t,e,n);r&&(r[i]&&(a.cancelBubble=!!r[i].call(r,a)),r.trigger(t,a),r=r.__hostTarget?r.__hostTarget:r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(t,a),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){typeof e[i]==`function`&&e[i].call(e,a),e.trigger&&e.trigger(t,a)}))}},t.prototype.findHover=function(e,t,n){var r=this.storage.getDisplayList(),i=new NV(e,t);if(IV(r,i,e,t,n),this._pointerSize&&!i.target){for(var a=[],o=this._pointerSize,s=o/2,c=new Aw(e-s,t-s,o,o),l=r.length-1;l>=0;l--){var u=r[l];u===n||u.ignore||u.ignoreCoarsePointer||u.parent&&u.parent.ignoreCoarsePointer||(PV.copy(u.getBoundingRect()),u.transform&&PV.applyTransform(u.transform),PV.intersect(c)&&a.push(u))}if(a.length){for(var d=4,f=Math.PI/12,p=Math.PI*2,m=0;m4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function iue(e,t,n){if(e[e.rectHover?`rectContain`:`contain`](t,n)){for(var r=e,i=void 0,a=!1;r;){if(r.ignoreClip&&(a=!0),!a){var o=r.getClipPath();if(o&&!o.contain(t,n))return!1}r.silent&&(i=!0);var s=r.__hostTarget;r=s?r.ignoreHostSilent?null:s:r.parent}return!i||MV}return!1}function IV(e,t,n,r,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=iue(o,n,r))&&(!t.topTarget&&(t.topTarget=o),s!==MV)){t.target=o;break}}}function LV(e,t,n){var r=e.painter;return t<0||t>r.getWidth()||n<0||n>r.getHeight()}var RV=32,zV=7;function aue(e){for(var t=0;e>=RV;)t|=e&1,e>>=1;return e+t}function BV(e,t,n,r){var i=t+1;if(i===n)return 1;if(r(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function oue(e,t,n){for(n--;t>>1,i(a,e[c])<0?s=c:o=c+1;var l=r-o;switch(l){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;l>0;)e[o+l]=e[o+l-1],l--}e[o]=a}}function HV(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])>0){for(s=r-i;c0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}else{for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}for(o++;o>>1);a(e,t[n+u])>0?o=u+1:c=u}return c}function UV(e,t,n,r,i,a){var o=0,s=0,c=1;if(a(e,t[n+i])<0){for(s=i+1;cs&&(c=s);var l=o;o=i-c,c=i-l}else{for(s=r-i;c=0;)o=c,c=(c<<1)+1,c<=0&&(c=s);c>s&&(c=s),o+=i,c+=i}for(o++;o>>1);a(e,t[n+u])<0?c=u:o=u+1}return c}function sue(e,t){var n=zV,r,i,a=0,o=[];r=[],i=[];function s(e,t){r[a]=e,i[a]=t,a+=1}function c(){for(;a>1;){var e=a-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;u(e)}}function l(){for(;a>1;){var e=a-2;e>0&&i[e-1]=zV||m>=zV);if(h)break;f<0&&(f=0),f+=2}if(n=f,n<1&&(n=1),i===1){for(c=0;c=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else{for(var m=n;;){var h=0,g=0,_=!1;do if(t(o[u],e[l])<0){if(e[d--]=e[l--],h++,g=0,--i===0){_=!0;break}}else if(e[d--]=o[u--],g++,h=0,--s===1){_=!0;break}while((h|g)=0;c--)e[p+c]=e[f+c];if(i===0){_=!0;break}}if(e[d--]=o[u--],--s===1){_=!0;break}if(g=s-HV(e[l],o,0,s,s-1,t),g!==0){for(d-=g,u-=g,s-=g,p=d+1,f=u+1,c=0;c=zV||g>=zV);if(_)break;m<0&&(m=0),m+=2}if(n=m,n<1&&(n=1),s===1){for(d-=i,l-=i,p=d+1,f=l+1,c=i-1;c>=0;c--)e[p+c]=e[f+c];e[d]=o[u]}else if(s===0)throw Error();else for(f=d-(s-1),c=0;cs&&(c=s),VV(e,n,n+c,n+a,t),a=c}o.pushRun(n,a),o.mergeRuns(),i-=a,n+=a}while(i!==0);o.forceMergeRuns()}}}var GV=!1;function KV(){GV||(GV=!0,console.warn(`z / z2 / zlevel of displayable is invalid, which may cause unexpected errors`))}function qV(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var cue=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=qV}return e.prototype.traverse=function(e,t){for(var n=0;n=0&&this._roots.splice(r,1)}},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),JV=CC.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function YV(){return new Date().getTime()}var lue=function(e){UC(t,e);function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t||={},n.stage=t.stage||{},n}return t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){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=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=YV()-this._pausedTime,n=t-this._time,r=this._head;r;){var i=r.next;r.step(t,n)&&(r.ondestroy(),this.removeClip(r)),r=i}this._time=t,e||(this.trigger(`frame`,n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0;function t(){e._running&&(JV(t),!e._paused&&e.update())}JV(t)},t.prototype.start=function(){this._running||(this._time=YV(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||=(this._pauseStart=YV(),!0)},t.prototype.resume=function(){this._paused&&=(this._pausedTime+=YV()-this._pauseStart,!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(e,t){t||={},this.start();var n=new nD(e,t.loop);return this.addAnimator(n),n},t}(rD),uue=300,XV=CC.domSupported,ZV=(function(){var e=[`click`,`dblclick`,`mousewheel`,`wheel`,`mouseout`,`mouseup`,`mousedown`,`mousemove`,`contextmenu`],t=[`touchstart`,`touchend`,`touchmove`],n={pointerdown:1,pointerup:1,pointermove:1,pointerout:1};return{mouse:e,touch:t,pointer:US(e,function(e){var t=e.replace(`mouse`,`pointer`);return n.hasOwnProperty(t)?t:e})}})(),QV={mouse:[`mousemove`,`mouseup`],pointer:[`pointermove`,`pointerup`]},$V=!1;function eH(e){var t=e.pointerType;return t===`pen`||t===`touch`}function due(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function tH(e){e&&(e.zrByTouch=!0)}function fue(e,t){return DV(e.dom,new pue(e,t),!0)}function nH(e,t){for(var n=t,r=!1;n&&n.nodeType!==9&&!(r=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return r}var pue=function(){function e(e,t){this.stopPropagation=bC,this.stopImmediatePropagation=bC,this.preventDefault=bC,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY}return e}(),rH={mousedown:function(e){e=DV(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger(`mousedown`,e)},mousemove:function(e){e=DV(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger(`mousemove`,e)},mouseup:function(e){e=DV(this.dom,e),this.__togglePointerCapture(!1),this.trigger(`mouseup`,e)},mouseout:function(e){e=DV(this.dom,e);var t=e.toElement||e.relatedTarget;nH(this,t)||(this.__pointerCapturing&&(e.zrEventControl=`no_globalout`),this.trigger(`mouseout`,e))},wheel:function(e){$V=!0,e=DV(this.dom,e),this.trigger(`mousewheel`,e)},mousewheel:function(e){$V||(e=DV(this.dom,e),this.trigger(`mousewheel`,e))},touchstart:function(e){e=DV(this.dom,e),tH(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,`start`),rH.mousemove.call(this,e),rH.mousedown.call(this,e)},touchmove:function(e){e=DV(this.dom,e),tH(e),this.handler.processGesture(e,`change`),rH.mousemove.call(this,e)},touchend:function(e){e=DV(this.dom,e),tH(e),this.handler.processGesture(e,`end`),rH.mouseup.call(this,e),+new Date-this.__lastTouchMoment0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(e){this._disposed||(e||={},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t=0;o--)r[o]&&!Fk(r[o])?a=!0:(r[o]=null,!a&&i--);r.length=i,e[n]=r}}),delete e[yH],e},t.prototype.setTheme=function(e){this._theme=new dN(e),this._resetOption(`recreate`,null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var r=n[t||0];if(r)return r;if(t==null){for(var i=0;i=t:n===`max`?e<=t:e===t}function Pue(e,t){return e.join(`,`)===t.join(`,`)}var wH=Y,TH=eC,EH=[`areaStyle`,`lineStyle`,`nodeStyle`,`linkStyle`,`chordStyle`,`label`,`labelLine`];function DH(e){var t=e&&e.itemStyle;if(t)for(var n=0,r=EH.length;n0?e[n-1].seriesModel:null)}),Wue(e))})}function Wue(e){Y(e,function(t,n){var r=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,c=t.seriesModel.get(`stackStrategy`)||`samesign`;o.modify(a,function(a,l,u){var d=o.get(t.stackedDimension,u);if(isNaN(d))return i;var f,p;s?p=o.getRawIndex(u):f=o.get(t.stackedByDimension,u);for(var m=NaN,h=n-1;h>=0;h--){var g=e[h];if(s||(p=g.data.rawIndexOf(g.stackedByDimension,f)),p>=0){var _=g.data.getByRawIndex(g.stackResultDimension,p);if(c===`all`||c===`positive`&&_>0||c===`negative`&&_<0||c===`samesign`&&d>=0&&_>0||c===`samesign`&&d<=0&&_<0){d=ck(d,_),m=_;break}}}return r[0]=d,r[1]=m,r})})}var VH=function(){function e(){this.group=new yj,this.uid=AP(`viewComponent`)}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,r){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,r){},e.prototype.updateLayout=function(e,t,n,r){},e.prototype.updateVisual=function(e,t,n,r){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();jC(VH),RC(VH);var HH=Lk(),UH={itemStyle:zC(uN,!0),lineStyle:zC(lN,!0)},Gue={lineStyle:`stroke`,itemStyle:`fill`};function WH(e,t){return e.visualStyleMapper||UH[t]||(console.warn(`Unknown style type '`+t+`'.`),UH.itemStyle)}function GH(e,t){return e.visualDrawType||Gue[t]||(console.warn(`Unknown style type '`+t+`'.`),`fill`)}var Kue={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=e.getModel(r),a=WH(e,r)(i),o=i.getShallow(`decal`);o&&(n.setVisual(`decal`,o),o.dirty=!0);var s=GH(e,r),c=a[s],l=XS(c)?c:null,u=a.fill===`auto`||a.stroke===`auto`;if(!a[s]||l||u){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());a[s]||(a[s]=d,n.setVisual(`colorFromPalette`,!0)),a.fill=a.fill===`auto`||XS(a.fill)?d:a.fill,a.stroke=a.stroke===`auto`||XS(a.stroke)?d:a.stroke}if(n.setVisual(`style`,a),n.setVisual(`drawType`,s),!t.isSeriesFiltered(e)&&l)return n.setVisual(`colorFromPalette`,!1),{dataEach:function(t,n){var r=e.getDataParams(n),i=J({},a);i[s]=l(r),t.setItemVisual(n,`style`,i)}}}},KH=new dN,que={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var n=e.getData(),r=e.visualStyleAccessPath||`itemStyle`,i=WH(e,r),a=n.getVisual(`drawType`);return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[r]){KH.option=n[r];var o=i(KH);J(e.ensureUniqueItemVisual(t,`style`),o),KH.option.decal&&(e.setItemVisual(t,`decal`,KH.option.decal),KH.option.decal.dirty=!0),a in o&&e.setItemVisual(t,`colorFromPalette`,!1)}}:null}}}},Jue={performRawSeries:!0,overallReset:function(e){var t=_C();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=e.type+`-`+e.getColorBy();HH(e).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(e){if(!e.isColorBySeries()){var t=e.getRawData(),n={},r=e.getData(),i=HH(e).scope,a=GH(e,e.visualStyleAccessPath||`itemStyle`);r.each(function(e){var t=r.getRawIndex(e);n[t]=e}),t.each(function(o){var s=n[o];if(r.getItemVisual(s,`colorFromPalette`)){var c=r.ensureUniqueItemVisual(s,`style`),l=t.getName(o)||o+``,u=t.count();c[a]=e.getColorFromPalette(l,i,u)}})}})}},qH=Math.PI;function Yue(e,t){t||={},zS(t,{text:`loading`,textColor:Q.color.primary,fontSize:12,fontWeight:`normal`,fontStyle:`normal`,fontFamily:`sans-serif`,maskColor:`rgba(255,255,255,0.8)`,showSpinner:!0,color:Q.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var n=new yj,r=new OO({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(r);var i=new MO({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new OO({style:{fill:`none`},textContent:i,textConfig:{position:`right`,distance:10},zlevel:t.zlevel,z:10001});n.add(a);var o;return t.showSpinner&&(o=new Hj({shape:{startAngle:-qH/2,endAngle:-qH/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:`round`,lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:qH*3/2}).start(`circularInOut`),o.animateShape(!0).when(1e3,{startAngle:qH*3/2}).delay(300).start(`circularInOut`),n.add(o)),n.resize=function(){var n=i.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,c=(e.getWidth()-s*2-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),l=e.getHeight()/2;t.showSpinner&&o.setShape({cx:c,cy:l}),a.setShape({x:c-s,y:l-s,width:s*2,height:s*2}),r.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}var JH=function(){function e(e,t,n,r){this._stageTaskMap=_C(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),r=this._visualHandlers=r.slice(),this._allHandlers=n.concat(r)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),r=n.context,i=!t&&n.progressiveEnabled&&(!r||r.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,a=r&&r.modDataCount;return{step:i,modBy:a==null?null:Math.ceil(a/i),modDataCount:a}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid);e.pipelineContext=n.context=e.__preparePipelineContext?e.__preparePipelineContext(t,n):eA(e,t,n)},e.prototype.restorePipelines=function(e,t){var n=this,r=n._pipelineMap=_C();t.eachSeries(function(t){var i=e.painter.type===`canvas`&&t.getProgressive(),a=t.uid;r.set(a,{id:a,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),n._pipe(t,t.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;Y(this._allHandlers,function(r){var i=e.get(r.uid)||e.set(r.uid,{});dC(!(r.reset&&r.overallReset),``),r.reset&&this._createSeriesStageTask(r,i,t,n),r.overallReset&&this._createOverallStageTask(r,i,t,n)},this)},e.prototype.prepareView=function(e,t,n,r){var i=e.renderTask,a=i.context;a.model=t,a.ecModel=n,a.api=r,i.__block=!e.incrementalPrepareRender,this._pipe(t,i)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,r){r||={};var i=!1,a=this;Y(e,function(e,s){if(!(r.visualType&&r.visualType!==e.visualType)){var c=a._stageTaskMap.get(e.uid),l=c.seriesTaskMap,u=c.overallTask;if(u){var d,f=u.agentStubMap;f.each(function(e){o(r,e)&&(e.dirty(),d=!0)}),d&&u.dirty(),a.updatePayload(u,n);var p=a.getPerformArgs(u,r.block);f.each(function(e){e.perform(p)}),u.perform(p)&&(i=!0)}else l&&l.each(function(s,c){o(r,s)&&s.dirty();var l=a.getPerformArgs(s,r.block);l.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),a.updatePayload(s,n),s.perform(l)&&(i=!0)})}});function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){t!==`remain`&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,r){var i=this,a=t.seriesTaskMap,o=t.seriesTaskMap=_C(),s=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(l):s?n.eachRawSeriesByType(s,l):c&&c(n,r).each(l);function l(t){var s=t.uid,c=o.set(s,a&&a.get(s)||mI({plan:ede,reset:tde,count:rde}));c.context={model:t,ecModel:n,api:r,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(t,c)}},e.prototype._createOverallStageTask=function(e,t,n,r){var i=this,a=t.overallTask=t.overallTask||mI({reset:Xue});a.context={ecModel:n,api:r,overallReset:e.overallReset,scheduler:i};var o=a.agentStubMap,s=a.agentStubMap=_C(),c=e.seriesType,l=e.getTargetSeries,u=e.dirtyOnOverallProgress,d=!1;dC(!e.createOnAllSeries,``),c?n.eachRawSeriesByType(c,f):l?l(n,r).each(f):Y(n.getSeries(),f);function f(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,mI({reset:Zue,onDirty:$ue})));n.context={model:e,dirtyOnOverallProgress:u},n.agent=a,n.__block=u,i._pipe(e,n)}d&&a.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,r=this._pipelineMap.get(n);!r.head&&(r.head=t),r.tail&&r.tail.pipe(t),r.tail=t,t.__idxInPipeline=r.count++,t.__pipeline=r},e.wrapStageHandler=function(e,t){return XS(e)&&(e={overallReset:e,seriesType:ide(e)}),e.uid=AP(`stageHandler`),t&&(e.visualType=t),e},e}();function Xue(e){e.overallReset(e.ecModel,e.api,e.payload)}function Zue(e){return e.dirtyOnOverallProgress&&Que}function Que(){this.agent.dirty(),this.getDownstream().dirty()}function $ue(){this.agent&&this.agent.dirty()}function ede(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function tde(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Dk(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?US(t,function(e,t){return YH(t)}):nde}var nde=YH(0);function YH(e){return function(t,n){var r=n.data,i=n.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&u===i.length-l.length){var d=i.slice(0,u);d!==`data`&&(t.mainType=d,t[l.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(i)&&(n[i]=e,s=!0),s||(r[i]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:r}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var r=n.targetEl,i=n.packedEvent,a=n.model,o=n.view;if(!a||!o)return!0;var s=t.cptQuery,c=t.dataQuery;return l(s,a,`mainType`)&&l(s,a,`subType`)&&l(s,a,`index`,`componentIndex`)&&l(s,a,`name`)&&l(s,a,`id`)&&l(c,i,`name`)&&l(c,i,`dataIndex`)&&l(c,i,`dataType`)&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,r,i));function l(e,t,n,r){return e[n]==null||t[r||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),aU=[`symbol`,`symbolSize`,`symbolRotate`,`symbolOffset`],oU=aU.concat([`symbolKeepAspect`]),ode={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual(`legendIcon`,e.legendIcon),!e.hasSymbolVisual)return;for(var r={},i={},a=!1,o=0;o=0&&pU(c)?c:.5,e.createRadialGradient(o,s,0,o,s,c)}function mU(e,t,n){for(var r=t.type===`radial`?_de(e,t,n):gde(e,t,n),i=t.colorStops,a=0;a0)?null:e===`dashed`?[4*t,2*t]:e===`dotted`?[t]:$S(e)?[e]:X(e)?e:null}function _U(e){var t=e.style,n=t.lineDash&&t.lineWidth>0&&yde(t.lineDash,t.lineWidth),r=t.lineDashOffset;if(n){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(n=US(n,function(e){return e/i}),r/=i)}return[n,r]}var bde=new cO(!0);function vU(e){var t=e.stroke;return!(t==null||t===`none`||!(e.lineWidth>0))}function yU(e){return typeof e==`string`&&e!==`none`}function bU(e){var t=e.fill;return t!=null&&t!==`none`}function xU(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function SU(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function CU(e,t,n){var r=YC(t.image,t.__image,n);if(ZC(r)){var i=e.createPattern(r,t.repeat||`repeat`);if(typeof DOMMatrix==`function`&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*xC),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function xde(e,t,n,r,i){var a,o=vU(n),s=bU(n),c=n.strokePercent,l=c<1,u=!t.path;(!t.silent||l)&&u&&t.createPathProxy();var d=t.path||bde,f=t.__dirty;if(!r){var p=n.fill,m=n.stroke,h=s&&!!p.colorStops,g=o&&!!m.colorStops,_=s&&!!p.image,v=o&&!!m.image,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0;(h||g)&&(C=t.getBoundingRect()),h&&(y=f?mU(e,p,C):t.__canvasFillGradient,t.__canvasFillGradient=y),g&&(b=f?mU(e,m,C):t.__canvasStrokeGradient,t.__canvasStrokeGradient=b),_&&(x=f||!t.__canvasFillPattern?CU(e,p,t):t.__canvasFillPattern,t.__canvasFillPattern=x),v&&(S=f||!t.__canvasStrokePattern?CU(e,m,t):t.__canvasStrokePattern,t.__canvasStrokePattern=S),h?e.fillStyle=y:_&&(x?e.fillStyle=x:s=!1),g?e.strokeStyle=b:v&&(S?e.strokeStyle=S:o=!1)}var w=t.getGlobalScale();d.setScale(w[0],w[1],t.segmentIgnoreThreshold);var T,E;e.setLineDash&&n.lineDash&&(a=_U(t),T=a[0],E=a[1]);var D=!0;(u||f&4)&&(d.setDPR(e.dpr),l?d.setContext(null):(d.setContext(e),D=!1),d.reset(),t.buildPath(d,t.shape,r),d.toStatic(),t.pathUpdated()),D&&d.rebuildPath(e,l?c:1),T&&(e.setLineDash(T),e.lineDashOffset=E),r?(i.batchFill=s,i.batchStroke=o):n.strokeFirst?(o&&SU(e,n),s&&xU(e,n)):(s&&xU(e,n),o&&SU(e,n)),T&&e.setLineDash([])}function Sde(e,t,n){var r=t.__image=YC(n.image,t.__image,t,t.onload);if(r&&ZC(r)){var i=n.x||0,a=n.y||0,o=t.getWidth(),s=t.getHeight(),c=r.width/r.height;if(o==null&&s!=null?o=s*c:s==null&&o!=null?s=o/c:o==null&&s==null&&(o=r.width,s=r.height),n.sWidth&&n.sHeight){var l=n.sx||0,u=n.sy||0;e.drawImage(r,l,u,n.sWidth,n.sHeight,i,a,o,s)}else if(n.sx&&n.sy){var l=n.sx,u=n.sy,d=o-l,f=s-u;e.drawImage(r,l,u,d,f,i,a,o,s)}else e.drawImage(r,i,a,o,s)}}function Cde(e,t,n){var r,i=n.text;if(i!=null&&(i+=``),i){e.font=n.font||`12px sans-serif`,e.textAlign=n.textAlign,e.textBaseline=n.textBaseline;var a=void 0,o=void 0;e.setLineDash&&n.lineDash&&(r=_U(t),a=r[0],o=r[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),n.strokeFirst?(vU(n)&&e.strokeText(i,n.x,n.y),bU(n)&&e.fillText(i,n.x,n.y)):(bU(n)&&e.fillText(i,n.x,n.y),vU(n)&&e.strokeText(i,n.x,n.y)),a&&e.setLineDash([])}}var wU=[`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`],TU=[[`lineCap`,`butt`],[`lineJoin`,`miter`],[`miterLimit`,10]];function EU(e,t,n,r,i){var a=!1;if(!r&&(n||={},t===n))return!1;if(r||t.opacity!==n.opacity){NU(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?OD.opacity:o}(r||t.blend!==n.blend)&&(a||=(NU(e,i),!0),e.globalCompositeOperation=t.blend||OD.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[XU]){if(this._disposed)this.id;else{var r,i,a;if(eC(t)&&(n=t.lazyUpdate,r=t.silent,i=t.replaceMerge,a=t.transition,t=t.notMerge),this[XU]=!0,EW(this),!this._model||t){var o=new Aue(this._api),s=this._theme,c=this._model=new bH;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:i},NW);var l={seriesTransition:a,optionChanged:!0};if(n)this[QU]={silent:r,updateParams:l},this[XU]=!1,this.getZr().wakeUp();else{try{cW(this),dW.update.call(this,null,l)}catch(e){throw this[QU]=null,this[XU]=!1,e}this._ssr||this._zr.flush(),this[QU]=null,this[XU]=!1,hW.call(this,r),gW.call(this,r)}}}},t.prototype.setTheme=function(e,t){if(!this[XU]){if(this._disposed)this.id;else{var n=this._model;if(n){var r=t&&t.silent,i=null;this[QU]&&(r??=this[QU].silent,i=this[QU].updateParams,this[QU]=null),this[XU]=!0,EW(this);try{this._updateTheme(e),n.setTheme(this._theme),cW(this),dW.update.call(this,{type:`setTheme`},i)}catch(e){throw this[XU]=!1,e}this[XU]=!1,hW.call(this,r),gW.call(this,r)}}}},t.prototype._updateTheme=function(e){ZS(e)&&(e=FW[e]),e&&(e=LS(e),e&&BH(e,!0),this._theme=e)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||CC.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){return e||={},this._zr.painter.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get(`backgroundColor`),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){return e||={},this._zr.painter.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){var e=this._zr;return Y(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()},t.prototype.getDataURL=function(e){if(this._disposed)this.id;else{e||={};var t=e.excludeComponents,n=this._model,r=[],i=this;Y(t,function(e){n.eachComponent({mainType:e},function(e){var t=i._componentsMap[e.__viewId];t.group.ignore||(r.push(t),t.group.ignore=!0)})});var a=this._zr.painter.getType()===`svg`?this.getSvgDataURL():this.renderToCanvas(e).toDataURL(`image/`+(e&&e.type||`png`));return Y(r,function(e){e.group.ignore=!1}),a}},t.prototype.getConnectedDataURL=function(e){if(this._disposed)this.id;else{var t=e.type===`svg`,n=this.group,r=Math.min,i=Math.max,a=1/0;if(RW[n]){var o=a,s=a,c=-a,l=-a,u=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Y(LW,function(a,d){if(a.group===n){var f=t?a.getZr().painter.getSvgDom().innerHTML:a.renderToCanvas(LS(e)),p=a.getDom().getBoundingClientRect();o=r(p.left,o),s=r(p.top,s),c=i(p.right,c),l=i(p.bottom,l),u.push({dom:f,left:p.left,top:p.top})}}),o*=d,s*=d,c*=d,l*=d;var f=c-o,p=l-s,m=TS.createCanvas(),h=uH(m,{renderer:t?`svg`:`canvas`});if(h.resize({width:f,height:p}),t){var g=``;return Y(u,function(e){var t=e.left-o,n=e.top-s;g+=``+e.dom+``}),h.painter.getSvgRoot().innerHTML=g,e.connectedBackgroundColor&&h.painter.setBackgroundColor(e.connectedBackgroundColor),h.refreshImmediately(),h.painter.toDataURL()}return e.connectedBackgroundColor&&h.add(new OO({shape:{x:0,y:0,width:f,height:p},style:{fill:e.connectedBackgroundColor}})),Y(u,function(e){var t=new CO({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});h.add(t)}),h.refreshImmediately(),m.toDataURL(`image/`+(e&&e.type||`png`))}return this.getDataURL(e)}},t.prototype.convertToPixel=function(e,t,n){return fW(this,`convertToPixel`,e,t,n)},t.prototype.convertToLayout=function(e,t,n){return fW(this,`convertToLayout`,e,t,n)},t.prototype.convertFromPixel=function(e,t,n){return fW(this,`convertFromPixel`,e,t,n)},t.prototype.containPixel=function(e,t){if(this._disposed)this.id;else{var n=this._model,r;return Y(Rk(n,e),function(e,n){n.indexOf(`Models`)>=0&&Y(e,function(e){var i=e.coordinateSystem;if(i&&i.containPoint)r||=!!i.containPoint(t);else if(n===`seriesModels`){var a=this._chartsMap[e.__viewId];a&&a.containPoint&&(r||=a.containPoint(t,e))}},this)},this),!!r}},t.prototype.getVisual=function(e,t){var n=this._model,r=Rk(n,e,{defaultMainType:`series`}),i=r.seriesModel.getData(),a=r.hasOwnProperty(`dataIndexInside`)?r.dataIndexInside:r.hasOwnProperty(`dataIndex`)?i.indexOfRawIndex(r.dataIndex):null;return a==null?cU(i,t):sU(i,a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e=this;Y(qde,function(t){var n=function(n){var r=e.getModel(),i=n.target,a;if(t===`globalout`?a={}:i&&lU(i,function(e){var t=rA(e);if(t&&t.dataIndex!=null){var n=t.dataModel||r.getSeriesByIndex(t.seriesIndex);return a=n&&n.getDataParams(t.dataIndex,t.dataType,i)||{},!0}if(t.eventData)return a=J({},t.eventData),!0},!0),a){var o=a.componentType,s=a.componentIndex;(o===`markLine`||o===`markPoint`||o===`markArea`)&&(o=`series`,s=a.seriesIndex);var c=o&&s!=null&&r.getComponent(o,s),l=c&&e[c.mainType===`series`?`_chartsMap`:`_componentsMap`][c.__viewId];a.event=n,a.type=t,e._$eventProcessor.eventInfo={targetEl:i,packedEvent:a,model:c,view:l},e.trigger(t,a)}};n.zrEventfulCallAtLast=!0,e._zr.on(t,n,e)});var t=this._messageCenter;Y(jW,function(n,r){t.on(r,function(t){e.trigger(r,t)})}),Gle(t,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?this.id:this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)this.id;else{this._disposed=!0,this.getDom()&&Uk(this.getDom(),zW,``);var e=this,t=e._api,n=e._model;Y(e._componentsViews,function(e){e.dispose(n,t)}),Y(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete LW[e.id]}},t.prototype.resize=function(e){if(!this[XU]){if(this._disposed)this.id;else{this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption(`media`),r=e&&e.silent;this[QU]&&(r??=this[QU].silent,n=!0,this[QU]=null),this[XU]=!0,EW(this);try{n&&cW(this),dW.update.call(this,{type:`resize`,animation:J({duration:0},e&&e.animation)})}catch(e){throw this[XU]=!1,e}this[XU]=!1,hW.call(this,r),gW.call(this,r)}}}},t.prototype.showLoading=function(e,t){if(this._disposed)this.id;else if(eC(e)&&(t=e,e=``),e||=`default`,this.hideLoading(),IW[e]){var n=IW[e](this._api,t),r=this._zr;this._loadingFX=n,r.add(n)}},t.prototype.hideLoading=function(){this._disposed?this.id:(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=J({},e);return t.type=AW[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)this.id;else if(eC(t)||(t={silent:!!t}),kW[e.type]&&this._model){if(this[XU])this._pendingActions.push(e);else{var n=t.silent;mW.call(this,e,n);var r=t.flush;r?this._zr.flush():r!==!1&&CC.browser.weChat&&this._throttledZrFlush(),hW.call(this,n),gW.call(this,n)}}},t.prototype.updateLabelLayout=function(){uU.trigger(`series:layoutlabels`,this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)this.id;else{var t=e.seriesIndex;this.getModel().getSeriesByIndex(t).appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},t.internalField=function(){cW=function(e){Cz(e._model);var t=e._scheduler;t.restorePipelines(e._zr,e._model),t.prepareStageTasks(),lW(e,!0),lW(e,!1),t.plan()},lW=function(e,t){for(var n=e._model,r=e._scheduler,i=t?e._componentsViews:e._chartsViews,a=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,c=0;csC(t.get(`hoverLayerThreshold`),hH.hoverLayerThreshold)&&!CC.node&&!CC.worker;(e._usingTHL||a)&&(t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){var t=e.states.emphasis;t&&t.hoverLayer!==2&&(t.hoverLayer=+!!a)})}}),e._usingTHL=a)}}function a(e,t){var n=e.get(`blendMode`)||null;t.eachRendered(function(e){e.isGroup||(e.style.blend=n)})}function o(e,t){if(!e.preventAutoZ){var n=BM(e);t.eachRendered(function(e){return HM(e,n.z,n.zlevel),!0})}}function s(e,t){t.eachRendered(function(e){if(!iM(e)){var t=e.getTextContent(),n=e.getTextGuideLine();e.stateTransition&&=null,t&&t.stateTransition&&(t.stateTransition=null),n&&n.stateTransition&&(n.stateTransition=null),e.hasState()?(e.prevStates=e.currentStates,e.clearStates()):e.prevStates&&=null}})}function c(e,t){var n=e.getModel(`stateAnimation`),i=e.isAnimationEnabled(),a=n.get(`duration`),o=a>0?{duration:a,delay:n.get(`delay`),easing:n.get(`easing`)}:null;t.eachRendered(function(e){if(e.states&&e.states.emphasis){if(iM(e))return;if(e instanceof xO&&Vae(e),e.__dirty){var t=e.prevStates;t&&e.useStates(t)}if(i){e.stateTransition=o;var n=e.getTextContent(),a=e.getTextGuideLine();n&&(n.stateTransition=o),a&&(a.stateTransition=o)}e.__dirty&&r(e)}})}SW=function(e){return new(function(t){vS(n,t);function n(){return t!==null&&t.apply(this,arguments)||this}return n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(n!=null)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){BA(t,n),wW(e)},n.prototype.leaveEmphasis=function(t,n){VA(t,n),wW(e)},n.prototype.enterBlur=function(t){HA(t),wW(e)},n.prototype.leaveBlur=function(t){UA(t),wW(e)},n.prototype.enterSelect=function(t){WA(t),wW(e)},n.prototype.leaveSelect=function(t){GA(t),wW(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n.prototype.getECUpdateCycleVersion=function(){return e[ZU]},n.prototype.usingTHL=function(){return e._usingTHL},n}(pA))(e)},CW=function(e){function t(e,t){for(var n=0;n=0)){KW.push(n);var o=JH.wrapStageHandler(n,i);o.__prio=t,o.__raw=n,e.push(o)}}function JW(e,t){IW[e]=t}function tfe(e,t,n){var r=ude(`registerMap`);r&&r(e,t,n)}var nfe=Vse;GW(KU,Kue),GW(JU,que),GW(JU,Jue),GW(KU,ode),GW(JU,sde),GW(YU,jde),VW(BH),HW(Fde,Hue),JW(`default`,Yue),WW({type:xA,event:xA,update:xA},bC),WW({type:SA,event:SA,update:SA},bC),WW({type:CA,event:EA,update:CA,action:bC,refineEvent:YW,publishNonRefinedEvent:!0}),WW({type:wA,event:EA,update:wA,action:bC,refineEvent:YW,publishNonRefinedEvent:!0}),WW({type:TA,event:EA,update:TA,action:bC,refineEvent:YW,publishNonRefinedEvent:!0});function YW(e,t,n,r){return{eventContent:{selected:Iae(n),isFromClick:t.isFromClick||!1}}}BW(`default`,{}),BW(`dark`,iU);var XW=[],rfe={registerPreprocessor:VW,registerProcessor:HW,registerPostInit:Zde,registerPostUpdate:Qde,registerUpdateLifecycle:UW,registerAction:WW,registerCoordinateSystem:$de,registerLayout:efe,registerVisual:GW,registerTransform:nfe,registerLoading:JW,registerMap:tfe,registerImpl:lde,PRIORITY:Wde,ComponentModel:sI,ComponentView:VH,SeriesModel:LI,ChartView:uL,registerComponentModel:function(e){sI.registerClass(e)},registerComponentView:function(e){VH.registerClass(e)},registerSeriesModel:function(e){LI.registerClass(e)},registerChartView:function(e){uL.registerClass(e)},registerCustomSeries:function(e,t){dde(e,t)},registerSubTypeDefaulter:function(e,t){sI.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){bue(e,t)}};function ZW(e){X(e)?Y(e,function(e){ZW(e)}):BS(XW,e)>=0||(XW.push(e),XS(e)&&(e={install:e}),e.install(rfe))}var ife=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),QW=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents(`grid`,Bk).models[0]},t.type=`cartesian2dAxis`,t}(sI);VS(QW,ife);var $W={show:!0,z:0,inverse:!1,name:``,nameLocation:`end`,nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:`...`,placeholder:`.`},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:`auto`,onZeroAxisIndex:null,lineStyle:{color:Q.color.axisLine,width:1,type:`solid`},symbol:[`none`,`none`],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:Q.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:Q.color.axisSplitLine,width:1,type:`solid`}},splitArea:{show:!1,areaStyle:{color:[Q.color.backgroundTint,Q.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:Q.color.neutral00,borderColor:Q.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:`auto`}},afe=RS({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:`auto`,show:`auto`},axisLabel:{interval:`auto`}},$W),eG=RS({boundaryGap:[0,0],axisLine:{show:`auto`},axisTick:{show:`auto`},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:Q.color.axisMinorSplitLine,width:1}}},$W),ofe={category:afe,value:eG,time:RS({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:`bold`}}},splitLine:{show:!1}},eG),log:zS({logBase:10},eG)};function tG(e,t,n,r){Y(pR,function(i,a){var o=RS(RS({},ofe[a],!0),r,!0),s=function(e){vS(n,e);function n(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t+`Axis.`+a,n}return n.prototype.mergeDefaultAndTheme=function(e,t){var n=iI(this),r=n?oI(e):{};RS(e,t.getTheme().get(a+`Axis`)),RS(e,this.getDefaultOption()),e.type=nG(e),n&&aI(e,r,n)},n.prototype.optionUpdated=function(){this.option.type===`category`&&(this.__ordinalMeta=SL.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if(t.type===`category`)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.updateAxisBreaks=function(e){var t=pB();return t?t.updateModelAxisBreak(this,e):{breaks:[]}},n.type=t+`Axis.`+a,n.defaultOption=o,n}(n);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+`Axis`,nG)}function nG(e){return e.type||(e.data?`category`:`value`)}var sfe=function(){function e(e){this.type=`cartesian`,this._dimList=[],this._axes={},this.name=e||``}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return US(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),GS(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),rG=[`x`,`y`];function iG(e){return(e.type===`interval`||e.type===`time`)&&!lF(e)}var cfe=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=KB,t.dimensions=rG,t}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis(`x`).scale,t=this.getAxis(`y`).scale;if(iG(e)&&iG(t)){var n=OL(e,null),r=OL(t,null),i=this.dataToPoint([n[0],r[0]]),a=this.dataToPoint([n[1],r[1]]),o=n[1]-n[0],s=r[1]-r[0];if(o&&s){var c=(a[0]-i[0])/o,l=(a[1]-i[1])/s,u=i[0]-n[0]*c,d=i[1]-r[0]*l,f=this._transform=[c,0,0,l,u,d];this._invTransform=iw([],f)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale(`ordinal`)[0]||this.getAxesByScale(`time`)[0]||this.getAxis(`x`)},t.prototype.containPoint=function(e){var t=this.getAxis(`x`),n=this.getAxis(`y`);return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis(`x`).containData(e[0])&&this.getAxis(`y`).containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),r=this.dataToPoint(t),i=this.getArea(),a=new Aw(n[0],n[1],r[0]-n[0],r[1]-n[1]);return i.intersect(a)},t.prototype.dataToPoint=function(e,t,n){n||=[];var r=e[0],i=e[1];if(this._transform&&r!=null&&isFinite(r)&&i!=null&&isFinite(i))return mw(n,e,this._transform);var a=this.getAxis(`x`),o=this.getAxis(`y`);return n[0]=a.toGlobalCoord(a.dataToCoord(r,t)),n[1]=o.toGlobalCoord(o.dataToCoord(i,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis(`x`).scale,r=this.getAxis(`y`).scale,i=n.getExtent(),a=r.getExtent(),o=n.parse(e[0]),s=r.parse(e[1]);return t||=[],t[0]=Math.min(Math.max(Math.min(i[0],i[1]),o),Math.max(i[0],i[1])),t[1]=Math.min(Math.max(Math.min(a[0],a[1]),s),Math.max(a[0],a[1])),t},t.prototype.pointToData=function(e,t,n){if(n||=[],this._invTransform)return mw(n,e,this._invTransform);var r=this.getAxis(`x`),i=this.getAxis(`y`);return n[0]=r.coordToData(r.toLocalCoord(e[0]),t),n[1]=i.coordToData(i.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis(e.dim===`x`?`y`:`x`)},t.prototype.getArea=function(e){e||=0;var t=this.getAxis(`x`).getGlobalExtent(),n=this.getAxis(`y`).getGlobalExtent(),r=Math.min(t[0],t[1])-e,i=Math.min(n[0],n[1])-e;return new Aw(r,i,Math.max(t[0],t[1])-r+e,Math.max(n[0],n[1])-i+e)},t}(sfe);function lfe(e,t){var n=e.scale,r=e.model,i=VB(n,r,r.ecModel,e,null),a=PL(n),o=PL(t)?t.intervalStub:t,s=a?n.intervalStub:n,c=n.base,l=o.getTicks(),u=o.getTicks({expandToNicedExtent:!0}),d=l.length-1,f,p,m;if(d===1)f=p=0,m=1;else if(d===2){var h=qO(l[0].value-l[1].value),g=qO(l[1].value-l[2].value);f=p=0,h===g?m=2:(m=1,h=C[1])return!0})):b[1]?(T=C[1],A(function(){if(P(),k=ik(O-E*m,D),j(),w<=C[0])return!0})):A(function(){k=ik(XO(C[0]/E)*E,D),O=ik(YO(C[1]/E)*E,D);var e=JO((O-k)/E);if(e<=m){var t=m-e,n=void 0,r=i.incl0||a;if(r&&C[0]===0)n=[0,t];else if(r&&C[1]===0)n=[t,0];else{var o=YO(t/2);n=t%2==0?[o,o]:w+T=C[1])return!0}})}kR(n,b,S,[w,T],x,{interval:E,intervalCount:m,intervalPrecision:D,niceExtent:[k,O]})}function aG(e,t){var n=PL(e),r=n?e.intervalStub:e,i=t.fixMinMax||[],a=n?e.getExtent():null,o=r.getExtent(),s=BL(o,i,t.rawExtentResult);r.setExtent(s[0],s[1]),s=r.getExtent();var c=n?dfe(r,t):ufe(r,t),l=c.intervalPrecision,u=c.interval,d=t.userInterval;d!=null&&(c.interval=d,c.intervalPrecision=LL(d)),i[0]||(s[0]=ik(YO(s[0]/u)*u,l)),i[1]||(s[1]=ik(XO(s[1]/u)*u,l)),d!=null&&(c.niceExtent=s.slice()),kR(e,i,o,s,a,c)}function ufe(e,t){var n=HL(t.splitNumber,5),r=kL(e),i=t.minInterval,a=t.maxInterval,o=hk(r/n,!0);i!=null&&oa&&(o=a);var s=LL(o),c=e.getExtent(),l=[ik(XO(c[0]/o)*o,s),ik(YO(c[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:l}}function dfe(e,t){var n=HL(t.splitNumber,10),r=e.getExtent(),i=kL(e),a=KO(pk(i),1);n/i*a<=.5&&(a*=10);var o=LL(a),s=[ik(XO(r[0]/a)*a,o),ik(YO(r[1]/a)*a,o)];return{intervalPrecision:o,interval:a,niceExtent:s}}function oG(e){var t=e.scale,n=e.model,r=n.axis,i=n.ecModel;ffe(t,n,r,i,null)}function ffe(e,t,n,r,i){var a=VB(e,t,r,n,i),o=ML(e)||NL(e);pfe(e,{splitNumber:t.get(`splitNumber`),fixMinMax:a.fixMM,userInterval:t.get(`interval`),minInterval:o?t.get(`minInterval`):null,maxInterval:o?t.get(`maxInterval`):null,rawExtentResult:a}),n&&r&&fle(n,e,a,r)}function pfe(e,t){mfe[e.type](e,t)}var mfe={interval:aG,log:aG,time:aR,ordinal:bC},sG=[[3,1],[0,2]],hfe=function(){function e(e,t,n){this.type=`grid`,this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=rG,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;Y(this._axesList,function(e){RB(e,1);var t=e.scale;FL(t)&&t.setSortInfo(e.model.get(`categorySortInfo`))});function r(e){for(var t=qS(e),n=[],r=t.length-1;r>=0;r--){var i=e[+t[r]];i.__alignTo?n.push(i):oG(i)}Y(n,function(e){_fe(e,e.__alignTo)?oG(e):lfe(e,e.__alignTo.scale)})}r(n.x),r(n.y);var i={};Y(n.x,function(e){cG(n,`y`,e,i)}),Y(n.y,function(e){cG(n,`x`,e,i)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var r=rI(e,t),i=this._rect=tI(e.getBoxLayoutParams(),r.refContainer),a=this._axesMap,o=this._coordsList,s=e.get(`containLabel`);if(dG(a,i),!n){var c=hG(i,o,a,s,t),l=void 0;if(s)pG?(pG(this._axesList,i),dG(a,i)):l=mG(i.clone(),`axisLabel`,null,i,a,c,r);else{var u=_G(e,i,r),d=u.outerBoundsRect,f=u.parsedOuterBoundsContain,p=u.outerBoundsClamp;d&&(l=mG(d,f,p,i,a,c,r))}gG(i,a,nz.determine,null,l,r),Y(this._coordsList,function(e){e.calcAffineTransform()})}},e.prototype.getAxis=function(e,t){var n=this._axesMap[e];if(n!=null)return n[t||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(e,t){if(e!=null&&t!=null){var n=`x`+e+`y`+t;return this._coordsMap[n]}eC(e)&&(t=e.yAxisIndex,e=e.xAxisIndex);for(var r=0,i=this._coordsList;r=0;i--){var a=e[+t[i]];jL(a.scale)&&DR(a.model,a.type,!0)==null&&(a.model.get(`alignTicks`)&&a.model.get(`interval`)==null?r.push(a):n=a)}n||=r.pop(),n&&Y(r,function(e){e.__alignTo=n})}function _fe(e,t){return lF(e.scale)||lF(t.scale)||t.scale.getTicks().length<2}function vfe(e,t){var n=e.getExtent(),r=n[0]+n[1];e.toGlobalCoord=e.dim===`x`?function(e){return e+t}:function(e){return r-e+t},e.toLocalCoord=e.dim===`x`?function(e){return e-t}:function(e){return r-e+t}}function dG(e,t){Y(e.x,function(e){return fG(e,t.x,t.width)}),Y(e.y,function(e){return fG(e,t.y,t.height)})}function fG(e,t,n){var r=[0,n],i=+!!e.inverse;e.setExtent(r[i],r[1-i]),vfe(e,t)}var pG;function mG(e,t,n,r,i,a,o){gG(r,i,nz.estimate,t,!1,o);var s=[0,0,0,0];l(0),l(1),u(r,0,NaN),u(r,1,NaN);var c=KS(s,function(e){return e>0})==null;return AM(r,s,!0,!0,n),dG(i,r),c;function l(e){Y(i[uM[e]],function(t){if(ER(t.model)){var n=a.ensureRecord(t.model),r=n.labelInfoList;if(r)for(var i=0;i0&&!aC(t)&&t>1e-4&&(e/=t),e}}function hG(e,t,n,r,i){var a=new _B(vG);return Y(n,function(n){return Y(n,function(n){if(ER(n.model)){var o=!r;n.axisBuilder=nle(e,t,n.model,i,a,o)}})}),a}function gG(e,t,n,r,i,a){var o=n===nz.determine;Y(t,function(t){return Y(t,function(t){ER(t.model)&&(rle(t.axisBuilder,e,t.model),t.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};c(0),c(1);function c(t){s[uM[1-t]]=e[dM[t]]<=a.refContainer[dM[t]]*.5?0:1-t==1?2:1}Y(t,function(e,t){return Y(e,function(e){ER(e.model)&&((r===`all`||o)&&e.axisBuilder.build({axisName:!0},{nameMarginLevel:s[t]}),o&&e.axisBuilder.build({axisLine:!0}))})})}function _G(e,t,n){var r,i=e.get(`outerBoundsMode`,!0);i===`same`?r=t.clone():(i==null||i===`auto`)&&(r=tI(e.get(`outerBounds`,!0)||WB,n.refContainer));var a=e.get(`outerBoundsContain`,!0),o=a==null||a===`auto`||BS([`all`,`axisLabel`],a)<0?`all`:a,s=[nk(sC(e.get(`outerBoundsClampWidth`,!0),GB[0]),t.width),nk(sC(e.get(`outerBoundsClampHeight`,!0),GB[1]),t.height)];return{outerBoundsRect:r,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var vG=function(e,t,n,r,i,a){var o=n.axis.dim===`x`?`y`:`x`;bB(e,t,n,r,i,a),TR(e.nameLocation)||Y(t.recordMap[o],function(e){e&&e.labelInfoList&&e.dirVec&&SB(e.labelInfoList,e.dirVec,r,i)})};function yG(e,t){var n={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return bG(n,e,t),n.seriesInvolved&&SG(n,e),n}function bG(e,t,n){var r=t.getComponent(`tooltip`),i=t.getComponent(`axisPointer`),a=i.get(`link`,!0)||[],o=[];Y(n.getCoordinateSystems(),function(n){if(!n.axisPointerEnabled)return;var s=kG(n.model),c=e.coordSysAxesInfo[s]={};e.coordSysMap[s]=n;var l=n.model.getModel(`tooltip`,r);if(Y(n.getAxes(),YS(p,!1,null)),n.getTooltipAxes&&r&&l.get(`show`)){var u=l.get(`trigger`)===`axis`,d=l.get([`axisPointer`,`type`])===`cross`,f=n.getTooltipAxes(l.get([`axisPointer`,`axis`]));(u||d)&&Y(f.baseAxes,YS(p,!d||`cross`,u)),d&&Y(f.otherAxes,YS(p,`cross`,!1))}function p(r,s,u){var d=u.model.getModel(`axisPointer`,i),f=d.get(`show`);if(f&&(f!==`auto`||r||OG(d))){s??=d.get(`triggerTooltip`),d=r?xG(u,l,i,t,r,s):d;var p=d.get(`snap`),m=d.get(`triggerEmphasis`),h=kG(u.model),g=s||p||u.type===`category`,_=e.axesInfo[h]={key:h,axis:u,coordSys:n,axisPointerModel:d,triggerTooltip:s,triggerEmphasis:m,involveSeries:g,snap:p,useHandle:OG(d),seriesModels:[],linkGroup:null};c[h]=_,e.seriesInvolved=e.seriesInvolved||g;var v=CG(a,u);if(v!=null){var y=o[v]||(o[v]={axesInfo:{}});y.axesInfo[h]=_,y.mapper=a[v].mapper,_.linkGroup=y}}}})}function xG(e,t,n,r,i,a){var o=t.getModel(`axisPointer`),s=[`type`,`snap`,`lineStyle`,`shadowStyle`,`label`,`animation`,`animationDurationUpdate`,`animationEasingUpdate`,`z`],c={};Y(s,function(e){c[e]=LS(o.get(e))}),c.snap=e.type!==`category`&&!!a,o.get(`type`)===`cross`&&(c.type=`line`);var l=c.label||={};if(l.show??=!1,i===`cross`&&(l.show=o.get([`label`,`show`])??!0,!a)){var u=c.lineStyle=o.get(`crossStyle`);u&&zS(l,u.textStyle)}return e.model.getModel(`axisPointer`,new dN(c,n,r))}function SG(e,t){t.eachSeries(function(t){var n=t.coordinateSystem,r=t.get([`tooltip`,`trigger`],!0),i=t.get([`tooltip`,`show`],!0);n&&n.model&&r!==`none`&&r!==!1&&r!==`item`&&i!==!1&&t.get([`axisPointer`,`show`],!0)!==!1&&Y(e.coordSysAxesInfo[kG(n.model)],function(e){var r=e.axis;n.getAxis(r.dim)===r&&(e.seriesModels.push(t),e.seriesDataCount??=0,e.seriesDataCount+=t.getData().count())})})}function CG(e,t){for(var n=t.model,r=t.dim,i=0;i=0||e===t}function TG(e){var t=EG(e);if(t){var n=t.axisPointerModel,r=t.axis.scale,i=n.option,a=n.get(`status`),o=n.get(`value`);o!=null&&(o=r.parse(o));var s=OG(n);a??(i.status=s?`show`:`hide`);var c=r.getExtent();(o==null||o>c[1])&&(o=c[1]),o3?1.4:i>1?1.2:1.1,c=r>0?s:1/s;this._checkTriggerMoveZoom(this,`zoom`,`zoomOnMouseWheel`,e,{scale:c,originX:a,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(r),u=(r>0?1:-1)*(l>3?.4:l>1?.15:.05);this._checkTriggerMoveZoom(this,`scrollMove`,`moveOnMouseWheel`,e,{scrollDelta:u,originX:a,originY:o,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(e){if(!(WG(this._zr,`globalPan`)||JG(e))){var t=e.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,`zoom`,null,e,{scale:t,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(e,t,n,r,i){e._checkPointer(r,i.originX,i.originY)&&(OV(r.event),r.__ecRoamConsumed=!0,tK(e,t,n,r,i))},t}(rD);function JG(e){return e.__ecRoamConsumed}var YG=Lk();function XG(e){var t=YG(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function ZG(e,t,n,r){for(var i=XG(e).roam,a=i[t]=i[t]||[],o=0;o1e-6;KK[0]=o?(i[0]-r.x)/a:i[0],KK[1]=o?(i[1]-r.y)/a:i[1],mw(KK,KK,e.mtRawInv);var s=HK(e,KK);qK(t,s,a),Y(n,function(e){e!==t&&qK(e,s.slice(),a)})}var KK=[];function qK(e,t,n){var r=e.option;r.center=t,r.zoom=n}function JK(e,t){if(t){var n=t.min||0,r=t.max||1/0;e=Math.max(Math.min(r,e),n)}return e}function YK(e,t,n,r,i,a,o,s){if(!LK(e)){n.disable();return}n.enable(sC(e.get(`roam`),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get(`roamTrigger`),isInSelf:r,isInClip:function(e,t,n){return!i||i.contain(t,n)}}});function c(n){var r=e.mainType,i=WM(zS({type:$K(r,e.subType,fA)},n));s&&(i.componentType=r),i[r+`Id`]=e.id,t.dispatchAction(i)}n.off(`pan`).off(`zoom`).on(`pan`,function(e){a&&a(`pan`),c({dx:e.dx,dy:e.dy})}).on(`zoom`,function(e){a&&a(`zoom`),c({zoom:e.scale,originX:e.originX,originY:e.originY})})}function XK(e){return function(t,n,r){return ZK.copy(e.getBoundingRect()),ZK.applyTransform(e.getComputedTransform()),ZK.contain(n,r)}}var ZK=new Aw(0,0,0,0);function QK(e,t,n){var r=$K(t,n,fA);e.registerAction({type:r,event:r,update:`none`},function(e,r,i){r.eachComponent(Hk(e,t,n),function(t){IK(e,t),RK(e,t,r,i)})})}function $K(e,t,n){return(e===`series`?t===`map`?`geo`:t:e)+n}function eq(e,t,n,r,i,a,o){var s=new aK(null,WK(e.ecModel,t));return gK(s,n,r,i,a),o?_K(s,o.x,o.y,o.width,o.height):_K(s,n,r,i,a),hK(s,e),s}var tq=Lk();function nq(e){var t=e.mainData,n=e.datas;n||(n={main:t},e.datasAttr={main:`data`}),e.datas=e.mainData=null,lq(t,n,e),Y(n,function(n){Y(t.TRANSFERABLE_METHODS,function(t){n.wrapMethod(t,YS(rq,e))})}),t.wrapMethod(`cloneShallow`,YS(aq,e)),Y(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,YS(iq,e))}),dC(n[t.dataType]===t)}function rq(e,t){if(cq(this)){var n=J({},tq(this).datas);n[this.dataType]=t,lq(t,n,e)}else uq(t,this.dataType,tq(this).mainData,e);return t}function iq(e,t){return e.struct&&e.struct.update(),t}function aq(e,t){return Y(tq(t).datas,function(n,r){n!==t&&uq(n.cloneShallow(),r,t,e)}),t}function oq(e){var t=tq(this).mainData;return e==null||t==null?t:tq(t).datas[e]}function sq(){var e=tq(this).mainData;return e==null?[{data:e}]:US(qS(tq(e).datas),function(t){return{type:t,data:tq(e).datas[t]}})}function cq(e){return tq(e).mainData===e}function lq(e,t,n){tq(e).datas={},Y(t,function(t,r){uq(t,r,e,n)})}function uq(e,t,n,r){tq(n).datas[t]=e,tq(e).mainData=n,e.dataType=t,r.struct&&(e[r.structAttr]=r.struct,r.struct[r.datasAttr[t]]=e),e.getLinkedData=oq,e.getLinkedDataAll=sq}var dq=Y,fq=eC,pq=-1,mq=function(){function e(t){var n=t.mappingMethod,r=t.type,i=this.option=LS(t);this.type=r,this.mappingMethod=n,this._normalizeData=Eq[n];var a=e.visualHandlers[r];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[n],n===`piecewise`?(_q(i),hq(i)):n===`category`?i.categories?gq(i):_q(i,!0):(dC(n!==`linear`||i.dataExtent),_q(i))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return JS(this._normalizeData,this)},e.listVisualTypes=function(){return qS(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){eC(e)?Y(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,r){var i,a=X(t)?[]:eC(t)?{}:(i=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(r,e,t);i?a=o:a[t]=o}),a},e.retrieveVisuals=function(t){var n={},r;return t&&dq(e.visualHandlers,function(e,i){t.hasOwnProperty(i)&&(n[i]=t[i],r=!0)}),r?n:null},e.prepareVisualTypes=function(e){if(X(e))e=e.slice();else if(fq(e)){var t=[];dq(e,function(e,n){t.push(n)}),e=t}else return[];return e.sort(function(e,t){return t===`color`&&e!==`color`&&e.indexOf(`color`)===0?1:-1}),e},e.dependsOn=function(e,t){return t===`color`?!!(e&&e.indexOf(t)===0):e===t},e.findPieceIndex=function(e,t,n){for(var r,i=1/0,a=0,o=t.length;a=0;a--)r[a]??(delete n[t[a]],t.pop())}function _q(e,t){var n=e.visual,r=[];eC(n)?dq(n,function(e){r.push(e)}):n!=null&&r.push(n),!t&&r.length===1&&!{color:1,symbol:1}.hasOwnProperty(e.type)&&(r[1]=r[0]),Tq(e,r)}function vq(e){return{applyVisual:function(t,n,r){var i=this.mapValueToVisual(t);r(`color`,e(n(`color`),i))},_normalizedToVisual:Cq([0,1])}}function yq(e){var t=this.option.visual;return t[Math.round(ek(e,[0,1],[0,t.length-1],!0))]||{}}function bq(e){return function(t,n,r){r(e,this.mapValueToVisual(t))}}function xq(e){var t=this.option.visual;return t[this.option.loop&&e!==pq?e%t.length:e]}function Sq(){return this.option.visual[0]}function Cq(e){return{linear:function(t){return ek(t,e,this.option.visual,!0)},category:xq,piecewise:function(t,n){var r=wq.call(this,n);return r??=ek(t,e,this.option.visual,!0),r},fixed:Sq}}function wq(e){var t=this.option,n=t.pieceList;if(t.hasSpecialVisual){var r=n[mq.findPieceIndex(e,n)];if(r&&r.visual)return r.visual[this.type]}}function Tq(e,t){return e.visual=t,e.type===`color`&&(e.parsedVisual=US(t,function(e){return tE(e)||[0,0,0,1]})),t}var Eq={linear:function(e){return ek(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,n=mq.findPieceIndex(e,t,!0);if(n!=null)return ek(n,[0,t.length-1],[0,1],!0)},category:function(e){return(this.option.categories?this.option.categoryMap[e]:e)??pq},fixed:bC};function Dq(e,t,n){return e?t<=n:t=0&&e.call(t,n[i],i)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,r=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&e.call(t,n[i],i)},e.prototype.breadthFirstTraverse=function(e,t,n,r){if(t instanceof Aq||(t=this._nodesMap[Oq(t)]),t){for(var i=n===`out`?`outEdges`:n===`in`?`inEdges`:`edges`,a=0;a=0&&n.node2.dataIndex>=0});for(var i=0,a=r.length;i=0&&!e.hasKey(p)&&(e.set(p,!0),a.push(f.node1))}for(s=0;s=0&&!e.hasKey(v)&&(e.set(v,!0),o.push(_.node2))}}}return{edge:e.keys(),node:t.keys()}},e}(),jq=function(){function e(e,t,n){this.dataIndex=-1,this.node1=e,this.node2=t,this.dataIndex=n??-1}return e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostGraph.edgeData.getItemModel(this.dataIndex).getModel(e)},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var e=_C(),t=_C();e.set(this.dataIndex,!0);for(var n=[this.node1],r=[this.node2],i=0;i=0&&!e.hasKey(u)&&(e.set(u,!0),n.push(l.node1))}for(i=0;i=0&&!e.hasKey(m)&&(e.set(m,!0),r.push(p.node2))}return{edge:e.keys(),node:t.keys()}},e}();function Mq(e,t){return{getValue:function(n){var r=this[e][t];return r.getStore().get(r.getDimensionIndex(n||`value`),this.dataIndex)},setVisual:function(n,r){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,n,r)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,r){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,r)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}VS(Aq,Mq(`hostGraph`,`data`)),VS(jq,Mq(`hostGraph`,`edgeData`));function Nq(e,t,n,r,i){for(var a=new kq(r),o=0;o `+f)),l++)}var p=n.get(`coordinateSystem`),m;if(p===`cartesian2d`||p===`polar`||p===`matrix`)m=kP(e,n);else{var h=wP.get(p),g=h&&h.dimensions||[];BS(g,`value`)<0&&g.concat([`value`]);var _=xP(e,{coordDimensions:g,encodeDefine:n.getEncode()}).dimensions;m=new bP(_,n),m.initData(e)}var v=new bP([`value`],n);return v.initData(c,s),i&&i(m,v),nq({mainData:m,struct:a,structAttr:`graph`,datas:{node:m,edge:v},datasAttr:{node:`data`,edge:`edgeData`}}),a.update(),a}var Pq=Rj.prototype,Fq=Vj.prototype,Iq=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return e}();(function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Iq);function Lq(e){return isNaN(+e.cpx1)||isNaN(+e.cpy1)}var Rq=function(e){vS(t,e);function t(t){var n=e.call(this,t)||this;return n.type=`ec-line`,n}return t.prototype.getDefaultStyle=function(){return{stroke:Q.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Iq},t.prototype.buildPath=function(e,t){Lq(t)?Pq.buildPath.call(this,e,t):Fq.buildPath.call(this,e,t)},t.prototype.pointAt=function(e){return Lq(this.shape)?Pq.pointAt.call(this,e):Fq.pointAt.call(this,e)},t.prototype.tangentAt=function(e){var t=this.shape,n=Lq(t)?[t.x2-t.x1,t.y2-t.y1]:Fq.tangentAt.call(this,e);return dw(n,n)},t}(xO),zq=[`fromSymbol`,`toSymbol`];function Bq(e){return`_`+e+`Type`}function Vq(e,t,n){var r=t.getItemVisual(n,e);if(!r||r===`none`)return r;var i=t.getItemVisual(n,e+`Size`),a=t.getItemVisual(n,e+`Rotate`),o=t.getItemVisual(n,e+`Offset`),s=t.getItemVisual(n,e+`KeepAspect`),c=UI(i),l=WI(o||0,c);return r+c+l+(a||``)+(s||``)}function Hq(e,t,n){var r=t.getItemVisual(n,e);if(r&&r!==`none`){var i=t.getItemVisual(n,e+`Size`),a=t.getItemVisual(n,e+`Rotate`),o=t.getItemVisual(n,e+`Offset`),s=t.getItemVisual(n,e+`KeepAspect`),c=UI(i),l=WI(o||0,c),u=HI(r,-c[0]/2+l[0],-c[1]/2+l[1],c[0],c[1],null,s);return u.__specifiedRotation=a==null||isNaN(a)?void 0:a*Math.PI/180||0,u.name=e,u}}function Uq(e){var t=new Rq({name:`line`,subPixelOptimize:!0});return Wq(t.shape,e),t}function Wq(e,t){e.x1=t[0][0],e.y1=t[0][1],e.x2=t[1][0],e.y2=t[1][1],e.percent=1;var n=t[2];n?(e.cpx1=n[0],e.cpy1=n[1]):(e.cpx1=NaN,e.cpy1=NaN)}var Gq=function(e){vS(t,e);function t(t,n,r){var i=e.call(this)||this;return i._createLine(t,n,r),i}return t.prototype._createLine=function(e,t,n){var r=e.hostModel,i=e.getItemLayout(t),a=e.getItemVisual(t,`z2`),o=Uq(i);o.shape.percent=0,rM(o,{z2:sC(a,0),shape:{percent:1}},r,t),this.add(o),Y(zq,function(n){var r=Hq(n,e,t);this.add(r),this[Bq(n)]=Vq(n,e,t)},this),this._updateCommonStl(e,t,n)},t.prototype.updateData=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=e.getItemLayout(t),o={shape:{}};Wq(o.shape,a),nM(i,o,r,t),Y(zq,function(n){var r=Vq(n,e,t),i=Bq(n);if(this[i]!==r){this.remove(this.childOfName(n));var a=Hq(n,e,t);this.add(a)}this[i]=r},this),this._updateCommonStl(e,t,n)},t.prototype.getLinePath=function(){return this.childAt(0)},t.prototype._updateCommonStl=function(e,t,n){var r=e.hostModel,i=this.childOfName(`line`),a=n&&n.emphasisLineStyle,o=n&&n.blurLineStyle,s=n&&n.selectLineStyle,c=n&&n.labelStatesModels,l=n&&n.emphasisDisabled,u=n&&n.focus,d=n&&n.blurScope;if(!n||e.hasItemOption){var f=e.getItemModel(t),p=f.getModel(`emphasis`);a=p.getModel(`lineStyle`).getLineStyle(),o=f.getModel([`blur`,`lineStyle`]).getLineStyle(),s=f.getModel([`select`,`lineStyle`]).getLineStyle(),l=p.get(`disabled`),u=p.get(`focus`),d=p.get(`blurScope`),c=ZM(f)}var m=e.getItemVisual(t,`style`),h=m.stroke;i.useStyle(m),i.style.fill=null,i.style.strokeNoScale=!0,i.ensureState(`emphasis`).style=a,i.ensureState(`blur`).style=o,i.ensureState(`select`).style=s,Y(zq,function(e){var t=this.childOfName(e);if(t){t.setColor(h),t.style.opacity=m.opacity;for(var n=0;n0&&(y[0]=-y[0],y[1]=-y[1]);var x=v[0]<0?-1:1;if(r.__position!==`start`&&r.__position!==`end`){var S=-Math.atan2(v[1],v[0]);l[0].8?`left`:u[0]<-.8?`right`:`center`,p=u[1]>.8?`top`:u[1]<-.8?`bottom`:`middle`;break;case`start`:r.x=-u[0]*h+c[0],r.y=-u[1]*g+c[1],f=u[0]>.8?`right`:u[0]<-.8?`left`:`center`,p=u[1]>.8?`bottom`:u[1]<-.8?`top`:`middle`;break;case`insideStartTop`:case`insideStart`:case`insideStartBottom`:r.x=h*x+c[0],r.y=c[1]+C,f=v[0]<0?`right`:`left`,r.originX=-h*x,r.originY=-C;break;case`insideMiddleTop`:case`insideMiddle`:case`insideMiddleBottom`:case`middle`:r.x=b[0],r.y=b[1]+C,f=`center`,r.originY=-C;break;case`insideEndTop`:case`insideEnd`:case`insideEndBottom`:r.x=-h*x+l[0],r.y=l[1]+C,f=v[0]>=0?`right`:`left`,r.originX=h*x,r.originY=-C}r.scaleX=r.scaleY=i,r.setStyle({verticalAlign:r.__verticalAlign||p,align:r.__align||f})}},t}(yj),Kq=function(){function e(e){this.group=new yj,this._LineCtor=e||Gq}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,r=n.group,i=n._lineData;n._lineData=e,i||r.removeAll();var a=Jq(e);e.diff(i).add(function(n){t._doAdd(e,n,a)}).update(function(n,r){t._doUpdate(i,e,r,n,a)}).remove(function(e){r.remove(i.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=Jq(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){this._progressiveEls=[];function r(e){!e.isGroup&&!qq(e)&&(e.incremental=n,e.ensureState(`emphasis`).hoverLayer=2)}for(var i=e.start;i0}function Jq(e){var t=e.hostModel,n=t.getModel(`emphasis`);return{lineStyle:t.getModel(`lineStyle`).getLineStyle(),emphasisLineStyle:n.getModel([`lineStyle`]).getLineStyle(),blurLineStyle:t.getModel([`blur`,`lineStyle`]).getLineStyle(),selectLineStyle:t.getModel([`select`,`lineStyle`]).getLineStyle(),emphasisDisabled:n.get(`disabled`),blurScope:n.get(`blurScope`),focus:n.get(`focus`),labelStatesModels:ZM(t)}}function Yq(e){return isNaN(e[0])||isNaN(e[1])}function Xq(e){return e&&!Yq(e[0])&&!Yq(e[1])}function Zq(e,t,n,r,i,a){e||=0;var o=ck(n[1],-n[0]);if(i!=null&&(i=$q(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),r===`all`){var s=Math.abs(ck(t[1],-t[0]));s=$q(s,[0,o]),i=a=$q(s,[i,a]),r=0}t[0]=$q(t[0],n),t[1]=$q(t[1],n);var c=Qq(t,r);t[r]+=e;var l=i||0,u=n.slice();c.sign<0?u[0]=ck(u[0],l):u[1]=ck(u[1],-l),t[r]=$q(t[r],u);var d=Qq(t,r);return i!=null&&(d.sign!==c.sign||d.spana&&(t[1-r]=ck(t[r],d.sign*a)),t}function Qq(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function $q(e,t){return Math.min(t[1]==null?1/0:t[1],Math.max(t[0]==null?-1/0:t[0],e))}var eJ=`sankey`,tJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){var n=e.edges||e.links||[],r=e.data||e.nodes||[],i=e.levels||[];this.levelModels=[];for(var a=this.levelModels,o=0;o=0&&(a[i[o].depth]=new dN(i[o],this,t));return Nq(r,n,this,!0,s).data;function s(e,t){e.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getData().getItemLayout(t);if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e}),t.wrapMethod(`getItemModel`,function(e,t){var n=e.parentModel,r=n.getGraph().getEdgeByIndex(t).node1.getLayout();if(r){var i=r.depth,a=n.levelModels[i];a&&(e.parentModel=a)}return e})}},t.prototype.setNodePosition=function(e,t){var n=(this.option.data||this.option.nodes)[e];n.localX=t[0],n.localY=t[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function r(e){return isNaN(e)||e==null}if(n===`edge`){var i=this.getDataParams(e,n),a=i.data,o=i.value;return EI(`nameValue`,{name:a.source+` -- `+a.target,value:o,noValue:r(o)})}var s=this.getGraph().getNodeByIndex(e).getLayout().value,c=this.getDataParams(e,n).data.name;return EI(`nameValue`,{name:c==null?null:c+``,value:s,noValue:r(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var r=e.prototype.getDataParams.call(this,t,n);return r.value==null&&n===`node`&&(r.value=this.getGraph().getNodeByIndex(t).getLayout().value),r},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type=`series.`+eJ,t.layoutMode=`box`,t.defaultOption={z:2,coordinateSystemUsage:`box`,left:`5%`,top:`5%`,right:`20%`,bottom:`5%`,orient:`horizontal`,nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:`global`,center:null,zoom:1,label:{show:!0,position:`right`,fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:`justify`,lineStyle:{color:Q.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:Q.color.primary}},animationEasing:`linear`,animationDuration:1e3},t}(LI),nJ=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),rJ=function(e){vS(t,e);function t(t){return e.call(this,t)||this}return t.prototype.getDefaultShape=function(){return new nJ},t.prototype.buildPath=function(e,t){var n=t.extent;e.moveTo(t.x1,t.y1),e.bezierCurveTo(t.cpx1,t.cpy1,t.cpx2,t.cpy2,t.x2,t.y2),t.orient===`vertical`?(e.lineTo(t.x2+n,t.y2),e.bezierCurveTo(t.cpx2+n,t.cpy2,t.cpx1+n,t.cpy1,t.x1+n,t.y1)):(e.lineTo(t.x2,t.y2+n),e.bezierCurveTo(t.cpx2,t.cpy2+n,t.cpx1,t.cpy1+n,t.x1,t.y1+n)),e.closePath()},t.prototype.highlight=function(){BA(this)},t.prototype.downplay=function(){VA(this)},t}(xO),iJ=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=eJ,t._mainGroup=new yj,t}return t.prototype.init=function(e,t){this._controller=new qG(t.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(e,t,n){var r=e.getGraph(),i=this._mainGroup,a=e.layoutInfo,o=a.width,s=a.height,c=e.getData(),l=e.getData(`edge`),u=e.get(`orient`);i.removeAll(),i.x=a.x,i.y=a.y,this._updateViewCoordSys(e,n),YK(e,n,this._controller,XK(i),null),r.eachEdge(function(t){var n=new rJ,r=rA(n);r.dataIndex=t.dataIndex,r.seriesIndex=e.seriesIndex,r.dataType=`edge`;var a=t.getModel(),c=a.getModel(`lineStyle`),d=c.get(`curveness`),f=t.node1.getLayout(),p=t.node1.getModel(),m=p.get(`localX`),h=p.get(`localY`),g=t.node2.getLayout(),_=t.node2.getModel(),v=_.get(`localX`),y=_.get(`localY`),b=t.getLayout(),x,S,C,w,T,E,D,O;n.shape.extent=Math.max(1,b.dy),n.shape.orient=u,u===`vertical`?(x=(m==null?f.x:m*o)+b.sy,S=(h==null?f.y:h*s)+f.dy,C=(v==null?g.x:v*o)+b.ty,w=y==null?g.y:y*s,T=x,E=S*(1-d)+w*d,D=C,O=S*d+w*(1-d)):(x=(m==null?f.x:m*o)+f.dx,S=(h==null?f.y:h*s)+b.sy,C=v==null?g.x:v*o,w=(y==null?g.y:y*s)+b.ty,T=x*(1-d)+C*d,E=S,D=x*d+C*(1-d),O=w),n.setShape({x1:x,y1:S,x2:C,y2:w,cpx1:T,cpy1:E,cpx2:D,cpy2:O}),n.useStyle(c.getItemStyle()),aJ(n.style,u,t);var k=``+a.get(`value`),A=ZM(a,`edgeLabel`);XM(n,A,{labelFetcher:{getFormattedLabel:function(t,n,r,i,a,o){return e.getFormattedLabel(t,n,`edge`,i,cC(a,A.normal&&A.normal.get(`formatter`),k),o)}},labelDataIndex:t.dataIndex,defaultText:k}),n.setTextConfig({position:`inside`});var j=a.getModel(`emphasis`);tj(n,a,`lineStyle`,function(e){var n=e.getItemStyle();return aJ(n,u,t),n}),i.add(n),l.setItemGraphicEl(t.dataIndex,n);var M=j.get(`focus`);$A(n,M===`adjacency`?t.getAdjacentDataIndices():M===`trajectory`?t.getTrajectoryDataIndices():M,j.get(`blurScope`),j.get(`disabled`))}),r.eachNode(function(t){var n=t.getLayout(),r=t.getModel(),a=r.get(`localX`),l=r.get(`localY`),u=r.getModel(`emphasis`),d=r.get([`itemStyle`,`borderRadius`])||0,f=new OO({shape:{x:a==null?n.x:a*o,y:l==null?n.y:l*s,width:n.dx,height:n.dy,r:d},style:r.getModel(`itemStyle`).getItemStyle(),z2:10});XM(f,ZM(r),{labelFetcher:{getFormattedLabel:function(t,n){return e.getFormattedLabel(t,n,`node`)}},labelDataIndex:t.dataIndex,defaultText:t.id}),f.disableLabelAnimation=!0,f.setStyle(`fill`,t.getVisual(`color`)),f.setStyle(`decal`,t.getVisual(`style`).decal),tj(f,r),i.add(f),c.setItemGraphicEl(t.dataIndex,f),rA(f).dataType=`node`;var p=u.get(`focus`);$A(f,p===`adjacency`?t.getAdjacentDataIndices():p===`trajectory`?t.getTrajectoryDataIndices():p,u.get(`blurScope`),u.get(`disabled`))}),c.eachItemGraphicEl(function(t,r){c.getItemModel(r).get(`draggable`)&&(t.drift=function(t,i){this.shape.x+=t,this.shape.y+=i,this.dirty(),n.dispatchAction({type:`dragNode`,seriesId:e.id,dataIndex:c.getRawIndex(r),localX:this.shape.x/o,localY:this.shape.y/s})},t.draggable=!0,t.cursor=`move`)}),!this._data&&e.isAnimationEnabled()&&i.setClipPath(oJ(i.getBoundingRect(),e,function(){i.removeClipPath()})),this._data=e.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(e,t,n){MK(this.group,2,t.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(e,t){var n=e.layoutInfo,r=e.coordinateSystem=eq(e,t,n.x,n.y,n.width,n.height);MK(this.group,2,r,this._firstRender?null:e)},t.type=eJ,t}(uL);function aJ(e,t,n){switch(e.fill){case`source`:e.fill=n.node1.getVisual(`color`),e.decal=n.node1.getVisual(`style`).decal;break;case`target`:e.fill=n.node2.getVisual(`color`),e.decal=n.node2.getVisual(`style`).decal;break;case`gradient`:var r=n.node1.getVisual(`color`),i=n.node2.getVisual(`color`);ZS(r)&&ZS(i)&&(e.fill=new Gj(0,0,+(t===`horizontal`),+(t===`vertical`),[{color:r,offset:0},{color:i,offset:1}]))}}function oJ(e,t,n){var r=new OO({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return rM(r,{shape:{width:e.width+20}},t,n),r}var sJ=tA(eJ,cJ);function cJ(e,t){e.eachSeriesByType(eJ,function(e){var n=e.get(`nodeWidth`),r=e.get(`nodeGap`),i=rI(e,t).refContainer,a=tI(e.getBoxLayoutParams(),i);e.layoutInfo=a;var o=a.width,s=a.height,c=e.getGraph(),l=c.nodes,u=c.edges;uJ(l),lJ(l,u,n,r,o,s,GS(l,function(e){return e.getLayout().value===0}).length===0?e.get(`layoutIterations`):0,e.get(`orient`),e.get(`nodeAlign`))})}function lJ(e,t,n,r,i,a,o,s,c){dJ(e,t,n,i,a,s,c),gJ(e,t,a,i,r,o,s),kJ(e,s)}function uJ(e){Y(e,function(e){var t=DJ(e.outEdges,EJ),n=DJ(e.inEdges,EJ),r=e.getValue()||0,i=Math.max(t,n,r);e.setLayout({value:i},!0)})}function dJ(e,t,n,r,i,a,o){for(var s=[],c=[],l=[],u=[],d=0,f=0;f=0;_&&g.depth>p&&(p=g.depth),h.setLayout({depth:_?g.depth:d},!0),a===`vertical`?h.setLayout({dy:n},!0):h.setLayout({dx:n},!0);for(var v=0;vd-1?p:d-1;o&&o!==`left`&&pJ(e,o,a,C),hJ(e,a===`vertical`?(i-n)/C:(r-n)/C,a)}function fJ(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function pJ(e,t,n,r){if(t===`right`){for(var i=[],a=e,o=0;a.length;){for(var s=0;s0;a--)c*=.99,bJ(s,c,o),yJ(s,i,n,r,o),OJ(s,c,o),yJ(s,i,n,r,o)}function _J(e,t){var n=[],r=t===`vertical`?`y`:`x`,i=gae(e,function(e){return e.getLayout()[r]});return ak(i.keys),Y(i.keys,function(e){n.push(i.buckets.get(e))}),n}function vJ(e,t,n,r,i,a){var o=1/0;Y(e,function(e){var t=e.length,s=0;Y(e,function(e){s+=e.getLayout().value});var c=a===`vertical`?(r-(t-1)*i)/s:(n-(t-1)*i)/s;c0&&(o=s.getLayout()[a]+c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0)),l=s.getLayout()[a]+s.getLayout()[d]+t;var p=i===`vertical`?r:n;if(c=l-t-p,c>0){o=s.getLayout()[a]-c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0),l=o;for(var f=u-2;f>=0;--f)s=e[f],c=s.getLayout()[a]+s.getLayout()[d]+t-l,c>0&&(o=s.getLayout()[a]-c,i===`vertical`?s.setLayout({x:o},!0):s.setLayout({y:o},!0)),l=s.getLayout()[a]}})}function bJ(e,t,n){Y(e.slice().reverse(),function(e){Y(e,function(e){if(e.outEdges.length){var r=DJ(e.outEdges,xJ,n)/DJ(e.outEdges,EJ);if(isNaN(r)){var i=e.outEdges.length;r=i?DJ(e.outEdges,SJ,n)/i:0}if(n===`vertical`){var a=e.getLayout().x+(r-TJ(e,n))*t;e.setLayout({x:a},!0)}else{var o=e.getLayout().y+(r-TJ(e,n))*t;e.setLayout({y:o},!0)}}})})}function xJ(e,t){return TJ(e.node2,t)*e.getValue()}function SJ(e,t){return TJ(e.node2,t)}function CJ(e,t){return TJ(e.node1,t)*e.getValue()}function wJ(e,t){return TJ(e.node1,t)}function TJ(e,t){return t===`vertical`?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function EJ(e){return e.getValue()}function DJ(e,t,n){for(var r=0,i=e.length,a=-1;++aa&&(a=t)}),Y(n,function(t){var n=new mq({type:`color`,mappingMethod:`linear`,dataExtent:[i,a],visual:e.get(`color`)}).mapValueToVisual(t.getLayout().value),r=t.getModel().get([`itemStyle`,`color`]);r==null?(t.setVisual(`color`,n),t.setVisual(`style`,{fill:n})):(t.setVisual(`color`,r),t.setVisual(`style`,{fill:r}))})}r.length&&Y(r,function(e){var t=e.getModel().get(`lineStyle`);e.setVisual(`style`,t)})})}function MJ(e){e.registerChartView(iJ),e.registerSeriesModel(tJ),e.registerLayout(sJ),e.registerVisual(AJ),e.registerAction({type:`dragNode`,event:`dragnode`,update:`update`},function(e,t){t.eachComponent({mainType:iA,subType:eJ,query:e},function(t){t.setNodePosition(e.dataIndex,[e.localX,e.localY])})}),QK(e,iA,eJ)}var NJ=256,PJ=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=TS.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,r,i,a){var o=this._getBrush(),s=this._getGradient(i,`inRange`),c=this._getGradient(i,`outOfRange`),l=this.pointSize+this.blurSize,u=this.canvas,d=u.getContext(`2d`),f=e.length;u.width=t,u.height=n;for(var p=0;p0){var E=a(v)?s:c;v>0&&(v=v*w+C),b[x++]=E[T],b[x++]=E[T+1],b[x++]=E[T+2],b[x++]=E[T+3]*v*256}else x+=4}return d.putImageData(y,0,0),u},e.prototype._getBrush=function(){var e=this._brushCanvas||=TS.createCanvas(),t=this.pointSize+this.blurSize,n=t*2;e.width=n,e.height=n;var r=e.getContext(`2d`);return r.clearRect(0,0,n,n),r.shadowOffsetX=n,r.shadowBlur=this.blurSize,r.shadowColor=Q.color.neutral99,r.beginPath(),r.arc(-t,t,this.pointSize,0,Math.PI*2,!0),r.closePath(),r.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,r=n[t]||(n[t]=new Uint8ClampedArray(1024)),i=[0,0,0,0],a=0,o=0;o<256;o++)e[t](o/255,!0,i),r[a++]=i[0],r[a++]=i[1],r[a++]=i[2],r[a++]=i[3];return r},e}();function FJ(e,t,n){var r=e[1]-e[0];t=US(t,function(t){return{interval:[(t.interval[0]-e[0])/r,(t.interval[1]-e[0])/r]}});var i=t.length,a=0;return function(e){for(var r=a;r=0;r--){var o=t[r].interval;if(o[0]<=e&&e<=o[1]){a=r;break}}return r>=0&&r=t[0]&&e<=t[1]}}var LJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r;t.eachComponent(`visualMap`,function(t){t.eachTargetSeries(function(n){n===e&&(r=t)})}),this._progressiveEls=null,this.group.removeAll();var i=e.coordinateSystem;i.type===`cartesian2d`||i.type===`calendar`||i.type===`matrix`?this._renderOnGridLike(e,n,0,e.getData().count()):_L(i)&&this._renderOnGeo(i,e,r,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,r){var i=t.coordinateSystem;i&&(_L(i)?this.render(t,n,r):(this._progressiveEls=[],this._renderOnGridLike(t,r,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){FM(this._progressiveEls||this.group,e)},t.prototype._renderOnGridLike=function(e,t,n,r,i){var a=e.coordinateSystem,o=gL(a,`cartesian2d`),s=gL(a,`matrix`),c,l,u,d;if(o){var f=a.getAxis(`x`),p=a.getAxis(`y`);c=Jz(f).w+.5,l=Jz(p).w+.5,u=f.scale.getExtent(),d=p.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel([`emphasis`,`itemStyle`]).getItemStyle(),_=e.getModel([`blur`,`itemStyle`]).getItemStyle(),v=e.getModel([`select`,`itemStyle`]).getItemStyle(),y=e.get([`itemStyle`,`borderRadius`]),b=ZM(e),x=e.getModel(`emphasis`),S=x.get(`focus`),C=x.get(`blurScope`),w=x.get(`disabled`),T=o||s?[h.mapDimension(`x`),h.mapDimension(`y`),h.mapDimension(`value`)]:[h.mapDimension(`time`),h.mapDimension(`value`)],E=n;Eu[1]||Ad[1])continue;var j=a.dataToPoint([k,A]);D=new OO({shape:{x:j[0]-c/2,y:j[1]-l/2,width:c,height:l},style:O})}else if(s){var M=a.dataToLayout([h.get(T[0],E),h.get(T[1],E)]).rect;if(aC(M.x))continue;D=new OO({z2:1,shape:M,style:O})}else{if(isNaN(h.get(T[1],E)))continue;var N=a.dataToLayout([h.get(T[0],E)]),M=N.contentRect||N.rect;if(aC(M.x)||aC(M.y))continue;D=new OO({z2:1,shape:M,style:O})}if(h.hasItemOption){var P=h.getItemModel(E),F=P.getModel(`emphasis`);g=F.getModel(`itemStyle`).getItemStyle(),_=P.getModel([`blur`,`itemStyle`]).getItemStyle(),v=P.getModel([`select`,`itemStyle`]).getItemStyle(),y=P.get([`itemStyle`,`borderRadius`]),S=F.get(`focus`),C=F.get(`blurScope`),w=F.get(`disabled`),b=ZM(P)}D.shape.r=y;var ee=e.getRawValue(E),I=`-`;ee&&ee[2]!=null&&(I=ee[2]+``),XM(D,b,{labelFetcher:e,labelDataIndex:E,defaultOpacity:O.opacity,defaultText:I}),D.ensureState(`emphasis`).style=g,D.ensureState(`blur`).style=_,D.ensureState(`select`).style=v,$A(D,S,C,w),D.incremental=$k(e,i),i&&(D.states.emphasis.hoverLayer=2),m.add(D),h.setItemGraphicEl(E,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(e,t,n,r){var i=n.targetVisuals.inRange,a=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new PJ;s.blurSize=t.get(`blurSize`),s.pointSize=t.get(`pointSize`),s.minOpacity=t.get(`minOpacity`),s.maxOpacity=t.get(`maxOpacity`);var c=e.getViewRect().clone(),l=e.getRoamTransform();c.applyTransform(l);var u=Math.max(c.x,0),d=Math.max(c.y,0),f=Math.min(c.width+c.x,r.getWidth()),p=Math.min(c.height+c.y,r.getHeight()),m=f-u,h=p-d,g=[o.mapDimension(`lng`),o.mapDimension(`lat`),o.mapDimension(`value`)],_=o.mapArray(g,function(t,n,r){var i=e.dataToPoint([t,n]);return i[0]-=u,i[1]-=d,i.push(r),i}),v=n.getExtent(),y=n.type===`visualMap.continuous`?IJ(v,n.option.range):FJ(v,n.getPieceList(),n.option.selected);s.update(_,m,h,i.color.getNormalizer(),{inRange:i.color.getColorMapper(),outOfRange:a.color.getColorMapper()},y);var b=new CO({style:{width:m,height:h,x:u,y:d,image:s.canvas},silent:!0});this.group.add(b)},t.type=`heatmap`,t}(uL),RJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.getInitialData=function(e,t){return kP(null,this,{generateCoord:`value`})},t.prototype.preventIncremental=function(){var e=wP.get(this.get(`coordinateSystem`));if(e&&e.dimensions)return e.dimensions[0]===`lng`&&e.dimensions[1]===`lat`},t.type=`series.heatmap`,t.dependencies=[`grid`,`geo`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:Q.color.primary}}},t}(LI);function zJ(e){e.registerChartView(LJ),e.registerSeriesModel(RJ)}var BJ={color:`fill`,borderColor:`stroke`},VJ={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},HJ=Lk(),UJ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(){this.currentZLevel=this.get(`zlevel`,!0),this.currentZ=this.get(`z`,!0)},t.prototype.getInitialData=function(e,t){return kP(null,this)},t.prototype.getDataParams=function(t,n,r){var i=e.prototype.getDataParams.call(this,t,n);return r&&(i.info=HJ(r).info),i},t.type=`series.custom`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,clip:!1},t}(LI);function WJ(e,t){return t||=[0,0],US([`x`,`y`],function(n,r){var i=this.getAxis(n),a=t[r],o=e[r]/2;return i.type===`category`?Jz(i).w:Math.abs(i.dataToCoord(a-o)-i.dataToCoord(a+o))},this)}function GJ(e){var t=e.master.getRect();return{coordSys:{type:`cartesian2d`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:JS(WJ,e)}}}function KJ(e,t){return t||=[0,0],US([0,1],function(n){var r=t[n],i=e[n]/2,a=[],o=[];return a[n]=r-i,o[n]=r+i,a[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(a)[n]-this.dataToPoint(o)[n])},this)}function qJ(e){var t=e.view,n=t.getBoundingRect();return{coordSys:{type:`geo`,x:n.x,y:n.y,width:n.width,height:n.height,zoom:sK(t)},api:{coord:function(t){return e.dataToPoint(t)},size:JS(KJ,e)}}}function JJ(e,t){var n=this.getAxis(),r=t instanceof Array?t[0]:t,i=(e instanceof Array?e[0]:e)/2;return n.type===`category`?Jz(n).w:Math.abs(n.dataToCoord(r-i)-n.dataToCoord(r+i))}function YJ(e){var t=e.getRect();return{coordSys:{type:`singleAxis`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t){return e.dataToPoint(t)},size:JS(JJ,e)}}}function XJ(e,t){return t||=[0,0],US([`Radius`,`Angle`],function(n,r){var i=`get`+n+`Axis`,a=this[i](),o=t[r],s=e[r]/2,c=a.type===`category`?Jz(a).w:Math.abs(a.dataToCoord(o-s)-a.dataToCoord(o+s));return n===`Angle`&&(c=c*Math.PI/180),c},this)}function ZJ(e){var t=e.getRadiusAxis(),n=e.getAngleAxis(),r=t.getExtent();return r[0]>r[1]&&r.reverse(),{coordSys:{type:`polar`,cx:e.cx,cy:e.cy,r:r[1],r0:r[0]},api:{coord:function(r){var i=t.dataToRadius(r[0]),a=n.dataToAngle(r[1]),o=e.coordToPoint([i,a]);return o.push(i,a*Math.PI/180),o},size:JS(XJ,e)}}}function QJ(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:`calendar`,x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}function $J(e){var t=e.getRect();return{coordSys:{type:`matrix`,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(t,n){return e.dataToPoint(t,n)},layout:function(t,n){return e.dataToLayout(t,n)}}}}var eY={position:[`x`,`y`],scale:[`scaleX`,`scaleY`],origin:[`originX`,`originY`]},tY=qS(eY);WS(yT,function(e,t){return e[t]=1,e},{}),yT.join(`, `);var nY=[``,`style`,`shape`,`extra`],rY=Lk();function iY(e,t,n,r,i){var a=e+`Animation`,o=eM(e,r,i)||{},s=rY(t).userDuring;return o.duration>0&&(o.during=s?JS(mY,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),J(o,n[a]),o}function aY(e,t,n,r){r||={};var i=r.dataIndex,a=r.isInit,o=r.clearStyle,s=n.isAnimationEnabled(),c=rY(e),l=t.style;c.userDuring=t.during;var u={},d={};if(vY(e,t,d),e.type===`compound`)for(var f=e.shape.paths,p=t.shape.paths,m=0;m0&&e.animateFrom(g,_)}else uY(e,t,i||0,n,u)}oY(e,t),l?e.dirty():e.markRedraw()}function oY(e,t){for(var n=rY(e).leaveToProps,r=0;r0&&e.animateFrom(i,a)}}function dY(e,t){Z(t,`silent`)&&(e.silent=t.silent),Z(t,`ignore`)&&(e.ignore=t.ignore),e instanceof jD&&Z(t,`invisible`)&&(e.invisible=t.invisible),e instanceof xO&&Z(t,`autoBatch`)&&(e.autoBatch=t.autoBatch)}var fY={},pY={setTransform:function(e,t){return fY.el[e]=t,this},getTransform:function(e){return fY.el[e]},setShape:function(e,t){var n=fY.el,r=n.shape||={};return r[e]=t,n.dirtyShape&&n.dirtyShape(),this},getShape:function(e){var t=fY.el.shape;if(t)return t[e]},setStyle:function(e,t){var n=fY.el,r=n.style;return r&&(r[e]=t,n.dirtyStyle&&n.dirtyStyle()),this},getStyle:function(e){var t=fY.el.style;if(t)return t[e]},setExtra:function(e,t){var n=fY.el.extra||(fY.el.extra={});return n[e]=t,this},getExtra:function(e){var t=fY.el.extra;if(t)return t[e]}};function mY(){var e=this,t=e.el;if(t){var n=rY(t).userDuring,r=e.userDuring;n===r?(fY.el=t,r(pY)):e.el=e.userDuring=null}}function hY(e,t,n,r){var i=n[e];if(i){var a=t[e],o;if(a){var s=n.transition,c=i.transition;if(c){if(!o&&(o=r[e]={}),cY(c))J(o,a);else for(var l=Dk(c),u=0;u=0){!o&&(o=r[e]={});for(var p=qS(a),u=0;u=0)){var f=e.getAnimationStyleProps(),p=f?f.style:null;if(p){!a&&(a=r.style={});for(var m=qS(n),l=0;l=0?t.getStore().get(i,n):void 0}var a=t.get(r.name,n),o=r&&r.ordinalMeta;return o?o.categories[a]:a}function C(n,r){r??=u;var i=t.getItemVisual(r,`style`),a=i&&i.fill,o=i&&i.opacity,s=y(r,EY).getItemStyle();a!=null&&(s.fill=a),o!=null&&(s.opacity=o);var c={inheritColor:ZS(a)?a:Q.color.neutral99},l=b(r,EY),d=QM(l,null,c,!1,!0);d.text=l.getShallow(`show`)?sC(e.getFormattedLabel(r,EY),GI(t,r)):null;var f=$M(l,c,!1);return E(n,s),s=yL(s,d,f),n&&T(s,n),s.legacy=!0,s}function w(n,r){r??=u;var i=y(r,TY).getItemStyle(),a=b(r,TY),o=QM(a,null,null,!0,!0);o.text=a.getShallow(`show`)?cC(e.getFormattedLabel(r,TY),e.getFormattedLabel(r,EY),GI(t,r)):null;var s=$M(a,null,!0);return E(n,i),i=yL(i,o,s),n&&T(i,n),i.legacy=!0,i}function T(e,t){for(var n in t)Z(t,n)&&(e[n]=t[n])}function E(e,t){e&&(e.textFill&&(t.textFill=e.textFill),e.textPosition&&(t.textPosition=e.textPosition))}function D(e,n){if(n??=u,Z(BJ,e)){var r=t.getItemVisual(n,`style`);return r?r[BJ[e]]:null}if(Z(VJ,e))return t.getItemVisual(n,e)}function O(e){if(o.type===`cartesian2d`)return xle(zS({axis:o.getBaseAxis()},e))}function k(){return n.getCurrentSeriesIndices()}function A(e){return iN(e,n)}}function KY(e){var t={};return Y(e.dimensions,function(n){var r=e.getDimensionInfo(n);if(!r.isExtraCoord){var i=r.coordDim,a=t[i]=t[i]||[];a[r.coordDimIndex]=e.getDimensionIndex(n)}}),t}function qY(e,t,n,r,i,a,o){if(!r)a.remove(t);else{var s=JY(e,t,n,r,i,a);return s&&o.setItemGraphicEl(n,s),s&&$A(s,r.focus,r.blurScope,r.emphasisDisabled),s}}function JY(e,t,n,r,i,a){var o=-1,s=t;t&&YY(t,r,i)&&(o=BS(a.childrenRef(),t),t=null);var c=!t,l=t;l?l.clearStates():(l=BY(r),s&&RY(s,l)),r.morph===!1?l.disableMorphing=!0:l.disableMorphing&&(l.disableMorphing=!1),r.tooltipDisabled&&(l.tooltipDisabled=!0),PY.normal.cfg=PY.normal.conOpt=PY.emphasis.cfg=PY.emphasis.conOpt=PY.blur.cfg=PY.blur.conOpt=PY.select.cfg=PY.select.conOpt=null,PY.isLegacy=!1,ZY(l,n,r,i,c,PY),XY(l,n,r,i,c),VY(e,l,n,r,PY,i,c),Z(r,`info`)&&(HJ(l).info=r.info);for(var u=0;u=0?a.replaceAt(l,o):a.add(l),l}function YY(e,t,n){var r=HJ(e),i=t.type,a=t.shape,o=t.style;return n.isUniversalTransitionEnabled()||i!=null&&i!==r.customGraphicType||i===`path`&&cX(a)&&sX(a)!==r.customPathData||i===`image`&&Z(o,`image`)&&o.image!==r.customImagePath}function XY(e,t,n,r,i){var a=n.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&YY(o,a,r)&&(o=null),o||(o=BY(a),e.setClipPath(o)),VY(null,o,t,a,null,r,i)}}function ZY(e,t,n,r,i,a){if(!(e.isGroup||e.type===`compoundPath`)){QY(n,null,a),QY(n,TY,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,c=a.blur.conOpt,l=a.select.conOpt;if(o!=null||s!=null||l!=null||c!=null){var u=e.getTextContent();if(o===!1)u&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:`text`},u?u.clearStates():(u=BY(o),e.setTextContent(u)),VY(null,u,t,o,null,r,i);for(var d=o&&o.style,f=0;f=u;p--)nX(t,t.childAt(p),i)}}}function nX(e,t,n){t&&sY(t,HJ(e).option,n)}function rX(e){new mN(e.oldChildren,e.newChildren,iX,iX,e).add(aX).update(aX).remove(oX).execute()}function iX(e,t){return(e&&e.name)??NY+t}function aX(e,t){var n=this.context,r=e==null?null:n.newChildren[e],i=t==null?null:n.oldChildren[t];JY(n.api,i,n.dataIndex,r,n.seriesModel,n.group)}function oX(e){var t=this.context,n=t.oldChildren[e];n&&sY(n,HJ(n).option,t.seriesModel)}function sX(e){return e&&(e.pathData||e.d)}function cX(e){return e&&(Z(e,`pathData`)||Z(e,`d`))}function lX(e){e.registerChartView(zY),e.registerSeriesModel(UJ)}var uX=Lk(),dX=LS,fX=JS,pX=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,r){var i=t.get(`value`),a=t.get(`status`);if(this._axisModel=e,this._axisPointerModel=t,this._api=n,r||this._lastValue!==i||this._lastStatus!==a){this._lastValue=i,this._lastStatus=a;var o=this._group,s=this._handle;if(!a||a===`hide`)o&&o.hide(),s&&s.hide();else{o&&o.show(),s&&s.show();var c={};this.makeElOption(c,i,e,t,n);var l=c.graphicKey;l!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=l;var u=this._moveAnimation=this.determineAnimation(e,t);if(!o)o=this._group=new yj,this.createPointerEl(o,c,e,t),this.createLabelEl(o,c,e,t),n.getZr().add(o);else{var d=YS(mX,t,u);this.updatePointerEl(o,c,d),this.updateLabelEl(o,c,d,t)}vX(o,t,!0),this._renderHandle(i)}}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get(`animation`),r=e.axis,i=r.type===`category`,a=t.get(`snap`);if(!a&&!i)return!1;if(n===`auto`||n==null){var o=this.animationThreshold;if(i&&Jz(r).w>o)return!0;if(a){var s=EG(e).seriesDataCount,c=r.getExtent();return Math.abs(c[0]-c[1])/s>o}return!1}return n===!0},e.prototype.makeElOption=function(e,t,n,r,i){},e.prototype.createPointerEl=function(e,t,n,r){var i=t.pointer;if(i){var a=uX(e).pointerEl=new _oe[i.type](dX(t.pointer));e.add(a)}},e.prototype.createLabelEl=function(e,t,n,r){if(t.label){var i=uX(e).labelEl=new MO(dX(t.label));e.add(i),gX(i,r)}},e.prototype.updatePointerEl=function(e,t,n){var r=uX(e).pointerEl;r&&t.pointer&&(r.setStyle(t.pointer.style),n(r,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,r){var i=uX(e).labelEl;i&&(i.setStyle(t.label.style),n(i,{x:t.label.x,y:t.label.y}),gX(i,r))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t=this._axisPointerModel,n=this._api.getZr(),r=this._handle,i=t.getModel(`handle`),a=t.get(`status`);if(!i.get(`show`)||!a||a===`hide`)r&&n.remove(r),this._handle=null;else{var o;this._handle||(o=!0,r=this._handle=DM(i.get(`icon`),{cursor:`move`,draggable:!0,onmousemove:function(e){OV(e.event)},onmousedown:fX(this._onHandleDragMove,this,0,0),drift:fX(this._onHandleDragMove,this),ondragend:fX(this._onHandleDragEnd,this)}),n.add(r)),vX(r,t,!1),r.setStyle(i.getItemStyle(null,[`color`,`borderColor`,`borderWidth`,`opacity`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`]));var s=i.get(`size`);X(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,nV(this,`_doDispatchAxisPointer`,i.get(`throttle`)||0,`fixRate`),this._moveHandleToValue(e,o)}}},e.prototype._moveHandleToValue=function(e,t){mX(this._axisPointerModel,!t&&this._moveAnimation,this._handle,_X(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var r=this.updateHandleTransform(_X(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=r,n.stopAnimation(),n.attr(_X(r)),uX(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:`updateAxisPointer`,x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get(`value`);this._moveHandleToValue(e),this._api.dispatchAction({type:`hideTip`})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,r=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),r&&t.remove(r),this._group=null,this._handle=null,this._payloadInfo=null),rV(this,`_doDispatchAxisPointer`)},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}},e}();function mX(e,t,n,r){hX(uX(n).lastProp,r)||(uX(n).lastProp=r,t?nM(n,r,e):(n.stopAnimation(),n.attr(r)))}function hX(e,t){if(eC(e)&&eC(t)){var n=!0;return Y(t,function(t,r){n&&=hX(e[r],t)}),!!n}return e===t}function gX(e,t){e[t.get([`label`,`show`])?`show`:`hide`]()}function _X(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function vX(e,t,n){var r=t.get(`z`),i=t.get(`zlevel`);e&&e.traverse(function(e){e.type!==`group`&&(r!=null&&(e.z=r),i!=null&&(e.zlevel=i),e.silent=n)})}function yX(e){var t=e.get(`type`),n=e.getModel(t+`Style`),r;return t===`line`?(r=n.getLineStyle(),r.fill=null):t===`shadow`&&(r=n.getAreaStyle(),r.stroke=null),r}function bX(e,t,n,r,i){var a=SX(n.get(`value`),t.axis,t.ecModel,n.get(`seriesDataIndices`),{precision:n.get([`label`,`precision`]),formatter:n.get([`label`,`formatter`])}),o=n.getModel(`label`),s=GF(o.get(`padding`)||0),c=o.getFont(),l=Gw(a,c),u=i.position,d=l.width+s[1]+s[3],f=l.height+s[0]+s[2],p=i.align;p===`right`&&(u[0]-=d),p===`center`&&(u[0]-=d/2);var m=i.verticalAlign;m===`bottom`&&(u[1]-=f),m===`middle`&&(u[1]-=f/2),xX(u,d,f,r);var h=o.get(`backgroundColor`);h&&h!==`auto`||(h=t.get([`axisLine`,`lineStyle`,`color`])),e.label={x:u[0],y:u[1],style:QM(o,{text:a,font:c,fill:o.getTextColor(),padding:s,backgroundColor:h}),z2:10}}function xX(e,t,n,r){var i=r.getWidth(),a=r.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+n,a)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function SX(e,t,n,r,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:xR(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Y(r,function(e){var t=n.getSeriesByIndex(e.seriesIndex),r=e.dataIndexInside,i=t&&t.getDataParams(r);i&&s.seriesData.push(i)}),ZS(o)?a=o.replace(`{value}`,a):XS(o)&&(a=o(s))}return a}function CX(e,t,n){var r=QC();return rw(r,r,n.rotation),nw(r,r,n.position),SM([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],r)}function wX(e,t,n,r,i,a){var o=CB.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=i.get([`label`,`margin`]),bX(t,r,i,a,{position:CX(r.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function TX(e,t,n){return n||=0,{x1:e[n],y1:e[1-n],x2:t[n],y2:t[1-n]}}function EX(e,t,n){return n||=0,{x:e[n],y:e[1-n],width:t[n],height:t[1-n]}}function DX(e,t,n){return Jz(e,{fromStat:{sers:US(t,function(e){return n.getSeriesByIndex(e.seriesIndex)})},min:1}).w}function OX(e,t,n){return[KO(GO(t[0],t[1]),e-n/2),GO(e+n/2,KO(t[0],t[1]))]}var kX=function(e){vS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(e,t,n,r,i){var a=n.axis,o=a.grid,s=r.get(`type`),c=a.getGlobalExtent(),l=AX(o,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(t,!0));if(s&&s!==`none`){var d=yX(r),f=jX[s](a,u,c,l,r.get(`seriesDataIndices`),r.ecModel);f.style=d,e.graphicKey=f.type,e.pointer=f}wX(t,e,MB(o.getRect(),n),n,r,i)},t.prototype.getHandleTransform=function(e,t,n){var r=MB(t.axis.grid.getRect(),t,{labelInside:!1});r.labelMargin=n.get([`handle`,`margin`]);var i=CX(t.axis,e,r);return{x:i[0],y:i[1],rotation:r.rotation+(r.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,r){var i=n.axis,a=i.grid,o=i.getGlobalExtent(!0),s=AX(a,i).getOtherAxis(i).getGlobalExtent(),c=i.dim===`x`?0:1,l=[e.x,e.y];l[c]+=t[c],l[c]=GO(o[1],l[c]),l[c]=KO(o[0],l[c]);var u=(s[1]+s[0])/2,d=[u,u];return d[c]=l[c],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:`middle`},{align:`center`}][c]}},t}(pX);function AX(e,t){var n={};return n[t.dim+`AxisIndex`]=t.index,e.getCartesian(n)}var jX={line:function(e,t,n,r){return{type:`Line`,subPixelOptimize:!0,shape:TX([t,r[0]],[t,r[1]],MX(e))}},shadow:function(e,t,n,r,i,a){var o=DX(e,i,a),s=r[1]-r[0],c=OX(t,n,o),l=c[0],u=c[1];return{type:`Rect`,shape:EX([l,r[0]],[u-l,s],MX(e))}}};function MX(e){return e.dim===`x`?0:1}var NX=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`axisPointer`,t.defaultOption={show:`auto`,z:50,type:`line`,snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:Q.color.border,width:1,type:`dashed`},shadowStyle:{color:Q.color.shadowTint},label:{show:!0,formatter:null,precision:`auto`,margin:3,color:Q.color.neutral00,padding:[5,7,5,7],backgroundColor:Q.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:`M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z`,size:45,margin:50,color:Q.color.accent40,throttle:40}},t}(sI),PX=Lk(),FX=Y;function IX(e,t,n){if(!CC.node){var r=t.getZr();PX(r).records||(PX(r).records={}),LX(r,t);var i=PX(r).records[e]||(PX(r).records[e]={});i.handler=n}}function LX(e,t){if(PX(e).initialized)return;PX(e).initialized=!0,n(`click`,YS(BX,`click`)),n(`mousemove`,YS(BX,`mousemove`)),n(`mousewheel`,YS(BX,`mousewheel`)),n(`globalout`,zX);function n(n,r){e.on(n,function(n){var i=VX(t);FX(PX(e).records,function(e){e&&r(e,n,i.dispatchAction)}),RX(i.pendings,t)})}}function RX(e,t){var n=e.showTip.length,r=e.hideTip.length,i;n?i=e.showTip[n-1]:r&&(i=e.hideTip[r-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function zX(e,t,n){e.handler(`leave`,null,n)}function BX(e,t,n,r){t.handler(e,n,r)}function VX(e){var t={showTip:[],hideTip:[]},n=function(r){var i=t[r.type];i?i.push(r):(r.dispatchAction=n,e.dispatchAction(r))};return{dispatchAction:n,pendings:t}}function HX(e,t){if(!CC.node){var n=t.getZr();(PX(n).records||{})[e]&&(PX(n).records[e]=null)}}var UX=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.render=function(e,t,n){var r=t.getComponent(`tooltip`),i=e.get(`triggerOn`)||r&&r.get(`triggerOn`)||`mousemove|click|mousewheel`;IX(`axisPointer`,n,function(e,t,n){i!==`none`&&(e===`leave`||i.indexOf(e)>=0)&&n({type:`updateAxisPointer`,currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){HX(`axisPointer`,t)},t.prototype.dispose=function(e,t){HX(`axisPointer`,t)},t.type=`axisPointer`,t}(VH);function WX(e,t){var n=[],r=e.seriesIndex,i;if(r==null||!(i=t.getSeriesByIndex(r)))return{point:[]};var a=i.getData(),o=Ik(a,e);if(o==null||o<0||X(o))return{point:[]};var s=a.getItemGraphicEl(o),c=i.coordinateSystem;if(i.getTooltipPosition)n=i.getTooltipPosition(o)||[];else if(c&&c.dataToPoint){if(e.isStacked){var l=c.getBaseAxis(),u=c.getOtherAxis(l).dim,d=l.dim,f=+(u===`x`||u===`radius`),p=a.mapDimension(d),m=[];m[f]=a.get(p,o),m[1-f]=a.get(a.getCalculationInfo(`stackResultDimension`),o),n=c.dataToPoint(m)||[]}else n=c.dataToPoint(a.getValues(US(c.dimensions,function(e){return a.mapDimension(e)}),o))||[]}else if(s){var h=s.getBoundingRect().clone();h.applyTransform(s.transform),n=[h.x+h.width/2,h.y+h.height/2]}return{point:n,el:s}}var GX=Lk();function KX(e,t,n){var r=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||JS(n.dispatchAction,n),s=t.getComponent(`axisPointer`).coordSysAxesInfo;if(s){nZ(i)&&(i=WX({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var c=nZ(i),l=a.axesInfo,u=s.axesInfo,d=r===`leave`||nZ(i),f={},p={},m={list:[],map:{}},h={showPointer:YS(YX,p),showTooltip:YS(XX,m)};Y(s.coordSysMap,function(e,t){var n=c||e.containPoint(i);Y(s.coordSysAxesInfo[t],function(e,t){var r=e.axis,a=eZ(l,e);if(!d&&n&&(!l||a)){var o=a&&a.value;o==null&&!c&&(o=r.pointToData(i)),o!=null&&qX(e,o,h,!1,f)}})});var g={};return Y(u,function(e,t){var n=e.linkGroup;n&&!p[t]&&Y(n.axesInfo,function(t,r){var i=p[r];if(t!==e&&i){var a=i.value;n.mapper&&(a=e.axis.scale.parse(n.mapper(a,tZ(t),tZ(e)))),g[e.key]=a}})}),Y(g,function(e,t){qX(u[t],e,h,!0,f)}),ZX(p,u,f),QX(m,i,e,o),$X(u,o,n),f}}function qX(e,t,n,r,i){var a=e.axis;if(!a.scale.isBlank()&&a.containData(t)){if(!e.involveSeries)n.showPointer(e,t);else{var o=JX(t,e),s=o.payloadBatch,c=o.snapToValue;s[0]&&i.seriesIndex==null&&J(i,s[0]),!r&&e.snap&&a.containData(c)&&c!=null&&(t=c),n.showPointer(e,t,s),n.showTooltip(e,o,c)}}}function JX(e,t){var n=t.axis,r=n.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return Y(t.seriesModels,function(t,c){var l=t.getData().mapDimensionsAll(r),u,d;if(t.getAxisTooltipData){var f=t.getAxisTooltipData(l,e,n);d=f.dataIndices,u=f.nestestValue}else{if(d=t.indicesOfNearest(r,l[0],e,n.type===`category`?.5:null),!d.length)return;u=t.getData().get(l[0],d[0])}if(xk(u)){var p=e-u,m=Math.abs(p);m<=o&&((m=0&&s<0)&&(o=m,s=p,i=u,a.length=0),Y(d,function(e){a.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:a,snapToValue:i}}function YX(e,t,n,r){e[t.key]={value:n,payloadBatch:r}}function XX(e,t,n,r){var i=n.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(t.triggerTooltip&&i.length){var c=t.coordSys.model,l=kG(c),u=e.map[l];u||(u=e.map[l]={coordSysId:c.id,coordSysIndex:c.componentIndex,coordSysType:c.type,coordSysMainType:c.mainType,dataByAxis:[]},e.list.push(u)),u.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:r,valueLabelOpt:{precision:s.get([`label`,`precision`]),formatter:s.get([`label`,`formatter`])},seriesDataIndices:i.slice()})}}function ZX(e,t,n){var r=n.axesInfo=[];Y(t,function(t,n){var i=t.axisPointerModel.option,a=e[n];a?(!t.useHandle&&(i.status=`show`),i.value=a.value,i.seriesDataIndices=(a.payloadBatch||[]).slice()):!t.useHandle&&(i.status=`hide`),i.status===`show`&&r.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:i.value})})}function QX(e,t,n,r){if(nZ(t)||!e.list.length)r({type:`hideTip`});else{var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};r({type:`showTip`,escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}}function $X(e,t,n){var r=n.getZr(),i=`axisPointerLastHighlights`,a=GX(r)[i]||{},o=GX(r)[i]={};Y(e,function(e,t){var n=e.axisPointerModel.option;n.status===`show`&&e.triggerEmphasis&&Y(n.seriesDataIndices,function(e){o[e.seriesIndex+`|`+e.dataIndex]=e})});var s=[],c=[];function l(e){return{seriesIndex:e.seriesIndex,dataIndex:e.dataIndex}}Y(a,function(e,t){!o[t]&&c.push(l(e))}),Y(o,function(e,t){!a[t]&&s.push(l(e))}),c.length&&n.dispatchAction({type:`downplay`,escapeConnect:!0,notBlur:!0,batch:c}),s.length&&n.dispatchAction({type:`highlight`,escapeConnect:!0,notBlur:!0,batch:s})}function eZ(e,t){for(var n=0;n<(e||[]).length;n++){var r=e[n];if(t.axis.dim===r.axisDim&&t.axis.model.componentIndex===r.axisIndex)return r}}function tZ(e){var t=e.axis.model,n={},r=n.axisDim=e.axis.dim;return n.axisIndex=n[r+`AxisIndex`]=t.componentIndex,n.axisName=n[r+`AxisName`]=t.name,n.axisId=n[r+`AxisId`]=t.id,n}function nZ(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function rZ(e){jG.registerAxisPointerClass(`CartesianAxisPointer`,kX),e.registerComponentModel(NX),e.registerComponentView(UX),e.registerPreprocessor(function(e){if(e){e.axisPointer&&e.axisPointer.length!==0||(e.axisPointer={});var t=e.axisPointer.link;t&&!X(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(e,t){e.getComponent(`axisPointer`).coordSysAxesInfo=yG(e,t)}}),e.registerAction({type:`updateAxisPointer`,event:`updateAxisPointer`,update:`:updateAxisPointer`},KX)}function iZ(e){ZW(HG),ZW(rZ)}var aZ=[`x`,`y`,`radius`,`angle`,`single`],oZ=Lk(),sZ=[`cartesian2d`,`polar`,`singleAxis`];function cZ(e){return BS(sZ,e.get(`coordinateSystem`))>=0}function lZ(e){return e+`Axis`}function uZ(e,t){var n=_C(),r=[],i=_C();e.eachComponent({mainType:`dataZoom`,query:t},function(e){i.get(e.uid)||s(e)});var a;do a=!1,e.eachComponent(`dataZoom`,o);while(a);function o(e){!i.get(e.uid)&&c(e)&&(s(e),a=!0)}function s(e){i.set(e.uid,!0),r.push(e),l(e)}function c(e){var t=!1;return e.eachTargetAxis(function(e,r){var i=n.get(e);i&&i[r]&&(t=!0)}),t}function l(e){e.eachTargetAxis(function(e,t){(n.get(e)||n.set(e,[]))[t]=!0})}return r}function dZ(e){var t=e.ecModel,n={infoList:[],infoMap:_C()};return e.eachTargetAxis(function(e,r){var i=t.getComponent(lZ(e),r);if(i){var a=i.getCoordSysModel();if(a){var o=a.uid,s=n.infoMap.get(o);s||(s={model:a,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(i)}}}),n}function fZ(e){var t=oZ(Tz(e));return t.axisProxyMap||=_C()}function pZ(e){if(e)return fZ(e.ecModel).get(e.uid)}function mZ(e,t){fZ(e.ecModel).set(e.uid,t)}function hZ(e,t){var n=t.getAxisModel().axis.__alignTo;return n&&e.getAxisProxy(n.dim,n.model.componentIndex)?pZ(n.model):null}var gZ=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),_Z=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=[`percent`,`percent`],n}return t.prototype.init=function(e,t,n){var r=vZ(e);this.settledOption=r,this.mergeDefaultAndTheme(e,n),this._doInit(r)},t.prototype.mergeOption=function(e){var t=vZ(e);RS(this.option,e,!0),RS(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;Y([[`start`,`startValue`],[`end`,`endValue`]],function(e,r){this._rangePropMode[r]===`value`&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get(`orient`,!0),t=this._targetAxisInfoMap=_C();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||`horizontal`,this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return Y(aZ,function(n){var r=this.getReferringComponents(lZ(n),pae);if(r.specified){t=!0;var i=new gZ;Y(r.models,function(e){i.add(e.componentIndex)}),e.set(n,i)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,r=!0;if(r){var i=t===`vertical`?`y`:`x`,a=n.findComponents({mainType:i+`Axis`});o(a,i)}if(r){var a=n.findComponents({mainType:`singleAxis`,filter:function(e){return e.get(`orient`,!0)===t}});o(a,`single`)}function o(t,n){var i=t[0];if(i){var a=new gZ;if(a.add(i.componentIndex),e.set(n,a),r=!1,n===`x`||n===`y`){var o=i.getReferringComponents(`grid`,Bk).models[0];o&&Y(t,function(e){i.componentIndex!==e.componentIndex&&o===e.getReferringComponents(`grid`,Bk).models[0]&&a.add(e.componentIndex)})}}}r&&Y(aZ,function(t){if(r){var i=n.findComponents({mainType:lZ(t),filter:function(e){return e.get(`type`,!0)===`category`}});if(i[0]){var a=new gZ;a.add(i[0].componentIndex),e.set(t,a),r=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),e===`y`?`vertical`:`horizontal`},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty(`throttle`)&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get(`rangeMode`);Y([[`start`,`startValue`],[`end`,`endValue`]],function(r,i){var a=e[r[0]]!=null,o=e[r[1]]!=null;a&&!o?t[i]=`percent`:!a&&o?t[i]=`value`:n?t[i]=n[i]:a&&(t[i]=`percent`)})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){e??=this.ecModel.getComponent(lZ(t),n)},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,r){Y(n.indexList,function(n){e.call(t,r,n)})})},t.prototype.getAxisProxy=function(e,t){return pZ(this.getAxisModel(e,t))},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(lZ(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Y([[`start`,`startValue`],[`end`,`endValue`]],function(r){(e[r[0]]!=null||e[r[1]]!=null)&&(t[r[0]]=n[r[0]]=e[r[0]],t[r[1]]=n[r[1]]=e[r[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;Y([`start`,`startValue`,`end`,`endValue`],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getWindow().percent},t.prototype.getValueRange=function(e,t){if(e==null&&t==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getWindow().value}else return this.getAxisProxy(e,t).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return pZ(e);for(var t,n=this._targetAxisInfoMap.keys(),r=0;ra[1];if(u&&!d&&!f)return!0;u&&(i=!0),d&&(t=!0),f&&(n=!0)}return i&&t&&n})}else Y(r,function(n){if(i===`empty`)e.setData(t=t.map(n,function(e){return o(e)?e:NaN}));else{var r={};r[n]=a,t.selectRange(r)}});Y(r,function(e){t.setApproximateExtent(a,e)})}});function o(e){return e>=a[0]&&e<=a[1]}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._extent;Y([`min`,`max`],function(r){var i=t.get(r+`Span`),a=t.get(r+`ValueSpan`);a!=null&&(a=this.getAxisModel().axis.scale.parse(a)),a==null?i!=null&&(a=ek(i,[0,100],n,!0)-n[0]):i=ek(n[0]+a,n,[0,100],!0),e[r+`Span`]=i,e[r+`ValueSpan`]=a},this)},e}(),xZ={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(t){e.eachComponent(`dataZoom`,function(n){n.eachTargetAxis(function(r,i){t(r,i,e.getComponent(lZ(r),i),n)})})}var n=[];t(function(t,r,i,a){if(!pZ(i)){var o=new bZ(t,r,a,e);n.push(o),mZ(i,o)}});var r=_C();return Y(n,function(e){Y(e.getTargetSeriesModels(),function(e){r.set(e.uid,e)})}),r},overallReset:function(e,t){e.eachComponent(`dataZoom`,function(e){var n=[];e.eachTargetAxis(function(t,r){var i=e.getAxisProxy(t,r),a=hZ(e,i);a?n.push([i,a]):i.reset(e,null)}),Y(n,function(t){t[0].reset(e,t[1].getWindow().percentInverted)}),e.eachTargetAxis(function(n,r){e.getAxisProxy(n,r).filterData(e,t)})}),e.eachComponent(`dataZoom`,function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getWindow(),r=n.percent,i=n.value;e.setCalculatedRange({start:r[0],end:r[1],startValue:i[0],endValue:i[1]})}})}};function SZ(e){e.registerAction(`dataZoom`,function(e,t){Y(uZ(t,e),function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var CZ=Zk();function wZ(e){CZ(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,xZ),SZ(e),e.registerSubTypeDefaulter(`dataZoom`,function(){return`slider`})})}function TZ(e,t){var n=GF(t.get(`padding`)),r=t.getItemStyle([`color`,`opacity`]);return r.fill=t.get(`backgroundColor`),new OO({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get(`borderRadius`)},style:r,silent:!0,z2:-1})}var EZ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`tooltip`,t.dependencies=[`axisPointer`],t.defaultOption={z:60,show:!0,showContent:!0,trigger:`item`,triggerOn:`mousemove|click|mousewheel`,alwaysShowContent:!1,renderMode:`auto`,confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:Q.color.neutral00,shadowBlur:10,shadowColor:`rgba(0, 0, 0, .2)`,shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:Q.color.border,padding:null,extraCssText:``,axisPointer:{type:`line`,axis:`auto`,animation:`auto`,animationDurationUpdate:200,animationEasingUpdate:`exponentialOut`,crossStyle:{color:Q.color.borderShade,width:1,type:`dashed`,textStyle:{}}},textStyle:{color:Q.color.tertiary,fontSize:14}},t}(sI);function DZ(e){var t=e.get(`confine`);return t==null?e.get(`renderMode`)===`richText`:!!t}function OZ(e){if(CC.domSupported){for(var t=document.documentElement.style,n=0,r=e.length;n-1?(s+=`top:50%`,c+=`translateY(-50%) rotate(`+(l=a===`left`?-225:-45)+`deg)`):(s+=`left:50%`,c+=`translateX(-50%) rotate(`+(l=a===`top`?225:45)+`deg)`);var u=l*Math.PI/180,d=o+i,f=d*Math.abs(Math.cos(u))+d*Math.abs(Math.sin(u)),p=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-d)/2)*100)/100;s+=`;`+a+`:-`+p+`px`;var m=t+` solid `+i+`px;`;return`
`}function bfe(e,t,n){var r=`cubic-bezier(0.23,1,0.32,1)`,i=``,a=``;return n&&(i=` `+e/2+`s `+r,a=`opacity`+i+`,visibility`+i),t||(i=` `+e+`s `+r,a+=(a.length?`,`:``)+(CC.transformSupported?``+PZ+i:`,left`+i+`,top`+i)),NZ+`:`+a}function LZ(e,t,n){var r=e.toFixed(0)+`px`,i=t.toFixed(0)+`px`;if(!CC.transformSupported)return n?`top:`+i+`;left:`+r+`;`:[[`top`,i],[`left`,r]];var a=CC.transform3dSupported,o=`translate`+(a?`3d`:``)+`(`+r+`,`+i+(a?`,0`:``)+`)`;return n?`top:0;left:0;`+PZ+`:`+o+`;`:[[`top`,0],[`left`,0],[kZ,o]]}function xfe(e){var t=[],n=e.get(`fontSize`),r=e.getTextColor();r&&t.push(`color:`+r),t.push(`font:`+e.getFont());var i=sC(e.get(`lineHeight`),Math.round(n*3/2));n&&t.push(`line-height:`+i+`px`);var a=e.get(`textShadowColor`),o=e.get(`textShadowBlur`)||0,s=e.get(`textShadowOffsetX`)||0,c=e.get(`textShadowOffsetY`)||0;return a&&o&&t.push(`text-shadow:`+s+`px `+c+`px `+o+`px `+a),Y([`decoration`,`align`],function(n){var r=e.get(n);r&&t.push(`text-`+n+`:`+r)}),t.join(`;`)}function Sfe(e,t,n,r){var i=[],a=e.get(`transitionDuration`),o=e.get(`backgroundColor`),s=e.get(`shadowBlur`),c=e.get(`shadowColor`),l=e.get(`shadowOffsetX`),u=e.get(`shadowOffsetY`),d=e.getModel(`textStyle`),f=NI(e,`html`),p=l+`px `+u+`px `+s+`px `+c;return i.push(`box-shadow:`+p),t&&a>0&&i.push(bfe(a,n,r)),o&&i.push(`background-color:`+o),Y([`width`,`color`,`radius`],function(t){var n=`border-`+t,r=WF(n),a=e.get(r);a!=null&&i.push(n+`:`+a+(t===`color`?``:`px`))}),i.push(xfe(d)),f!=null&&i.push(`padding:`+GF(f).join(`px `)+`px`),i.join(`;`)+`;`}function RZ(e,t,n,r,i){var a=t&&t.painter;if(n){var o=a&&a.getViewportRoot();o&&RP(e,o,n,r,i)}else{e[0]=r,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var Cfe=function(){function e(e,t){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,CC.wxa)return null;var n=document.createElement(`div`);n.domBelongToZr=!0,this.el=n;var r=this._zr=e.getZr(),i=t.appendTo,a=i&&(ZS(i)?document.querySelector(i):rC(i)?i:XS(i)&&i(e.getDom()));RZ(this._styleCoord,r,a,e.getWidth()/2,e.getHeight()/2),(a||e.getDom()).appendChild(n),this._api=e,this._container=a;var o=this;n.onmouseenter=function(){o._enterable&&(clearTimeout(o._hideTimeout),o._show=!0),o._inContent=!0},n.onmousemove=function(e){if(e||=window.event,!o._enterable){var t=r.handler;DV(r.painter.getViewportRoot(),e,!0),t.dispatch(`mousemove`,e)}},n.onmouseleave=function(){o._inContent=!1,o._enterable&&o._show&&o.hideLater(o._hideDelay)}}return e.prototype.update=function(e){if(!this._container){var t=this._api.getDom(),n=MZ(t,`position`),r=t.style;r.position!==`absolute`&&n!==`absolute`&&(r.position=`relative`)}var i=e.get(`alwaysShowContent`);i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=e.get(`displayTransition`)&&e.get(`transitionDuration`)>0,this.el.className=e.get(`className`)||``},e.prototype.show=function(e,t){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,r=n.style,i=this._styleCoord;n.innerHTML?r.cssText=FZ+Sfe(e,!this._firstShow,this._longHide,this._enableDisplayTransition)+LZ(i[0],i[1],!0)+(`border-color:`+XF(t)+`;`)+(e.get(`extraCssText`)||``)+(`;pointer-events:`+(this._enterable?`auto`:`none`)):r.display=`none`,this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(e,t,n,r,i){var a=this.el;if(e==null)a.innerHTML=``;else{var o=``;if(ZS(i)&&n.get(`trigger`)===`item`&&!DZ(n)&&(o=yfe(n,r,i)),ZS(e))a.innerHTML=e+o;else if(e){a.innerHTML=``,X(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,r):t===`leave`&&this._hide(r))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,r=e.get(`triggerOn`);if(e.get(`trigger`)!==`axis`&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&r!==`none`&&r!==`click`){var i=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&i.manuallyShowTip(e,t,n,{x:i._lastX,y:i._lastY,dataByCoordSys:i._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,r){if(r.from!==this.uid&&!CC.node&&n.getDom()){var i=UZ(r,n);this._ticket=``;var a=r.dataByCoordSys,o=Afe(r,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:r.position,positionDefault:`bottom`},i)}else if(r.tooltip&&r.x!=null&&r.y!=null){var c=Tfe;c.x=r.x,c.y=r.y,c.update(),rA(c).tooltipConfig={name:null,option:r.tooltip},this._tryShow({offsetX:r.x,offsetY:r.y,target:c},i)}else if(a)this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,dataByCoordSys:a,tooltipOption:r.tooltipOption},i);else if(r.seriesIndex!=null){if(this._manuallyAxisShowTip(e,t,n,r))return;var l=WX(r,t),u=l.point[0],d=l.point[1];u!=null&&d!=null&&this._tryShow({offsetX:u,offsetY:d,target:l.el,position:r.position,positionDefault:`bottom`},i)}else r.x!=null&&r.y!=null&&(n.dispatchAction({type:`updateAxisPointer`,x:r.x,y:r.y}),this._tryShow({offsetX:r.x,offsetY:r.y,position:r.position,target:n.getZr().findHover(r.x,r.y).target},i))}},t.prototype.manuallyHideTip=function(e,t,n,r){var i=this._tooltipContent;this._tooltipModel&&i.hideLater(this._tooltipModel.get(`hideDelay`)),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,r.from!==this.uid&&this._hide(UZ(r,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,r){var i=r.seriesIndex,a=r.dataIndex,o=t.getComponent(`axisPointer`).coordSysAxesInfo;if(i!=null&&a!=null&&o!=null){var s=t.getSeriesByIndex(i);if(s&&HZ([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model],this._tooltipModel).get(`trigger`)===`axis`)return n.dispatchAction({type:`updateAxisPointer`,seriesIndex:i,dataIndex:a,position:r.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var r=e.dataByCoordSys;if(r&&r.length)this._showAxisTooltip(r,e);else if(n){if(rA(n).ssrType===`legend`)return;this._lastDataByCoordSys=null,this._cbParamsList=null;var i,a;lU(n,function(e){if(e.tooltipDisabled)return i=a=null,!0;i||a||(rA(e).dataIndex==null?rA(e).tooltipConfig!=null&&(a=e):i=e)},!0),i?this._showSeriesItemTooltip(e,i,t):a?this._showComponentItemTooltip(e,a,t):this._hide(t)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get(`showDelay`);t=JS(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,r=this._tooltipModel,i=[t.offsetX,t.offsetY],a=HZ([t.tooltipOption],r),o=this._renderMode,s=[],c=EI(`section`,{blocks:[],noHeader:!0}),l=[],u=new PI;Y(e,function(e){Y(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+`Axis`,e.axisIndex),i=e.value,a=t.axis,d=a.scale.parse(i);if(t&&i!=null){var f=SX(i,a,n,e.seriesDataIndices,e.valueLabelOpt),p=EI(`section`,{header:f,noHeader:!fC(f),sortBlocks:!0,blocks:[]});c.blocks.push(p),Y(e.seriesDataIndices,function(i){var a=n.getSeriesByIndex(i.seriesIndex),c=i.dataIndexInside,m=a.getDataParams(c);if(!(m.dataIndex<0)){m.axisDim=e.axisDim,m.axisIndex=e.axisIndex,m.axisType=e.axisType,m.axisId=e.axisId,m.axisValue=xR(t.axis,{value:d}),m.axisValueLabel=f,m.marker=u.makeTooltipMarker(`item`,XF(m.color),o);var h=pI(a.formatTooltip(c,!0,null)),g=h.frag;if(g){var _=HZ([a],r).get(`valueFormatter`);p.blocks.push(_?J({valueFormatter:_},g):g)}h.text&&l.push(h.text),s.push(m)}})}})}),c.blocks.reverse(),l.reverse();var d=t.position,f=AI(c,u,o,a.get(`order`),n.get(`useUTC`),a.get(`textStyle`));f&&l.unshift(f);var p=o===`richText`?` -`:`
`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=rA(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=VZ([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new NI;h.marker=g.makeTooltipMarker(`item`,XF(h.color),d);var _=pI(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?kI(y?J({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=rA(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(ZS(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=LS(a),a.content=KP(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=VZ(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new NI;this._showOrMove(d,function(){var n=LS(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(ZS(u)){var p=e.ecModel.get(`useUTC`),m=X(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=DF(m.axisValue,d,p)),d=YF(d,n,!0)}else if(XS(u)){var g=JS(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||X(t))return{color:r||i};if(!X(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),XS(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),X(t))n=tk(t[0],s),r=tk(t[1],c);else if(eC(t)){var p=t;p.width=l[0],p.height=l[1];var m=tI(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(ZS(t)&&o){var h=Afe(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=Ofe(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=UZ(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=UZ(d)?l[1]/2:d===`bottom`?l[1]:0),EZ(e)){var h=kfe(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&Y(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&Y(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&Y(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&Y(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!CC.node&&t.getDom()&&(nV(this,`_updatePosition`),this._tooltipContent.dispose(),VX(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(BH);function VZ(e,t,n){var r=t.ecModel,i;n?(i=new dN(n,r,r),i=new dN(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof dN&&(o=o.get(`tooltip`,!0)),ZS(o)&&(o={formatter:o}),o&&(i=new dN(o,i,r)))}return i}function HZ(e,t){return e.dispatchAction||JS(t.dispatchAction,t)}function Ofe(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function kfe(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function Afe(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function UZ(e){return e===`center`||e===`middle`}function jfe(e,t,n){var r=zk(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=Vk(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=rA(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function Mfe(e){XW(nZ),e.registerComponentModel(TZ),e.registerComponentView(Dfe),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},bC),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},bC)}var WZ=Y;function GZ(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function KZ(e,t,n){var r={};return WZ(t,function(t){var a=r[t]=i();WZ(e[t],function(e,r){if(pq.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new pq(i),r===`opacity`&&(i=LS(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new pq(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function Nfe(e,t,n){var r;Y(n,function(e){t.hasOwnProperty(e)&&GZ(t[e])&&(r=!0)}),r&&Y(n,function(n){t.hasOwnProperty(n)&&GZ(t[n])?e[n]=LS(t[n]):delete e[n]})}function Pfe(e,t,n,r){var i={};return Y(e,function(e){i[e]=pq.prepareVisualTypes(t[e])}),{progress:function(e,a){var o;r!=null&&(o=a.getDimensionIndex(r));function s(e){return oU(a,l,e)}function c(e,t){lde(a,l,e,t)}for(var l,u=a.getStore();(l=e.next())!=null;){var d=a.getRawDataItem(l);if(!(d&&d.visualMap===!1))for(var f=r==null?l:u.get(o,l),p=n(f),m=t[p],h=i[p],g=0,_=h.length;g<_;g++){var v=h[g];m[v]&&m[v].applyVisual(f,s,c)}}}}}function qZ(e,t){if(!e)return!1;for(var n=X(e)?e:[e],r=0;r=0&&(s[o]=+s[o].toFixed(f)),[s,d]}var $Z={min:YS(QZ,`min`),max:YS(QZ,`max`),average:YS(QZ,`average`),median:YS(QZ,`median`)};function eQ(e,t){if(t){var n=e.getData(),r=e.coordinateSystem,i=r&&r.dimensions;if(!Ife(t)&&!X(t.coord)&&X(i)){var a=tQ(t,n,r,e);if(t=LS(t),t.type&&$Z[t.type]&&a.baseAxis&&a.valueAxis){var o=BS(i,a.baseAxis.dim),s=BS(i,a.valueAxis.dim),c=$Z[t.type](n,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=c[0],t.value=c[1]}else t.coord=[t.xAxis==null?t.radiusAxis:t.xAxis,t.yAxis==null?t.angleAxis:t.yAxis]}if(t.coord==null||!X(i)){t.coord=[];var l=e.getBaseAxis();if(l&&t.type&&$Z[t.type]){var u=r.getOtherAxis(l);u&&(t.value=iQ(n,n.mapDimension(u.dim),t.type))}}else for(var d=t.coord,f=0;f<2;f++)$Z[d[f]]&&(d[f]=iQ(n,n.mapDimension(i[f]),d[f]));return t}}function tQ(e,t,n,r){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex==null?e.valueDim:t.getDimension(e.valueIndex),i.valueAxis=n.getAxis(Lfe(r,i.valueDataDim)),i.baseAxis=n.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=r.getBaseAxis(),i.valueAxis=n.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function Lfe(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}function nQ(e,t){return e&&e.containData&&t.coord&&!ZZ(t)?e.containData(t.coord):!0}function Rfe(e,t,n){return e&&e.containZone&&t.coord&&n.coord&&!ZZ(t)&&!ZZ(n)?e.containZone(t.coord,n.coord):!0}function rQ(e,t){return e?function(e,n,r,i){return YN(i<2?e.coord&&e.coord[i]:e.value,t[i])}:function(e,n,r,i){return YN(e.value,t[i])}}function iQ(e,t,n){if(n===`average`){var r=0,i=0;return e.each(t,function(e,t){isNaN(e)||(r+=e,i++)}),r/i}return n===`median`?e.getMedian(t):e.getDataExtent(t)[+(n===`max`)]}var aQ=Lk(),oQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this.markerGroupMap=_C()},t.prototype.render=function(e,t,n){var r=this,i=this.markerGroupMap;i.each(function(e){aQ(e).keep=!1}),t.eachSeries(function(e){var i=XZ.getMarkerModelFromSeries(e,r.type);i&&r.renderSeries(e,i,t,n)}),i.each(function(e){!aQ(e).keep&&r.group.remove(e.group)}),zfe(t,i,this.type)},t.prototype.markKeep=function(e){aQ(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Y(e,function(e){var r=XZ.getMarkerModelFromSeries(e,n.type);r&&r.getData().eachItemGraphicEl(function(e){e&&(t?HA(e):UA(e))})})},t.type=`marker`,t}(BH);function zfe(e,t,n){e.eachSeries(function(e){var r=XZ.getMarkerModelFromSeries(e,n),i=t.get(e.id);if(r&&i&&i.group){var a=BM(r),o=a.z,s=a.zlevel;HM(i.group,o,s)}})}function sQ(e,t,n){var r=t.coordinateSystem,i=n.getWidth(),a=n.getHeight(),o=r&&r.getArea&&r.getArea();e.each(function(n){var s=e.getItemModel(n),c=s.get(`relativeTo`)===`coordinate`,l=c?o?o.width:0:i,u=c?o?o.height:0:a,d=c&&o?o.x:0,f=c&&o?o.y:0,p,m=tk(s.get(`x`),l)+d,h=tk(s.get(`y`),u)+f;if(!isNaN(m)&&!isNaN(h))p=[m,h];else if(t.getMarkerPosition)p=t.getMarkerPosition(e.getValues(e.dimensions,n));else if(r){var g=e.get(r.dimensions[0],n),_=e.get(r.dimensions[1],n);p=r.dataToPoint([g,_])}isNaN(m)||(p[0]=m),isNaN(h)||(p[1]=h),e.setItemLayout(n,p)})}var Bfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=XZ.getMarkerModelFromSeries(e,`markPoint`);t&&(sQ(t.getData(),e,n),this.markerGroupMap.get(e.id).updateLayout())},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new ZI),l=Vfe(i,e,t);t.setData(l),sQ(t.getData(),e,r),l.each(function(e){var n=l.getItemModel(e),r=n.getShallow(`symbol`),i=n.getShallow(`symbolSize`),a=n.getShallow(`symbolRotate`),s=n.getShallow(`symbolOffset`),c=n.getShallow(`symbolKeepAspect`);if(XS(r)||XS(i)||XS(a)||XS(s)){var u=t.getRawValue(e),d=t.getDataParams(e);XS(r)&&(r=r(u,d)),XS(i)&&(i=i(u,d)),XS(a)&&(a=a(u,d)),XS(s)&&(s=s(u,d))}var f=n.getModel(`itemStyle`).getItemStyle(),p=n.get(`z2`),m=sU(o,`color`);f.fill||=m,l.setItemVisual(e,{z2:sC(p,0),symbol:r,symbolSize:i,symbolRotate:a,symbolOffset:s,symbolKeepAspect:c,style:f})}),c.updateData(l),this.group.add(c.group),l.eachItemGraphicEl(function(e){e.traverse(function(e){rA(e).dataModel=t})}),this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markPoint`,t}(oQ);function Vfe(e,t,n){var r=e?US(e&&e.dimensions,function(e){var n=t.getData();return J(J({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new bP(r,n),a=US(n.get(`data`),YS(eQ,t));e&&(a=GS(a,YS(nQ,e)));var o=rQ(!!e,r);return i.initData(a,null,o),i}function Hfe(e){e.registerComponentModel(Ffe),e.registerComponentView(Bfe),e.registerPreprocessor(function(e){qZ(e.series,`markPoint`)&&(e.markPoint=e.markPoint||{})})}var Ufe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markLine`,t.defaultOption={z:5,symbol:[`circle`,`arrow`],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:`item`},label:{show:!0,position:`end`,distance:5},lineStyle:{type:`dashed`},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:`linear`},t}(XZ),cQ=Lk(),Wfe=function(e,t,n,r){var i=e.getData(),a;if(X(r))a=r;else{var o=r.type;if(o===`min`||o===`max`||o===`average`||o===`median`||r.xAxis!=null||r.yAxis!=null){var s=void 0,c=void 0;if(r.yAxis!=null||r.xAxis!=null)s=t.getAxis(r.yAxis==null?`x`:`y`),c=oC(r.yAxis,r.xAxis);else{var l=tQ(r,i,t,e);s=l.valueAxis,c=iQ(i,OP(i,l.valueDataDim),o)}var u=s.dim===`x`?0:1,d=1-u,f=LS(r),p={coord:[]};f.type=null,f.coord=[],f.coord[d]=-1/0,p.coord[d]=1/0;var m=n.get(`precision`);m>=0&&$S(c)&&(c=+c.toFixed(Math.min(m,20))),f.coord[u]=p.coord[u]=c,a=[f,p,{type:o,valueIndex:r.valueIndex,value:c}]}else a=[]}var h=[eQ(e,a[0]),eQ(e,a[1]),J({},a[2])];return h[2].type=h[2].type||null,RS(h[2],h[0]),RS(h[2],h[1]),h};function lQ(e){return!isNaN(e)&&!isFinite(e)}function uQ(e,t,n,r){var i=1-e,a=r.dimensions[e];return lQ(t[i])&&lQ(n[i])&&t[e]===n[e]&&r.getAxis(a).containData(t[e])}function Gfe(e,t){if(e.type===`cartesian2d`){var n=t[0].coord,r=t[1].coord;if(n&&r&&(uQ(1,n,r,e)||uQ(0,n,r,e)))return!0}return nQ(e,t[0])&&nQ(e,t[1])}function dQ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=tk(o.get(`x`),i.getWidth()),l=tk(o.get(`y`),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition)s=r.getMarkerPosition(e.getValues(e.dimensions,t));else{var u=a.dimensions,d=e.get(u[0],t),f=e.get(u[1],t);s=a.dataToPoint([d,f])}if(hL(a,`cartesian2d`)){var p=a.getAxis(`x`),m=a.getAxis(`y`),u=a.dimensions;lQ(e.get(u[0],t))?s[0]=p.toGlobalCoord(p.getExtent()[+!n]):lQ(e.get(u[1],t))&&(s[1]=m.toGlobalCoord(m.getExtent()[+!n]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}e.setItemLayout(t,s)}var Kfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=XZ.getMarkerModelFromSeries(e,`markLine`);if(t){var r=t.getData(),i=cQ(t).from,a=cQ(t).to;i.each(function(t){dQ(i,t,!0,e,n),dQ(a,t,!1,e,n)}),r.each(function(e){r.setItemLayout(e,[i.getItemLayout(e),a.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new Gq);this.group.add(c.group);var l=qfe(i,e,t),u=l.from,d=l.to,f=l.line;cQ(t).from=u,cQ(t).to=d,t.setData(f);var p=t.get(`symbol`),m=t.get(`symbolSize`),h=t.get(`symbolRotate`),g=t.get(`symbolOffset`);X(p)||(p=[p,p]),X(m)||(m=[m,m]),X(h)||(h=[h,h]),X(g)||(g=[g,g]),l.from.each(function(e){_(u,e,!0),_(d,e,!1)}),f.each(function(e){var t=f.getItemModel(e),n=t.getModel(`lineStyle`).getLineStyle();f.setItemLayout(e,[u.getItemLayout(e),d.getItemLayout(e)]);var r=t.get(`z2`);n.stroke??=u.getItemVisual(e,`style`).fill,f.setItemVisual(e,{z2:sC(r,0),fromSymbolKeepAspect:u.getItemVisual(e,`symbolKeepAspect`),fromSymbolOffset:u.getItemVisual(e,`symbolOffset`),fromSymbolRotate:u.getItemVisual(e,`symbolRotate`),fromSymbolSize:u.getItemVisual(e,`symbolSize`),fromSymbol:u.getItemVisual(e,`symbol`),toSymbolKeepAspect:d.getItemVisual(e,`symbolKeepAspect`),toSymbolOffset:d.getItemVisual(e,`symbolOffset`),toSymbolRotate:d.getItemVisual(e,`symbolRotate`),toSymbolSize:d.getItemVisual(e,`symbolSize`),toSymbol:d.getItemVisual(e,`symbol`),style:n})}),c.updateData(f),l.line.eachItemGraphicEl(function(e){rA(e).dataModel=t,e.traverse(function(e){rA(e).dataModel=t})});function _(t,n,i){var a=t.getItemModel(n);dQ(t,n,i,e,r);var s=a.getModel(`itemStyle`).getItemStyle();s.fill??=sU(o,`color`),t.setItemVisual(n,{symbolKeepAspect:a.get(`symbolKeepAspect`),symbolOffset:sC(a.get(`symbolOffset`,!0),g[+!i]),symbolRotate:sC(a.get(`symbolRotate`,!0),h[+!i]),symbolSize:sC(a.get(`symbolSize`),m[+!i]),symbol:sC(a.get(`symbol`,!0),p[+!i]),style:s})}this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markLine`,t}(oQ);function qfe(e,t,n){var r=e?US(e&&e.dimensions,function(e){var n=t.getData();return J(J({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new bP(r,n),a=new bP(r,n),o=new bP([],n),s=US(n.get(`data`),YS(Wfe,t,e,n));e&&(s=GS(s,YS(Gfe,e)));var c=rQ(!!e,r);return i.initData(US(s,function(e){return e[0]}),null,c),a.initData(US(s,function(e){return e[1]}),null,c),o.initData(US(s,function(e){return e[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function Jfe(e){e.registerComponentModel(Ufe),e.registerComponentView(Kfe),e.registerPreprocessor(function(e){qZ(e.series,`markLine`)&&(e.markLine=e.markLine||{})})}var Yfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markArea`,t.defaultOption={z:1,tooltip:{trigger:`item`},animation:!1,label:{show:!0,position:`top`},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:`top`}}},t}(XZ),fQ=Lk(),Xfe=function(e,t,n,r){var i=r[0],a=r[1];if(i&&a){var o=eQ(e,i),s=eQ(e,a),c=o.coord,l=s.coord;c[0]=oC(c[0],-1/0),c[1]=oC(c[1],-1/0),l[0]=oC(l[0],1/0),l[1]=oC(l[1],1/0);var u=kre([{},o,s]);return u.coord=[o.coord,s.coord],u.x0=o.x,u.y0=o.y,u.x1=s.x,u.y1=s.y,u}};function pQ(e){return!isNaN(e)&&!isFinite(e)}function mQ(e,t,n,r){var i=1-e;return pQ(t[i])&&pQ(n[i])}function Zfe(e,t){var n=t.coord[0],r=t.coord[1],i={coord:n,x:t.x0,y:t.y0},a={coord:r,x:t.x1,y:t.y1};return hL(e,`cartesian2d`)?n&&r&&(mQ(1,n,r,e)||mQ(0,n,r,e))?!0:Rfe(e,i,a):nQ(e,i)||nQ(e,a)}function hQ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=tk(o.get(n[0]),i.getWidth()),l=tk(o.get(n[1]),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition){var u=e.getValues([`x0`,`y0`],t),d=e.getValues([`x1`,`y1`],t),f=a.clampData(u),p=a.clampData(d),m=[];m[0]=n[0]===`x0`?f[0]>p[0]?d[0]:u[0]:f[0]>p[0]?u[0]:d[0],m[1]=n[1]===`y0`?f[1]>p[1]?d[1]:u[1]:f[1]>p[1]?u[1]:d[1],s=r.getMarkerPosition(m,n,!0)}else{var h=e.get(n[0],t),g=e.get(n[1],t),_=[h,g];a.clampData&&a.clampData(_,_),s=a.dataToPoint(_,!0)}if(hL(a,`cartesian2d`)){var v=a.getAxis(`x`),y=a.getAxis(`y`),h=e.get(n[0],t),g=e.get(n[1],t);pQ(h)?s[0]=v.toGlobalCoord(v.getExtent()[n[0]===`x0`?0:1]):pQ(g)&&(s[1]=y.toGlobalCoord(y.getExtent()[n[1]===`y0`?0:1]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}return s}var gQ=[[`x0`,`y0`],[`x1`,`y0`],[`x1`,`y1`],[`x0`,`y1`]],Qfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=XZ.getMarkerModelFromSeries(e,`markArea`);if(t){var r=t.getData();r.each(function(t){var i=US(gQ,function(i){return hQ(r,t,i,e,n)});r.setItemLayout(t,i),r.getItemGraphicEl(t).setShape(`points`,i)})}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,{group:new yj});this.group.add(c.group),this.markKeep(c);var l=$fe(i,e,t);t.setData(l),l.each(function(t){var n=US(gQ,function(n){return hQ(l,t,n,e,r)}),a=i.getAxis(`x`).scale,s=i.getAxis(`y`).scale,c=a.getExtent(),u=s.getExtent(),d=[a.parse(l.get(`x0`,t)),a.parse(l.get(`x1`,t))],f=[s.parse(l.get(`y0`,t)),s.parse(l.get(`y1`,t))];ak(d),ak(f);var p=c[0]>d[1]||c[1]f[1]||u[1]=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:Q.size.m,align:`auto`,backgroundColor:Q.color.transparent,borderColor:Q.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:Q.color.disabled,inactiveBorderColor:Q.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:Q.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:Q.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:Q.color.tertiary,borderWidth:1,borderColor:Q.color.border},emphasis:{selectorLabel:{show:!0,color:Q.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(sI),vQ=YS,yQ=Y,bQ=yj,xQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new bQ),this.group.add(this._selectorGroup=new bQ),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);i&&i!==`auto`||(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=rI(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=tI(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=tI(zS({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=wZ(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=_C(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),yQ(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` -`)){var p=new bQ;p.newline=!0,s.add(p)}else{var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,vQ(SQ,f,null,r,d)).on(`mouseover`,vQ(CQ,m.name,null,r,d)).on(`mouseout`,vQ(wQ,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=rA(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=tE(h.fill);_&&_[3]===0&&(_[3]=.2,h=J(J({},h),{fill:lE(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,vQ(SQ,null,f,r,d)).on(`mouseover`,vQ(CQ,null,f,r,d)).on(`mouseout`,vQ(wQ,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=rA(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};rA(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();yQ(e,function(e){var r=e.type,i=new MO({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),XM(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),QA(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=npe(c,r,o,s,d,m,u),y=new bQ,b=r.getModel(`textStyle`);if(XS(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(rpe({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;ZS(w)&&w?T=w.replace(`{name}`,t??``):XS(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new MO({style:QM(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new OO({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&NM({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),QA(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();eI(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){eI(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(BH);function npe(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),yQ(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:zU(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function rpe(e){var t=e.icon||`roundRect`,n=VI(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Q.color.neutral00,n.style.lineWidth=2),n}function SQ(e,t,n,r){wQ(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),CQ(e,t,n,r)}function CQ(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function wQ(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function TQ(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),EQ(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){Y(i,function(t,n){e[t?`select`:`unSelect`](n)}),EQ(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function EQ(e,t){var n=t||{};return Y(e.getData(),function(t){var r=t.get(`name`);if(r!==` -`&&r!==``){var i=e.isSelected(r);n[r]=Z(n,r)?n[r]&&i:i}}),n}function ipe(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,YS(TQ,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,YS(TQ,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,YS(TQ,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,YS(TQ,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,YS(TQ,`unSelect`))}var ape=nA(ope);function ope(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=sC(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new OO({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&nM(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;Y([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,ZS(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=AQ[i],o=jQ[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(xQ);function lpe(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function upe(e){XW(DQ),e.registerComponentModel(spe),e.registerComponentView(cpe),lpe(e)}function dpe(e){XW(DQ),XW(upe)}var fpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=MP(gZ.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(gZ),MQ=Lk();function ppe(e,t,n){MQ(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function mpe(e,t){for(var n=MQ(e).coordSysRecordMap,r=n.keys(),i=0;ia[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=sC(t.get(`cursorGrab`,!0),s),c=sC(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function ype(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=MQ(t),r=n.coordSysRecordMap||=_C();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){Y(uZ(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,hpe(t,n.model));(a.dataZoomInfoMap||=_C()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i)NQ(r,e);else{var s=vpe(a,e,t);n.enable(s.controlType,s.opt),tV(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)}})})}var bpe=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),ppe(r,t,{pan:JS(PQ.pan,this),zoom:JS(PQ.zoom,this),scrollMove:JS(PQ.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){mpe(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(vZ),PQ={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=IQ[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Xq(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:FQ(function(e,t,n,r,i,a){var o=IQ[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:FQ(function(e,t,n,r,i,a){return IQ[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function FQ(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(Xq(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var IQ={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function xpe(e){CZ(e),e.registerComponentModel(fpe),e.registerComponentView(bpe),ype(e)}var Spe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=MP(gZ.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Q.color.accent10,borderRadius:0,backgroundColor:Q.color.transparent,dataBackground:{lineStyle:{color:Q.color.accent30,width:.5},areaStyle:{color:Q.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Q.color.accent40,width:.5},areaStyle:{color:Q.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:Q.color.neutral00,borderColor:Q.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:Q.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Q.color.tertiary},brushSelect:!0,brushStyle:{color:Q.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Q.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(gZ),LQ=OO,Cpe=1,RQ=30,wpe=7,zQ=`horizontal`,BQ=`vertical`,Tpe=5,Epe=[`line`,`bar`,`candlestick`,`scatter`],Dpe={easing:`cubicOut`,duration:100,delay:0},Ope=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=JS(this._onBrush,this),this._onBrushEnd=JS(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),tV(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1?this.group.removeAll():t.noTarget()?(this._clear(),this.group.removeAll()):(i&&i.type===`dataZoom`&&i.from===this.uid||this._buildView(),this._updateView())},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){nV(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new yj;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?wpe:0,r=rI(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===zQ?{right:r.width-i.x-i.width,top:r.height-RQ-a-n,width:i.width,height:RQ}:{right:a,top:i.y,width:RQ,height:i.height},s=oI(e.option);Y([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=tI(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===BQ&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===zQ&&!i?{scaleY:o?1:-1,scaleX:1}:n===zQ&&i?{scaleY:o?1:-1,scaleX:-1}:n===BQ&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new LQ({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new LQ({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:JS(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b)v||(y+=g);else{y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:ek(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new yj,r=new Ij({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new Lj({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){Y(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&BS(Epe,e.get(`type`))<0)){var o=r.getComponent(cZ(i),a).axis,s=kpe(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new LQ({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new LQ({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:Cpe,fill:Q.color.transparent}})),Y([0,1],function(t){var a=o.get(`handleIcon`);!BI[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=VI(a,-1,0,2,2,null,!0);s.attr({cursor:Ape(this._orient),draggable:!0,drift:JS(this._onDragMove,this,t),ondragend:JS(this._onDragEnd,this),onmouseover:JS(this._onOverDataInfoTriggerArea,this,!0),onmouseout:JS(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=tk(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),QA(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new MO({silent:!0,invisible:!f,style:QM(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=tk(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new OO({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=VI(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Q.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new OO({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:JS(this._onActualMoveZoneDrift,this),ondragstart:JS(this._onActualMoveZoneDragStart,this),ondragend:JS(this._onActualMoveZoneDragEnd,this),onmouseover:JS(this._onOverDataInfoTriggerArea,this,!0),onmouseout:JS(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[ek(e[0],[0,100],t,!0),ek(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];Xq(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:ek(a.minSpan,o,i,!0),a.maxSpan==null?null:ek(a.maxSpan,o,i,!0));var s=this._range,c=this._range=ak([ek(r[0],i,o,!0),ek(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=ak(n.slice()),i=this._size;Y([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;ct[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new _w(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Xq(0,a,r,0,o.minSpan==null?null:ek(o.minSpan,i,r,!0),o.maxSpan==null?null:ek(o.maxSpan,i,r,!0)),this._range=ak([ek(a[0],r,i,!0),ek(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(DV(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new LQ({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?Dpe:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=uZ(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(vZ);function VQ(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:PL(r)||ML(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?ik(o,a,!0):o+``;return XS(i)?i(o,s):ZS(i)?i.replace(`{value}`,s):s}function kpe(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function Ape(e){return e===`vertical`?`ns-resize`:`ew-resize`}function jpe(e){e.registerComponentModel(Spe),e.registerComponentView(Ope),CZ(e)}function Mpe(e){XW(xpe),XW(jpe)}var HQ={get:function(e,t,n){var r=LS((Npe[e]||{})[t]);return n&&X(r)?r[r.length-1]:r}},Npe={color:{active:[`#006edd`,`#e0ffff`],inactive:[Q.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},UQ=pq.mapVisual,Ppe=pq.eachVisual,Fpe=X,WQ=Y,Ipe=ak,Lpe=ek,GQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&Nfe(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=JS(e,this),this.controllerVisuals=KZ(this.option.controller,t,e),this.targetVisuals=KZ(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return WQ(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Vk(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return US(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){Y(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],X(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return ZS(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):XS(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=Ipe([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=KS(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};RS(r,n),RS(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){Fpe(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},WQ(r,function(e,t){if(pq.isValidType(t)){var n=HQ.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;WQ(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&LS(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&LS(n)||(a?s[0]:[s[0],s[0]])),c.symbol=UQ(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;Ppe(l,function(e){e>u&&(u=e)}),c.symbolSize=UQ(l,function(e){return Lpe(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Q.color.transparent,borderColor:Q.color.borderTint,contentColor:Q.color.theme[0],inactiveColor:Q.color.disabled,borderWidth:0,padding:Q.size.m,textGap:10,precision:0,textStyle:{color:Q.color.secondary}},t}(sI),KQ=[20,140],Rpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=KQ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=KQ[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):X(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),Y(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=ak((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=qQ(this,`outOfRange`,this.getExtent()),n=qQ(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new yj(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);zpe([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=QQ(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=SM(n.handleLabelPoints[l],xM(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=QQ(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=SM(c.indicatorLabelPoint,xM(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||n$(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=dae(u,d);this._dispatchHighDown(`downplay`,ZQ(f[0],n)),this._dispatchHighDown(`highlight`,ZQ(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(cU(e.target,function(e){var n=rA(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function qpe(e,t,n,r){for(var i=t.targetVisuals[r],a=pq.prepareVisualTypes(i),o={color:sU(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(Wpe,Gpe),Y(Kpe,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(Jpe))}function Ype(e){e.registerComponentModel(Rpe),e.registerComponentView(Hpe),s$(e)}var Xpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],Zpe[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=LS(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=US(this._pieceList,function(e){return e=LS(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=pq.listVisualTypes(),i=this.isCategory();Y(t.pieces,function(e){Y(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),Y(n,function(e,n){var r=!1;Y(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&Y(this.stateList,function(e){(t[e]||(t[e]={}))[n]=HQ.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,Y(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;Y(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=LS(e)},t.prototype.getValueState=function(e){var t=pq.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){pq.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return Y(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=MP(GQ.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(GQ),Zpe={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function c$(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var Qpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=oC(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),Y(o.viewPieceList,function(o){var s=o.piece,u=new yj;u.onclick=JS(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new MO({style:QM(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:sC(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),eI(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:ZQ(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return XQ(e,this.api,e.itemSize);var n=t.align;return n&&n!==`auto`||(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new yj,o=this.visualMapModel.textStyleModel;a.add(new MO({style:QM(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=US(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=VI(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=LS(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,Y(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(JQ);function $pe(e){e.registerComponentModel(Xpe),e.registerComponentView(Qpe),s$(e)}function eme(e){XW(Ype),XW($pe)}var tme={label:{enabled:!0},decal:{show:!1}},l$=Lk(),u$=Lk(),nme=nA(rme);function rme(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=u$(e).scope||(u$(e).scope={}),i=LS(tme);RS(i.label,e.getLocaleModel().get(`aria`),!1),RS(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=_C();e.eachSeries(function(e){e.isColorBySeries()||(l$(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(XS(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=uI(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=l$(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=uI(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?J(J({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=zS(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`))r.setAttribute(`aria-label`,a.get(`description`));else{var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=m$:-c>=m$),f=c>0?c%m$:c%m$+m$,p=!1;p=d?!0:!gE(u)&&f>=p$==!!l;var m=e+n*f$(a),h=t+r*d$(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*ome);if(d){var _=1/this._p,v=(l?1:-1)*(m$-_);this._add(`A`,n,r,g,1,+l,e+n*f$(a+v),t+r*d$(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*f$(o),b=t+r*d$(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d`}function gme(e){return``}function S$(e,t){t||={};var n=t.newline?` -`:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return hme(i,a)+(i===`style`?o||``:KP(o))+(t?``+n+US(t,function(e){return r(e)}).join(n)+n:``)+gme(i)}return r(e)}function _me(e,t,n){n||={};var r=n.newline?` -`:``,i=` {`+r,a=r+`}`,o=US(qS(e),function(t){return t+i+US(qS(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=US(qS(t),function(e){return`@keyframes `+e+i+US(qS(t[e]),function(n){return n+i+US(qS(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[``].join(r)}function C$(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function w$(e,t,n,r){return x$(`svg`,`root`,{width:e,height:t,xmlns:v$,"xmlns:xlink":y$,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var vme=0;function T$(){return vme++}var E$={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},D$=`transform-origin`;function yme(e,t,n){var r=J({},e.shape);J(r,t),e.buildPath(n,r);var i=new h$;return i.reset(jE(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function bme(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[D$]=n+`px `+r+`px`)}var xme={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function O$(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function Sme(e,t,n){var r=e.shape.paths,i={},a,o;if(Y(r,function(e){var t=C$(n.zrId);t.animation=!0,A$(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=qS(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=O$(i,n);return a.replace(o,s)}}function k$(e){return ZS(e)?E$[e]?`cubic-bezier(`+E$[e]+`)`:HT(e)?e:``:``}function A$(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Uj){var s=Sme(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l0}).length)return O$(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+T$();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function Cme(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};j$(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=fE(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),j$(r,t,n,!0)}}}function j$(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+T$(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var M$=Math.round;function N$(e){return e&&ZS(e.src)}function P$(e){return e&&XS(e.toDataURL)}function F$(e,t,n,r){dme(function(i,a){var o=i===`fill`||i===`stroke`;o&&kE(a)?U$(t,e,i,r):o&&EE(a)?W$(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),Ame(n,e,r)}function I$(e,t){var n=Sue(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[mme+`silent`]=`true`))}function L$(e){return gE(e[0]-1)&&gE(e[1])&&gE(e[2])&&gE(e[3]-1)}function wme(e){return gE(e[4])&&gE(e[5])}function R$(e,t,n){if(t&&!(wme(t)&&L$(t))){var r=n?10:1e4;e.transform=L$(t)?`translate(`+M$(t[4]*r)/r+` `+M$(t[5]*r)/r+`)`:yE(t)}}function z$(e,t,n){for(var r=e.points,i=[],a=0;a`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;dC(f,g),dC(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=YC(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=x$(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=LS(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=ME(i);x&&(o.patternTransform=x);var S=x$(`pattern`,``,o,[d]),C=S$(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=x$(`pattern`,T,o,[d])),t[n]=AE(T)}}function jme(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=x$(`clipPath`,a,o,[V$(e,n)])}t[`clip-path`]=AE(a)}function G$(e){return document.createTextNode(e)}function K$(e,t,n){e.insertBefore(t,n)}function q$(e,t){e.removeChild(t)}function J$(e,t){e.appendChild(t)}function Y$(e){return e.parentNode}function X$(e){return e.nextSibling}function Z$(e,t){e.textContent=t}var Q$=58,Mme=120,Nme=x$(``,``);function $$(e){return e===void 0}function e1(e){return e!==void 0}function Pme(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function t1(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function n1(e){var t,n=e.children,r=e.tag;if(e1(r)){var i=e.elm=b$(r);if(a1(Nme,e),X(n))for(t=0;ta?(m=n[c+1]==null?null:n[c+1].elm,r1(e,m,n,i,c)):i1(e,t,r,a))}function o1(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(a1(e,t),$$(t.text)?e1(r)&&e1(i)?r!==i&&Fme(n,r,i):e1(i)?(e1(e.text)&&Z$(n,``),r1(n,null,i,0,i.length-1)):e1(r)?i1(n,r,0,r.length-1):e1(e.text)&&Z$(n,``):e.text!==t.text&&(e1(r)&&i1(n,r,0,r.length-1),Z$(n,t.text)))}function Ime(e,t){if(t1(e,t))o1(e,t);else{var n=e.elm,r=Y$(n);n1(t),r!==null&&(K$(r,t.elm,X$(n)),i1(r,[e],0,0))}return t}var Lme=0,Rme=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=zme(`configLayer`),this.storage=t,this._opts=n=J({},n),this.root=e,this._id=`zr`+Lme++,this._oldVNode=w$(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=b$(`svg`);a1(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,Ime(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return H$(e,C$(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=C$(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=Bme(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=x$(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=US(qS(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(x$(`defs`,`defs`,{},c)),e.animation){var l=_me(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=x$(`style`,`stl`,{},[],l);a.push(u)}}return w$(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},S$(this.renderToVNode({animation:sC(e.cssAnimation,!0),emphasis:sC(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:sC(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g=a}}}for(var l=l1(this),u=l.startIdx;u=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!c1(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}_1(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},C1),CC.wxa&&y1(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=c1(e),c=s&&TS.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d15){d++;break}}}FU(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=f1,t=0);var i=v1(this._i,e)[t];return i||(i=h1(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&RS(i,this._layerConfig[e],!0),(n||r&&e!==f1)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&Ume(e)){for(var l=o.length,u=0;u0&&(c=v1(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),v1(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return y1(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return y1(this._i,function(n,r){e.call(t,n,r)},b1)},e.prototype.eachOtherLayer=function(e,t){return y1(this._i,function(n,r){e.call(t,n,r)},x1)},e.prototype.getLayers=function(){var e={};return y1(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(c1(t)?s=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=hU(i,0,r),t=hU(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,y1(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(f1).resize(e,t)}return this},e.prototype.clearLayer=function(e){Y(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[f1][0].dom;var t=new u1(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;y1(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s=1024&&t=10||t===0?T1.format(e):Yme.format(e)} ${w1[t]}`}function D1(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function O1(e,t=Date.now()){let n=Date.parse(e);return Number.isNaN(n)?`–`:`${D1(Math.max(0,t-n))} ago`}function k1(e){let t=Date.parse(e);return Number.isNaN(t)?e:`${$me.format(t)} UTC`}function A1(e,t){switch(t){case`bytes`:return E1(e);case`duration`:return D1(e);case`percent`:return`${T1.format(e)}%`;case`usd`:return e<10?Zme.format(e):Qme.format(e);default:return Number.isInteger(e)?T1.format(e):Xme.format(e)}}function j1(e,t){return e==null||e===``?`–`:t.type===`number`&&typeof e==`number`?A1(e,t.unit):t.type===`time`&&typeof e==`string`?O1(e):t.type===`bool`?e?`yes`:`no`:String(e)}function M1(e,t){return`${T1.format(e)} ${t}${e===1?``:t.endsWith(`s`)?`es`:`s`}`}function N1(e){let t=e.replace(/_bytes$|_at$/,``).replaceAll(`_`,` `);return t.charAt(0).toUpperCase()+t.slice(1)}XW([Gle,QR,jJ,RJ,cX,Hfe,Jfe,epe,rZ,Mfe,Mpe,dpe,eme,ame,Jme,Vme]);function ehe(e){let t=Hy[e],n=Uy[e];return{scheme:e,text:t.text,muted:t.muted,line:t.controlBorder,grid:t.borderSoft,surface:t.raised,inset:t.inset,border:t.border,brand:n.brand,series:Wy[e],states:{working:n.success,waiting:n.warning,stuck:n.danger,idle:n.info,finished:t.controlBorder}}}function P1(e,t){return e.series[t]??e.muted}function F1(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var I1=e=>({color:e.muted,fontFamily:Ky.mono,fontSize:Gy.micro});function L1(e,t={}){return{confine:!0,backgroundColor:e.inset,borderColor:e.border,borderWidth:1,borderRadius:6,padding:[6,10],textStyle:{color:e.text,fontSize:Gy.small,fontFamily:Ky.sans},extraCssText:`box-shadow: none;`,...t}}function R1(e,t,n){return`
${F1(t)}${F1(n)}
`}function z1(e,t){if(t.viz===`bar`){let t=e.columns[1]?.unit,n=e.rows.map(e=>({name:String(e[0]??`–`)||`–`,n:Number(e[1]??0)}));if(!n.length)return``;let r=n.reduce((e,t)=>t.n>e.n?t:e),i=n.reduce((e,t)=>e+t.n,0);return`${r.name} most, ${A1(r.n,t)} of ${A1(i,t)}`}if(t.viz!==`timeseries`)return``;let n=e.columns[2]?.unit,r=new Map,i=-1/0;for(let t of e.rows)typeof t[2]==`number`&&(r.set(String(t[1]??``),t[2]),i=Math.max(i,t[2]));if(!r.size)return``;if(r.size===1)return`${A1([...r.values()][0],n)} now, peak ${A1(i,n)}`;let[a,o]=[...r.entries()].reduce((e,t)=>t[1]>e[1]?t:e);return`${a} highest now at ${A1(o,n)}`}function the(e,t){let n=new Map;for(let t of e.rows){let e=Date.parse(String(t[0])),r=typeof t[2]==`number`?t[2]:null;if(Number.isNaN(e)||r===null)continue;let i=String(t[1]??``);n.has(i)||n.set(i,[]),n.get(i).push([e,r])}return[...n.entries()].map(([e,n])=>({name:e||N1(t.measure??`value`),points:n}))}function nhe(e,t,n,r,i=`hour`){let a=r??n.brand,o=e.map((e,t)=>[t,e]);return{animation:!1,aria:{enabled:!0,label:{description:`${t} over the last ${i}`}},grid:{left:1,right:3,top:3,bottom:3},xAxis:{type:`value`,show:!1,min:0,max:Math.max(1,e.length-1)},yAxis:{type:`value`,show:!1,scale:!0},series:[{type:`line`,data:o,showSymbol:!1,connectNulls:!1,smooth:.3,silent:!0,lineStyle:{width:1.5,color:a},areaStyle:{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Dn(a,.32)},{offset:1,color:Dn(a,0)}]}},markPoint:{symbol:`circle`,symbolSize:4,silent:!0,label:{show:!1},itemStyle:{color:a},data:rhe(o)}}]}}function rhe(e){for(let t=e.length-1;t>=0;t--)if(e[t][1]!==null)return[{coord:e[t]}];return[]}function ihe(e,t){return{animation:!1,textStyle:{color:t.text,fontFamily:Ky.sans,fontSize:Gy.small},aria:{enabled:!0,label:{description:e.description}},tooltip:L1(t,{trigger:`item`,formatter:e=>e.data?.tip??``}),series:[{type:`sankey`,left:e.left??100,right:e.right??350,top:8,bottom:8,nodeWidth:12,nodeGap:12,nodeAlign:`justify`,layoutIterations:0,draggable:!1,lineStyle:{color:`gradient`,opacity:.22,curveness:.5},emphasis:{focus:`adjacency`,lineStyle:{opacity:.5}},label:{fontFamily:Ky.mono,fontSize:Gy.small,color:t.text,width:e.labelWidth??340,overflow:`truncate`,formatter:e=>e.data?.text??``,rich:e.rich},data:e.nodes,links:e.links}]}}function ahe(e,t){if(e!==`bytes`||!(t>0))return{};for(let e=1;e<=1024**5;e*=1024)for(let n of[1,2,4,8,16,32,64,128,256,512]){let r=n*e;if(t/r<=5)return{interval:r,max:Math.ceil(t/r)*r}}return{}}var ohe=[`click`];function B1({option:e,label:t,height:n,small:r,onEvent:i}){let a=Yn(`dark`),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(i);return c.current=i,(0,h.useEffect)(()=>{if(!o.current)return;let e=Xde(o.current,void 0,{renderer:r?`svg`:`canvas`});s.current=e;for(let t of ohe)e.on(t,e=>c.current?.(t,e));let t=new ResizeObserver(()=>e.resize());return t.observe(o.current),()=>{t.disconnect(),e.dispose(),s.current=null}},[r]),(0,h.useEffect)(()=>{s.current?.setOption(e(ehe(a)),{notMerge:!0})},[e,a,r]),(0,H.jsx)(`div`,{ref:o,role:`img`,"aria-label":t,style:{height:n??`100%`,width:`100%`,minHeight:r?0:80}})}var V1={axisLine:{show:!1},axisTick:{show:!1}},H1=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function she(e,t,n){return typeof e.color==`number`?P1(n,e.color):e.color===`brand`?n.brand:e.color===void 0?t===0?n.brand:P1(n,t):n.states[e.color]}function che(e,t){let{series:n,from:r,to:i,format:a,waits:o=[],events:s=[],peak:c=!0}=e,l=n.length>1,u=n.reduce((e,t)=>t.points.reduce((e,t)=>Math.max(e,t[1]),e),0),d=n[0],f=e=>{if(!d?.points.length)return 0;let t=d.points[0];for(let n of d.points)Math.abs(n[0]-e)e.length?[`
${F1(H1(e[0].value[0]))}
`,...e.map(e=>R1(e.color,e.seriesName,a(e.value[1])))].join(``):``}),xAxis:{type:`time`,min:r,max:i,...V1,axisLabel:{...I1(t),hideOverlap:!0,formatter:e=>H1(e)},splitLine:{show:!1}},yAxis:{type:`value`,...ahe(e.unit,u),...V1,axisLabel:{...I1(t),formatter:e=>a(e)},splitLine:{lineStyle:{color:t.grid}}},series:n.map((e,n)=>{let r=she(e,n,t);return{type:`line`,name:e.name,data:e.points,showSymbol:!1,smooth:!1,sampling:`lttb`,lineStyle:{width:1.5,color:r},itemStyle:{color:r},areaStyle:n===0?{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Dn(r,.28)},{offset:1,color:Dn(r,0)}]}}:void 0,emphasis:{disabled:!0},markLine:n===0&&c&&e.points.length?{silent:!0,symbol:`none`,lineStyle:{color:t.muted,type:`dashed`,width:1},label:{formatter:`peak ${a(u)}`,position:`insideStartTop`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:[{type:`max`,name:`peak`}]}:void 0,markArea:n===0&&o.length?{silent:!0,itemStyle:{color:Dn(t.states.waiting,.1)},label:{show:!0,position:`insideBottom`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:o.map(e=>[{name:e.label,xAxis:e.from},{xAxis:e.to}])}:void 0,markPoint:n===0&&s.length?{symbol:`circle`,symbolSize:8,itemStyle:{color:t.brand,borderColor:t.surface,borderWidth:2},label:{show:!0,position:`top`,formatter:`{b}`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.text,backgroundColor:t.inset,borderColor:t.border,borderWidth:1,padding:[2,5],borderRadius:3},data:s.map(e=>({name:e.label,coord:[e.at,f(e.at)]}))}:void 0}})}}function lhe(e,t){let{rows:n,cols:r,values:i,format:a,unit:o}=e,s=i.flatMap((e,t)=>e.map((e,n)=>[n,t,e])),c=s.reduce((e,t)=>Math.max(e,t[2]),1);return{animation:!1,aria:{enabled:!0,label:{description:e.label}},tooltip:L1(t,{trigger:`item`,formatter:e=>`${F1(n[e.value[1]])} · ${F1(r[e.value[0]])}
${F1(a(e.value[2]))} ${F1(o)}`}),grid:{left:4,right:4,top:4,bottom:4},xAxis:{type:`category`,data:r,...V1,axisLabel:{...I1(t),interval:2},splitLine:{show:!1}},yAxis:{type:`category`,data:n,inverse:!0,...V1,axisLabel:{...I1(t),fontSize:Gy.small,color:t.text},splitLine:{show:!1}},visualMap:{show:!1,min:0,max:c,inRange:{color:[Dn(t.brand,.08),Dn(t.brand,.45),t.brand]}},series:[{type:`heatmap`,data:s,itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{borderColor:t.text}}}]}}function uhe(e,t){let{lanes:n,from:r,to:i,now:a}=e,o=n.flatMap((e,n)=>e.segments.map(r=>({value:[n,r.from,r.to,r.state],name:e.name,itemStyle:{color:t.states[r.state]}}))),s=(e,n)=>{let r=n.value(0),i=n.coord([n.value(1),r]),a=n.coord([n.value(2),r]),o=n.size([0,1])[1]*.5,s=e.coordSys,c=EM({x:i[0],y:i[1]-o/2,width:Math.max(2,a[0]-i[0]),height:o},s);return c?{type:`rect`,shape:{...c,r:2},style:{fill:t.states[n.value(3)]},transition:[]}:null},c=e=>i-e<(i-r)*.06;return{animation:!1,aria:{enabled:!0,label:{description:e.label}},tooltip:L1(t,{trigger:`item`,formatter:e=>R1(e.color,e.name,`${e.value[3]} · ${D1(e.value[2]-e.value[1])}`)}),grid:{left:4,right:36,top:6,bottom:4},xAxis:{type:`time`,min:r,max:i,...V1,axisLabel:{...I1(t),hideOverlap:!0,showMaxLabel:!1,formatter:e=>c(e)?``:H1(e)},splitLine:{lineStyle:{color:t.grid}}},yAxis:{type:`category`,data:n.map(e=>e.name),inverse:!0,...V1,axisLabel:{...I1(t),fontSize:Gy.small,color:t.text,width:150,overflow:`truncate`},splitLine:{show:!1}},series:[{type:`custom`,renderItem:s,encode:{x:[1,2],y:0},data:o,markLine:{silent:!0,symbol:`none`,lineStyle:{color:t.text,width:1},label:{formatter:`now`,position:`end`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:[{xAxis:a}]}}]}}var dhe=[8,30,55,80,100];function fhe({rows:e,cols:t,values:n,format:r,unit:i,label:a,rowHeight:o=22}){let s=(0,h.useCallback)(o=>lhe({rows:e,cols:t,values:n,format:r,unit:i,label:a},o),[e,t,n,r,i,a]);return(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(B1,{option:s,label:a,height:e.length*o+32}),(0,H.jsxs)(K,{justify:`flex-end`,gap:6,"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1,children:`fewer`}),dhe.map(e=>(0,H.jsx)(G,{w:12,h:10,style:{borderRadius:2,background:`color-mix(in srgb, var(--mantine-color-brand-filled) ${e}%, var(--driga-raised))`}},e)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,lh:1,children:[`more `,i]})]})]})}var phe={icon:bv,direction:`neutral`},mhe={"summary:sum:need_you":{icon:ry,attention:`waiting`,target:`inbox`,direction:`down-good`},"summary:sum:to_review":{icon:Uv,attention:`review`,target:`inbox`,direction:`neutral`},"summary:sum:attention_stuck":{icon:sy,attention:`stuck`,target:`stuck`,direction:`down-good`},"summary:sum:leftover_bytes":{icon:Zte,target:`leftover`,direction:`down-good`,countNouns:{leftover:[`tree`,`trees`]}},"cleanup:sum:size_bytes":{icon:pv,target:`reclaim`,direction:`down-good`},"local_activity:max:mem_used_bytes":{icon:_y,target:`memory`,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:cpu_percent":{icon:Nv,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:disk_used_bytes":{icon:ay,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:load1":{icon:Yv,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:swap_used_bytes":{icon:_y,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:events":{icon:bv,direction:`neutral`,sublabel:`local-machine`},"summary:sum:machines_reachable":{icon:Dy,direction:`up-good`}};function U1(e){return mhe[`${e.source}:${e.measure??`count`}`]??phe}function hhe(e,t){let n=e.caption?.split(`:`).at(-1),r=n?U1(e).countNouns?.[n]:void 0;return`${A1(t)}${r?` ${r[t===1?0:1]}`:``}`}var W1=[`waiting`,`stuck`,`working`,`idle`,`finished`],G1=[`working`,`waiting`,`stuck`,`idle`],K1={working:`working`,waiting:`waiting`,stuck:`stuck`,idle:`idle`,finished:`finished`},q1={claude:`Claude Code`,codex:`Codex`,gemini:`Gemini`,copilot:`Copilot`,agy:`agy`};function J1(e){return e&&Object.hasOwn(q1,e)?e:void 0}function Y1(e){let t=J1(e);return t?q1[t]:e??``}var X1=[`waiting`,`review`,`stuck`],Z1={waiting:{label:`Need you`,tone:`warning`,icon:ry,key:`1`,hint:`Filter the inbox to what needs you`,target:`inbox`},review:{label:`To review`,tone:`info`,icon:Uv,key:`2`,hint:`Filter the inbox to what finished`,target:`inbox`},stuck:{label:`Stuck`,tone:`danger`,icon:sy,key:`3`,hint:`Show the stuck sessions on Home`,target:`stuck`}},Q1=[`stuck`,`waiting`,`working`,`idle`];function $1(e){return Q1.find(t=>e.sessions[t]>0)??null}function e0(e,t){return t>0?Math.round(e/t*100):0}function ghe(e,t){let n=Q1.filter(t=>e.sessions[t]>0).map(t=>`${e.sessions[t]} ${t}`),r=e.reachable?n.length?n:[`no sessions`]:[`unreachable`];return[...e.local?[`this machine`]:[],...r,`seen ${O1(e.seenAt,t)}`].join(` · `)}function _he(e,t){return[e.name,ghe(e,t),`${E1(e.memory.used)} of ${E1(e.memory.total)}`].join(` · `)}function vhe(e){let t=e.flatMap(e=>e.reachable?$1(e)===`stuck`?[`${e.name} stuck`]:$1(e)===`waiting`?[`${e.name} waiting`]:[]:[`${e.name} unreachable`]);return t.length?t.join(` · `):`all working or idle`}function t0(e){return`Fleet: ${e.length} machine${e.length===1?``:`s`} · ${vhe(e)}`}function yhe(e){return e.trend.length<2||e.trend[0]===null||e.trend[e.trend.length-1]===null?`not enough history for an hour’s change`:e.delta===0?`steady over the last hour`:`${e.delta>0?`up`:`down`} ${Math.abs(e.delta)} in the last hour`}function bhe(e){let t=new Map(e.results.map(e=>[e.id,e])),n=e=>typeof e==`number`&&Number.isFinite(e)?e:null;return e.dashboard.panels.filter(e=>e.viz===`stat`||e.viz===`gauge`).map(e=>{let r=t.get(e.id),i=r?.status===`ok`;return{id:e.id,title:r?.title||e.title,viz:e.viz,panel:e,value:i?n(r.frame?.rows[0]?.[0]):null,unit:e.unit??r?.frame?.columns[0]?.unit,total:i?n(r.total):null,caption:i&&e.caption?n(r.caption):null,trend:i?r.trend:void 0,max:e.max,error:r?.status===`error`?r.message??`This panel could not run.`:void 0,behavior:U1(e)}})}var xhe={attention:{waiting:[],review:[],stuck:[]},polls:{}};function n0(e,t){return e.machines.map(n=>{let r=Object.fromEntries(G1.map(t=>[t,e.sessions.filter(e=>e.machine===n.id&&e.state===t).length]));return{id:n.id,name:n.name,local:n.local,reachable:n.reachable,sessions:r,memory:{used:n.memoryUsed,total:n.memoryTotal},polls:t[n.id]??[],seenAt:n.lastSeen}})}function She(e,t,n){let r=t?n0(t,n.polls):[];return{tiles:bhe(e).map(e=>e.behavior.attention?{...e,trend:n.attention[e.behavior.attention]}:e),localMachine:r.find(t=>t.local||t.id===e.local_machine)?.name??e.local_machine??`this machine`,machines:r,checkedAt:e.observed_at}}function Che(e,t){return Object.fromEntries(t.filter(t=>(e.polls[t.id]?.length??0)>1).map(t=>{let n=e.polls[t.id],r=n.map((e,t)=>({state:e===`quiet`?null:e,label:`poll ${t+1} of ${n.length} · ${e===`offline`?`unreachable`:e===`quiet`?`no sessions`:e}`}));return[t.id,{cells:r,from:`${n.length} polls`,to:`now`,label:`${t.name}, last ${n.length} polls`}]}))}function r0(e){if(!e)return xhe;let t=e.history.attention??[],n={};for(let t of e.history.polls??[])(n[t.machine_id]??=[]).push(t.state);return{attention:Object.fromEntries(X1.map(e=>[e,t.map(t=>t[e])])),polls:n}}function whe(){return(0,H.jsxs)(o_,{align:`center`,justify:`center`,gap:6,style:{flex:1},py:`xl`,children:[(0,H.jsx)(E_,{variant:`light`,color:`gray`,radius:`xl`,size:36,children:(0,H.jsx)(Fv,{size:18,"aria-hidden":!0})}),(0,H.jsx)(q,{fw:600,fz:`md`,children:`No machines yet`}),(0,H.jsx)(q,{fz:`sm`,c:`dimmed`,ta:`center`,maw:420,style:{textWrap:`pretty`},children:`Start an agent in a terminal on this machine, or pair another one; the fleet appears here within a few seconds.`})]})}var i0={working:`success`,waiting:`warning`,stuck:`danger`,idle:`info`,finished:`neutral`};function a0(e){return e===`neutral`?`var(--driga-control-border)`:`var(--mantine-color-${e}-filled)`}function o0(e){return a0(i0[e])}function s0(e){let t=e.startsWith(`~`),n=e.replace(/^~/,``);return{state:Object.hasOwn(K1,n)?n:void 0,label:n,inferred:t}}function c0({state:e,variant:t=`dot`,label:n,inferred:r,evidence:i,pulse:a,tone:o}){let s=o??(e?i0[e]:`neutral`),c=(n??(e?K1[e]:``)).replace(/^~/,``),l=i?.trim(),u=r?`${c}, inferred`:c,d=a0(s),f=e===`finished`?(0,H.jsx)(Dv,{size:12,weight:`regular`,"aria-hidden":!0,style:{color:`var(--driga-muted)`,flex:`none`}}):(0,H.jsx)(G,{"aria-hidden":!0,className:a&&e===`waiting`?`w-pulse`:void 0,style:{width:6,height:6,borderRadius:`50%`,flex:`none`,background:e===`idle`?`transparent`:d,boxShadow:e===`idle`?`inset 0 0 0 1.5px ${d}`:void 0}}),p=t===`pill`?(0,H.jsx)(bm,{variant:`light`,color:s===`neutral`?`gray`:s,size:`md`,radius:`sm`,fw:500,lts:`0.04em`,leftSection:f,"aria-label":u,"aria-description":l,title:l?void 0:u,tabIndex:l?0:void 0,styles:{root:{textTransform:`none`,background:`var(--driga-tint-${s})`,color:`var(--driga-text)`,boxShadow:`inset 0 0 0 1px ${d}`,border:r?`1px dashed var(--driga-muted)`:void 0,paddingInline:6},label:{fontSize:`var(--mantine-font-size-xs)`}},children:c}):(0,H.jsxs)(K,{role:`img`,gap:6,wrap:`nowrap`,"aria-label":u,"aria-description":l,title:l?void 0:u,tabIndex:l?0:void 0,style:{display:`inline-flex`},children:[f,(0,H.jsx)(q,{size:`xs`,fw:500,lh:1.2,style:{whiteSpace:`nowrap`,borderBottom:r&&l?`1px dashed var(--driga-faint)`:void 0},children:r&&c!==`unknown`?`~${c}`:c})]});return l?(0,H.jsx)(Bg,{label:l,multiline:!0,w:280,events:{hover:!0,focus:!0,touch:!0},children:p}):p}var l0={waiting:{label:`waiting`,tone:i0.waiting,rank:0},stuck:{label:`stuck`,tone:i0.stuck,rank:1},working:{label:`working`,tone:i0.working,rank:2},idle:{label:`idle`,tone:i0.idle,rank:3},finished:{label:`finished`,tone:i0.finished,rank:4}};function u0(e){return[...e].sort((e,t)=>Number(!!t.local)-Number(!!e.local)||e.name.localeCompare(t.name))}function d0(e,t){return l0[e.state].rank-l0[t.state].rank||e.title.localeCompare(t.title)}function The(){return{waiting:0,stuck:0,working:0,idle:0,finished:0}}function Ehe(e){let t=The();for(let n of e)t[n.state]++;return t}function f0(e){return e.filter(e=>e.state===`waiting`||e.state===`stuck`).length}function Dhe({machines:e,projects:t,sessions:n}){let r=new Map(t.map(e=>[e.id,e]));return u0(e).map(e=>{let t=n.filter(t=>t.machine===e.id),i=new Map;for(let e of t)i.set(e.project,[...i.get(e.project)??[],e]);return{machine:e,projects:[...i.entries()].map(([e,t])=>({project:r.get(e)??{id:e,name:e,repo:``},sessions:t.sort(d0),memory:t.reduce((e,t)=>e+t.memory,0),waiting:t.some(e=>e.state===`waiting`)})).sort((e,t)=>e.project.name.localeCompare(t.project.name)),memory:t.reduce((e,t)=>e+t.memory,0),counts:Ehe(t)}})}function Ohe(e){let t=new Map(e.map(e=>[e,new Map])),n=new Map;for(let r of e)for(let e of new Set(r.files??[])){let i=JSON.stringify([r.machine,r.project,e]),a=n.get(i)??[];for(let n of a)for(let[i,a]of[[r,n],[n,r]]){let n=t.get(i),r=n.get(a)??[];r.push(e),n.set(a,r)}a.push(r),n.set(i,a)}return new Map([...t].map(([e,t])=>[e,[...t].map(([e,t])=>({with:e,files:t}))]))}function p0(e){return JSON.stringify([e.machine,e.id])}function khe(e){try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&t.every(e=>typeof e==`string`))return{kind:`session`,machine:t[0],id:t[1]}}catch{}return null}var m0=class{data;groups;machines;projects;sessions=new Map;childrenByParent=new Map;projectMembers=new Map;shared;constructor(e){this.data=e;for(let t of e.sessions){this.sessions.set(p0(t),t);let e=this.projectMembers.get(t.project)??[];if(e.push(t),this.projectMembers.set(t.project,e),t.parent){let e=p0({machine:t.machine,id:t.parent}),n=this.childrenByParent.get(e)??[];n.push(t),this.childrenByParent.set(e,n)}}for(let e of this.childrenByParent.values())e.sort(d0);this.groups=Dhe(e),this.machines=u0(e.machines),this.projects=[...this.projectMembers.keys()].map(e=>this.project(e)??{id:e,name:e,repo:``}).sort((e,t)=>e.name.localeCompare(t.name)),this.shared=Ohe(e.sessions)}session(e,t){if(t!==void 0)return this.sessions.get(p0({machine:t,id:e}));let n=this.data.sessions.filter(t=>t.id===e);return n.length===1?n[0]:void 0}machine(e){return this.data.machines.find(t=>t.id===e)}project(e){return this.data.projects.find(t=>t.id===e)}projectSessions(e){return this.projectMembers.get(e)??[]}projectMachines(e){let t=new Set(this.projectSessions(e).map(e=>e.machine));return this.machines.filter(e=>t.has(e.id))}parent(e){return e.parent?this.session(e.parent,e.machine):void 0}children(e){return this.childrenByParent.get(p0(e))??[]}roots(e,t){return this.projectSessions(t).filter(t=>t.machine===e&&!this.parent(t)).sort(d0)}overlaps(e){return this.shared.get(this.session(e.id,e.machine))??[]}branch(e){let t=[],n=(e,r,i)=>{let a=p0(e);if(i.has(a))return;t.push({session:e,depth:r});let o=new Set(i).add(a);for(let t of this.children(e))n(t,r+1,o)};return n(e,0,new Set),t}};function Ahe(e){let t=(e.turns??[]).slice(-30);return{ok:t.filter(e=>e===`ok`).length,waited:t.filter(e=>e===`waited`).length,failed:t.filter(e=>e===`failed`).length,total:t.length}}function jhe(e){let t=(e.turns??[]).slice(-30),n=30-t.length,r={ok:`working`,waited:`waiting`,failed:`stuck`};return Array.from({length:30},(e,i)=>ie.project)).size;return(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,style:{flex:`none`},children:[(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,align:`baseline`,style:{minWidth:0},children:[(0,H.jsx)(k_,{order:1,fz:28,fw:650,lh:1.2,style:{letterSpacing:`-0.02em`},children:`Fleet`}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[M1(e.length,`machine`),` · `,M1(i,`project`),` · `,M1(t.length,`session`)]}),r>0&&(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,fw:600,c:`warning`,style:{whiteSpace:`nowrap`},children:[`· `,r,` need you`]})]}),(0,H.jsx)(K,{gap:`xs`,wrap:`nowrap`,children:n})]})}function g0(e,[t,n]=[.7,.9]){return e>=n?`danger`:e>=t?`warning`:`brand`}function _0({value:e,max:t,format:n,label:r,thresholds:i=[.7,.9],size:a=4,caption:o=!0}){let s=t>0?Math.min(1,Math.max(0,e/t)):0,c=Math.round(s*100),l=g0(s,i),u=`${r}: ${n(e)} of ${n(t)}, ${c}%`;return(0,H.jsxs)(o_,{gap:4,children:[o&&(0,H.jsxs)(K,{justify:o===`percent`?`flex-end`:`space-between`,gap:`xs`,wrap:`nowrap`,"aria-hidden":!0,children:[o!==`percent`&&(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:[n(e),` `,(0,H.jsxs)(q,{span:!0,c:`dimmed`,ff:`monospace`,fz:`inherit`,children:[`/ `,n(t)]})]}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,c:l===`brand`?`dimmed`:l,lh:1.2,children:[c,`%`]})]}),(0,H.jsxs)(G,{pos:`relative`,py:2,children:[(0,H.jsx)(Ng.Root,{size:a,styles:{root:{background:`var(--driga-border)`}},children:(0,H.jsx)(Ng.Section,{value:s*100,color:l,"aria-label":u})}),i.map(e=>(0,H.jsx)(G,{"aria-hidden":!0,pos:`absolute`,top:0,h:a+4,w:1,left:`${e*100}%`,style:{background:`var(--driga-control-border)`}},e))]})]})}var v0={light:Ry.latte,dark:Ry.mocha},Fhe={light:{claude:v0.light.peach,codex:v0.light.teal,gemini:v0.light.sapphire,copilot:v0.light.sky,agy:v0.light.pink},dark:{claude:v0.dark.peach,codex:v0.dark.teal,gemini:v0.dark.sapphire,copilot:v0.dark.sky,agy:v0.dark.pink}};function Ihe(e,t){let n=J1(t);if(!n)return{tint:`var(--driga-tint-neutral)`,ring:`var(--driga-border)`,ink:`var(--driga-muted)`};let r=Fhe[e][n];return{tint:Dn(r,.16),ring:Dn(r,.4),ink:e===`dark`?r:wn(r,.3)}}var Lhe={claude:Cy,codex:kv,gemini:Lv,copilot:$v,agy:Gte};function y0({agent:e,name:t,waiting:n,size:r=20}){let i=Ihe(Yn(`dark`),e),a=J1(e),o=a?Lhe[a]:qte,s=`${Y1(e)||`agent`}${n?`, waiting on you`:``}`,c=(0,H.jsx)(G,{"aria-hidden":!0,style:{width:r,height:r,borderRadius:`50%`,background:i.tint,boxShadow:`inset 0 0 0 1px ${i.ring}`,color:i.ink,display:`grid`,placeItems:`center`,flex:`none`},children:(0,H.jsx)(o,{size:Math.round(r*.6),weight:`regular`})}),l=n?(0,H.jsx)(ch,{color:`warning`,size:7,offset:1,withBorder:!0,children:c}):c;return t?(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,title:s,style:{display:`inline-flex`},children:[l,(0,H.jsx)(q,{size:`xs`,lh:1.2,style:{whiteSpace:`nowrap`},children:Y1(e)||`agent`}),n&&(0,H.jsx)(`span`,{className:`sr-only`,children:`, waiting on you`})]}):(0,H.jsx)(G,{role:`img`,"aria-label":s,title:s,style:{display:`inline-flex`,flex:`none`},children:l})}function Rhe({segments:e,total:t,marker:n,format:r,label:i,size:a=8}){let o=Yn(`dark`),s=t??e.reduce((e,t)=>e+t.value,0),c=e=>s>0?Math.round(Math.min(100,e/s*100)*100)/100:0,l=(e,t)=>e.color===`brand`?`var(--mantine-color-brand-filled)`:typeof e.color==`string`?o0(e.color):Wy[o][e.color??t]??`var(--driga-faint)`,u=n?c(n.value):0;return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsxs)(G,{pos:`relative`,pt:n?18:0,children:[(0,H.jsx)(Ng.Root,{size:a,styles:{root:{background:`var(--driga-border)`}},children:e.map((e,t)=>(0,H.jsx)(Ng.Section,{value:c(e.value),color:l(e,t),"aria-label":`${e.label}: ${r(e.value)}`,style:{boxShadow:`inset -1px 0 0 var(--driga-raised)`}},e.label))}),n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(G,{"aria-hidden":!0,pos:`absolute`,bottom:-3,h:a+6,w:2,left:`${u}%`,style:{background:`var(--driga-text)`,transform:`translateX(-1px)`,borderRadius:1}}),(0,H.jsx)(q,{"aria-hidden":!0,pos:`absolute`,top:0,size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,style:u>75?{right:0,whiteSpace:`nowrap`}:{left:`${u}%`,transform:`translateX(-50%)`,whiteSpace:`nowrap`},children:n.label})]})]}),(0,H.jsxs)(K,{gap:`md`,role:`list`,"aria-label":i,children:[e.map((e,t)=>(0,H.jsxs)(K,{role:`listitem`,gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:8,color:l(e,t),withShadow:!1,"aria-hidden":!0}),(0,H.jsx)(q,{size:`xs`,lh:1.2,children:e.label}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1.2,children:r(e.value)})]},e.label)),n&&(0,H.jsxs)(q,{role:`listitem`,size:`xs`,c:`dimmed`,lh:1.2,children:[n.label,` at `,r(n.value)]})]})]})}function b0({n:e,unit:t,size:n=28,total:r,lineHeight:i=1.1}){if(typeof e!=`number`)return(0,H.jsx)(q,{ff:`monospace`,fz:n,fw:600,lh:i,c:`dimmed`,children:`—`});let[a,o]=x0(A1(e,t));if(typeof r==`number`){let[a,o]=x0(A1(r,t)),[s]=x0(t===`bytes`?zhe(e,r):A1(e,t));return(0,H.jsxs)(q,{ff:`monospace`,fz:n,fw:600,lh:i,style:{fontVariantNumeric:`tabular-nums`},children:[s,(0,H.jsxs)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,mx:3,children:[`/ `,a]}),o&&(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,children:o})]})}return(0,H.jsxs)(q,{ff:`monospace`,fz:n,fw:600,lh:i,style:{fontVariantNumeric:`tabular-nums`},children:[a,o&&(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,ml:3,children:o})]})}function zhe(e,t){let n=e/1024**Math.max(0,Math.min(4,Math.floor(Math.log(Math.max(t,1))/Math.log(1024))));return n>=10?String(Math.round(n)):n.toFixed(1)}function x0(e){let t=/^([$]?[\d.,]+)\s*(.*)$/.exec(e);return t?[t[1],t[2]]:[e,``]}function S0({trend:e,title:t,color:n,window:r=`hour`}){let i=(0,h.useCallback)(i=>nhe(e,t,i,n,r),[e,t,n,r]);return(0,H.jsx)(B1,{option:i,label:`${t} over the last ${r}`,small:!0})}function Bhe(e){let t=new Map;for(let n of e){let e=n.state===`offline`?`unseen`:n.state?K1[n.state]:`quiet`;t.set(e,(t.get(e)??0)+1)}return[...t.entries()].map(([e,t])=>`${t} ${e}`).join(`, `)}function C0({cells:e,label:t,summary:n,from:r,to:i,height:a=12}){let[o,s]=(0,h.useState)(null),c=(0,h.useRef)(null),l=t=>{if(!c.current||!e.length)return;let n=c.current.getBoundingClientRect();n.width<=0?s(null):s(Math.min(e.length-1,Math.max(0,Math.floor((t.clientX-n.left)/n.width*e.length))))},u=n??Bhe(e);return(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(Bg.Floating,{label:o===null?u:e[o]?.label??u,offset:10,children:(0,H.jsx)(G,{ref:c,role:`img`,"aria-label":`${t}: ${u}`,onMouseMove:l,onMouseLeave:()=>s(null),style:{display:`flex`,gap:1,height:a,cursor:`default`},children:e.map((e,t)=>(0,H.jsx)(`div`,{className:`w-cell`,"data-state":e.state??void 0,style:o===t?{outline:`1px solid var(--driga-text)`,outlineOffset:0}:void 0},t))})}),(r||i)&&(0,H.jsxs)(K,{justify:`space-between`,gap:`xs`,"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:r}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:i})]})]})}var Vhe={desktop:Fv,laptop:dy,server:ay};function Hhe({data:e,selection:t,onSelect:n,onOpen:r,onReply:i,width:a=320}){let o=new m0(e),s=t&&(t.kind===`session`?o.session(t.id,t.machine):t.kind===`machine`?o.machine(t.id):o.project(t.id));return(0,H.jsx)(Im,{role:`group`,"aria-label":`Inspector`,w:{base:`100%`,lg:a},padding:`sm`,style:{flex:`none`,display:`flex`,flexDirection:`column`,minHeight:0},children:(0,H.jsx)(Yc,{type:`auto`,scrollbarSize:4,style:{flex:1,minHeight:0},children:!t||!s?(0,H.jsx)(Uhe,{}):t.kind===`session`?(0,H.jsx)(Whe,{session:s,relationships:o,onSelect:n,onOpen:r,onReply:i}):t.kind===`machine`?(0,H.jsx)(Ghe,{group:o.groups.find(e=>e.machine.id===t.id),onSelect:n}):(0,H.jsx)(Khe,{project:s,relationships:o,onSelect:n})})})}function Uhe(){return(0,H.jsxs)(o_,{align:`center`,justify:`center`,gap:4,py:`xl`,px:`sm`,children:[(0,H.jsx)(q,{fw:600,fz:`sm`,children:`Nothing selected`}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ta:`center`,style:{textWrap:`pretty`},children:`Select a session or a machine to see its details and actions here.`})]})}function w0({children:e}){return(0,H.jsx)(q,{fz:`xs`,fw:600,c:`dimmed`,children:e})}function T0({session:e,onSelect:t,extra:n}){return(0,H.jsx)($c,{className:`fleet-row-title`,onClick:()=>t({kind:`session`,id:e.id,machine:e.machine}),px:4,py:2,children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:6,color:a0(l0[e.state].tone),withShadow:!1,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,truncate:!0,title:e.title,children:e.title}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`},children:n??e.label??l0[e.state].label})]})})}function Whe({session:e,relationships:t,onSelect:n,onOpen:r,onReply:i}){let a=t.project(e.project),o=t.machine(e.machine),s=t.children(e),c=t.parent(e),l=t.overlaps(e),u=e=>l.filter(t=>t.files.includes(e)).map(e=>e.with),d=Math.max(0,Date.now()-Date.parse(e.lastActivity));return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(c0,{variant:`pill`,state:e.state,label:e.label,inferred:e.inferred,evidence:e.evidence}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:[`#`,e.id]})]}),(0,H.jsx)(k_,{order:2,fz:`md`,lh:1.3,style:{textWrap:`balance`,letterSpacing:`-0.01em`},children:e.title}),(0,H.jsxs)(K,{gap:8,wrap:`wrap`,children:[(0,H.jsx)(y0,{agent:e.agent,name:!0,size:16}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:a?.name??e.project}),e.branch&&(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,children:[(0,H.jsx)(Zv,{size:12,"aria-hidden":!0}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:e.branch})]}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:o?.name??e.machine})]}),e.waiting&&(0,H.jsxs)(K,{className:`w-needs-you`,gap:8,wrap:`nowrap`,align:`flex-start`,px:`xs`,py:6,role:`status`,children:[(0,H.jsx)(ty,{size:16,"aria-hidden":!0,style:{color:`var(--mantine-color-warning-filled)`,flex:`none`,marginTop:1}}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(q,{fz:`xs`,fw:600,children:`Needs you`}),(0,H.jsx)(q,{fz:`xs`,style:{overflowWrap:`anywhere`},children:e.waiting})]})]}),e.evidence&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,children:e.evidence}),o&&!o.reachable&&(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,children:[`Last known: `,o.name,` was last seen `,O1(o.lastSeen),`.`]}),e.lastTool&&(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,className:`w-inset`,truncate:!0,title:`${e.lastTool} · ${O1(e.lastActivity)}`,style:{display:`block`},children:[e.lastTool,` · `,O1(e.lastActivity)]}),(0,H.jsxs)(K,{gap:6,children:[!!e.turns?.length&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:M1(e.turns.length,`turn`)}),!!e.files?.length&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:M1(e.files.length,`file`)}),(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:E1(e.memory)})]}),e.turns&&e.turns.length>0&&(0,H.jsx)(C0,{cells:jhe(e),label:`Last 30 turns`,summary:Mhe(e),height:8,to:`turn ${Math.min(30,e.turns.length)}`,from:e.turns.length>30?`turn ${e.turns.length-29}`:`turn 1`}),e.files&&e.files.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Files`}),e.files.map(e=>{let t=u(e);return(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,truncate:!0,title:e,children:e}),t.length>0&&(0,H.jsxs)(bm,{color:`danger`,variant:`light`,size:`xs`,style:{flex:`none`,background:`var(--driga-tint-danger)`,color:`var(--driga-text)`},title:`Also edited by ${t.map(e=>e.title).join(`, `)}`,children:[`also #`,t.map(e=>e.id).join(`, #`)]})]},e)})]}),s.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Subagents`}),s.map(e=>(0,H.jsx)(T0,{session:e,onSelect:n},`${e.machine}/${e.id}`))]}),c&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Spawned by`}),(0,H.jsx)(T0,{session:c,onSelect:n})]}),(0,H.jsxs)(K,{gap:`xs`,mt:4,children:[e.state===`waiting`&&(0,H.jsx)(km,{onClick:()=>i(e),children:`Reply`}),(0,H.jsx)(km,{variant:`default`,onClick:()=>r(e),children:`Open`})]}),(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,title:e.started?`Started ${k1(e.started)}`:void 0,children:[e.started?`started ${O1(e.started)} · `:``,`quiet `,D1(d)]})]})}function Ghe({group:e,onSelect:t}){let{machine:n,counts:r}=e,i=Vhe[n.kind??`desktop`],a=n.memoryTotal>0?Math.round(n.memoryUsed/n.memoryTotal*100):0,o=W1.reduce((e,t)=>e+r[t],0);return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(i,{size:16,"aria-hidden":!0}),(0,H.jsx)(k_,{order:2,fz:`md`,ff:`monospace`,lh:1.6,children:n.name}),n.local&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,children:`local`})]}),(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:7,color:n.reachable?`var(--mantine-color-success-filled)`:`transparent`,withShadow:!1,"aria-hidden":!0,style:{border:n.reachable?void 0:`1px solid var(--driga-muted)`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,title:k1(n.lastSeen),children:Phe(n)})]}),(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(w0,{children:`Memory`}),(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,align:`baseline`,children:[(0,H.jsx)(b0,{n:n.memoryUsed,unit:`bytes`,total:n.memoryTotal,size:22}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:[a,`% used`,n.reachable?``:`, last known`]})]}),(0,H.jsx)(Ng,{value:a,size:4,color:`var(--driga-control-border)`,"aria-label":`Memory used ${a}%`}),n.memoryByRole&&n.memoryByRole.length>0&&(0,H.jsx)(Rhe,{label:`Agent memory on ${n.name} by owner`,segments:n.memoryByRole,total:n.memoryTotal,format:E1,size:6})]}),n.cpuPercent!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(w0,{children:`CPU`}),(0,H.jsx)(_0,{value:n.cpuPercent,max:100,format:e=>`${Math.round(e)}%`,label:`CPU on ${n.name}`})]}),!!n.diskTotal&&n.diskFree!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(w0,{children:`Disk`}),(0,H.jsx)(_0,{value:Math.max(0,n.diskTotal-n.diskFree),max:n.diskTotal,format:E1,label:`Disk on ${n.name}`})]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Sessions`}),o===0&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,children:`None`}),W1.filter(e=>r[e]>0).map(e=>(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:6,color:a0(l0[e].tone),withShadow:!1,"aria-hidden":!0}),(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,children:[r[e],` `,l0[e].label]})]},e))]}),e.projects.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Projects`}),e.projects.map(e=>(0,H.jsx)($c,{className:`fleet-row-title`,px:4,py:2,onClick:()=>t({kind:`project`,id:e.project.id}),children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:e.project.name}),(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,children:[M1(e.sessions.length,`session`),` · `,E1(e.memory)]})]})},e.project.id))]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Leftover`}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:n.leftover?`${M1(n.leftover.processes,`process`)} · ${E1(n.leftover.memory)} reclaimable`:`none`})]})]})}function Khe({project:e,relationships:t,onSelect:n}){let r=t.projectMachines(e.id),i=t.projectSessions(e.id);return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsx)(k_,{order:2,fz:`md`,ff:`monospace`,lh:1.6,children:e.name}),e.repo&&(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,truncate:!0,title:e.repo,children:e.repo}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Machines`}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:r.length?r.map(e=>e.name).join(` · `):`none`})]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(w0,{children:`Sessions`}),i.map(e=>(0,H.jsx)(T0,{session:e,onSelect:n,extra:`${e.label??l0[e.state].label} · ${t.machine(e.machine)?.name??e.machine}`},`${e.machine}/${e.id}`))]})]})}function E0({value:e,max:t,format:n,label:r,caption:i,thresholds:a,size:o=44,thickness:s=4}){let c=t>0?Math.min(1,Math.max(0,e/t)):0,l=Math.round(c*100),u=g0(c,a),d=i??`${n(e)} / ${n(t)}`,f=o*.9-3*Math.min(s||12,o/4),p=Math.min(11,Math.max(0,f)*.85/((o>36?4:3)*.7));return(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,children:[(0,H.jsx)(Wg,{size:o,thickness:s,rootColor:`var(--driga-border)`,sections:[{value:l,color:u}],role:`img`,"aria-label":`${r}: ${d}, ${l}%`,style:{flex:`none`},label:(0,H.jsxs)(q,{ta:`center`,fz:p,ff:`monospace`,fw:400,lh:1,"aria-hidden":!0,children:[l,o>36&&`%`]})}),(0,H.jsxs)(o_,{gap:2,style:{minWidth:0},"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`sm`,fw:500,lh:1.2,truncate:!0,title:r,children:r}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:d})]})]})}var qhe={desktop:Fv,laptop:dy,server:ay};function Jhe({machine:e,selected:t,onSelect:n,onOpen:r,onReclaim:i}){let a=Date.now(),o=qhe[e.kind??`desktop`],s=a-Date.parse(e.lastSeen),c=!e.reachable&&s>6e5,l=()=>r?.(e),u=e=>{e.target.closest(`button, a`)||l()},d=e=>{e.key===`Enter`&&e.target===e.currentTarget&&(e.preventDefault(),l())},f=e.leftover.trees===0?`nothing left over`:`${e.leftover.trees} leftover · ${E1(e.leftover.bytes)} reclaimable`,p=(0,H.jsxs)(o_,{gap:8,children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{minWidth:0},children:[(0,H.jsx)(o,{size:16,"aria-hidden":!0,style:{color:`var(--driga-muted)`,flex:`none`}}),(0,H.jsx)(q,{size:`md`,fw:600,ff:`monospace`,lh:1.2,truncate:!0,title:e.name,style:{minWidth:0},children:e.name}),e.local&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,fw:500,styles:{root:{textTransform:`none`,flex:`none`}},children:`local`}),e.tls&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,fw:500,styles:{root:{textTransform:`none`,flex:`none`}},children:`mTLS`})]}),(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{flex:`none`},title:k1(e.lastSeen),children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:6,height:6,borderRadius:`50%`,background:e.reachable?`var(--mantine-color-success-filled)`:`transparent`,boxShadow:e.reachable?void 0:`inset 0 0 0 1.5px var(--driga-faint)`}}),(0,H.jsx)(q,{size:`xs`,lh:1.2,c:c?`danger`:`dimmed`,fw:c?500:void 0,style:{whiteSpace:`nowrap`},children:e.reachable?`reachable`:`last seen ${D1(s)} ago`})]})]}),e.cpuPercent!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,children:`CPU`}),(0,H.jsx)(_0,{value:e.cpuPercent,max:100,format:e=>`${Math.round(e)}%`,label:`CPU on ${e.name}`,caption:`percent`})]}),e.diskTotal&&e.diskFree!==void 0?(0,H.jsxs)(K,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Pressure`,children:[(0,H.jsx)(E0,{value:e.memUsed,max:e.memTotal,format:E1,label:`Memory`,caption:E1(e.memUsed),size:36}),(0,H.jsx)(E0,{value:Math.max(0,e.diskTotal-e.diskFree),max:e.diskTotal,format:E1,label:`Disk`,caption:E1(e.diskTotal-e.diskFree),size:36})]}):(0,H.jsx)(_0,{value:e.memUsed,max:e.memTotal,format:E1,label:`Memory on ${e.name}`}),(0,H.jsxs)(K,{gap:10,wrap:`nowrap`,role:`group`,"aria-label":G1.map(t=>`${e.sessions[t]} ${K1[t]}`).join(`, `),children:[G1.map(t=>(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,title:K1[t],children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:6,height:6,borderRadius:`50%`,background:e.sessions[t]>0?o0(t):`transparent`,boxShadow:e.sessions[t]>0?void 0:`inset 0 0 0 1.5px ${o0(t)}`,opacity:e.sessions[t]>0?1:.5}}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,lh:1,c:e.sessions[t]>0?void 0:`dimmed`,children:e.sessions[t]})]},t)),!e.reachable&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:`last known`})]}),e.strip&&(0,H.jsx)(C0,{cells:e.strip.cells,label:e.strip.label,from:e.strip.from,to:e.strip.to,height:10}),(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`xs`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,truncate:!0,title:f,style:{minWidth:0},children:f}),!n&&i&&e.leftover.trees>0&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,H.jsx)(pv,{size:12}),onClick:()=>i(e),style:{flex:`none`},children:`Reclaim`})]})]}),m=e.reachable?void 0:`dashed`;return n?(0,H.jsx)(il,{component:`button`,type:`button`,withBorder:!0,radius:`md`,p:`sm`,className:`w-row w-card`,"data-clickable":``,"aria-pressed":!!t,onClick:()=>n(e),style:{borderStyle:m,textAlign:`left`,width:`100%`,cursor:`pointer`},children:p}):(0,H.jsx)(il,{withBorder:!0,radius:`md`,p:`sm`,className:`w-row w-card`,"data-clickable":r?``:void 0,"data-selected":t?`true`:void 0,tabIndex:r?0:void 0,onClick:r?u:void 0,onKeyDown:r?d:void 0,style:{borderStyle:m},children:p})}function Yhe({groups:e,strips:t,selected:n,onSelect:r}){return(0,H.jsx)(e_,{minColWidth:280,autoFlow:`auto-fit`,spacing:`sm`,component:`ul`,"aria-label":`Machines`,m:0,p:0,style:{flex:`none`,listStyle:`none`,maxHeight:`min(40vh, 18rem)`,overflowY:`auto`},children:e.map(e=>(0,H.jsx)(`li`,{style:{minWidth:0},children:(0,H.jsx)(Jhe,{machine:Nhe(e,t?.[e.machine.id]),selected:n===e.machine.id,onSelect:e=>r(n===e.id?null:e.id??null)})},e.machine.id))})}function Xhe(e){return Math.max(360,26*e+48)}function Zhe(e){let t=e.dataType===`edge`?e.data?.target:e.name;if(!t)return null;let[n,r]=[t.slice(0,2),t.slice(2)];return n===`m:`||n===`l:`?{kind:`machine`,id:r}:n===`p:`?{kind:`project`,id:r}:n===`s:`?khe(r):null}function D0(e){return e.replace(/[{}|]/g,` `)}function Qhe(e,t){let n={...t.states,brand:t.brand,machine:t.line,leftover:t.muted},r=new m0(e),{groups:i,machines:a,projects:o}=r,s=e.sessions.reduce((e,t)=>e+t.memory,0)+a.reduce((e,t)=>e+(t.leftover?.memory??0),0),c=Math.max(1,s/200),l=[],u=[],d={color:`gradient`,opacity:.22},f={color:n.waiting,opacity:.4};for(let e of i){let r=e.machine,i=e.projects.reduce((e,t)=>e+t.sessions.length,0);l.push({name:`m:${r.id}`,depth:0,text:D0(r.name),tip:`${F1(r.name)}${r.local?` · local`:``}
${r.reachable?`reachable`:`unreachable · last seen ${F1(O1(r.lastSeen))}`}
${F1(E1(r.memoryUsed))} of ${F1(E1(r.memoryTotal))} used · ${M1(i,`session`)}`,itemStyle:{color:n.machine,borderColor:r.reachable?n.machine:t.muted,borderWidth:1,borderType:r.reachable?`solid`:`dashed`},label:{position:`left`,fontFamily:Ky.sans,fontSize:Gy.small+1,fontWeight:600,color:t.text}})}for(let e of o){let i=r.projectMachines(e.id),a=r.projectSessions(e.id);l.push({name:`p:${e.id}`,depth:1,text:D0(e.name),tip:`${F1(e.name)}
${F1(e.repo)}
on ${F1(i.map(e=>e.name).join(`, `))} · ${M1(a.length,`session`)} · ${F1(E1(a.reduce((e,t)=>e+t.memory,0)))}`,itemStyle:{color:Dn(n.brand,.55)},label:{fontFamily:Ky.sans,fontSize:Gy.small,color:t.text}})}for(let e of i){let r=e.machine;r.leftover&&(l.push({name:`l:${r.id}`,depth:1,text:D0(`leftover · ${M1(r.leftover.processes,`proc`)} · ${E1(r.leftover.memory)}`),tip:`Leftover on ${F1(r.name)}
${M1(r.leftover.processes,`process`)} no session owns · ${F1(E1(r.leftover.memory))} reclaimable`,itemStyle:{color:`transparent`,borderColor:n.leftover,borderWidth:1,borderType:`dashed`},label:{fontFamily:Ky.mono,fontSize:Gy.small,color:t.muted}}),u.push({source:`m:${r.id}`,target:`l:${r.id}`,value:Math.max(r.leftover.memory,c),tip:`${F1(r.name)} → leftover: ${F1(E1(r.leftover.memory))}`,lineStyle:{color:n.leftover,opacity:.14}}))}for(let e of o)for(let t of i){let i=t.projects.find(t=>t.project.id===e.id);if(i){u.push({source:`m:${t.machine.id}`,target:`p:${e.id}`,value:Math.max(i.memory,c),tip:`${F1(t.machine.name)} → ${F1(e.name)}: ${F1(E1(i.memory))} in ${M1(i.sessions.length,`session`)}`,lineStyle:i.waiting?f:d});for(let a of i.sessions){let i=r.children(a).length,o=r.overlaps(a),s=`${i?` {dim|↳${i}}`:``}${o.length?` {bang|!}`:``}`;l.push({name:`s:${p0(a)}`,depth:2,text:`${D0(a.title)}${s}{dim| · ${D0(a.agent)} · ${E1(a.memory)}}`,tip:[`${F1(a.title)}`,`${F1(a.label??l0[a.state].label)}${a.inferred?` (inferred)`:``} · ${F1(Y1(a.agent))}${a.branch?` · ${F1(a.branch)}`:``}`,`${F1(e.name)} on ${F1(t.machine.name)} · ${F1(E1(a.memory))}`,a.lastTool?`${F1(a.lastTool)} · ${F1(O1(a.lastActivity))}`:``,a.waiting?F1(a.waiting):``,i?M1(i,`subagent`):``,...o.map(e=>`also editing ${F1(e.files.map(e=>e.slice(e.lastIndexOf(`/`)+1)).join(`, `))} with ${F1(e.with.title)}`)].filter(Boolean).join(`
`),itemStyle:{color:n[a.state]}}),u.push({source:`p:${e.id}`,target:`s:${p0(a)}`,value:Math.max(a.memory,c),tip:`${F1(e.name)} → ${F1(a.title)}: ${F1(E1(a.memory))}`,lineStyle:a.state===`waiting`?f:d})}}}let p=f0(e.sessions);return ihe({nodes:l,links:u,description:`Fleet flow: ${M1(a.length,`machine`)}, ${M1(o.length,`project`)}, ${M1(e.sessions.length,`session`)}, ${p} needing you. Link width is memory, with a minimum width for visibility; node colour is state.`,rich:{dim:{color:t.muted,fontFamily:Ky.mono,fontSize:Gy.small},bang:{color:n.stuck,fontWeight:700,fontFamily:Ky.mono,fontSize:Gy.small}}},t)}var $he={desktop:Fv,laptop:dy,server:ay},O0=20;function ege({data:e,selected:t,onSelect:n,onOpen:r,onReply:i}){let a=new m0(e),o=a.groups,[s,c]=(0,h.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=(e,n)=>t?.kind===e&&t.id===n,d=e=>a.branch(e).map(({session:e,depth:a})=>(0,H.jsx)(rge,{session:e,level:a+2,selected:u(`session`,e.id)&&(!t?.machine||t.machine===e.machine),onSelect:n,onOpen:r,onReply:i},p0(e)));return(0,H.jsx)(C_.ScrollContainer,{minWidth:1032,type:`native`,children:(0,H.jsxs)(C_,{"aria-label":`Fleet tree`,layout:`fixed`,children:[(0,H.jsx)(C_.Thead,{children:(0,H.jsxs)(C_.Tr,{children:[(0,H.jsx)(C_.Th,{w:100,children:`State`}),(0,H.jsx)(C_.Th,{children:`Name`}),(0,H.jsx)(C_.Th,{w:120,children:`Agent`}),(0,H.jsx)(C_.Th,{w:100,children:`Branch`}),(0,H.jsx)(C_.Th,{w:124,ta:`right`,children:`Memory`}),(0,H.jsx)(C_.Th,{w:96,ta:`right`,children:`Last activity`}),(0,H.jsx)(C_.Th,{w:144,children:(0,H.jsx)(tl,{children:`Actions`})})]})}),(0,H.jsx)(C_.Tbody,{children:o.map(e=>{let t=!s.has(e.machine.id);return[(0,H.jsx)(tge,{group:e,open:t,selected:u(`machine`,e.machine.id),onToggle:()=>l(e.machine.id),onSelect:n},e.machine.id),...t?e.projects.flatMap(t=>[(0,H.jsx)(nge,{group:t,selected:u(`project`,t.project.id),onSelect:n},`${e.machine.id}/${t.project.id}`),...a.roots(e.machine.id,t.project.id).flatMap(d)]):[]]})})]})})}function tge({group:e,open:t,selected:n,onToggle:r,onSelect:i}){let a=e.machine,o=$he[a.kind??`desktop`],s=e.projects.reduce((e,t)=>e+t.sessions.length,0);return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":n,children:[(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:7,color:a.reachable?`var(--mantine-color-success-filled)`:`transparent`,withShadow:!1,"aria-hidden":!0,style:{border:a.reachable?void 0:`1px solid var(--driga-muted)`,flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,truncate:!0,title:a.reachable?`reachable`:`last seen ${O1(a.lastSeen)}`,children:a.reachable?`reachable`:`seen ${O1(a.lastSeen)}`})]})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(lu,{size:`sm`,"aria-label":`${t?`Collapse`:`Expand`} ${a.name}`,"aria-expanded":t,onClick:r,children:t?(0,H.jsx)(hv,{size:14}):(0,H.jsx)(_v,{size:14})}),(0,H.jsx)(o,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)($c,{className:`fleet-row-title`,miw:0,onClick:()=>i({kind:`machine`,id:a.id}),"aria-pressed":n,children:(0,H.jsx)(q,{fz:`sm`,fw:600,ff:`monospace`,truncate:!0,title:a.name,children:a.name})}),a.local&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,style:{flex:`none`},children:`local`}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:M1(s,`session`)})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,style:{whiteSpace:`nowrap`},children:[E1(a.memoryUsed),(0,H.jsxs)(q,{span:!0,fz:`xs`,ff:`monospace`,c:`dimmed`,children:[` / `,E1(a.memoryTotal)]})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{})]})}function nge({group:e,selected:t,onSelect:n}){return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":t,children:[(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,pl:O0,children:[(0,H.jsx)(qv,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)($c,{className:`fleet-row-title`,miw:0,onClick:()=>n({kind:`project`,id:e.project.id}),"aria-pressed":t,children:(0,H.jsx)(q,{fz:`sm`,fw:500,ff:`monospace`,truncate:!0,title:e.project.name,children:e.project.name})}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:M1(e.sessions.length,`session`)})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,children:E1(e.memory)})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{})]})}function rge({session:e,level:t,selected:n,onSelect:r,onOpen:i,onReply:a}){return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":n,children:[(0,H.jsx)(C_.Td,{children:(0,H.jsx)(c0,{state:e.state,label:e.label,inferred:e.inferred,evidence:e.evidence})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,pl:O0*t,style:{minWidth:0},children:[t>2&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,"aria-hidden":!0,style:{flex:`none`},children:`↳`}),(0,H.jsx)($c,{className:`fleet-row-title`,onClick:()=>r({kind:`session`,id:e.id,machine:e.machine}),"aria-pressed":n,style:{minWidth:0},children:(0,H.jsx)(q,{fz:`sm`,truncate:!0,title:e.title,children:e.title})}),(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:[`#`,e.id]})]})}),(0,H.jsx)(C_.Td,{children:(0,H.jsx)(y0,{agent:e.agent,name:!0,size:16})}),(0,H.jsx)(C_.Td,{children:e.branch&&(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,children:[(0,H.jsx)(Zv,{size:12,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,truncate:!0,title:e.branch,children:e.branch})]})}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:E1(e.memory)})}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,title:k1(e.lastActivity),children:O1(e.lastActivity)})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:2,wrap:`nowrap`,justify:`flex-end`,className:`fleet-row-actions`,children:[e.state===`waiting`&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,style:{flex:`none`,whiteSpace:`nowrap`},"aria-label":`Reply to ${e.title}`,onClick:()=>a(e),children:`Reply`}),(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,style:{flex:`none`,whiteSpace:`nowrap`},"aria-label":`Open ${e.title}`,onClick:()=>i(e),children:`Open`})]})})]})}var ige=[{value:`flow`,label:`Flow`},{value:`tree`,label:`Tree`}];function age({machines:e,projects:t,sessions:n,strips:r,selected:i,defaultSelected:a,onSelect:o,onOpen:s,onReply:c,mode:l,defaultMode:u,onModeChange:d}){let f=(0,h.useMemo)(()=>({machines:e,projects:t,sessions:n}),[e,t,n]),[p,m]=oe({value:i,defaultValue:a,finalValue:null,onChange:o}),[g,_]=oe({value:l,defaultValue:u,finalValue:`flow`,onChange:d}),v=(0,h.useMemo)(()=>new m0(f).groups,[f]),y=p?.kind===`machine`&&e.some(e=>e.id===p.id)?p.id:null;(0,h.useEffect)(()=>{p?.kind===`machine`&&!e.some(e=>e.id===p.id)&&m(null)},[e,p,m]);let b=(0,h.useMemo)(()=>y?{machines:f.machines.filter(e=>e.id===y),projects:f.projects,sessions:f.sessions.filter(e=>e.machine===y)}:f,[f,y]),x=(0,h.useCallback)(e=>Qhe(b,e),[b]),S=(0,h.useCallback)((e,t)=>{let n=Zhe(t);n&&m(n)},[m]);return e.length?(0,H.jsxs)(o_,{gap:`sm`,h:`100%`,style:{minHeight:0},children:[(0,H.jsx)(h0,{...f,children:(0,H.jsx)(qg,{size:`xs`,value:g,onChange:e=>_(e),data:ige,"aria-label":`View`})}),(0,H.jsx)(Yhe,{groups:v,strips:r,selected:y,onSelect:e=>m(e?{kind:`machine`,id:e}:null)}),(0,H.jsxs)(xf,{className:`fleet-body`,direction:{base:`column`,lg:`row`},align:`stretch`,wrap:`nowrap`,gap:`sm`,role:`region`,"aria-label":`Fleet`,tabIndex:0,children:[(0,H.jsx)(Im,{padding:`sm`,className:`fleet-chart`,role:`region`,"aria-label":`Fleet flow`,tabIndex:0,children:g===`flow`?(0,H.jsxs)(o_,{gap:4,style:{flex:1,minHeight:0},children:[b.sessions.length?(0,H.jsx)(G,{style:{flex:1,minHeight:Xhe(b.sessions.length),display:`flex`,flexDirection:`column`},children:(0,H.jsx)(B1,{option:x,label:`Fleet flow from machines through projects to sessions`,height:`100%`,onEvent:S})}):(0,H.jsx)(q,{fz:`sm`,c:`dimmed`,py:`xl`,ta:`center`,children:`No sessions on this machine right now.`}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,style:{flex:`none`},children:`width = memory (minimum shown) · colour = state`})]}):(0,H.jsx)(ege,{data:b,selected:p,onSelect:m,onOpen:s,onReply:c})}),(0,H.jsx)(Hhe,{data:f,selection:p,onSelect:m,onOpen:s,onReply:c})]})]}):(0,H.jsxs)(o_,{gap:`sm`,h:`100%`,children:[(0,H.jsx)(h0,{...f}),(0,H.jsx)(whe,{})]})}var oge={name:`Fleet`,panels:[{id:`machines`,title:`Machines`,viz:`table`,source:`machines`,limit:200},{id:`sessions`,title:`Sessions`,viz:`table`,source:`sessions`,limit:200},{id:`flow`,title:`Flow`,viz:`table`,source:`flow`,columns:[`id`,`parent_id`,`started_at`,`ended_at`,`last_tool`,`reason`,`machine_id`],limit:200},{id:`orphans`,title:`Leftover`,viz:`table`,source:`orphans`,limit:200},{id:`projects`,title:`Projects`,viz:`table`,source:`projects`,limit:200},{id:`memory`,title:`Memory by role`,viz:`table`,source:`memory`,limit:200},{id:`heatmap`,title:`Tool calls by project`,viz:`timeseries`,source:`activity_heatmap`,by:`project`,measure:`sum:tool_calls`}]},k0=e=>e==null?``:String(e),A0=e=>typeof e==`number`?e:0,j0=e=>typeof e==`number`?e:void 0,M0=(e,t)=>JSON.stringify([k0(e),k0(t)]);function sge(e){try{let t=JSON.parse(k0(e));return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function cge(e){let t=s0(e);return t.state?{state:t.state,inferred:t.inferred}:t.label===`dead`?{state:`stuck`,label:`dead`,inferred:!0}:{state:`idle`,label:t.label||void 0,inferred:!0}}function N0(e,t){let n=t=>gS(e.results.find(e=>e.id===t)?.frame),r=Date.parse(e.observed_at)||Date.now(),i=new Map;for(let e of n(`orphans`)){let t=i.get(k0(e.machine_id))??{trees:0,processes:0,memory:0};i.set(k0(e.machine_id),{trees:t.trees+1,processes:t.processes+A0(e.processes),memory:t.memory+A0(e.rss_bytes)})}let a=new Map;for(let e of n(`memory`)){let t=[k0(e.agent),k0(e.role)].filter(Boolean).join(` · `);a.set(k0(e.machine),[...a.get(k0(e.machine))??[],{label:t,value:A0(e.rss_bytes)}])}let o=n(`machines`).map(e=>{let t=k0(e.machine_id),n=k0(e.machine),o=k0(e.state);return{id:t,name:n,kind:k0(e.os)===`linux`?`server`:`desktop`,local:o===`local`,reachable:o===`local`||o===`live`,lastSeen:new Date(r-A0(e.last_seen)).toISOString(),memoryUsed:A0(e.mem_used_bytes),memoryTotal:A0(e.mem_total_bytes),cpuPercent:typeof e.cpu_percent==`number`?e.cpu_percent:void 0,diskFree:j0(e.disk_free_bytes),diskTotal:j0(e.disk_total_bytes),leftover:i.get(t),memoryByRole:a.get(n)}}),s=[];for(let e of n(`projects`)){let t=k0(e.project);t&&!s.some(e=>e.id===t)&&s.push({id:t,name:t,repo:k0(e.path)})}let c=new Map(n(`flow`).map(e=>[M0(e.machine_id,e.id),e])),l=new Map;for(let e of gS(t?.results[0]?.frame))e.kind===`waiting`&&k0(e.session_id)&&k0(e.session_id)!==`0`&&l.set(M0(e.machine_id,e.session_id),[e.reason||`waiting`,e.tool,e.detail].filter(Boolean).join(` · `));let u=n(`sessions`).map(t=>{let n=k0(t.id),r=M0(t.machine_id,n),i=c.get(r),a=cge(k0(t.label));return{id:n,title:k0(t.title)||`Session ${n}`,state:a.state,label:a.label,inferred:a.inferred||t.inferred===!0,evidence:k0(t.evidence)||void 0,agent:k0(t.agent),project:k0(t.project),machine:k0(t.machine_id),branch:k0(t.branch)||void 0,memory:A0(t.mem_bytes),turns:k0(t.turns).split(`,`).filter(e=>[`ok`,`waited`,`failed`].includes(e)),files:sge(t.edited),parent:i&&k0(i.parent_id)&&k0(i.parent_id)!==`0`?k0(i.parent_id):void 0,lastTool:k0(i?.last_tool)||void 0,lastActivity:k0(t.last_activity_at)||e.observed_at,started:k0(i?.started_at)||void 0,waiting:a.state===`waiting`?l.get(r)??(k0(i?.reason)||void 0):void 0}});for(let e of u)e.project&&!s.some(t=>t.id===e.project)&&s.push({id:e.project,name:e.project,repo:``});return{machines:o,projects:s,sessions:u}}function lge({fragment:e,inbox:t,act:n}){let r=(0,h.useMemo)(()=>e?N0(e,t):null,[e,t]),i=(0,h.useMemo)(()=>r0(e),[e]),a=(0,h.useMemo)(()=>r?Che(i,n0(r,i.polls)):{},[i,r]),{projects:o,cols:s,values:c}=(0,h.useMemo)(()=>{let t=gS(e?.results.find(e=>e.id===`heatmap`)?.frame),n=[...new Set(t.map(e=>String(e.series)))],r=[...new Set(t.map(e=>String(e.ts)))].sort(),i=new Map(t.map(e=>[JSON.stringify([e.series,e.ts]),Number(e.value??0)]));return{projects:n,cols:r.map(e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,hour12:!1})),values:n.map(e=>r.map(t=>i.get(JSON.stringify([e,t]))??0))}},[e]);if(!r)return(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`});let l=e=>{let t=Number(e.id);n&&Number.isSafeInteger(t)&&t>0&&n({kind:`jump`,row:{session_id:t,machine_id:e.machine}})};return(0,H.jsxs)(o_,{gap:`sm`,style:{flex:1,minHeight:0,overflowY:`auto`},children:[(0,H.jsx)(G,{style:{flex:1,minHeight:600},children:(0,H.jsx)(age,{...r,strips:a,onSelect:()=>void 0,onOpen:l,onReply:l})}),o.length>0&&(0,H.jsxs)(G,{py:`sm`,children:[(0,H.jsx)(q,{size:`xs`,fw:600,c:`dimmed`,mb:6,children:`Tool calls by project · last 24 hours`}),(0,H.jsx)(fhe,{rows:o,cols:s,values:c,format:String,unit:`tool calls`,label:`Tool calls by project, last 24 hours`})]})]})}var P0=(0,h.createContext)({});function F0(){return(0,h.useContext)(P0)}var uge={jump:`Open pane`,ack:`Mark reviewed`,open:`Open`,stop:`Stop`,kill:`Kill`,force_kill:`Force kill`,cleanup:`Remove`,summarize:`Summarize`};function I0(e){return uge[e]}function L0(e,t,n){let r=!t.machine_id||t.machine_id===n;switch(e){case`orphans`:return r&&t.verified===!0&&t.young!==!0?[`kill`,`force_kill`]:[];case`cleanup`:return t.status===`ready`?[`cleanup`]:[];case`sessions`:case`flow`:return r&&t.label!==`ended`&&t.label!==`dead`?[`jump`,`stop`]:[];case`projects`:return r&&t.path?[`summarize`]:[];default:return[]}}var R0=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function z0(e,t,n){let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n});if(!r.ok)throw new R0((await r.text()).trim()||`${r.status}`,r.status);return r.json()}async function B0(e,t){let n=await fetch(e,{signal:t});if(!n.ok)throw new R0((await n.text()).trim()||`${n.status}`,n.status);return n.json()}var V0={reset:(e,t)=>z0(`/app/api/reset`,{id:e,base_version:t}).then(hS),catalog:()=>z0(`/app/api/catalog`,{}).then(e=>e.widgets),replace:(e,t,n,r,i)=>z0(`/app/api/replace`,{id:e,dashboard:t,base_version:n,vars:r,message:i}).then(hS),list:()=>z0(`/app/api/list`,{}).then(e=>e.dashboards),open:(e,t,n)=>z0(`/app/api/open`,{id:e,vars:t},n).then(hS),run:(e,t,n)=>z0(`/app/api/run`,{dashboard:e,vars:t},n).then(hS),create:(e,t)=>z0(`/app/api/create`,{dashboard:e,message:t}).then(hS),delete:e=>z0(`/app/api/delete`,{id:e}),edit:(e,t,n,r,i)=>z0(`/app/api/edit`,{id:e,operations:t,base_version:n,vars:r,message:i}).then(hS)};async function H0(e,t){try{let n=await z0(`/app/confirm`,{message:e,request:t});return n.confirmed===!0?n:{confirmed:!1}}catch{return{confirmed:!1}}}async function U0(e){return(await H0(e)).confirmed}async function dge(e,t){let n=await H0(e,t);return!n.confirmed||typeof n.token!=`string`||n.token.length===0?!1:(await W0({...t,token:n.token}),!0)}function W0(e){return z0(`/app/action`,e)}var G0={history:()=>B0(`/chat/api/history`),create:()=>z0(`/chat/api/new`,{}),send:(e,t,n)=>z0(`/chat/api/send`,{id:e,text:t,context:n}),stop:e=>z0(`/chat/api/stop`,{id:e}),decide:(e,t,n)=>z0(`/chat/api/decide`,{id:e,action:t,allow:n}),decideSimilar:(e,t)=>z0(`/chat/api/decide`,{id:e,action:t,allow:!0,similar:!0}),answerSimilar:e=>z0(`/chat/api/prompt-answer`,{id:e,allow:!0,similar:!0}),revokeGrant:e=>z0(`/chat/api/grant-revoke`,{id:e}),grantHistory:()=>B0(`/chat/api/grant-history`).then(e=>e??[]),setMode:(e,t)=>z0(`/chat/api/mode`,{id:e,mode:t}),bursts:()=>B0(`/chat/api/prompt-bursts`).then(e=>e??[]),decideBurst:(e,t,n)=>z0(`/chat/api/burst-decide`,{id:e,members:t,allow:n}),prompts:()=>B0(`/chat/api/prompts`).then(e=>e??[]),answer:(e,t)=>z0(`/chat/api/prompt-answer`,{id:e,allow:t}),wait:(e,t,n)=>B0(`/chat/api/wait?id=${encodeURIComponent(e)}&after=${t}`,n)};function fge(e){return pge(e)||typeof e==`function`||mge(e)}function pge(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function mge(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function K0(e,t){return e==null?null:fge(e)?h.createElement(e,t):e}function hge(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?K0(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:K0(n.cell,t.getContext())}return`header`in e&&e.header?K0(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?K0(e.footer.column.columnDef.footer,e.footer.getContext()):null}function gge({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function _ge(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var q0=[],J0=0,{link:Y0,unlink:vge,propagate:yge,checkDirty:X0,shallowPropagate:Z0}=gge({update(e){return e._update()},notify(e){q0[$0++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,n2(e))}}),Q0=0,$0=0,e2,t2=0;function bge(e){try{++t2,e()}finally{--t2||r2()}}function n2(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=vge(n,e)}function r2(){if(!(t2>0)){for(;Q0<$0;){let e=q0[Q0];q0[Q0++]=void 0,e.notify()}Q0=0,$0=0}}function xge(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return e2!==void 0&&Y0(i,e2,J0),i._snapshot},subscribe(e){let t=_ge(e),n={current:!1},r=Sge(()=>{i.get(),n.current?(e2=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=e2,o=t?.compare??Object.is;if(n)e2=i,++J0,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{e2=a,n&&(i.flags&=-5),n2(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&X0(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Z0(e)}}else e&32&&(i.flags=e&-33);return e2!==void 0&&Y0(i,e2,J0),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(yge(e),Z0(e),r2())}},i}function Sge(e){let t=()=>{let t=e2;e2=n,++J0,n.depsTail=void 0,n.flags=6;try{return e()}finally{e2=t,n.flags&=-5,n2(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&X0(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,n2(this)}};return t(),n}function i2(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=a2(e);if(n.length!==a2(t).length)return!1;for(let r=0;r{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),wge=o(((e,t)=>{t.exports=Cge()})),Tge=o((e=>{var t=m(),n=wge();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ege=o(((e,t)=>{t.exports=Tge()}))();function Dge(e,t){return e===t}function o2(e,t=e=>e,n){let r=n?.compare??Dge,i=(0,h.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,h.useCallback)(()=>e.get(),[e]);return(0,Ege.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function Oge(e){let t=o2(e.source,e.selector,{compare:i2});return typeof e.children==`function`?e.children(t):e.children}function kge(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function Age(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return a&&i(o,t)||(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function jge(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{n&&t(r,e)||i(e)})}}function Mge(){return Age({createAtom:xge,batch:bge})}function s2(e,t){return typeof e==`function`?e(t):e}function c2(e){if(Array.isArray(e))return e.map(c2);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?l2():{},r=Object.keys(e);for(let t=0;t{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>s2(n,e))}}function d2(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function f2(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Fge=3;function Ige(e,t){return p2(e,t,Fge)}function p2(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!d2(e)||!d2(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=f2(e),i=f2(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e{let t=s2(n,e);return r(e,t)?e:t})}function Rge(e){return e instanceof Function}function zge(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var Bge=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e{t?e():t=!0}}function h2({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return Bge({...a,...o})}function g2(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function _2(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=g2(r);t[n]=a?h2({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function v2(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=g2(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=h2({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function Vge(e){return e.row.getValue(e.column.id)}function Hge(e){return e.getValue()??e.table.options.renderFallbackValue}function Uge(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Wge={assignCellPrototype:(e,t)=>{v2(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Vge(e)},cell_renderValue:{fn:e=>Hge(e)},cell_getContext:{fn:e=>Uge(e),memoDeps:e=>[e]}})}};function Gge(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let n=t;for(let t=0;te[i.accessorKey]}if(!s)throw Error();let l=Gge(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;ee.getFlatColumns())]}function e_e(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return b2(e.table,t)}return[e]}function t_e(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function S2(e,t,n,r=0){let i=Array(t.length);for(let a=0;ae.getFlatColumns())}function i_e(e){let t=l2(),n=e.getAllFlatColumns();for(let e=0;ee.getLeafColumns()))}function o_e(e){let t=l2(),n=e.getAllLeafColumns();for(let e=0;e{v2(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>$ge(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>e_e(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{_2(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>t_e(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>n_e(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>r_e(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>i_e(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>a_e(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>o_e(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>s_e(e,t)}})}};function l_e(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n0&&T2(s,t-1,n,r,i,a)}function E2(e){for(let t=0;te.id),e)}function __e(e){return[...e.getHeaderGroups()].reverse()}function v_e(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e{v2(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>m_e(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>h_e(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{_2(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>g_e(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>__e(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>v_e(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>y_e(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function x_e(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let s=x_e(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=l2(),c._valuesCache=l2(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;eh2({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>w_e(e,e.options.data),onAfterUpdate:m2(()=>{Xge(e),x2(e),Zge(e),Qge(e)})})}function O2(e,t,n,r=0,i){let a=[];for(let o=0;o{_2(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>T_e(e)},table_getPreFilteredRowModel:{fn:()=>E_e(e)},table_getFilteredRowModel:{fn:()=>D_e(e)},table_getPreGroupedRowModel:{fn:()=>O_e(e)},table_getGroupedRowModel:{fn:()=>k_e(e)},table_getPreSortedRowModel:{fn:()=>A_e(e)},table_getSortedRowModel:{fn:()=>j_e(e)},table_getPreExpandedRowModel:{fn:()=>M_e(e)},table_getExpandedRowModel:{fn:()=>N_e(e)},table_getPrePaginatedRowModel:{fn:()=>P_e(e)},table_getPaginatedRowModel:{fn:()=>F_e(e)},table_getRowModel:{fn:()=>I_e(e)}})}};function R_e(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;ne.subRows)}function K_e(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e{v2(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>B_e(e)},row_getAllCellsByColumnId:{fn:e=>X_e(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>Y_e(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>G_e(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>q_e(e)},row_getParentRows:{fn:e=>J_e(e)},row_getUniqueValues:{fn:(e,t)=>U_e(e,t)},row_getValue:{fn:(e,t)=>H_e(e,t)},row_renderValue:{fn:(e,t)=>W_e(e,t)}})},constructTableAPIs:e=>{_2(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>V_e(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>Z_e(t,e,n,r)},table_getRow:{fn:(t,n)=>Q_e(e,t,n)},table_getMaxSubRowDepth:{fn:()=>K_e(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function k2(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function A2(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{k2(e,t,n),e._reactivity.commit?.()})}function eve(e){let t=c2(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;rr):e.options=r,n?.syncExternalState!==!1&&A2(e,r.state??null)}var nve={coreCellsFeature:Wge,coreColumnsFeature:c_e,coreHeadersFeature:b_e,coreRowModelsFeature:L_e,coreRowsFeature:$_e,coreTablesFeature:{constructTableAPIs:e=>{_2(`coreTablesFeature`,e,{table_reset:{fn:()=>eve(e)},table_setOptions:{fn:t=>j2(e,t)}})}}};function rve(e){return e}function ive(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),c2(t)}function ave(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...nve,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=ive(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&u2(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}k2(v),v.store=kge(t.createReadonlyAtom(()=>{let e={};for(let t=0;t{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}var sve=M2({resolveDataValue:e=>lve(e).toLowerCase(),sort:(e,t)=>uve(e,t)}),N2=M2({sort:(e,t)=>cve(e,t)});function cve(e,t){return e===t?0:e>t?1:-1}function lve(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function uve(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n=48&&e<=57}function F2(e,t,n){let r=t+1;for(;ro)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function fve(e,t,n,r,i,a){let o=t;for(;oi?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function I2(e,t,n){let r=0;for(let i=t;i1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return N2}function V2(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&q2(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function W2(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??V2(e)===`desc`?`desc`:`asc`}function G2(e,t){let n=W2(e),r=J2(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function K2(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function q2(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function J2(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function hve(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function gve(e){R2(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function _ve(e){let t=K2(e);return n=>{t&&U2(e,void 0,q2(e)?e.table.options.isMultiSortEvent?.(n):!1)}}var vve={getInitialState(e){return{sorting:pve(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:Pge(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){v2(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>B2(e)},column_getAutoSortDir:{fn:e=>V2(e)},column_getSortFn:{fn:e=>H2(e)},column_toggleSorting:{fn:(e,t,n)=>U2(e,t,n)},column_getFirstSortDir:{fn:e=>W2(e)},column_getNextSortingOrder:{fn:(e,t)=>G2(e,t)},column_getCanSort:{fn:e=>K2(e)},column_getCanMultiSort:{fn:e=>q2(e)},column_getIsSorted:{fn:e=>J2(e)},column_getSortIndex:{fn:e=>hve(e)},column_clearSorting:{fn:e=>gve(e)},column_getToggleSortingHandler:{fn:e=>_ve(e)}})},constructTableAPIs(e){_2(`rowSortingFeature`,e,{table_autoResetSorting:{fn:()=>mve(e)},table_setSorting:{fn:t=>R2(e,t)},table_resetSorting:{fn:t=>z2(e,t)}})}};function yve(){return e=>{let t=e;return h2({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>bve(t),onAfterUpdate:m2(()=>x2(t))})}}function bve(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?K2(n):!1});if(!i.length)return t;let a=[];for(let t=0;t{for(let n=0;n{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i`u`?h.useEffect:h.useLayoutEffect;function Sve(e,t){let[{table:n,rootSource:r}]=(0,h.useState)(()=>{let t=ave({...e,features:{coreReactivityFeature:Mge(),...e.features}});return t.Subscribe=(e=>Oge({...e,source:e.source??t.store})),t.FlexRender=hge,{table:t,rootSource:jge(t.store,i2)}}),i=n;j2(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=o2(r,t,{compare:i2});return xve(()=>{r.markCommitted(o),A2(i,a??null,i2)}),(0,h.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}function Cve(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var wve=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Eve={};function Y2(e,t){return((t||Eve).jsx?Tve:wve).test(e)}var Dve=/[ \t\n\f\r]/g;function Ove(e){return typeof e==`object`?e.type===`text`&&X2(e.value):X2(e)}function X2(e){return e.replace(Dve,``)===``}var Z2=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Z2.prototype.normal={},Z2.prototype.property={},Z2.prototype.space=void 0;function Q2(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Z2(n,r,t)}function $2(e){return e.toLowerCase()}var e4=class{constructor(e,t){this.attribute=t,this.property=e}};e4.prototype.attribute=``,e4.prototype.booleanish=!1,e4.prototype.boolean=!1,e4.prototype.commaOrSpaceSeparated=!1,e4.prototype.commaSeparated=!1,e4.prototype.defined=!1,e4.prototype.mustUseProperty=!1,e4.prototype.number=!1,e4.prototype.overloadedBoolean=!1,e4.prototype.property=``,e4.prototype.spaceSeparated=!1,e4.prototype.space=void 0;var t4=s({boolean:()=>n4,booleanish:()=>r4,commaOrSpaceSeparated:()=>s4,commaSeparated:()=>o4,number:()=>$,overloadedBoolean:()=>i4,spaceSeparated:()=>a4}),kve=0,n4=c4(),r4=c4(),i4=c4(),$=c4(),a4=c4(),o4=c4(),s4=c4();function c4(){return 2**++kve}var l4=Object.keys(t4),u4=class extends e4{constructor(e,t,n,r){let i=-1;if(super(e,t),d4(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Pve.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(y4,Lve);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!y4.test(e)){let n=e.replace(Nve,Ive);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=u4}return new i(r,t)}function Ive(e){return`-`+e.toLowerCase()}function Lve(e){return e.charAt(1).toUpperCase()}var Rve=Q2([p4,Ave,g4,_4,v4],`html`),b4=Q2([p4,jve,g4,_4,v4],`svg`);function zve(e){return e.join(` `).trim()}var Bve=o(((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})),Vve=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(Bve());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),Hve=o((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))}})),Uve=o(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Vve()),i=Hve();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),x4=C4(`end`),S4=C4(`start`);function C4(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 Wve(e){let t=S4(e),n=x4(e);if(t&&n)return{start:t,end:n}}function w4(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?E4(e.position):`start`in e||`end`in e?E4(e):`line`in e||`column`in e?T4(e):``}function T4(e){return D4(e&&e.line)+`:`+D4(e&&e.column)}function E4(e){return T4(e&&e.start)+`-`+T4(e&&e.end)}function D4(e){return e&&typeof e==`number`?e:1}var O4=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=w4(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}};O4.prototype.file=``,O4.prototype.name=``,O4.prototype.reason=``,O4.prototype.message=``,O4.prototype.stack=``,O4.prototype.column=void 0,O4.prototype.line=void 0,O4.prototype.ancestors=void 0,O4.prototype.cause=void 0,O4.prototype.fatal=void 0,O4.prototype.place=void 0,O4.prototype.ruleId=void 0,O4.prototype.source=void 0;var Gve=l(Uve(),1),k4={}.hasOwnProperty,Kve=new Map,qve=/[A-Z]/g,Jve=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Yve=new Set([`td`,`th`]),A4=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Xve(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=iye(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=rye(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`?b4:Rve,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=j4(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function j4(e,t,n){if(t.type===`element`)return Zve(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Qve(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return eye(e,t,n);if(t.type===`mdxjsEsm`)return $ve(e,t);if(t.type===`root`)return tye(e,t,n);if(t.type===`text`)return nye(e,t)}function Zve(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=b4,e.schema=i),e.ancestors.push(t);let a=F4(e,t.tagName,!1),o=aye(e,t),s=P4(e,t);return Jve.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ove(e)})),M4(e,o,a,t),N4(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Qve(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)}I4(e,t.position)}function $ve(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);I4(e,t.position)}function eye(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=b4,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:F4(e,t.name,!0),o=oye(e,t),s=P4(e,t);return M4(e,o,a,t),N4(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function tye(e,t,n){let r={};return N4(r,P4(e,t)),e.create(t,e.Fragment,r,n)}function nye(e,t){return t.value}function M4(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function N4(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function rye(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 iye(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=S4(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 aye(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&k4.call(t.properties,i)){let a=sye(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Yve.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 oye(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 I4(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 I4(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function P4(e,t){let n=[],r=-1,i=e.passKeys?new Map:Kve;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?(U4(e,e.length,0,t),e):t}var G4={}.hasOwnProperty;function K4(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 J4(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Y4=i3(/[A-Za-z]/),X4=i3(/[\dA-Za-z]/),gye=i3(/[#-'*+\--9=?A-Z^-~]/);function Z4(e){return e!==null&&(e<32||e===127)}var Q4=i3(/\d/),_ye=i3(/[\dA-Fa-f]/),vye=i3(/[!-/:-@[-`{-~]/);function $4(e){return e!==null&&e<-2}function e3(e){return e!==null&&(e<0||e===32)}function t3(e){return e===-2||e===-1||e===32}var n3=i3(/\p{P}|\p{S}/u),r3=i3(/\s/);function i3(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function a3(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 o3(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return t3(r)?(e.enter(n),s(r)):t(r)}function s(r){return t3(r)&&a++0&&t3(t)?(e.enter(r),c(t)):l(t)}function c(t){return t3(t)&&o=i?t(e):n(e)}}var yye={tokenize:bye};function bye(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),o3(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);else return $4(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var c3=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){l3(this,e,t,n,!1)}addBefore(e,t,n){l3(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 l3(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 xye={tokenize:Sye},u3={tokenize:Cye};function Sye(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 Cye(e,t,n){return o3(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function d3(e){if(e===null||e3(e)||r3(e))return 1;if(n3(e))return 2}function f3(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};h3(o,-a),h3(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=W4(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=W4(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=W4(r,f3(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=W4(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=W4(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),U4(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&t3(t)?o3(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$4(t)?e.check(b3,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$4(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`),t3(t)?o3(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`),t3(t)?o3(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$4(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var S3={name:`codeIndented`,tokenize:Iye},Fye={partial:!0,tokenize:Lye};function Iye(e,t,n){return r;function r(t){return e.enter(`codeIndented`),s3(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):$4(t)?e.attempt(Fye,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||$4(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Lye(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):$4(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):s3(e,t,a,`linePrefix`,4,4)(o)}function a(e){return $4(e)?i(e):n(e)}}var Rye={name:`codeText`,previous:Bye,resolve:zye,tokenize:Vye};function zye(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&&C3(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),C3(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),C3(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 T3(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||Z4(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||$4(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||e3(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):$4(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||$4(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!t3(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function D3(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):$4(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),o3(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$4(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 O3(e,t){let n;return r;function r(i){return $4(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):t3(i)?o3(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Yye={name:`definition`,tokenize:Zye},Xye={partial:!0,tokenize:Qye};function Zye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return E3.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=J4(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 e3(t)?O3(e,l)(t):l(t)}function l(t){return T3(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Xye,d,d)(t)}function d(t){return t3(t)?o3(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$4(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Qye(e,t,n){return r;function r(t){return e3(t)?O3(e,i)(t):n(t)}function i(t){return D3(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return t3(t)?o3(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$4(e)?t(e):n(e)}}var $ye={name:`hardBreakEscape`,tokenize:ebe};function ebe(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $4(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var tbe={name:`headingAtx`,resolve:nbe,tokenize:rbe};function nbe(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`};U4(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function rbe(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||e3(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$4(n)?(e.exit(`atxHeading`),t(n)):t3(n)?o3(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||e3(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ibe=`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(`.`),k3=[`pre`,`script`,`style`,`textarea`],abe={concrete:!0,name:`htmlFlow`,resolveTo:sbe,tokenize:cbe},obe={partial:!0,tokenize:lbe};function sbe(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 cbe(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:ee):Y4(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):Y4(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):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 Y4(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||e3(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&k3.includes(l)?(i=1,r.interrupt?t(s):O(s)):ibe.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||X4(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 t3(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Y4(t)?(e.consume(t),b):t3(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||X4(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):t3(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):t3(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$4(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||e3(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||t3(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$4(t)?O(t):t3(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):$4(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(obe,te,k)(t)):t===null||$4(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(b3,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||$4(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return k3.includes(n)?(e.consume(t),I):O(t)}return Y4(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),ee):O(t)}function I(t){return t===null||$4(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function lbe(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(g3,t,n)}}var ube={name:`htmlText`,tokenize:dbe};function dbe(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):Y4(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):Y4(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):$4(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):$4(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):$4(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$4(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Y4(t)?(e.consume(t),S):n(t)}function S(t){return t===45||X4(t)?(e.consume(t),S):C(t)}function C(t){return $4(t)?(o=C,N(t)):t3(t)?(e.consume(t),C):M(t)}function w(t){return t===45||X4(t)?(e.consume(t),w):t===47||t===62||e3(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Y4(t)?(e.consume(t),E):$4(t)?(o=T,N(t)):t3(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||X4(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$4(t)?(o=D,N(t)):t3(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):$4(t)?(o=O,N(t)):t3(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):$4(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||e3(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||e3(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return t3(t)?o3(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var A3={name:`labelEnd`,resolveAll:hbe,resolveTo:gbe,tokenize:_be},fbe={tokenize:vbe},pbe={tokenize:ybe},mbe={tokenize:bbe};function hbe(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(J4(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(fbe,u,o?u:d)(t):t===91?e.attempt(pbe,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(mbe,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function vbe(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 e3(t)?O3(e,a)(t):a(t)}function a(t){return t===41?u(t):T3(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return e3(t)?O3(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?D3(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return e3(t)?O3(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 ybe(e,t,n){let r=this;return i;function i(t){return E3.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(J4(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function bbe(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 xbe={name:`labelStartImage`,resolveAll:A3.resolveAll,tokenize:Sbe};function Sbe(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 Cbe={name:`labelStartLink`,resolveAll:A3.resolveAll,tokenize:wbe};function wbe(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 j3={name:`lineEnding`,tokenize:Tbe};function Tbe(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),o3(e,t,`linePrefix`)}}var M3={name:`thematicBreak`,tokenize:Ebe};function Ebe(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||$4(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),t3(t)?o3(e,s,`whitespace`)(t):s(t))}}var N3={continuation:{tokenize:Abe},exit:Mbe,name:`list`,tokenize:kbe},Dbe={partial:!0,tokenize:Nbe},Obe={partial:!0,tokenize:jbe};function kbe(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:Q4(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(M3,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 Q4(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(g3,r.interrupt?n:u,e.attempt(Dbe,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return t3(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 Abe(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(g3,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,o3(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!t3(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(Obe,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,o3(e,e.attempt(N3,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function jbe(e,t,n){let r=this;return o3(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 Mbe(e){e.exit(this.containerState.type)}function Nbe(e,t,n){let r=this;return o3(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!t3(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var P3={name:`setextUnderline`,resolveTo:Pbe,tokenize:Fbe};function Pbe(e,t){let n=new c3,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 Fbe(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`),t3(t)?o3(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$4(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ibe={tokenize:Lbe};function Lbe(e){let t=this,n=e.attempt(g3,r,e.attempt(this.parser.constructs.flowInitial,i,o3(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Wye,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Rbe={resolveAll:I3()},zbe=F3(`string`),Bbe=F3(`text`);function F3(e){return{resolveAll:I3(e===`text`?Vbe: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);else 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(;++iXbe,contentInitial:()=>Wbe,disable:()=>Zbe,document:()=>Ube,flow:()=>Kbe,flowInitial:()=>Gbe,insideSpan:()=>Ybe,string:()=>qbe,text:()=>Jbe}),Ube={42:N3,43:N3,45:N3,48:N3,49:N3,50:N3,51:N3,52:N3,53:N3,54:N3,55:N3,56:N3,57:N3,62:_3},Wbe={91:Yye},Gbe={[-2]:S3,[-1]:S3,32:S3},Kbe={35:tbe,42:M3,45:[P3,M3],60:abe,61:P3,95:M3,96:x3,126:x3},qbe={38:y3,92:v3},Jbe={[-5]:j3,[-4]:j3,[-3]:j3,33:xbe,38:y3,42:p3,60:[Tye,ube],91:Cbe,92:[$ye,v3],93:A3,95:p3,96:Rye},Ybe={null:[p3,Rbe]},Xbe={null:[42,95]},Zbe={null:[]};function Qbe(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=W4(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=f3(a,l.events,l),l.events):[]}function f(e,t){return exe(p(e),t)}function p(e){return $be(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 exe(e,t){let n=-1,r=[],i;for(;++n`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=rA(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=HZ([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(m==null||m===`item`){var h=s.getDataParams(c,l),g=new PI;h.marker=g.makeTooltipMarker(`item`,XF(h.color),d);var _=pI(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?AI(y?J({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=rA(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(ZS(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=LS(a),a.content=KP(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=HZ(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new PI;this._showOrMove(d,function(){var n=LS(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,e.get(`showContent`)&&e.get(`show`)){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o||=e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`),e.get(`defaultBorderColor`,!0)).color;if(u){if(ZS(u)){var p=e.ecModel.get(`useUTC`),m=X(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=DF(m.axisValue,d,p)),d=YF(d,n,!0)}else if(XS(u)){var g=JS(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u}l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r,i){if(n===`axis`||X(t))return{color:r||i};if(!X(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t||=e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),XS(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),X(t))n=tk(t[0],s),r=tk(t[1],c);else if(eC(t)){var p=t;p.width=l[0],p.height=l[1];var m=tI(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(ZS(t)&&o){var h=kfe(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=Dfe(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=WZ(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=WZ(d)?l[1]/2:d===`bottom`?l[1]:0),DZ(e)){var h=Ofe(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&Y(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i&&=o.length===s.length,i&&Y(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&Y(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&Y(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,this._cbParamsList=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){!CC.node&&t.getDom()&&(rV(this,`_updatePosition`),this._tooltipContent.dispose(),HX(`itemTooltip`,t),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type=`tooltip`,t}(VH);function HZ(e,t,n){var r=t.ecModel,i;n?(i=new dN(n,r,r),i=new dN(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof dN&&(o=o.get(`tooltip`,!0)),ZS(o)&&(o={formatter:o}),o&&(i=new dN(o,i,r)))}return i}function UZ(e,t){return e.dispatchAction||JS(t.dispatchAction,t)}function Dfe(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function Ofe(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function kfe(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function WZ(e){return e===`center`||e===`middle`}function Afe(e,t,n){var r=zk(e).queryOptionMap,i=r.keys()[0];if(i&&i!==`series`){var a=Vk(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=rA(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}function jfe(e){ZW(rZ),e.registerComponentModel(EZ),e.registerComponentView(Efe),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},bC),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},bC)}var GZ=Y;function KZ(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function qZ(e,t,n){var r={};return GZ(t,function(t){var a=r[t]=i();GZ(e[t],function(e,r){if(mq.isValidType(r)){var i={type:r,visual:e};n&&n(i,t),a[r]=new mq(i),r===`opacity`&&(i=LS(i),i.type=`colorAlpha`,a.__hidden.__alphaForOpacity=new mq(i))}})}),r;function i(){var e=function(){};return e.prototype.__hidden=e.prototype,new e}}function Mfe(e,t,n){var r;Y(n,function(e){t.hasOwnProperty(e)&&KZ(t[e])&&(r=!0)}),r&&Y(n,function(n){t.hasOwnProperty(n)&&KZ(t[n])?e[n]=LS(t[n]):delete e[n]})}function Nfe(e,t,n,r){var i={};return Y(e,function(e){i[e]=mq.prepareVisualTypes(t[e])}),{progress:function(e,a){var o;r!=null&&(o=a.getDimensionIndex(r));function s(e){return sU(a,l,e)}function c(e,t){cde(a,l,e,t)}for(var l,u=a.getStore();(l=e.next())!=null;){var d=a.getRawDataItem(l);if(!(d&&d.visualMap===!1))for(var f=r==null?l:u.get(o,l),p=n(f),m=t[p],h=i[p],g=0,_=h.length;g<_;g++){var v=h[g];m[v]&&m[v].applyVisual(f,s,c)}}}}}function JZ(e,t){if(!e)return!1;for(var n=X(e)?e:[e],r=0;r=0&&(s[o]=+s[o].toFixed(f)),[s,d]}var eQ={min:YS($Z,`min`),max:YS($Z,`max`),average:YS($Z,`average`),median:YS($Z,`median`)};function tQ(e,t){if(t){var n=e.getData(),r=e.coordinateSystem,i=r&&r.dimensions;if(!Ffe(t)&&!X(t.coord)&&X(i)){var a=nQ(t,n,r,e);if(t=LS(t),t.type&&eQ[t.type]&&a.baseAxis&&a.valueAxis){var o=BS(i,a.baseAxis.dim),s=BS(i,a.valueAxis.dim),c=eQ[t.type](n,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=c[0],t.value=c[1]}else t.coord=[t.xAxis==null?t.radiusAxis:t.xAxis,t.yAxis==null?t.angleAxis:t.yAxis]}if(t.coord==null||!X(i)){t.coord=[];var l=e.getBaseAxis();if(l&&t.type&&eQ[t.type]){var u=r.getOtherAxis(l);u&&(t.value=aQ(n,n.mapDimension(u.dim),t.type))}}else for(var d=t.coord,f=0;f<2;f++)eQ[d[f]]&&(d[f]=aQ(n,n.mapDimension(i[f]),d[f]));return t}}function nQ(e,t,n,r){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex==null?e.valueDim:t.getDimension(e.valueIndex),i.valueAxis=n.getAxis(Ife(r,i.valueDataDim)),i.baseAxis=n.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=r.getBaseAxis(),i.valueAxis=n.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function Ife(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}function rQ(e,t){return e&&e.containData&&t.coord&&!QZ(t)?e.containData(t.coord):!0}function Lfe(e,t,n){return e&&e.containZone&&t.coord&&n.coord&&!QZ(t)&&!QZ(n)?e.containZone(t.coord,n.coord):!0}function iQ(e,t){return e?function(e,n,r,i){return YN(i<2?e.coord&&e.coord[i]:e.value,t[i])}:function(e,n,r,i){return YN(e.value,t[i])}}function aQ(e,t,n){if(n===`average`){var r=0,i=0;return e.each(t,function(e,t){isNaN(e)||(r+=e,i++)}),r/i}return n===`median`?e.getMedian(t):e.getDataExtent(t)[+(n===`max`)]}var oQ=Lk(),sQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.init=function(){this.markerGroupMap=_C()},t.prototype.render=function(e,t,n){var r=this,i=this.markerGroupMap;i.each(function(e){oQ(e).keep=!1}),t.eachSeries(function(e){var i=ZZ.getMarkerModelFromSeries(e,r.type);i&&r.renderSeries(e,i,t,n)}),i.each(function(e){!oQ(e).keep&&r.group.remove(e.group)}),Rfe(t,i,this.type)},t.prototype.markKeep=function(e){oQ(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Y(e,function(e){var r=ZZ.getMarkerModelFromSeries(e,n.type);r&&r.getData().eachItemGraphicEl(function(e){e&&(t?HA(e):UA(e))})})},t.type=`marker`,t}(VH);function Rfe(e,t,n){e.eachSeries(function(e){var r=ZZ.getMarkerModelFromSeries(e,n),i=t.get(e.id);if(r&&i&&i.group){var a=BM(r),o=a.z,s=a.zlevel;HM(i.group,o,s)}})}function cQ(e,t,n){var r=t.coordinateSystem,i=n.getWidth(),a=n.getHeight(),o=r&&r.getArea&&r.getArea();e.each(function(n){var s=e.getItemModel(n),c=s.get(`relativeTo`)===`coordinate`,l=c?o?o.width:0:i,u=c?o?o.height:0:a,d=c&&o?o.x:0,f=c&&o?o.y:0,p,m=tk(s.get(`x`),l)+d,h=tk(s.get(`y`),u)+f;if(!isNaN(m)&&!isNaN(h))p=[m,h];else if(t.getMarkerPosition)p=t.getMarkerPosition(e.getValues(e.dimensions,n));else if(r){var g=e.get(r.dimensions[0],n),_=e.get(r.dimensions[1],n);p=r.dataToPoint([g,_])}isNaN(m)||(p[0]=m),isNaN(h)||(p[1]=h),e.setItemLayout(n,p)})}var zfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=ZZ.getMarkerModelFromSeries(e,`markPoint`);t&&(cQ(t.getData(),e,n),this.markerGroupMap.get(e.id).updateLayout())},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new QI),l=Bfe(i,e,t);t.setData(l),cQ(t.getData(),e,r),l.each(function(e){var n=l.getItemModel(e),r=n.getShallow(`symbol`),i=n.getShallow(`symbolSize`),a=n.getShallow(`symbolRotate`),s=n.getShallow(`symbolOffset`),c=n.getShallow(`symbolKeepAspect`);if(XS(r)||XS(i)||XS(a)||XS(s)){var u=t.getRawValue(e),d=t.getDataParams(e);XS(r)&&(r=r(u,d)),XS(i)&&(i=i(u,d)),XS(a)&&(a=a(u,d)),XS(s)&&(s=s(u,d))}var f=n.getModel(`itemStyle`).getItemStyle(),p=n.get(`z2`),m=cU(o,`color`);f.fill||=m,l.setItemVisual(e,{z2:sC(p,0),symbol:r,symbolSize:i,symbolRotate:a,symbolOffset:s,symbolKeepAspect:c,style:f})}),c.updateData(l),this.group.add(c.group),l.eachItemGraphicEl(function(e){e.traverse(function(e){rA(e).dataModel=t})}),this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markPoint`,t}(sQ);function Bfe(e,t,n){var r=e?US(e&&e.dimensions,function(e){var n=t.getData();return J(J({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new bP(r,n),a=US(n.get(`data`),YS(tQ,t));e&&(a=GS(a,YS(rQ,e)));var o=iQ(!!e,r);return i.initData(a,null,o),i}function Vfe(e){e.registerComponentModel(Pfe),e.registerComponentView(zfe),e.registerPreprocessor(function(e){JZ(e.series,`markPoint`)&&(e.markPoint=e.markPoint||{})})}var Hfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markLine`,t.defaultOption={z:5,symbol:[`circle`,`arrow`],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:`item`},label:{show:!0,position:`end`,distance:5},lineStyle:{type:`dashed`},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:`linear`},t}(ZZ),lQ=Lk(),Ufe=function(e,t,n,r){var i=e.getData(),a;if(X(r))a=r;else{var o=r.type;if(o===`min`||o===`max`||o===`average`||o===`median`||r.xAxis!=null||r.yAxis!=null){var s=void 0,c=void 0;if(r.yAxis!=null||r.xAxis!=null)s=t.getAxis(r.yAxis==null?`x`:`y`),c=oC(r.yAxis,r.xAxis);else{var l=nQ(r,i,t,e);s=l.valueAxis,c=aQ(i,OP(i,l.valueDataDim),o)}var u=s.dim===`x`?0:1,d=1-u,f=LS(r),p={coord:[]};f.type=null,f.coord=[],f.coord[d]=-1/0,p.coord[d]=1/0;var m=n.get(`precision`);m>=0&&$S(c)&&(c=+c.toFixed(Math.min(m,20))),f.coord[u]=p.coord[u]=c,a=[f,p,{type:o,valueIndex:r.valueIndex,value:c}]}else a=[]}var h=[tQ(e,a[0]),tQ(e,a[1]),J({},a[2])];return h[2].type=h[2].type||null,RS(h[2],h[0]),RS(h[2],h[1]),h};function uQ(e){return!isNaN(e)&&!isFinite(e)}function dQ(e,t,n,r){var i=1-e,a=r.dimensions[e];return uQ(t[i])&&uQ(n[i])&&t[e]===n[e]&&r.getAxis(a).containData(t[e])}function Wfe(e,t){if(e.type===`cartesian2d`){var n=t[0].coord,r=t[1].coord;if(n&&r&&(dQ(1,n,r,e)||dQ(0,n,r,e)))return!0}return rQ(e,t[0])&&rQ(e,t[1])}function fQ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=tk(o.get(`x`),i.getWidth()),l=tk(o.get(`y`),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition)s=r.getMarkerPosition(e.getValues(e.dimensions,t));else{var u=a.dimensions,d=e.get(u[0],t),f=e.get(u[1],t);s=a.dataToPoint([d,f])}if(gL(a,`cartesian2d`)){var p=a.getAxis(`x`),m=a.getAxis(`y`),u=a.dimensions;uQ(e.get(u[0],t))?s[0]=p.toGlobalCoord(p.getExtent()[+!n]):uQ(e.get(u[1],t))&&(s[1]=m.toGlobalCoord(m.getExtent()[+!n]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}e.setItemLayout(t,s)}var Gfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=ZZ.getMarkerModelFromSeries(e,`markLine`);if(t){var r=t.getData(),i=lQ(t).from,a=lQ(t).to;i.each(function(t){fQ(i,t,!0,e,n),fQ(a,t,!1,e,n)}),r.each(function(e){r.setItemLayout(e,[i.getItemLayout(e),a.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,new Kq);this.group.add(c.group);var l=Kfe(i,e,t),u=l.from,d=l.to,f=l.line;lQ(t).from=u,lQ(t).to=d,t.setData(f);var p=t.get(`symbol`),m=t.get(`symbolSize`),h=t.get(`symbolRotate`),g=t.get(`symbolOffset`);X(p)||(p=[p,p]),X(m)||(m=[m,m]),X(h)||(h=[h,h]),X(g)||(g=[g,g]),l.from.each(function(e){_(u,e,!0),_(d,e,!1)}),f.each(function(e){var t=f.getItemModel(e),n=t.getModel(`lineStyle`).getLineStyle();f.setItemLayout(e,[u.getItemLayout(e),d.getItemLayout(e)]);var r=t.get(`z2`);n.stroke??=u.getItemVisual(e,`style`).fill,f.setItemVisual(e,{z2:sC(r,0),fromSymbolKeepAspect:u.getItemVisual(e,`symbolKeepAspect`),fromSymbolOffset:u.getItemVisual(e,`symbolOffset`),fromSymbolRotate:u.getItemVisual(e,`symbolRotate`),fromSymbolSize:u.getItemVisual(e,`symbolSize`),fromSymbol:u.getItemVisual(e,`symbol`),toSymbolKeepAspect:d.getItemVisual(e,`symbolKeepAspect`),toSymbolOffset:d.getItemVisual(e,`symbolOffset`),toSymbolRotate:d.getItemVisual(e,`symbolRotate`),toSymbolSize:d.getItemVisual(e,`symbolSize`),toSymbol:d.getItemVisual(e,`symbol`),style:n})}),c.updateData(f),l.line.eachItemGraphicEl(function(e){rA(e).dataModel=t,e.traverse(function(e){rA(e).dataModel=t})});function _(t,n,i){var a=t.getItemModel(n);fQ(t,n,i,e,r);var s=a.getModel(`itemStyle`).getItemStyle();s.fill??=cU(o,`color`),t.setItemVisual(n,{symbolKeepAspect:a.get(`symbolKeepAspect`),symbolOffset:sC(a.get(`symbolOffset`,!0),g[+!i]),symbolRotate:sC(a.get(`symbolRotate`,!0),h[+!i]),symbolSize:sC(a.get(`symbolSize`),m[+!i]),symbol:sC(a.get(`symbol`,!0),p[+!i]),style:s})}this.markKeep(c),c.group.silent=t.get(`silent`)||e.get(`silent`)},t.type=`markLine`,t}(sQ);function Kfe(e,t,n){var r=e?US(e&&e.dimensions,function(e){var n=t.getData();return J(J({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:`value`,type:`float`}],i=new bP(r,n),a=new bP(r,n),o=new bP([],n),s=US(n.get(`data`),YS(Ufe,t,e,n));e&&(s=GS(s,YS(Wfe,e)));var c=iQ(!!e,r);return i.initData(US(s,function(e){return e[0]}),null,c),a.initData(US(s,function(e){return e[1]}),null,c),o.initData(US(s,function(e){return e[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function qfe(e){e.registerComponentModel(Hfe),e.registerComponentView(Gfe),e.registerPreprocessor(function(e){JZ(e.series,`markLine`)&&(e.markLine=e.markLine||{})})}var Jfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.createMarkerModelFromSeries=function(e,n,r){return new t(e,n,r)},t.type=`markArea`,t.defaultOption={z:1,tooltip:{trigger:`item`},animation:!1,label:{show:!0,position:`top`},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:`top`}}},t}(ZZ),pQ=Lk(),Yfe=function(e,t,n,r){var i=r[0],a=r[1];if(i&&a){var o=tQ(e,i),s=tQ(e,a),c=o.coord,l=s.coord;c[0]=oC(c[0],-1/0),c[1]=oC(c[1],-1/0),l[0]=oC(l[0],1/0),l[1]=oC(l[1],1/0);var u=kre([{},o,s]);return u.coord=[o.coord,s.coord],u.x0=o.x,u.y0=o.y,u.x1=s.x,u.y1=s.y,u}};function mQ(e){return!isNaN(e)&&!isFinite(e)}function hQ(e,t,n,r){var i=1-e;return mQ(t[i])&&mQ(n[i])}function Xfe(e,t){var n=t.coord[0],r=t.coord[1],i={coord:n,x:t.x0,y:t.y0},a={coord:r,x:t.x1,y:t.y1};return gL(e,`cartesian2d`)?n&&r&&(hQ(1,n,r,e)||hQ(0,n,r,e))?!0:Lfe(e,i,a):rQ(e,i)||rQ(e,a)}function gQ(e,t,n,r,i){var a=r.coordinateSystem,o=e.getItemModel(t),s,c=tk(o.get(n[0]),i.getWidth()),l=tk(o.get(n[1]),i.getHeight());if(!isNaN(c)&&!isNaN(l))s=[c,l];else{if(r.getMarkerPosition){var u=e.getValues([`x0`,`y0`],t),d=e.getValues([`x1`,`y1`],t),f=a.clampData(u),p=a.clampData(d),m=[];m[0]=n[0]===`x0`?f[0]>p[0]?d[0]:u[0]:f[0]>p[0]?u[0]:d[0],m[1]=n[1]===`y0`?f[1]>p[1]?d[1]:u[1]:f[1]>p[1]?u[1]:d[1],s=r.getMarkerPosition(m,n,!0)}else{var h=e.get(n[0],t),g=e.get(n[1],t),_=[h,g];a.clampData&&a.clampData(_,_),s=a.dataToPoint(_,!0)}if(gL(a,`cartesian2d`)){var v=a.getAxis(`x`),y=a.getAxis(`y`),h=e.get(n[0],t),g=e.get(n[1],t);mQ(h)?s[0]=v.toGlobalCoord(v.getExtent()[n[0]===`x0`?0:1]):mQ(g)&&(s[1]=y.toGlobalCoord(y.getExtent()[n[1]===`y0`?0:1]))}isNaN(c)||(s[0]=c),isNaN(l)||(s[1]=l)}return s}var _Q=[[`x0`,`y0`],[`x1`,`y0`],[`x1`,`y1`],[`x0`,`y1`]],Zfe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=ZZ.getMarkerModelFromSeries(e,`markArea`);if(t){var r=t.getData();r.each(function(t){var i=US(_Q,function(i){return gQ(r,t,i,e,n)});r.setItemLayout(t,i),r.getItemGraphicEl(t).setShape(`points`,i)})}},this)},t.prototype.renderSeries=function(e,t,n,r){var i=e.coordinateSystem,a=e.id,o=e.getData(),s=this.markerGroupMap,c=s.get(a)||s.set(a,{group:new yj});this.group.add(c.group),this.markKeep(c);var l=Qfe(i,e,t);t.setData(l),l.each(function(t){var n=US(_Q,function(n){return gQ(l,t,n,e,r)}),a=i.getAxis(`x`).scale,s=i.getAxis(`y`).scale,c=a.getExtent(),u=s.getExtent(),d=[a.parse(l.get(`x0`,t)),a.parse(l.get(`x1`,t))],f=[s.parse(l.get(`y0`,t)),s.parse(l.get(`y1`,t))];ak(d),ak(f);var p=c[0]>d[1]||c[1]f[1]||u[1]=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,bottom:Q.size.m,align:`auto`,backgroundColor:Q.color.transparent,borderColor:Q.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:Q.color.disabled,inactiveBorderColor:Q.color.disabled,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:Q.color.disabled,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:Q.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:Q.color.tertiary,borderWidth:1,borderColor:Q.color.border},emphasis:{selectorLabel:{show:!0,color:Q.color.quaternary}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(sI),yQ=YS,bQ=Y,xQ=yj,SQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new xQ),this.group.add(this._selectorGroup=new xQ),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);i&&i!==`auto`||(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=rI(e,n).refContainer,l=e.getBoxLayoutParams(),u=e.get(`padding`),d=tI(l,c,u),f=this.layoutInner(e,i,d,r,o,s),p=tI(zS({width:f.width,height:f.height},l),c,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=TZ(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=_C(),l=t.get(`selectedMode`),u=t.get(`triggerEvent`),d=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&d.push(e.id)}),bQ(t.getData(),function(i,a){var o=this,f=i.get(`name`);if(!this.newlineDisabled&&(f===``||f===` +`)){var p=new xQ;p.newline=!0,s.add(p)}else{var m=n.getSeriesByName(f)[0];if(!c.get(f)){if(m){var h=m.getData(),g=h.getVisual(`legendLineStyle`)||{},_=h.getVisual(`legendIcon`),v=h.getVisual(`style`),y=this._createItem(m,f,a,i,t,e,g,v,_,l,r);y.on(`click`,yQ(CQ,f,null,r,d)).on(`mouseover`,yQ(wQ,m.name,null,r,d)).on(`mouseout`,yQ(TQ,m.name,null,r,d)),n.ssr&&y.eachChild(function(e){var t=rA(e);t.seriesIndex=m.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&y.eachChild(function(e){o.packEventData(e,t,m,a,f)}),c.set(f,!0)}else n.eachRawSeries(function(o){var s=this;if(!c.get(f)&&o.legendVisualProvider){var p=o.legendVisualProvider;if(!p.containName(f))return;var m=p.indexOfName(f),h=p.getItemVisual(m,`style`),g=p.getItemVisual(m,`legendIcon`),_=tE(h.fill);_&&_[3]===0&&(_[3]=.2,h=J(J({},h),{fill:lE(_,`rgba`)}));var v=this._createItem(o,f,a,i,t,e,{},h,g,l,r);v.on(`click`,yQ(CQ,null,f,r,d)).on(`mouseover`,yQ(wQ,null,f,r,d)).on(`mouseout`,yQ(TQ,null,f,r,d)),n.ssr&&v.eachChild(function(e){var t=rA(e);t.seriesIndex=o.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),u&&v.eachChild(function(e){s.packEventData(e,t,o,a,f)}),c.set(f,!0)}},this)}}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype.packEventData=function(e,t,n,r,i){var a={componentType:`legend`,componentIndex:t.componentIndex,dataIndex:r,value:i,seriesIndex:n.seriesIndex};rA(e).eventData=a},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();bQ(e,function(e){var r=e.type,i=new MO({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),XM(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),QA(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=tpe(c,r,o,s,d,m,u),y=new xQ,b=r.getModel(`textStyle`);if(XS(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(npe({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;ZS(w)&&w?T=w.replace(`{name}`,t??``):XS(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new MO({style:QM(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new OO({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&NM({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),QA(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();eI(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){eI(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(VH);function tpe(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),bQ(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:BU(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function npe(e){var t=e.icon||`roundRect`,n=HI(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=Q.color.neutral00,n.style.lineWidth=2),n}function CQ(e,t,n,r){TQ(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),wQ(e,t,n,r)}function wQ(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function TQ(e,t,n,r){n.usingTHL()||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}function EQ(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),DQ(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){Y(i,function(t,n){e[t?`select`:`unSelect`](n)}),DQ(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function DQ(e,t){var n=t||{};return Y(e.getData(),function(t){var r=t.get(`name`);if(r!==` +`&&r!==``){var i=e.isSelected(r);n[r]=Z(n,r)?n[r]&&i:i}}),n}function rpe(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,YS(EQ,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,YS(EQ,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,YS(EQ,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,YS(EQ,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,YS(EQ,`unSelect`))}var ipe=nA(ape);function ape(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;nn[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=sC(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new OO({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&nM(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;Y([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,ZS(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=jQ[i],o=MQ[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=+!!u,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??=h.i,++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(SQ);function cpe(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function lpe(e){ZW(OQ),e.registerComponentModel(ope),e.registerComponentView(spe),cpe(e)}function upe(e){ZW(OQ),ZW(lpe)}var dpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=MP(_Z.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(_Z),NQ=Lk();function fpe(e,t,n){NQ(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function ppe(e,t){for(var n=NQ(e).coordSysRecordMap,r=n.keys(),i=0;ia[i+r]&&(r=n),o&&=t.get(`preventDefaultMouseMove`,!0),s=sC(t.get(`cursorGrab`,!0),s),c=sC(t.get(`cursorGrabbing`,!0),c)}),{controlType:r,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:n,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:c}}}function vpe(e){e.registerUpdateLifecycle(`coordsys:aftercreate`,function(e,t){var n=NQ(t),r=n.coordSysRecordMap||=_C();r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){Y(dZ(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,mpe(t,n.model));(a.dataZoomInfoMap||=_C()).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var n=e.controller,i,a=e.dataZoomInfoMap;if(a){var o=a.keys()[0];o!=null&&(i=a.get(o))}if(!i)PQ(r,e);else{var s=_pe(a,e,t);n.enable(s.controlType,s.opt),nV(e,`dispatchAction`,i.model.get(`throttle`,!0),`fixRate`)}})})}var ype=function(e){vS(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),fpe(r,t,{pan:JS(FQ.pan,this),zoom:JS(FQ.zoom,this),scrollMove:JS(FQ.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){ppe(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(yZ),FQ={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=LQ[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Zq(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:IQ(function(e,t,n,r,i,a){var o=LQ[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:IQ(function(e,t,n,r,i,a){return LQ[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function IQ(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(Zq(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var LQ={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e||=[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e||=[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function bpe(e){wZ(e),e.registerComponentModel(dpe),e.registerComponentView(ype),vpe(e)}var xpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.slider`,t.layoutMode=`box`,t.defaultOption=MP(_Z.defaultOption,{show:!0,right:`ph`,top:`ph`,width:`ph`,height:`ph`,left:null,bottom:null,borderColor:Q.color.accent10,borderRadius:0,backgroundColor:Q.color.transparent,dataBackground:{lineStyle:{color:Q.color.accent30,width:.5},areaStyle:{color:Q.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:Q.color.accent40,width:.5},areaStyle:{color:Q.color.accent20,opacity:.3}},fillerColor:`rgba(135,175,274,0.2)`,handleIcon:`path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z`,handleSize:`100%`,handleStyle:{color:Q.color.neutral00,borderColor:Q.color.accent20},moveHandleSize:7,moveHandleIcon:`path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z`,moveHandleStyle:{color:Q.color.accent40,opacity:.5},showDetail:!0,showDataShadow:`auto`,realtime:!0,zoomLock:!1,textStyle:{color:Q.color.tertiary},brushSelect:!0,brushStyle:{color:Q.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:Q.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(_Z),RQ=OO,Spe=1,zQ=30,Cpe=7,BQ=`horizontal`,VQ=`vertical`,wpe=5,Tpe=[`line`,`bar`,`candlestick`,`scatter`],Epe={easing:`cubicOut`,duration:100,delay:0},Dpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return t.prototype.init=function(e,t){this.api=t,this._onBrush=JS(this._onBrush,this),this._onBrushEnd=JS(this._onBrushEnd,this)},t.prototype.render=function(t,n,r,i){e.prototype.render.apply(this,arguments),nV(this,`_dispatchZoomAction`,t.get(`throttle`),`fixRate`),this._orient=t.getOrient(),t.get(`show`)===!1?this.group.removeAll():t.noTarget()?(this._clear(),this.group.removeAll()):(i&&i.type===`dataZoom`&&i.from===this.uid||this._buildView(),this._updateView())},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){rV(this,`_dispatchZoomAction`);var e=this.api.getZr();e.off(`mousemove`,this._onBrush),e.off(`mouseup`,this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new yj;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get(`brushSelect`)?Cpe:0,r=rI(e,t).refContainer,i=this._findCoordRect(),a=e.get(`defaultLocationEdgeGap`,!0)||0,o=this._orient===BQ?{right:r.width-i.x-i.width,top:r.height-zQ-a-n,width:i.width,height:zQ}:{right:a,top:i.y,width:zQ,height:i.height},s=oI(e.option);Y([`right`,`top`,`width`,`height`],function(e){s[e]===`ph`&&(s[e]=o[e])});var c=tI(s,r);this._location={x:c.x,y:c.y},this._size=[c.width,c.height],this._orient===VQ&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,r=this.dataZoomModel.getFirstTargetAxisModel(),i=r&&r.get(`inverse`),a=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;a.attr(n===BQ&&!i?{scaleY:o?1:-1,scaleX:1}:n===BQ&&i?{scaleY:o?1:-1,scaleX:-1}:n===VQ&&!i?{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2});var s=e.getBoundingRect([a]),c=isNaN(s.x)?0:s.x,l=isNaN(s.y)?0:s.y;e.x=t.x-c,e.y=t.y-l,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,r=e.get(`brushSelect`);n.add(new RQ({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get(`backgroundColor`)},z2:-40}));var i=new RQ({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:`transparent`},z2:0,onclick:JS(this._onClickPanel,this)}),a=this.api.getZr();r?(i.on(`mousedown`,this._onBrushStart,this),i.cursor=`crosshair`,a.on(`mousemove`,this._onBrush),a.on(`mouseup`,this._onBrushEnd)):(a.off(`mousemove`,this._onBrush),a.off(`mouseup`,this._onBrushEnd)),n.add(i)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!e)return;var t=this._size,n=this._shadowSize||[],r=e.series,i=r.getRawData(),a=r.getShadowDim&&r.getShadowDim(),o=a&&i.getDimensionInfo(a)?r.getShadowDim():e.otherDim;if(o==null)return;var s=this._shadowPolygonPts,c=this._shadowPolylinePts;if(i!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var l=i.getDataExtent(e.thisDim),u=i.getDataExtent(o),d=(u[1]-u[0])*.3;u=[u[0]-d,u[1]+d];var f=[0,t[1]],p=[0,t[0]],m=[[t[0],0],[0,0]],h=[],g=p[1]/Math.max(1,i.count()-1),_=t[0]/(l[1]-l[0]),v=e.thisAxis.type===`time`,y=-g,b=Math.round(i.count()/t[0]),x;i.each([e.thisDim,o],function(e,t,n){if(b>0&&n%b)v||(y+=g);else{y=v?(+e-l[0])*_:y+g;var r=t==null||isNaN(t)||t===``,i=r?0:ek(t,u,f,!0);r&&!x&&n?(m.push([m[m.length-1][0],0]),h.push([h[h.length-1][0],0])):!r&&x&&(m.push([y,0]),h.push([y,0])),r||(m.push([y,i]),h.push([y,i])),x=r}}),s=this._shadowPolygonPts=m,c=this._shadowPolylinePts=h}this._shadowData=i,this._shadowDim=o,this._shadowSize=[t[0],t[1]];var S=this.dataZoomModel;function C(e){var t=S.getModel(e?`selectedDataBackground`:`dataBackground`),n=new yj,r=new Ij({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel(`areaStyle`).getAreaStyle(),silent:!0,z2:-20}),i=new Lj({shape:{points:c},segmentIgnoreThreshold:1,style:t.getModel(`lineStyle`).getLineStyle(),silent:!0,z2:-19});return n.add(r),n.add(i),n}for(var w=0;w<3;w++){var T=C(w===1);this._displayables.sliderGroup.add(T),this._displayables.dataShadowSegs.push(T)}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get(`showDataShadow`);if(t!==!1){var n,r=this.ecModel;return e.eachTargetAxis(function(i,a){Y(e.getAxisProxy(i,a).getTargetSeriesModels(),function(e){if(!n&&!(t!==!0&&BS(Tpe,e.get(`type`))<0)){var o=r.getComponent(lZ(i),a).axis,s=Ope(i),c,l=e.coordinateSystem;s!=null&&l.getOtherAxis&&(c=l.getOtherAxis(o).inverse),s=e.getData().mapDimension(s),n={thisAxis:o,series:e,thisDim:e.getData().mapDimension(i),otherDim:s,otherAxisInverse:c}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],r=t.handleLabels=[null,null],i=this._displayables.sliderGroup,a=this._size,o=this.dataZoomModel,s=this.api,c=o.get(`borderRadius`)||0,l=o.get(`brushSelect`),u=t.filler=new RQ({silent:l,style:{fill:o.get(`fillerColor`)},textConfig:{position:`inside`}});i.add(u),i.add(new RQ({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:a[0],height:a[1],r:c},style:{stroke:o.get(`dataBackgroundColor`)||o.get(`borderColor`),lineWidth:Spe,fill:Q.color.transparent}})),Y([0,1],function(t){var a=o.get(`handleIcon`);!VI[a]&&a.indexOf(`path://`)<0&&a.indexOf(`image://`)<0&&(a=`path://`+a);var s=HI(a,-1,0,2,2,null,!0);s.attr({cursor:kpe(this._orient),draggable:!0,drift:JS(this._onDragMove,this,t),ondragend:JS(this._onDragEnd,this),onmouseover:JS(this._onOverDataInfoTriggerArea,this,!0),onmouseout:JS(this._onOverDataInfoTriggerArea,this,!1),z2:5});var c=s.getBoundingRect(),l=o.get(`handleSize`);this._handleHeight=tk(l,this._size[1]),this._handleWidth=c.width/c.height*this._handleHeight,s.setStyle(o.getModel(`handleStyle`).getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState(`emphasis`).style=o.getModel([`emphasis`,`handleStyle`]).getItemStyle(),QA(s);var u=o.get(`handleColor`);u!=null&&(s.style.fill=u),i.add(n[t]=s);var d=o.getModel(`textStyle`),f=(o.get(`handleLabel`)||{}).show||!1;e.add(r[t]=new MO({silent:!0,invisible:!f,style:QM(d,{x:0,y:0,text:``,verticalAlign:`middle`,align:`center`,fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=u;if(l){var f=tk(o.get(`moveHandleSize`),a[1]),p=t.moveHandle=new OO({style:o.getModel(`moveHandleStyle`).getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:a[1]-.5,height:f}}),m=f*.8,h=t.moveHandleIcon=HI(o.get(`moveHandleIcon`),-m/2,-m/2,m,m,Q.color.neutral00,!0);h.silent=!0,h.y=a[1]+f/2-.5,p.ensureState(`emphasis`).style=o.getModel([`emphasis`,`moveHandleStyle`]).getItemStyle();var g=Math.min(a[1]/2,Math.max(f,10));d=t.moveZone=new OO({invisible:!0,shape:{y:a[1]-g,height:f+g}}),d.on(`mouseover`,function(){s.enterEmphasis(p)}).on(`mouseout`,function(){s.leaveEmphasis(p)}),i.add(p),i.add(h),i.add(d)}d.attr({draggable:!0,cursor:`grab`,drift:JS(this._onActualMoveZoneDrift,this),ondragstart:JS(this._onActualMoveZoneDragStart,this),ondragend:JS(this._onActualMoveZoneDragEnd,this),onmouseover:JS(this._onOverDataInfoTriggerArea,this,!0),onmouseout:JS(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[ek(e[0],[0,100],t,!0),ek(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,r=this._handleEnds,i=this._getViewExtent(),a=n.findRepresentativeAxisProxy().getMinMaxSpan(),o=[0,100];Zq(t,r,i,n.get(`zoomLock`)?`all`:e,a.minSpan==null?null:ek(a.minSpan,o,i,!0),a.maxSpan==null?null:ek(a.maxSpan,o,i,!0));var s=this._range,c=this._range=ak([ek(r[0],i,o,!0),ek(r[1],i,o,!0)]);return!s||s[0]!==c[0]||s[1]!==c[1]},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,r=ak(n.slice()),i=this._size;Y([0,1],function(e){var r=t.handles[e],a=this._handleHeight;r.attr({scaleX:a/2,scaleY:a/2,x:n[e]+(e?-1:1),y:i[1]/2-a/2})},this),t.filler.setShape({x:r[0],y:0,width:r[1]-r[0],height:i[1]});var a={x:r[0],width:r[1]-r[0]};t.moveHandle&&(t.moveHandle.setShape(a),t.moveZone.setShape(a),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr(`x`,a.x+a.width/2));for(var o=t.dataShadowSegs,s=[0,r[0],r[1],i[0]],c=0;ct[0]||n[1]<0||n[1]>t[1])){var r=this._handleEnds,i=(r[0]+r[1])/2,a=this._updateInterval(`all`,n[0]-i);this._updateView(),a&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new _w(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr(`ignore`,!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var r=this._getViewExtent(),i=[0,100],a=this._handleEnds=[n.x,n.x+n.width],o=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Zq(0,a,r,0,o.minSpan==null?null:ek(o.minSpan,i,r,!0),o.maxSpan==null?null:ek(o.maxSpan,i,r,!0)),this._range=ak([ek(a[0],r,i,!0),ek(a[1],r,i,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(OV(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,r=this.dataZoomModel,i=n.brushRect;i||(i=n.brushRect=new RQ({silent:!0,style:r.getModel(`brushStyle`).getItemStyle()}),n.sliderGroup.add(i)),i.attr(`ignore`,!1);var a=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),c=o.transformCoordToLocal(a.x,a.y),l=this._size;s[0]=Math.max(Math.min(l[0],s[0]),0),i.setShape({x:c[0],y:0,width:s[0]-c[0],height:l[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:`dataZoom`,from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?Epe:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=dZ(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var r=this.api.getWidth(),i=this.api.getHeight();e={x:r*.2,y:i*.2,width:r*.6,height:i*.6}}return e},t.type=`dataZoom.slider`,t}(yZ);function HQ(e,t,n,r){var i=e.get(`labelFormatter`),a=e.get(`labelPrecision`);(a==null||a===`auto`)&&(a=n.valuePrecision);var o=n.value[t],s=o==null||isNaN(o)?``:FL(r)||NL(r)?r.getLabel({value:Math.round(o)}):isFinite(a)?ik(o,a,!0):o+``;return XS(i)?i(o,s):ZS(i)?i.replace(`{value}`,s):s}function Ope(e){return{x:`y`,y:`x`,radius:`angle`,angle:`radius`}[e]}function kpe(e){return e===`vertical`?`ns-resize`:`ew-resize`}function Ape(e){e.registerComponentModel(xpe),e.registerComponentView(Dpe),wZ(e)}function jpe(e){ZW(bpe),ZW(Ape)}var UQ={get:function(e,t,n){var r=LS((Mpe[e]||{})[t]);return n&&X(r)?r[r.length-1]:r}},Mpe={color:{active:[`#006edd`,`#e0ffff`],inactive:[Q.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:[`circle`,`roundRect`,`diamond`],inactive:[`none`]},symbolSize:{active:[10,50],inactive:[0,0]}},WQ=mq.mapVisual,Npe=mq.eachVisual,Ppe=X,GQ=Y,Fpe=ak,Ipe=ek,KQ=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=[`inRange`,`outOfRange`],n.replacableOptionKeys=[`inRange`,`outOfRange`,`target`,`controller`,`color`],n.layoutMode={type:`box`,ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&Mfe(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel(`textStyle`),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=JS(e,this),this.controllerVisuals=qZ(this.option.controller,t,e),this.targetVisuals=qZ(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this,t=this.option.seriesTargets;if(t){var n=[];return GQ(t,function(t){if(t.seriesIndex!=null)n.push(t.seriesIndex);else if(t.seriesId!=null){var r;e.ecModel.eachSeries(function(e){e.id===t.seriesId&&(r=e)}),r&&n.push(r.componentIndex)}}),n}var r=this.option.seriesId,i=this.option.seriesIndex;i==null&&r==null&&(i=`all`);var a=Vk(this.ecModel,`series`,{index:i,id:r},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return US(a,function(e){return e.componentIndex})},t.prototype.eachTargetSeries=function(e,t){Y(this.getTargetSeriesIndices(),function(n){var r=this.ecModel.getSeriesByIndex(n);r&&e.call(t,r)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var r=this.option,i=r.precision,a=this.dataBound,o=r.formatter,s;n||=[`<`,`>`],X(e)&&(e=e.slice(),s=!0);var c=t?e:s?[l(e[0]),l(e[1])]:l(e);return ZS(o)?o.replace(`{value}`,s?c[0]:c).replace(`{value2}`,s?c[1]:c):XS(o)?s?o(e[0],e[1]):o(e):s?e[0]===a[0]?n[0]+` `+c[1]:e[1]===a[1]?n[1]+` `+c[0]:c[0]+` - `+c[1]:c;function l(e){return e===a[0]?`min`:e===a[1]?`max`:(+e).toFixed(Math.min(i,20))}},t.prototype.resetExtent=function(){var e=this.option,t=Fpe([e.min,e.max]);this._dataExtent=t},t.prototype.getDimension=function(e){var t=this,n=this.option.seriesTargets;if(n){var r=KS(n,function(n){return n.seriesIndex!=null&&n.seriesIndex===e||n.seriesId!=null&&n.seriesId===t.ecModel.getSeriesByIndex(e).id});if(r)return r.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(e){var t=e.hostModel.seriesIndex,n=this.getDimension(t);if(n!=null)return e.getDimensionIndex(n);for(var r=e.dimensions,i=r.length-1;i>=0;i--){var a=r[i],o=e.getDimensionInfo(a);if(!o.isCalculationCoord)return o.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},r=t.target||={},i=t.controller||={};RS(r,n),RS(i,n);var a=this.isCategory();o.call(this,r),o.call(this,i),s.call(this,r,`inRange`,`outOfRange`),c.call(this,i);function o(n){Ppe(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get(`gradientColor`)}}function s(e,t,n){var r=e[t],i=e[n];r&&!i&&(i=e[n]={},GQ(r,function(e,t){if(mq.isValidType(t)){var n=UQ.get(t,`inactive`,a);n!=null&&(i[t]=n,t===`color`&&!i.hasOwnProperty(`opacity`)&&!i.hasOwnProperty(`colorAlpha`)&&(i.opacity=[0,0]))}}))}function c(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,r=this.get(`inactiveColor`),i=this.getItemSymbol()||`roundRect`;GQ(this.stateList,function(o){var s=this.itemSize,c=e[o];c||=e[o]={color:a?r:[r]},c.symbol??(c.symbol=t&&LS(t)||(a?i:[i])),c.symbolSize??(c.symbolSize=n&&LS(n)||(a?s[0]:[s[0],s[0]])),c.symbol=WQ(c.symbol,function(e){return e===`none`?i:e});var l=c.symbolSize;if(l!=null){var u=-1/0;Npe(l,function(e){e>u&&(u=e)}),c.symbolSize=WQ(l,function(e){return Ipe(e,[0,u],[0,s[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get(`itemWidth`)),parseFloat(this.get(`itemHeight`))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type=`visualMap`,t.dependencies=[`series`],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:`vertical`,backgroundColor:Q.color.transparent,borderColor:Q.color.borderTint,contentColor:Q.color.theme[0],inactiveColor:Q.color.disabled,borderWidth:0,padding:Q.size.m,textGap:10,precision:0,textStyle:{color:Q.color.secondary}},t}(sI),qQ=[20,140],Lpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod=`linear`,e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=qQ[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=qQ[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):X(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),Y(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=ak((this.get(`range`)||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var r=[],i=n.getData();i.each(this.getDataDimensionIndex(i),function(t,n){e[0]<=t&&t<=e[1]&&r.push(n)},this),t.push({seriesId:n.id,dataIndex:r})},this),t},t.prototype.getVisualMeta=function(e){var t=JQ(this,`outOfRange`,this.getExtent()),n=JQ(this,`inRange`,this.option.range.slice()),r=[];function i(t,n){r.push({value:t,color:e(t,n)})}for(var a=0,o=0,s=n.length,c=t.length;oe[1])break;r.push({color:this.getControllerVisual(o,`color`,t),offset:a/n})}return r.push({color:this.getControllerVisual(e[1],`color`,t),offset:1}),r},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get(`inverse`);return new yj(t===`horizontal`&&!n?{scaleX:e===`bottom`?1:-1,rotation:Math.PI/2}:t===`horizontal`&&n?{scaleX:e===`bottom`?-1:1,rotation:-Math.PI/2}:t===`vertical`&&!n?{scaleX:e===`left`?1:-1,scaleY:-1}:{scaleX:e===`left`?1:-1})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,r=this.visualMapModel,i=n.handleThumbs,a=n.handleLabels,o=r.itemSize,s=r.getExtent(),c=this._applyTransform(`left`,n.mainGroup);Rpe([0,1],function(l){var u=i[l];u.setStyle(`fill`,t.handlesColor[l]),u.y=e[l];var d=$Q(e[l],[0,o[1]],s,!0),f=this.getControllerVisual(d,`symbolSize`);u.scaleX=u.scaleY=f/o[0],u.x=o[0]-f/2;var p=SM(n.handleLabelPoints[l],xM(u,this.group));if(this._orient===`horizontal`){var m=c===`left`||c===`top`?(o[0]-f)/2:(o[0]-f)/-2;p[1]+=m}a[l].setStyle({x:p[0],y:p[1],text:r.formatValueText(this._dataInterval[l]),verticalAlign:`middle`,align:this._orient===`vertical`?this._applyTransform(`left`,n.mainGroup):`center`})},this)}},t.prototype._showIndicator=function(e,t,n,r){var i=this.visualMapModel,a=i.getExtent(),o=i.itemSize,s=[0,o[1]],c=this._shapes,l=c.indicator;if(l){l.attr(`invisible`,!1);var u=this.getControllerVisual(e,`color`,{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,`symbolSize`),f=$Q(e,a,s,!0),p=o[0]-d/2,m={x:l.x,y:l.y};l.y=f,l.x=p;var h=SM(c.indicatorLabelPoint,xM(l,this.group)),g=c.indicatorLabel;g.attr(`invisible`,!1);var _=this._applyTransform(`left`,c.mainGroup),v=this._orient===`horizontal`;g.setStyle({text:(n||``)+i.formatValueText(t),verticalAlign:v?_:`middle`,align:v?`center`:_});var y={x:p,y:f,style:{fill:u}},b={style:{x:h[0],y:h[1]}};if(i.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var x={duration:100,easing:`cubicInOut`,additive:!0};l.x=m.x,l.y=m.y,l.animateTo(y,x),g.animateTo(b,x)}else l.attr(y),g.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ci[1]&&(l[1]=1/0),t&&(l[0]===-1/0?this._showIndicator(c,l[1],`< `,o):l[1]===1/0?this._showIndicator(c,l[0],`> `,o):this._showIndicator(c,c,`≈ `,o));var u=this._hoverLinkDataIndices,d=[];(t||r$(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(l));var f=dae(u,d);this._dispatchHighDown(`downplay`,QQ(f[0],n)),this._dispatchHighDown(`highlight`,QQ(f[1],n))}},t.prototype._hoverLinkFromSeriesMouseOver=function(e){var t;if(lU(e.target,function(e){var n=rA(e);if(n.dataIndex!=null)return t=n,!0},!0),t){var n=this.ecModel.getSeriesByIndex(t.seriesIndex),r=this.visualMapModel;if(r.isTargetSeries(n)){var i=n.getData(t.dataType),a=i.getStore().get(r.getDataDimensionIndex(i),t.dataIndex);isNaN(a)||this._showIndicator(a,a)}}},t.prototype._hideIndicator=function(){var e=this._shapes;e.indicator&&e.indicator.attr(`invisible`,!0),e.indicatorLabel&&e.indicatorLabel.attr(`invisible`,!0);var t=this._shapes.handleLabels;if(t)for(var n=0;n=0&&(i.dimension=a,r.push(i))}}),e.getData().setVisual(`visualMeta`,r)}}];function Kpe(e,t,n,r){for(var i=t.targetVisuals[r],a=mq.prepareVisualTypes(i),o={color:cU(e.getData(),`color`)},s=0,c=a.length;s0:e.splitNumber>0)||e.calculable)?`continuous`:`piecewise`}),e.registerAction(Upe,Wpe),Y(Gpe,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(qpe))}function Jpe(e){e.registerComponentModel(Lpe),e.registerComponentView(Vpe),c$(e)}var Ype=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var r=this._mode=this._determineMode();this._pieceList=[],Xpe[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(e,t){r===`categories`?(e.mappingMethod=`category`,e.categories=LS(i)):(e.dataExtent=this.getExtent(),e.mappingMethod=`piecewise`,e.pieceList=US(this._pieceList,function(e){return e=LS(e),t!==`inRange`&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},r=mq.listVisualTypes(),i=this.isCategory();Y(t.pieces,function(e){Y(r,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),Y(n,function(e,n){var r=!1;Y(this.stateList,function(e){r=r||a(t,e,n)||a(t.target,e,n)},this),!r&&Y(this.stateList,function(e){(t[e]||(t[e]={}))[n]=UQ.get(n,e===`inRange`?`active`:`inactive`,i)})},this);function a(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,r=this._pieceList,i=(t?n:e).selected||{};if(n.selected=i,Y(r,function(e,t){var n=this.getSelectedMapKey(e);i.hasOwnProperty(n)||(i[n]=!0)},this),n.selectedMode===`single`){var a=!1;Y(r,function(e,t){var n=this.getSelectedMapKey(e);i[n]&&(a?i[n]=!1:a=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get(`itemSymbol`)},t.prototype.getSelectedMapKey=function(e){return this._mode===`categories`?e.value+``:e.index+``},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?`pieces`:this.option.categories?`categories`:`splitNumber`},t.prototype.setSelected=function(e){this.option.selected=LS(e)},t.prototype.getValueState=function(e){var t=mq.findPieceIndex(e,this._pieceList);return t==null?`outOfRange`:this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?`inRange`:`outOfRange`},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(r){var i=[],a=r.getData();a.each(this.getDataDimensionIndex(a),function(t,r){mq.findPieceIndex(t,n)===e&&i.push(r)},this),t.push({seriesId:r.id,dataIndex:i})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(e.value!=null)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(this.isCategory())return;var t=[],n=[``,``],r=this;function i(i,a){var o=r.getRepresentValue({interval:i});a||=r.getValueState(o);var s=e(o,a);i[0]===-1/0?n[0]=s:i[1]===1/0?n[1]=s:t.push({value:i[0],color:s},{value:i[1],color:s})}var a=this._pieceList.slice();if(!a.length)a.push({interval:[-1/0,1/0]});else{var o=a[0].interval[0];o!==-1/0&&a.unshift({interval:[-1/0,o]}),o=a[a.length-1].interval[1],o!==1/0&&a.push({interval:[o,1/0]})}var s=-1/0;return Y(a,function(e){var t=e.interval;t&&(t[0]>s&&i([s,t[0]],`outOfRange`),i(t.slice()),s=t[1])},this),{stops:t,outerColors:n}},t.type=`visualMap.piecewise`,t.defaultOption=MP(KQ.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:`auto`,itemWidth:20,itemHeight:14,itemSymbol:`roundRect`,pieces:null,categories:null,splitNumber:5,selectedMode:`multiple`,itemGap:10,hoverLink:!0}),t}(KQ),Xpe={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),r=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(r[1]-r[0])/i;+a.toFixed(n)!==a&&n<5;)n++;t.precision=n,a=+a.toFixed(n),t.minOpen&&e.push({interval:[-1/0,r[0]],close:[0,0]});for(var o=0,s=r[0];o`,`≥`][t[0]]];e.text=e.text||this.formatValueText(e.value==null?e.interval:e.value,!1,n)},this)}};function l$(e,t){var n=e.inverse;(e.orient===`vertical`?!n:n)&&t.reverse()}var Zpe=function(e){vS(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get(`textGap`),r=t.textStyleModel,i=this._getItemAlign(),a=t.itemSize,o=this._getViewData(),s=o.endsText,c=oC(t.get(`showLabel`,!0),!s),l=!t.get(`selectedMode`);s&&this._renderEndsText(e,s[0],a,c,i),Y(o.viewPieceList,function(o){var s=o.piece,u=new yj;u.onclick=JS(this._onItemClick,this,s),this._enableHoverLink(u,o.indexInModelPieceList);var d=t.getRepresentValue(s);if(this._createItemSymbol(u,d,[0,0,a[0],a[1]],l),c){var f=this.visualMapModel.getValueState(d),p=r.get(`align`)||i;u.add(new MO({style:QM(r,{x:p===`right`?-n:a[0]+n,y:a[1]/2,text:s.text,verticalAlign:r.get(`verticalAlign`)||`middle`,align:p,opacity:sC(r.get(`opacity`),f===`outOfRange`?.5:1)}),silent:l}))}e.add(u)},this),s&&this._renderEndsText(e,s[1],a,c,i),eI(t.get(`orient`),e,t.get(`itemGap`)),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on(`mouseover`,function(){return r(`highlight`)}).on(`mouseout`,function(){return r(`downplay`)});var r=function(e){var r=n.visualMapModel;r.option.hoverLink&&n.api.dispatchAction({type:e,batch:QQ(r.findTargetDataIndices(t),r)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if(t.orient===`vertical`)return ZQ(e,this.api,e.itemSize);var n=t.align;return n&&n!==`auto`||(n=`left`),n},t.prototype._renderEndsText=function(e,t,n,r,i){if(t){var a=new yj,o=this.visualMapModel.textStyleModel;a.add(new MO({style:QM(o,{x:r?i===`right`?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:`middle`,align:r?i:`center`,text:t})})),e.add(a)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=US(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get(`text`),r=e.get(`orient`),i=e.get(`inverse`);return(r===`horizontal`?i:!i)?t.reverse():n&&=n.slice().reverse(),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n,r){var i=HI(this.getControllerVisual(t,`symbol`),n[0],n[1],n[2],n[3],this.getControllerVisual(t,`color`));i.silent=r,e.add(i)},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,r=n.selectedMode;if(r){var i=LS(n.selected),a=t.getSelectedMapKey(e);r===`single`||r===!0?(i[a]=!0,Y(i,function(e,t){i[t]=t===a})):i[a]=!i[a],this.api.dispatchAction({type:`selectDataRange`,from:this.uid,visualMapId:this.visualMapModel.id,selected:i})}},t.type=`visualMap.piecewise`,t}(YQ);function Qpe(e){e.registerComponentModel(Ype),e.registerComponentView(Zpe),c$(e)}function $pe(e){ZW(Jpe),ZW(Qpe)}var eme={label:{enabled:!0},decal:{show:!1}},u$=Lk(),d$=Lk(),tme=nA(nme);function nme(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=d$(e).scope||(d$(e).scope={}),i=LS(eme);RS(i.label,e.getLocaleModel().get(`aria`),!1),RS(n.option,i,!1),a(),o();function a(){if(n.getModel(`decal`).get(`show`)){var t=_C();e.eachSeries(function(e){e.isColorBySeries()||(u$(e).scope=t.get(e.type)||t.set(e.type,{}))}),e.eachSeries(function(t){if(XS(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var i=uI(t.ecModel,t.name,r,e.getSeriesCount()),a=n.getVisual(`decal`);n.setVisual(`decal`,u(a,i))}else{var o=t.getRawData(),s={},c=u$(t).scope;n.each(function(e){var t=n.getRawIndex(e);s[t]=e});var l=o.count();o.each(function(e){var r=s[e],i=o.getName(e)||e+``,a=uI(t.ecModel,i,c,l),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,u(d,a))})}function u(e,t){var n=e?J(J({},t),e):t;return n.dirty=!0,n}})}}function o(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=zS(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`))r.setAttribute(`aria-label`,a.get(`description`));else{var o=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(o,d),p;if(!(o<1)){var m=c();p=m?s(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=o>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=s(g,{seriesCount:o}),e.eachSeries(function(e,t){if(t1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=s(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:l(e.subType)});var i=e.getData();if(i.count()>u){var c=a.get([`data`,`partialData`]);n+=s(c,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_=h$:-c>=h$),f=c>0?c%h$:c%h$+h$,p=!1;p=d?!0:!gE(u)&&f>=m$==!!l;var m=e+n*p$(a),h=t+r*f$(a);this._start&&this._add(`M`,m,h);var g=Math.round(i*ame);if(d){var _=1/this._p,v=(l?1:-1)*(h$-_);this._add(`A`,n,r,g,1,+l,e+n*p$(a+v),t+r*f$(a+v)),_>.01&&this._add(`A`,n,r,g,0,+l,m,h)}else{var y=e+n*p$(o),b=t+r*f$(o);this._add(`A`,n,r,g,+p,+l,y,b)}},e.prototype.rect=function(e,t,n,r){this._add(`M`,e,t),this._add(`l`,n,0),this._add(`l`,0,r),this._add(`l`,-n,0),this._add(`Z`)},e.prototype.closePath=function(){this._d.length>0&&this._add(`Z`)},e.prototype._add=function(e,t,n,r,i,a,o,s,c){for(var l=[],u=this._p,d=1;d`}function hme(e){return``}function C$(e,t){t||={};var n=t.newline?` +`:``;function r(e){var t=e.children,i=e.tag,a=e.attrs,o=e.text;return mme(i,a)+(i===`style`?o||``:KP(o))+(t?``+n+US(t,function(e){return r(e)}).join(n)+n:``)+hme(i)}return r(e)}function gme(e,t,n){n||={};var r=n.newline?` +`:``,i=` {`+r,a=r+`}`,o=US(qS(e),function(t){return t+i+US(qS(e[t]),function(n){return n+`:`+e[t][n]+`;`}).join(r)+a}).join(r),s=US(qS(t),function(e){return`@keyframes `+e+i+US(qS(t[e]),function(n){return n+i+US(qS(t[e][n]),function(r){var i=t[e][n][r];return r===`d`&&(i=`path("`+i+`")`),r+`:`+i+`;`}).join(r)+a}).join(r)+a}).join(r);return!o&&!s?``:[``].join(r)}function w$(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function T$(e,t,n,r){return S$(`svg`,`root`,{width:e,height:t,xmlns:y$,"xmlns:xlink":b$,version:`1.1`,baseProfile:`full`,viewBox:r?`0 0 `+e+` `+t:!1},n)}var _me=0;function E$(){return _me++}var D$={cubicIn:`0.32,0,0.67,0`,cubicOut:`0.33,1,0.68,1`,cubicInOut:`0.65,0,0.35,1`,quadraticIn:`0.11,0,0.5,0`,quadraticOut:`0.5,1,0.89,1`,quadraticInOut:`0.45,0,0.55,1`,quarticIn:`0.5,0,0.75,0`,quarticOut:`0.25,1,0.5,1`,quarticInOut:`0.76,0,0.24,1`,quinticIn:`0.64,0,0.78,0`,quinticOut:`0.22,1,0.36,1`,quinticInOut:`0.83,0,0.17,1`,sinusoidalIn:`0.12,0,0.39,0`,sinusoidalOut:`0.61,1,0.88,1`,sinusoidalInOut:`0.37,0,0.63,1`,exponentialIn:`0.7,0,0.84,0`,exponentialOut:`0.16,1,0.3,1`,exponentialInOut:`0.87,0,0.13,1`,circularIn:`0.55,0,1,0.45`,circularOut:`0,0.55,0.45,1`,circularInOut:`0.85,0,0.15,1`},O$=`transform-origin`;function vme(e,t,n){var r=J({},e.shape);J(r,t),e.buildPath(n,r);var i=new g$;return i.reset(jE(e)),n.rebuildPath(i,1),i.generateStr(),i.getStr()}function yme(e,t){var n=t.originX,r=t.originY;(n||r)&&(e[O$]=n+`px `+r+`px`)}var bme={fill:`fill`,opacity:`opacity`,lineWidth:`stroke-width`,lineDashOffset:`stroke-dashoffset`};function k$(e,t){var n=t.zrId+`-ani-`+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function xme(e,t,n){var r=e.shape.paths,i={},a,o;if(Y(r,function(e){var t=w$(n.zrId);t.animation=!0,j$(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,c=qS(r),l=c.length;if(l){o=c[l-1];var u=r[o];for(var d in u){var f=u[d];i[d]=i[d]||{d:``},i[d].d+=f.d||``}for(var p in s){var m=s[p].animation;m.indexOf(o)>=0&&(a=m)}}}),a){t.d=!1;var s=k$(i,n);return a.replace(o,s)}}function A$(e){return ZS(e)?D$[e]?`cubic-bezier(`+D$[e]+`)`:HT(e)?e:``:``}function j$(e,t,n,r){var i=e.animators,a=i.length,o=[];if(e instanceof Uj){var s=xme(e,t,n);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var c={},l=0;l0}).length)return k$(l,n)+` `+i[0]+` both`}for(var g in c){var s=h(c[g]);s&&o.push(s)}if(o.length){var _=n.zrId+`-cls-`+E$();n.cssNodes[`.`+_]={animation:o.join(`,`)},t.class=_}}function Sme(e,t,n){if(!e.ignore){if(e.isSilent()){var r={"pointer-events":`none`};M$(r,t,n,!0)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,c=e.currentStates.indexOf(`select`)>=0&&s||o;c&&(a=fE(c))}var l=i.lineWidth;if(l){var u=!i.strokeNoScale&&e.transform?e.transform[0]:1;l/=u}var r={cursor:`pointer`};a&&(r.fill=a),i.stroke&&(r.stroke=i.stroke),l&&(r[`stroke-width`]=l),M$(r,t,n,!0)}}}function M$(e,t,n,r){var i=JSON.stringify(e),a=n.cssStyleCache[i];a||(a=n.zrId+`-cls-`+E$(),n.cssStyleCache[i]=a,n.cssNodes[`.`+a+(r?`:hover`:``)]=e),t.class=t.class?t.class+` `+a:a}var N$=Math.round;function P$(e){return e&&ZS(e.src)}function F$(e){return e&&XS(e.toDataURL)}function I$(e,t,n,r){ume(function(i,a){var o=i===`fill`||i===`stroke`;o&&kE(a)?W$(t,e,i,r):o&&EE(a)?G$(n,e,i,r):e[i]=a,o&&r.ssr&&a===`none`&&(e[`pointer-events`]=`visible`)},t,n,!1),kme(n,e,r)}function L$(e,t){var n=xue(t);n&&(n.each(function(t,n){t!=null&&(e[(`ecmeta_`+n).toLowerCase()]=t+``)}),t.isSilent()&&(e[pme+`silent`]=`true`))}function R$(e){return gE(e[0]-1)&&gE(e[1])&&gE(e[2])&&gE(e[3]-1)}function Cme(e){return gE(e[4])&&gE(e[5])}function z$(e,t,n){if(t&&!(Cme(t)&&R$(t))){var r=n?10:1e4;e.transform=R$(t)?`translate(`+N$(t[4]*r)/r+` `+N$(t[5]*r)/r+`)`:yE(t)}}function B$(e,t,n){for(var r=e.points,i=[],a=0;a`u`){var g=`Image width/height must been given explictly in svg-ssr renderer.`;dC(f,g),dC(p,g)}else if(f==null||p==null){var _=function(e,t){if(e){var n=e.elm,r=f||t.width,i=p||t.height;e.tag===`pattern`&&(l?(i=1,r/=a.width):u&&(r=1,i/=a.height)),e.attrs.width=r,e.attrs.height=i,n&&(n.setAttribute(`width`,r),n.setAttribute(`height`,i))}},v=YC(m,null,e,function(e){c||_(S,e),_(d,e)});v&&v.width&&v.height&&(f||=v.width,p||=v.height)}d=S$(`image`,`img`,{href:m,width:f,height:p}),o.width=f,o.height=p}else i.svgElement&&(d=LS(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(d){var y,b;c?y=b=1:l?(b=1,y=o.width/a.width):u?(y=1,b=o.height/a.height):o.patternUnits=`userSpaceOnUse`,y!=null&&!isNaN(y)&&(o.width=y),b!=null&&!isNaN(b)&&(o.height=b);var x=ME(i);x&&(o.patternTransform=x);var S=S$(`pattern`,``,o,[d]),C=C$(S),w=r.patternCache,T=w[C];T||(T=r.zrId+`-p`+r.patternIdx++,w[C]=T,o.id=T,S=r.defs[T]=S$(`pattern`,T,o,[d])),t[n]=AE(T)}}function Ame(e,t,n){var r=n.clipPathCache,i=n.defs,a=r[e.id];if(!a){a=n.zrId+`-c`+n.clipPathIdx++;var o={id:a};r[e.id]=a,i[a]=S$(`clipPath`,a,o,[H$(e,n)])}t[`clip-path`]=AE(a)}function K$(e){return document.createTextNode(e)}function q$(e,t,n){e.insertBefore(t,n)}function J$(e,t){e.removeChild(t)}function Y$(e,t){e.appendChild(t)}function X$(e){return e.parentNode}function Z$(e){return e.nextSibling}function Q$(e,t){e.textContent=t}var $$=58,jme=120,Mme=S$(``,``);function e1(e){return e===void 0}function t1(e){return e!==void 0}function Nme(e,t,n){for(var r={},i=t;i<=n;++i){var a=e[i].key;a!==void 0&&(r[a]=i)}return r}function n1(e,t){var n=e.key===t.key;return e.tag===t.tag&&n}function r1(e){var t,n=e.children,r=e.tag;if(t1(r)){var i=e.elm=x$(r);if(o1(Mme,e),X(n))for(t=0;ta?(m=n[c+1]==null?null:n[c+1].elm,i1(e,m,n,i,c)):a1(e,t,r,a))}function s1(e,t){var n=t.elm=e.elm,r=e.children,i=t.children;e!==t&&(o1(e,t),e1(t.text)?t1(r)&&t1(i)?r!==i&&Pme(n,r,i):t1(i)?(t1(e.text)&&Q$(n,``),i1(n,null,i,0,i.length-1)):t1(r)?a1(n,r,0,r.length-1):t1(e.text)&&Q$(n,``):e.text!==t.text&&(t1(r)&&a1(n,r,0,r.length-1),Q$(n,t.text)))}function Fme(e,t){if(n1(e,t))s1(e,t);else{var n=e.elm,r=X$(n);r1(t),r!==null&&(q$(r,t.elm,Z$(n)),a1(r,[e],0,0))}return t}var Ime=0,Lme=function(){function e(e,t,n){if(this.type=`svg`,this.configLayer=Rme(`configLayer`),this.storage=t,this._opts=n=J({},n),this.root=e,this._id=`zr`+Ime++,this._oldVNode=T$(n.width,n.height),e&&!n.ssr){var r=this._viewport=document.createElement(`div`);r.style.cssText=`position:relative;overflow:hidden`;var i=this._svgDom=this._oldVNode.elm=x$(`svg`);o1(null,this._oldVNode),r.appendChild(i),e.appendChild(r)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style=`position:absolute;left:0;top:0;user-select:none`,Fme(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return U$(e,w$(this._id))},e.prototype.renderToVNode=function(e){e||={};var t=this.storage.getDisplayList(!0),n=this._width,r=this._height,i=w$(this._id);i.animation=e.animation,i.willUpdate=e.willUpdate,i.compress=e.compress,i.emphasis=e.emphasis,i.ssr=this._opts.ssr;var a=[],o=this._bgVNode=zme(n,r,this._backgroundColor,i);o&&a.push(o);var s=e.compress?null:this._mainVNode=S$(`g`,`main`,{},[]);this._paintList(t,i,s?s.children:a),s&&a.push(s);var c=US(qS(i.defs),function(e){return i.defs[e]});if(c.length&&a.push(S$(`defs`,`defs`,{},c)),e.animation){var l=gme(i.cssNodes,i.cssAnims,{newline:!0});if(l){var u=S$(`style`,`stl`,{},[],l);a.push(u)}}return T$(n,r,a,e.useViewBox)},e.prototype.renderToString=function(e){return e||={},C$(this.renderToVNode({animation:sC(e.cssAnimation,!0),emphasis:sC(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:sC(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var r=e.length,i=[],a=0,o,s,c=0,l=0;l=0&&!(d&&s&&d[m]===s[m]);m--);for(var h=p-1;h>m;h--)a--,o=i[a-1];for(var g=m+1;g=a}}}for(var l=u1(this),u=l.startIdx;u=0)&&(a=!0)}),a||i.__dirty){var o=n._opts.useDirtyRect&&!l1(i)?i.createRepaintRects(e,t,n._width,n._height):null,s=n._i.layerStack[0],c=!0;if(i.__dirty){c=!1,i.__dirty=!1;var l=i.zlevel===s.zl&&i.zlevel2===s.zl2?n._backgroundColor:null;i.clear(!1,l,o)}v1(i,function(t){var a=n._paintPerCursor(i,t,e,o,c);r&&=a})}},w1),CC.wxa&&b1(this._i,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),r},e.prototype._paintPerCursor=function(e,t,n,r,i){var a=e.ctx;if(r){if(!r.length)t.drawIdx=t.endIdx;else for(var o=this.dpr,s=0;s=t.endIdx},e.prototype._paintPerCursorInRect=function(e,t,n,r,i){for(var a={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},o=e.ctx,s=l1(e),c=s&&TS.getTime(),l=t.drawIdx,u=t.notClearIdx,d=u>=0?Math.min(u,l):l;d15){d++;break}}}IU(o,a),t.drawIdx=Math.max(d,l)},e.prototype.getLayer=function(e,t){return this._ensureLayer(e,0,t)},e.prototype._ensureLayer=function(e,t,n){t||=0;var r=this._singleCanvas;r&&!this._needsManuallyCompositing&&(e=p1,t=0);var i=y1(this._i,e)[t];return i||(i=g1(`zr_`+e+`.`+t,this,e,t),this._layerConfig[e]&&RS(i,this._layerConfig[e],!0),(n||r&&e!==p1)&&(i.virtual=!0),this._insertLayer(i,e,t,!1),i.initContext()),i},e.prototype.insertLayer=function(e,t){this._insertLayer(t,e,0,!1)},e.prototype._insertLayer=function(e,t,n,r){var i=this._i,a=i.layers,o=i.layerStack,s=this._domRoot,c=null;if(!(a[t]&&a[t][n])&&Hme(e)){for(var l=o.length,u=0;u0&&(c=y1(i,o[u-1].zl)[o[u-1].zl2]),o.splice(u,0,{zl:t,zl2:n}),y1(i,t)[n]=e,!r&&!e.virtual){if(c){var d=c.dom;d.nextSibling?s.insertBefore(e.dom,d.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}e.painter||=this}},e.prototype.eachLayer=function(e,t){return b1(this._i,function(n,r){e.call(t,n,r)})},e.prototype.eachBuiltinLayer=function(e,t){return b1(this._i,function(n,r){e.call(t,n,r)},x1)},e.prototype.eachOtherLayer=function(e,t){return b1(this._i,function(n,r){e.call(t,n,r)},S1)},e.prototype.getLayers=function(){var e={};return b1(this._i,function(t,n,r){e[t.id]=t}),e},e.prototype._updateLayerStatus=function(e,t){var n=this;if(n._singleCanvas)for(var r=1;r=0;a--){var o=i.get(r[a]);if(!o.used)t.__dirty=!0,i.removeKey(r[a]),r.splice(a,1);else{var s=o.endIdxNew;(l1(t)?s=0;r--){var i=t[r];if(i.zl===e){var a=n[e][i.zl2];if(a.__builtin__)continue;if(t.splice(r,1),n[e][i.zl2]=void 0,!a.virtual){var o=a.dom.parentNode;o&&o.removeChild(a.dom)}}}},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;e!=null&&(r.width=e),t!=null&&(r.height=t),e=gU(i,0,r),t=gU(i,1,r),n.style.display=``,(this._width!==e||t!==this._height)&&(n.style.width=e+`px`,n.style.height=t+`px`,b1(this._i,function(n){n.resize(e,t)}),this.refresh({paintAll:!0})),this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this._ensureLayer(p1).resize(e,t)}return this},e.prototype.clearLayer=function(e){Y(this._i.layers[e],function(e){e&&!e.__builtin__&&e.clear()})},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(e){if(e||={},this._singleCanvas&&!this._compositeManually)return this._i.layers[p1][0].dom;var t=new d1(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;b1(this._i,function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else{for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},o=this.storage.getDisplayList(!0),s=0,c=o.length;s=1024&&t=10||t===0?E1.format(e):Jme.format(e)} ${T1[t]}`}function O1(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function k1(e,t=Date.now()){let n=Date.parse(e);return Number.isNaN(n)?`–`:`${O1(Math.max(0,t-n))} ago`}function A1(e){let t=Date.parse(e);return Number.isNaN(t)?e:`${Qme.format(t)} UTC`}function j1(e,t){switch(t){case`bytes`:return D1(e);case`duration`:return O1(e);case`percent`:return`${E1.format(e)}%`;case`usd`:return e<10?Xme.format(e):Zme.format(e);default:return Number.isInteger(e)?E1.format(e):Yme.format(e)}}function M1(e,t){return e==null||e===``?`–`:t.type===`number`&&typeof e==`number`?j1(e,t.unit):t.type===`time`&&typeof e==`string`?k1(e):t.type===`bool`?e?`yes`:`no`:String(e)}function N1(e,t){return`${E1.format(e)} ${t}${e===1?``:t.endsWith(`s`)?`es`:`s`}`}function P1(e){let t=e.replace(/_bytes$|_at$/,``).replaceAll(`_`,` `);return t.charAt(0).toUpperCase()+t.slice(1)}ZW([Wle,$R,MJ,zJ,lX,Vfe,qfe,$fe,iZ,jfe,jpe,upe,$pe,ime,qme,Bme]);function $me(e){let t=Hy[e],n=Uy[e];return{scheme:e,text:t.text,muted:t.muted,line:t.controlBorder,grid:t.borderSoft,surface:t.raised,inset:t.inset,border:t.border,brand:n.brand,series:Wy[e],states:{working:n.success,waiting:n.warning,stuck:n.danger,idle:n.info,finished:t.controlBorder}}}function F1(e,t){return e.series[t]??e.muted}function I1(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var L1=e=>({color:e.muted,fontFamily:Ky.mono,fontSize:Gy.micro});function R1(e,t={}){return{confine:!0,backgroundColor:e.inset,borderColor:e.border,borderWidth:1,borderRadius:6,padding:[6,10],textStyle:{color:e.text,fontSize:Gy.small,fontFamily:Ky.sans},extraCssText:`box-shadow: none;`,...t}}function z1(e,t,n){return`
${I1(t)}${I1(n)}
`}function B1(e,t){if(t.viz===`bar`){let t=e.columns[1]?.unit,n=e.rows.map(e=>({name:String(e[0]??`–`)||`–`,n:Number(e[1]??0)}));if(!n.length)return``;let r=n.reduce((e,t)=>t.n>e.n?t:e),i=n.reduce((e,t)=>e+t.n,0);return`${r.name} most, ${j1(r.n,t)} of ${j1(i,t)}`}if(t.viz!==`timeseries`)return``;let n=e.columns[2]?.unit,r=new Map,i=-1/0;for(let t of e.rows)typeof t[2]==`number`&&(r.set(String(t[1]??``),t[2]),i=Math.max(i,t[2]));if(!r.size)return``;if(r.size===1)return`${j1([...r.values()][0],n)} now, peak ${j1(i,n)}`;let[a,o]=[...r.entries()].reduce((e,t)=>t[1]>e[1]?t:e);return`${a} highest now at ${j1(o,n)}`}function ehe(e,t){let n=new Map;for(let t of e.rows){let e=Date.parse(String(t[0])),r=typeof t[2]==`number`?t[2]:null;if(Number.isNaN(e)||r===null)continue;let i=String(t[1]??``);n.has(i)||n.set(i,[]),n.get(i).push([e,r])}return[...n.entries()].map(([e,n])=>({name:e||P1(t.measure??`value`),points:n}))}function the(e,t,n,r,i=`hour`){let a=r??n.brand,o=e.map((e,t)=>[t,e]);return{animation:!1,aria:{enabled:!0,label:{description:`${t} over the last ${i}`}},grid:{left:1,right:3,top:3,bottom:3},xAxis:{type:`value`,show:!1,min:0,max:Math.max(1,e.length-1)},yAxis:{type:`value`,show:!1,scale:!0},series:[{type:`line`,data:o,showSymbol:!1,connectNulls:!1,smooth:.3,silent:!0,lineStyle:{width:1.5,color:a},areaStyle:{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Dn(a,.32)},{offset:1,color:Dn(a,0)}]}},markPoint:{symbol:`circle`,symbolSize:4,silent:!0,label:{show:!1},itemStyle:{color:a},data:nhe(o)}}]}}function nhe(e){for(let t=e.length-1;t>=0;t--)if(e[t][1]!==null)return[{coord:e[t]}];return[]}function rhe(e,t){return{animation:!1,textStyle:{color:t.text,fontFamily:Ky.sans,fontSize:Gy.small},aria:{enabled:!0,label:{description:e.description}},tooltip:R1(t,{trigger:`item`,formatter:e=>e.data?.tip??``}),series:[{type:`sankey`,left:e.left??100,right:e.right??350,top:8,bottom:8,nodeWidth:12,nodeGap:12,nodeAlign:`justify`,layoutIterations:0,draggable:!1,lineStyle:{color:`gradient`,opacity:.22,curveness:.5},emphasis:{focus:`adjacency`,lineStyle:{opacity:.5}},label:{fontFamily:Ky.mono,fontSize:Gy.small,color:t.text,width:e.labelWidth??340,overflow:`truncate`,formatter:e=>e.data?.text??``,rich:e.rich},data:e.nodes,links:e.links}]}}function ihe(e,t){if(e!==`bytes`||!(t>0))return{};for(let e=1;e<=1024**5;e*=1024)for(let n of[1,2,4,8,16,32,64,128,256,512]){let r=n*e;if(t/r<=5)return{interval:r,max:Math.ceil(t/r)*r}}return{}}var ahe=[`click`];function V1({option:e,label:t,height:n,small:r,onEvent:i}){let a=Yn(`dark`),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(i);return c.current=i,(0,h.useEffect)(()=>{if(!o.current)return;let e=Yde(o.current,void 0,{renderer:r?`svg`:`canvas`});s.current=e;for(let t of ahe)e.on(t,e=>c.current?.(t,e));let t=new ResizeObserver(()=>e.resize());return t.observe(o.current),()=>{t.disconnect(),e.dispose(),s.current=null}},[r]),(0,h.useEffect)(()=>{s.current?.setOption(e($me(a)),{notMerge:!0})},[e,a,r]),(0,H.jsx)(`div`,{ref:o,role:`img`,"aria-label":t,style:{height:n??`100%`,width:`100%`,minHeight:r?0:80}})}var H1={axisLine:{show:!1},axisTick:{show:!1}},U1=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function ohe(e,t,n){return typeof e.color==`number`?F1(n,e.color):e.color===`brand`?n.brand:e.color===void 0?t===0?n.brand:F1(n,t):n.states[e.color]}function she(e,t){let{series:n,from:r,to:i,format:a,waits:o=[],events:s=[],peak:c=!0}=e,l=n.length>1,u=n.reduce((e,t)=>t.points.reduce((e,t)=>Math.max(e,t[1]),e),0),d=n[0],f=e=>{if(!d?.points.length)return 0;let t=d.points[0];for(let n of d.points)Math.abs(n[0]-e)e.length?[`
${I1(U1(e[0].value[0]))}
`,...e.map(e=>z1(e.color,e.seriesName,a(e.value[1])))].join(``):``}),xAxis:{type:`time`,min:r,max:i,...H1,axisLabel:{...L1(t),hideOverlap:!0,formatter:e=>U1(e)},splitLine:{show:!1}},yAxis:{type:`value`,...ihe(e.unit,u),...H1,axisLabel:{...L1(t),formatter:e=>a(e)},splitLine:{lineStyle:{color:t.grid}}},series:n.map((e,n)=>{let r=ohe(e,n,t);return{type:`line`,name:e.name,data:e.points,showSymbol:!1,smooth:!1,sampling:`lttb`,lineStyle:{width:1.5,color:r},itemStyle:{color:r},areaStyle:n===0?{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:Dn(r,.28)},{offset:1,color:Dn(r,0)}]}}:void 0,emphasis:{disabled:!0},markLine:n===0&&c&&e.points.length?{silent:!0,symbol:`none`,lineStyle:{color:t.muted,type:`dashed`,width:1},label:{formatter:`peak ${a(u)}`,position:`insideStartTop`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:[{type:`max`,name:`peak`}]}:void 0,markArea:n===0&&o.length?{silent:!0,itemStyle:{color:Dn(t.states.waiting,.1)},label:{show:!0,position:`insideBottom`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:o.map(e=>[{name:e.label,xAxis:e.from},{xAxis:e.to}])}:void 0,markPoint:n===0&&s.length?{symbol:`circle`,symbolSize:8,itemStyle:{color:t.brand,borderColor:t.surface,borderWidth:2},label:{show:!0,position:`top`,formatter:`{b}`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.text,backgroundColor:t.inset,borderColor:t.border,borderWidth:1,padding:[2,5],borderRadius:3},data:s.map(e=>({name:e.label,coord:[e.at,f(e.at)]}))}:void 0}})}}function che(e,t){let{rows:n,cols:r,values:i,format:a,unit:o}=e,s=i.flatMap((e,t)=>e.map((e,n)=>[n,t,e])),c=s.reduce((e,t)=>Math.max(e,t[2]),1);return{animation:!1,aria:{enabled:!0,label:{description:e.label}},tooltip:R1(t,{trigger:`item`,formatter:e=>`${I1(n[e.value[1]])} · ${I1(r[e.value[0]])}
${I1(a(e.value[2]))} ${I1(o)}`}),grid:{left:4,right:4,top:4,bottom:4},xAxis:{type:`category`,data:r,...H1,axisLabel:{...L1(t),interval:2},splitLine:{show:!1}},yAxis:{type:`category`,data:n,inverse:!0,...H1,axisLabel:{...L1(t),fontSize:Gy.small,color:t.text},splitLine:{show:!1}},visualMap:{show:!1,min:0,max:c,inRange:{color:[Dn(t.brand,.08),Dn(t.brand,.45),t.brand]}},series:[{type:`heatmap`,data:s,itemStyle:{borderColor:t.surface,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{borderColor:t.text}}}]}}function lhe(e,t){let{lanes:n,from:r,to:i,now:a}=e,o=n.flatMap((e,n)=>e.segments.map(r=>({value:[n,r.from,r.to,r.state],name:e.name,itemStyle:{color:t.states[r.state]}}))),s=(e,n)=>{let r=n.value(0),i=n.coord([n.value(1),r]),a=n.coord([n.value(2),r]),o=n.size([0,1])[1]*.5,s=e.coordSys,c=EM({x:i[0],y:i[1]-o/2,width:Math.max(2,a[0]-i[0]),height:o},s);return c?{type:`rect`,shape:{...c,r:2},style:{fill:t.states[n.value(3)]},transition:[]}:null},c=e=>i-e<(i-r)*.06;return{animation:!1,aria:{enabled:!0,label:{description:e.label}},tooltip:R1(t,{trigger:`item`,formatter:e=>z1(e.color,e.name,`${e.value[3]} · ${O1(e.value[2]-e.value[1])}`)}),grid:{left:4,right:36,top:6,bottom:4},xAxis:{type:`time`,min:r,max:i,...H1,axisLabel:{...L1(t),hideOverlap:!0,showMaxLabel:!1,formatter:e=>c(e)?``:U1(e)},splitLine:{lineStyle:{color:t.grid}}},yAxis:{type:`category`,data:n.map(e=>e.name),inverse:!0,...H1,axisLabel:{...L1(t),fontSize:Gy.small,color:t.text,width:150,overflow:`truncate`},splitLine:{show:!1}},series:[{type:`custom`,renderItem:s,encode:{x:[1,2],y:0},data:o,markLine:{silent:!0,symbol:`none`,lineStyle:{color:t.text,width:1},label:{formatter:`now`,position:`end`,fontFamily:Ky.mono,fontSize:Gy.micro,color:t.muted},data:[{xAxis:a}]}}]}}var uhe=[8,30,55,80,100];function dhe({rows:e,cols:t,values:n,format:r,unit:i,label:a,rowHeight:o=22}){let s=(0,h.useCallback)(o=>che({rows:e,cols:t,values:n,format:r,unit:i,label:a},o),[e,t,n,r,i,a]);return(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(V1,{option:s,label:a,height:e.length*o+32}),(0,H.jsxs)(K,{justify:`flex-end`,gap:6,"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1,children:`fewer`}),uhe.map(e=>(0,H.jsx)(G,{w:12,h:10,style:{borderRadius:2,background:`color-mix(in srgb, var(--mantine-color-brand-filled) ${e}%, var(--driga-raised))`}},e)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,lh:1,children:[`more `,i]})]})]})}var fhe={icon:bv,direction:`neutral`},phe={"summary:sum:need_you":{icon:ry,attention:`waiting`,target:`inbox`,direction:`down-good`},"summary:sum:to_review":{icon:Uv,attention:`review`,target:`inbox`,direction:`neutral`},"summary:sum:attention_stuck":{icon:sy,attention:`stuck`,target:`stuck`,direction:`down-good`},"summary:sum:leftover_bytes":{icon:Zte,target:`leftover`,direction:`down-good`,countNouns:{leftover:[`tree`,`trees`]}},"cleanup:sum:size_bytes":{icon:pv,target:`reclaim`,direction:`down-good`},"local_activity:max:mem_used_bytes":{icon:_y,target:`memory`,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:cpu_percent":{icon:Nv,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:disk_used_bytes":{icon:ay,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:load1":{icon:Yv,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:swap_used_bytes":{icon:_y,direction:`down-good`,sublabel:`local-machine`},"local_activity:max:events":{icon:bv,direction:`neutral`,sublabel:`local-machine`},"summary:sum:machines_reachable":{icon:Dy,direction:`up-good`}};function W1(e){return phe[`${e.source}:${e.measure??`count`}`]??fhe}function mhe(e,t){let n=e.caption?.split(`:`).at(-1),r=n?W1(e).countNouns?.[n]:void 0;return`${j1(t)}${r?` ${r[t===1?0:1]}`:``}`}var G1=[`waiting`,`stuck`,`working`,`idle`,`finished`],K1=[`working`,`waiting`,`stuck`,`idle`],q1={working:`working`,waiting:`waiting`,stuck:`stuck`,idle:`idle`,finished:`finished`},J1={claude:`Claude Code`,codex:`Codex`,gemini:`Gemini`,copilot:`Copilot`,agy:`agy`};function Y1(e){return e&&Object.hasOwn(J1,e)?e:void 0}function X1(e){let t=Y1(e);return t?J1[t]:e??``}var Z1=[`waiting`,`review`,`stuck`],Q1={waiting:{label:`Need you`,tone:`warning`,icon:ry,key:`1`,hint:`Filter the inbox to what needs you`,target:`inbox`},review:{label:`To review`,tone:`info`,icon:Uv,key:`2`,hint:`Filter the inbox to what finished`,target:`inbox`},stuck:{label:`Stuck`,tone:`danger`,icon:sy,key:`3`,hint:`Show the stuck sessions on Home`,target:`stuck`}},$1=[`stuck`,`waiting`,`working`,`idle`];function e0(e){return $1.find(t=>e.sessions[t]>0)??null}function t0(e,t){return t>0?Math.round(e/t*100):0}function hhe(e,t){let n=$1.filter(t=>e.sessions[t]>0).map(t=>`${e.sessions[t]} ${t}`),r=e.reachable?n.length?n:[`no sessions`]:[`unreachable`];return[...e.local?[`this machine`]:[],...r,`seen ${k1(e.seenAt,t)}`].join(` · `)}function ghe(e,t){return[e.name,hhe(e,t),`${D1(e.memory.used)} of ${D1(e.memory.total)}`].join(` · `)}function _he(e){let t=e.flatMap(e=>e.reachable?e0(e)===`stuck`?[`${e.name} stuck`]:e0(e)===`waiting`?[`${e.name} waiting`]:[]:[`${e.name} unreachable`]);return t.length?t.join(` · `):`all working or idle`}function n0(e){return`Fleet: ${e.length} machine${e.length===1?``:`s`} · ${_he(e)}`}function vhe(e){return e.trend.length<2||e.trend[0]===null||e.trend[e.trend.length-1]===null?`not enough history for an hour’s change`:e.delta===0?`steady over the last hour`:`${e.delta>0?`up`:`down`} ${Math.abs(e.delta)} in the last hour`}function yhe(e){let t=new Map(e.results.map(e=>[e.id,e])),n=e=>typeof e==`number`&&Number.isFinite(e)?e:null;return e.dashboard.panels.filter(e=>e.viz===`stat`||e.viz===`gauge`).map(e=>{let r=t.get(e.id),i=r?.status===`ok`;return{id:e.id,title:r?.title||e.title,viz:e.viz,panel:e,value:i?n(r.frame?.rows[0]?.[0]):null,unit:e.unit??r?.frame?.columns[0]?.unit,total:i?n(r.total):null,caption:i&&e.caption?n(r.caption):null,trend:i?r.trend:void 0,max:e.max,error:r?.status===`error`?r.message??`This panel could not run.`:void 0,behavior:W1(e)}})}var bhe={attention:{waiting:[],review:[],stuck:[]},polls:{}};function r0(e,t){return e.machines.map(n=>{let r=Object.fromEntries(K1.map(t=>[t,e.sessions.filter(e=>e.machine===n.id&&e.state===t).length]));return{id:n.id,name:n.name,local:n.local,reachable:n.reachable,sessions:r,memory:{used:n.memoryUsed,total:n.memoryTotal},polls:t[n.id]??[],seenAt:n.lastSeen}})}function xhe(e,t,n){let r=t?r0(t,n.polls):[];return{tiles:yhe(e).map(e=>e.behavior.attention?{...e,trend:n.attention[e.behavior.attention]}:e),localMachine:r.find(t=>t.local||t.id===e.local_machine)?.name??e.local_machine??`this machine`,machines:r,checkedAt:e.observed_at}}function She(e,t){return Object.fromEntries(t.filter(t=>(e.polls[t.id]?.length??0)>1).map(t=>{let n=e.polls[t.id],r=n.map((e,t)=>({state:e===`quiet`?null:e,label:`poll ${t+1} of ${n.length} · ${e===`offline`?`unreachable`:e===`quiet`?`no sessions`:e}`}));return[t.id,{cells:r,from:`${n.length} polls`,to:`now`,label:`${t.name}, last ${n.length} polls`}]}))}function i0(e){if(!e)return bhe;let t=e.history.attention??[],n={};for(let t of e.history.polls??[])(n[t.machine_id]??=[]).push(t.state);return{attention:Object.fromEntries(Z1.map(e=>[e,t.map(t=>t[e])])),polls:n}}function Che(){return(0,H.jsxs)(o_,{align:`center`,justify:`center`,gap:6,style:{flex:1},py:`xl`,children:[(0,H.jsx)(E_,{variant:`light`,color:`gray`,radius:`xl`,size:36,children:(0,H.jsx)(Fv,{size:18,"aria-hidden":!0})}),(0,H.jsx)(q,{fw:600,fz:`md`,children:`No machines yet`}),(0,H.jsx)(q,{fz:`sm`,c:`dimmed`,ta:`center`,maw:420,style:{textWrap:`pretty`},children:`Start an agent in a terminal on this machine, or pair another one; the fleet appears here within a few seconds.`})]})}var a0={working:`success`,waiting:`warning`,stuck:`danger`,idle:`info`,finished:`neutral`};function o0(e){return e===`neutral`?`var(--driga-control-border)`:`var(--mantine-color-${e}-filled)`}function s0(e){return o0(a0[e])}function c0(e){let t=e.startsWith(`~`),n=e.replace(/^~/,``);return{state:Object.hasOwn(q1,n)?n:void 0,label:n,inferred:t}}function l0({state:e,variant:t=`dot`,label:n,inferred:r,evidence:i,pulse:a,tone:o}){let s=o??(e?a0[e]:`neutral`),c=(n??(e?q1[e]:``)).replace(/^~/,``),l=i?.trim(),u=r?`${c}, inferred`:c,d=o0(s),f=e===`finished`?(0,H.jsx)(Dv,{size:12,weight:`regular`,"aria-hidden":!0,style:{color:`var(--driga-muted)`,flex:`none`}}):(0,H.jsx)(G,{"aria-hidden":!0,className:a&&e===`waiting`?`w-pulse`:void 0,style:{width:6,height:6,borderRadius:`50%`,flex:`none`,background:e===`idle`?`transparent`:d,boxShadow:e===`idle`?`inset 0 0 0 1.5px ${d}`:void 0}}),p=t===`pill`?(0,H.jsx)(bm,{variant:`light`,color:s===`neutral`?`gray`:s,size:`md`,radius:`sm`,fw:500,lts:`0.04em`,leftSection:f,"aria-label":u,"aria-description":l,title:l?void 0:u,tabIndex:l?0:void 0,styles:{root:{textTransform:`none`,background:`var(--driga-tint-${s})`,color:`var(--driga-text)`,boxShadow:`inset 0 0 0 1px ${d}`,border:r?`1px dashed var(--driga-muted)`:void 0,paddingInline:6},label:{fontSize:`var(--mantine-font-size-xs)`}},children:c}):(0,H.jsxs)(K,{role:`img`,gap:6,wrap:`nowrap`,"aria-label":u,"aria-description":l,title:l?void 0:u,tabIndex:l?0:void 0,style:{display:`inline-flex`},children:[f,(0,H.jsx)(q,{size:`xs`,fw:500,lh:1.2,style:{whiteSpace:`nowrap`,borderBottom:r&&l?`1px dashed var(--driga-faint)`:void 0},children:r&&c!==`unknown`?`~${c}`:c})]});return l?(0,H.jsx)(Bg,{label:l,multiline:!0,w:280,events:{hover:!0,focus:!0,touch:!0},children:p}):p}var u0={waiting:{label:`waiting`,tone:a0.waiting,rank:0},stuck:{label:`stuck`,tone:a0.stuck,rank:1},working:{label:`working`,tone:a0.working,rank:2},idle:{label:`idle`,tone:a0.idle,rank:3},finished:{label:`finished`,tone:a0.finished,rank:4}};function d0(e){return[...e].sort((e,t)=>Number(!!t.local)-Number(!!e.local)||e.name.localeCompare(t.name))}function f0(e,t){return u0[e.state].rank-u0[t.state].rank||e.title.localeCompare(t.title)}function whe(){return{waiting:0,stuck:0,working:0,idle:0,finished:0}}function The(e){let t=whe();for(let n of e)t[n.state]++;return t}function p0(e){return e.filter(e=>e.state===`waiting`||e.state===`stuck`).length}function Ehe({machines:e,projects:t,sessions:n}){let r=new Map(t.map(e=>[e.id,e]));return d0(e).map(e=>{let t=n.filter(t=>t.machine===e.id),i=new Map;for(let e of t)i.set(e.project,[...i.get(e.project)??[],e]);return{machine:e,projects:[...i.entries()].map(([e,t])=>({project:r.get(e)??{id:e,name:e,repo:``},sessions:t.sort(f0),memory:t.reduce((e,t)=>e+t.memory,0),waiting:t.some(e=>e.state===`waiting`)})).sort((e,t)=>e.project.name.localeCompare(t.project.name)),memory:t.reduce((e,t)=>e+t.memory,0),counts:The(t)}})}function Dhe(e){let t=new Map(e.map(e=>[e,new Map])),n=new Map;for(let r of e)for(let e of new Set(r.files??[])){let i=JSON.stringify([r.machine,r.project,e]),a=n.get(i)??[];for(let n of a)for(let[i,a]of[[r,n],[n,r]]){let n=t.get(i),r=n.get(a)??[];r.push(e),n.set(a,r)}a.push(r),n.set(i,a)}return new Map([...t].map(([e,t])=>[e,[...t].map(([e,t])=>({with:e,files:t}))]))}function m0(e){return JSON.stringify([e.machine,e.id])}function Ohe(e){try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&t.every(e=>typeof e==`string`))return{kind:`session`,machine:t[0],id:t[1]}}catch{}return null}var h0=class{data;groups;machines;projects;sessions=new Map;childrenByParent=new Map;projectMembers=new Map;shared;constructor(e){this.data=e;for(let t of e.sessions){this.sessions.set(m0(t),t);let e=this.projectMembers.get(t.project)??[];if(e.push(t),this.projectMembers.set(t.project,e),t.parent){let e=m0({machine:t.machine,id:t.parent}),n=this.childrenByParent.get(e)??[];n.push(t),this.childrenByParent.set(e,n)}}for(let e of this.childrenByParent.values())e.sort(f0);this.groups=Ehe(e),this.machines=d0(e.machines),this.projects=[...this.projectMembers.keys()].map(e=>this.project(e)??{id:e,name:e,repo:``}).sort((e,t)=>e.name.localeCompare(t.name)),this.shared=Dhe(e.sessions)}session(e,t){if(t!==void 0)return this.sessions.get(m0({machine:t,id:e}));let n=this.data.sessions.filter(t=>t.id===e);return n.length===1?n[0]:void 0}machine(e){return this.data.machines.find(t=>t.id===e)}project(e){return this.data.projects.find(t=>t.id===e)}projectSessions(e){return this.projectMembers.get(e)??[]}projectMachines(e){let t=new Set(this.projectSessions(e).map(e=>e.machine));return this.machines.filter(e=>t.has(e.id))}parent(e){return e.parent?this.session(e.parent,e.machine):void 0}children(e){return this.childrenByParent.get(m0(e))??[]}roots(e,t){return this.projectSessions(t).filter(t=>t.machine===e&&!this.parent(t)).sort(f0)}overlaps(e){return this.shared.get(this.session(e.id,e.machine))??[]}branch(e){let t=[],n=(e,r,i)=>{let a=m0(e);if(i.has(a))return;t.push({session:e,depth:r});let o=new Set(i).add(a);for(let t of this.children(e))n(t,r+1,o)};return n(e,0,new Set),t}};function khe(e){let t=(e.turns??[]).slice(-30);return{ok:t.filter(e=>e===`ok`).length,waited:t.filter(e=>e===`waited`).length,failed:t.filter(e=>e===`failed`).length,total:t.length}}function Ahe(e){let t=(e.turns??[]).slice(-30),n=30-t.length,r={ok:`working`,waited:`waiting`,failed:`stuck`};return Array.from({length:30},(e,i)=>ie.project)).size;return(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,style:{flex:`none`},children:[(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,align:`baseline`,style:{minWidth:0},children:[(0,H.jsx)(k_,{order:1,fz:28,fw:650,lh:1.2,style:{letterSpacing:`-0.02em`},children:`Fleet`}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[N1(e.length,`machine`),` · `,N1(i,`project`),` · `,N1(t.length,`session`)]}),r>0&&(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,fw:600,c:`warning`,style:{whiteSpace:`nowrap`},children:[`· `,r,` need you`]})]}),(0,H.jsx)(K,{gap:`xs`,wrap:`nowrap`,children:n})]})}function _0(e,[t,n]=[.7,.9]){return e>=n?`danger`:e>=t?`warning`:`brand`}function v0({value:e,max:t,format:n,label:r,thresholds:i=[.7,.9],size:a=4,caption:o=!0}){let s=t>0?Math.min(1,Math.max(0,e/t)):0,c=Math.round(s*100),l=_0(s,i),u=`${r}: ${n(e)} of ${n(t)}, ${c}%`;return(0,H.jsxs)(o_,{gap:4,children:[o&&(0,H.jsxs)(K,{justify:o===`percent`?`flex-end`:`space-between`,gap:`xs`,wrap:`nowrap`,"aria-hidden":!0,children:[o!==`percent`&&(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:[n(e),` `,(0,H.jsxs)(q,{span:!0,c:`dimmed`,ff:`monospace`,fz:`inherit`,children:[`/ `,n(t)]})]}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,c:l===`brand`?`dimmed`:l,lh:1.2,children:[c,`%`]})]}),(0,H.jsxs)(G,{pos:`relative`,py:2,children:[(0,H.jsx)(Ng.Root,{size:a,styles:{root:{background:`var(--driga-border)`}},children:(0,H.jsx)(Ng.Section,{value:s*100,color:l,"aria-label":u})}),i.map(e=>(0,H.jsx)(G,{"aria-hidden":!0,pos:`absolute`,top:0,h:a+4,w:1,left:`${e*100}%`,style:{background:`var(--driga-control-border)`}},e))]})]})}var y0={light:Ry.latte,dark:Ry.mocha},Phe={light:{claude:y0.light.peach,codex:y0.light.teal,gemini:y0.light.sapphire,copilot:y0.light.sky,agy:y0.light.pink},dark:{claude:y0.dark.peach,codex:y0.dark.teal,gemini:y0.dark.sapphire,copilot:y0.dark.sky,agy:y0.dark.pink}};function Fhe(e,t){let n=Y1(t);if(!n)return{tint:`var(--driga-tint-neutral)`,ring:`var(--driga-border)`,ink:`var(--driga-muted)`};let r=Phe[e][n];return{tint:Dn(r,.16),ring:Dn(r,.4),ink:e===`dark`?r:wn(r,.3)}}var Ihe={claude:Cy,codex:kv,gemini:Lv,copilot:$v,agy:Gte};function b0({agent:e,name:t,waiting:n,size:r=20}){let i=Fhe(Yn(`dark`),e),a=Y1(e),o=a?Ihe[a]:qte,s=`${X1(e)||`agent`}${n?`, waiting on you`:``}`,c=(0,H.jsx)(G,{"aria-hidden":!0,style:{width:r,height:r,borderRadius:`50%`,background:i.tint,boxShadow:`inset 0 0 0 1px ${i.ring}`,color:i.ink,display:`grid`,placeItems:`center`,flex:`none`},children:(0,H.jsx)(o,{size:Math.round(r*.6),weight:`regular`})}),l=n?(0,H.jsx)(ch,{color:`warning`,size:7,offset:1,withBorder:!0,children:c}):c;return t?(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,title:s,style:{display:`inline-flex`},children:[l,(0,H.jsx)(q,{size:`xs`,lh:1.2,style:{whiteSpace:`nowrap`},children:X1(e)||`agent`}),n&&(0,H.jsx)(`span`,{className:`sr-only`,children:`, waiting on you`})]}):(0,H.jsx)(G,{role:`img`,"aria-label":s,title:s,style:{display:`inline-flex`,flex:`none`},children:l})}function Lhe({segments:e,total:t,marker:n,format:r,label:i,size:a=8}){let o=Yn(`dark`),s=t??e.reduce((e,t)=>e+t.value,0),c=e=>s>0?Math.round(Math.min(100,e/s*100)*100)/100:0,l=(e,t)=>e.color===`brand`?`var(--mantine-color-brand-filled)`:typeof e.color==`string`?s0(e.color):Wy[o][e.color??t]??`var(--driga-faint)`,u=n?c(n.value):0;return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsxs)(G,{pos:`relative`,pt:n?18:0,children:[(0,H.jsx)(Ng.Root,{size:a,styles:{root:{background:`var(--driga-border)`}},children:e.map((e,t)=>(0,H.jsx)(Ng.Section,{value:c(e.value),color:l(e,t),"aria-label":`${e.label}: ${r(e.value)}`,style:{boxShadow:`inset -1px 0 0 var(--driga-raised)`}},e.label))}),n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(G,{"aria-hidden":!0,pos:`absolute`,bottom:-3,h:a+6,w:2,left:`${u}%`,style:{background:`var(--driga-text)`,transform:`translateX(-1px)`,borderRadius:1}}),(0,H.jsx)(q,{"aria-hidden":!0,pos:`absolute`,top:0,size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,style:u>75?{right:0,whiteSpace:`nowrap`}:{left:`${u}%`,transform:`translateX(-50%)`,whiteSpace:`nowrap`},children:n.label})]})]}),(0,H.jsxs)(K,{gap:`md`,role:`list`,"aria-label":i,children:[e.map((e,t)=>(0,H.jsxs)(K,{role:`listitem`,gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:8,color:l(e,t),withShadow:!1,"aria-hidden":!0}),(0,H.jsx)(q,{size:`xs`,lh:1.2,children:e.label}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1.2,children:r(e.value)})]},e.label)),n&&(0,H.jsxs)(q,{role:`listitem`,size:`xs`,c:`dimmed`,lh:1.2,children:[n.label,` at `,r(n.value)]})]})]})}function x0({n:e,unit:t,size:n=28,total:r,lineHeight:i=1.1}){if(typeof e!=`number`)return(0,H.jsx)(q,{ff:`monospace`,fz:n,fw:600,lh:i,c:`dimmed`,children:`—`});let[a,o]=S0(j1(e,t));if(typeof r==`number`){let[a,o]=S0(j1(r,t)),[s]=S0(t===`bytes`?Rhe(e,r):j1(e,t));return(0,H.jsxs)(q,{ff:`monospace`,fz:n,fw:600,lh:i,style:{fontVariantNumeric:`tabular-nums`},children:[s,(0,H.jsxs)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,mx:3,children:[`/ `,a]}),o&&(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,children:o})]})}return(0,H.jsxs)(q,{ff:`monospace`,fz:n,fw:600,lh:i,style:{fontVariantNumeric:`tabular-nums`},children:[a,o&&(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`0.6em`,fw:500,c:`dimmed`,ml:3,children:o})]})}function Rhe(e,t){let n=e/1024**Math.max(0,Math.min(4,Math.floor(Math.log(Math.max(t,1))/Math.log(1024))));return n>=10?String(Math.round(n)):n.toFixed(1)}function S0(e){let t=/^([$]?[\d.,]+)\s*(.*)$/.exec(e);return t?[t[1],t[2]]:[e,``]}function C0({trend:e,title:t,color:n,window:r=`hour`}){let i=(0,h.useCallback)(i=>the(e,t,i,n,r),[e,t,n,r]);return(0,H.jsx)(V1,{option:i,label:`${t} over the last ${r}`,small:!0})}function zhe(e){let t=new Map;for(let n of e){let e=n.state===`offline`?`unseen`:n.state?q1[n.state]:`quiet`;t.set(e,(t.get(e)??0)+1)}return[...t.entries()].map(([e,t])=>`${t} ${e}`).join(`, `)}function w0({cells:e,label:t,summary:n,from:r,to:i,height:a=12}){let[o,s]=(0,h.useState)(null),c=(0,h.useRef)(null),l=t=>{if(!c.current||!e.length)return;let n=c.current.getBoundingClientRect();n.width<=0?s(null):s(Math.min(e.length-1,Math.max(0,Math.floor((t.clientX-n.left)/n.width*e.length))))},u=n??zhe(e);return(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(Bg.Floating,{label:o===null?u:e[o]?.label??u,offset:10,children:(0,H.jsx)(G,{ref:c,role:`img`,"aria-label":`${t}: ${u}`,onMouseMove:l,onMouseLeave:()=>s(null),style:{display:`flex`,gap:1,height:a,cursor:`default`},children:e.map((e,t)=>(0,H.jsx)(`div`,{className:`w-cell`,"data-state":e.state??void 0,style:o===t?{outline:`1px solid var(--driga-text)`,outlineOffset:0}:void 0},t))})}),(r||i)&&(0,H.jsxs)(K,{justify:`space-between`,gap:`xs`,"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:r}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:i})]})]})}var Bhe={desktop:Fv,laptop:dy,server:ay};function Vhe({data:e,selection:t,onSelect:n,onOpen:r,onReply:i,width:a=320}){let o=new h0(e),s=t&&(t.kind===`session`?o.session(t.id,t.machine):t.kind===`machine`?o.machine(t.id):o.project(t.id));return(0,H.jsx)(Im,{role:`group`,"aria-label":`Inspector`,w:{base:`100%`,lg:a},padding:`sm`,style:{flex:`none`,display:`flex`,flexDirection:`column`,minHeight:0},children:(0,H.jsx)(Yc,{type:`auto`,scrollbarSize:4,style:{flex:1,minHeight:0},children:!t||!s?(0,H.jsx)(Hhe,{}):t.kind===`session`?(0,H.jsx)(Uhe,{session:s,relationships:o,onSelect:n,onOpen:r,onReply:i}):t.kind===`machine`?(0,H.jsx)(Whe,{group:o.groups.find(e=>e.machine.id===t.id),onSelect:n}):(0,H.jsx)(Ghe,{project:s,relationships:o,onSelect:n})})})}function Hhe(){return(0,H.jsxs)(o_,{align:`center`,justify:`center`,gap:4,py:`xl`,px:`sm`,children:[(0,H.jsx)(q,{fw:600,fz:`sm`,children:`Nothing selected`}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ta:`center`,style:{textWrap:`pretty`},children:`Select a session or a machine to see its details and actions here.`})]})}function T0({children:e}){return(0,H.jsx)(q,{fz:`xs`,fw:600,c:`dimmed`,children:e})}function E0({session:e,onSelect:t,extra:n}){return(0,H.jsx)($c,{className:`fleet-row-title`,onClick:()=>t({kind:`session`,id:e.id,machine:e.machine}),px:4,py:2,children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:6,color:o0(u0[e.state].tone),withShadow:!1,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,truncate:!0,title:e.title,children:e.title}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`},children:n??e.label??u0[e.state].label})]})})}function Uhe({session:e,relationships:t,onSelect:n,onOpen:r,onReply:i}){let a=t.project(e.project),o=t.machine(e.machine),s=t.children(e),c=t.parent(e),l=t.overlaps(e),u=e=>l.filter(t=>t.files.includes(e)).map(e=>e.with),d=Math.max(0,Date.now()-Date.parse(e.lastActivity));return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(l0,{variant:`pill`,state:e.state,label:e.label,inferred:e.inferred,evidence:e.evidence}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:[`#`,e.id]})]}),(0,H.jsx)(k_,{order:2,fz:`md`,lh:1.3,style:{textWrap:`balance`,letterSpacing:`-0.01em`},children:e.title}),(0,H.jsxs)(K,{gap:8,wrap:`wrap`,children:[(0,H.jsx)(b0,{agent:e.agent,name:!0,size:16}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:a?.name??e.project}),e.branch&&(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,children:[(0,H.jsx)(Zv,{size:12,"aria-hidden":!0}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:e.branch})]}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:o?.name??e.machine})]}),e.waiting&&(0,H.jsxs)(K,{className:`w-needs-you`,gap:8,wrap:`nowrap`,align:`flex-start`,px:`xs`,py:6,role:`status`,children:[(0,H.jsx)(ty,{size:16,"aria-hidden":!0,style:{color:`var(--mantine-color-warning-filled)`,flex:`none`,marginTop:1}}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(q,{fz:`xs`,fw:600,children:`Needs you`}),(0,H.jsx)(q,{fz:`xs`,style:{overflowWrap:`anywhere`},children:e.waiting})]})]}),e.evidence&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,children:e.evidence}),o&&!o.reachable&&(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,children:[`Last known: `,o.name,` was last seen `,k1(o.lastSeen),`.`]}),e.lastTool&&(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,className:`w-inset`,truncate:!0,title:`${e.lastTool} · ${k1(e.lastActivity)}`,style:{display:`block`},children:[e.lastTool,` · `,k1(e.lastActivity)]}),(0,H.jsxs)(K,{gap:6,children:[!!e.turns?.length&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:N1(e.turns.length,`turn`)}),!!e.files?.length&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:N1(e.files.length,`file`)}),(0,H.jsx)(bm,{variant:`default`,size:`xs`,ff:`monospace`,children:D1(e.memory)})]}),e.turns&&e.turns.length>0&&(0,H.jsx)(w0,{cells:Ahe(e),label:`Last 30 turns`,summary:jhe(e),height:8,to:`turn ${Math.min(30,e.turns.length)}`,from:e.turns.length>30?`turn ${e.turns.length-29}`:`turn 1`}),e.files&&e.files.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Files`}),e.files.map(e=>{let t=u(e);return(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,truncate:!0,title:e,children:e}),t.length>0&&(0,H.jsxs)(bm,{color:`danger`,variant:`light`,size:`xs`,style:{flex:`none`,background:`var(--driga-tint-danger)`,color:`var(--driga-text)`},title:`Also edited by ${t.map(e=>e.title).join(`, `)}`,children:[`also #`,t.map(e=>e.id).join(`, #`)]})]},e)})]}),s.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Subagents`}),s.map(e=>(0,H.jsx)(E0,{session:e,onSelect:n},`${e.machine}/${e.id}`))]}),c&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Spawned by`}),(0,H.jsx)(E0,{session:c,onSelect:n})]}),(0,H.jsxs)(K,{gap:`xs`,mt:4,children:[e.state===`waiting`&&(0,H.jsx)(km,{onClick:()=>i(e),children:`Reply`}),(0,H.jsx)(km,{variant:`default`,onClick:()=>r(e),children:`Open`})]}),(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,title:e.started?`Started ${A1(e.started)}`:void 0,children:[e.started?`started ${k1(e.started)} · `:``,`quiet `,O1(d)]})]})}function Whe({group:e,onSelect:t}){let{machine:n,counts:r}=e,i=Bhe[n.kind??`desktop`],a=n.memoryTotal>0?Math.round(n.memoryUsed/n.memoryTotal*100):0,o=G1.reduce((e,t)=>e+r[t],0);return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(i,{size:16,"aria-hidden":!0}),(0,H.jsx)(k_,{order:2,fz:`md`,ff:`monospace`,lh:1.6,children:n.name}),n.local&&(0,H.jsx)(bm,{variant:`default`,size:`xs`,children:`local`})]}),(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:7,color:n.reachable?`var(--mantine-color-success-filled)`:`transparent`,withShadow:!1,"aria-hidden":!0,style:{border:n.reachable?void 0:`1px solid var(--driga-muted)`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,title:A1(n.lastSeen),children:Nhe(n)})]}),(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(T0,{children:`Memory`}),(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,align:`baseline`,children:[(0,H.jsx)(x0,{n:n.memoryUsed,unit:`bytes`,total:n.memoryTotal,size:22}),(0,H.jsxs)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,children:[a,`% used`,n.reachable?``:`, last known`]})]}),(0,H.jsx)(Ng,{value:a,size:4,color:`var(--driga-control-border)`,"aria-label":`Memory used ${a}%`}),n.memoryByRole&&n.memoryByRole.length>0&&(0,H.jsx)(Lhe,{label:`Agent memory on ${n.name} by owner`,segments:n.memoryByRole,total:n.memoryTotal,format:D1,size:6})]}),n.cpuPercent!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(T0,{children:`CPU`}),(0,H.jsx)(v0,{value:n.cpuPercent,max:100,format:e=>`${Math.round(e)}%`,label:`CPU on ${n.name}`})]}),!!n.diskTotal&&n.diskFree!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(T0,{children:`Disk`}),(0,H.jsx)(v0,{value:Math.max(0,n.diskTotal-n.diskFree),max:n.diskTotal,format:D1,label:`Disk on ${n.name}`})]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Sessions`}),o===0&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,children:`None`}),G1.filter(e=>r[e]>0).map(e=>(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:6,color:o0(u0[e].tone),withShadow:!1,"aria-hidden":!0}),(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,children:[r[e],` `,u0[e].label]})]},e))]}),e.projects.length>0&&(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Projects`}),e.projects.map(e=>(0,H.jsx)($c,{className:`fleet-row-title`,px:4,py:2,onClick:()=>t({kind:`project`,id:e.project.id}),children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:e.project.name}),(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,children:[N1(e.sessions.length,`session`),` · `,D1(e.memory)]})]})},e.project.id))]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Leftover`}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:n.leftover?`${N1(n.leftover.processes,`process`)} · ${D1(n.leftover.memory)} reclaimable`:`none`})]})]})}function Ghe({project:e,relationships:t,onSelect:n}){let r=t.projectMachines(e.id),i=t.projectSessions(e.id);return(0,H.jsxs)(o_,{gap:`sm`,children:[(0,H.jsx)(k_,{order:2,fz:`md`,ff:`monospace`,lh:1.6,children:e.name}),e.repo&&(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,truncate:!0,title:e.repo,children:e.repo}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Machines`}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:r.length?r.map(e=>e.name).join(` · `):`none`})]}),(0,H.jsxs)(o_,{gap:2,children:[(0,H.jsx)(T0,{children:`Sessions`}),i.map(e=>(0,H.jsx)(E0,{session:e,onSelect:n,extra:`${e.label??u0[e.state].label} · ${t.machine(e.machine)?.name??e.machine}`},`${e.machine}/${e.id}`))]})]})}function D0({value:e,max:t,format:n,label:r,caption:i,thresholds:a,size:o=44,thickness:s=4}){let c=t>0?Math.min(1,Math.max(0,e/t)):0,l=Math.round(c*100),u=_0(c,a),d=i??`${n(e)} / ${n(t)}`,f=o*.9-3*Math.min(s||12,o/4),p=Math.min(11,Math.max(0,f)*.85/((o>36?4:3)*.7));return(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,children:[(0,H.jsx)(Wg,{size:o,thickness:s,rootColor:`var(--driga-border)`,sections:[{value:l,color:u}],role:`img`,"aria-label":`${r}: ${d}, ${l}%`,style:{flex:`none`},label:(0,H.jsxs)(q,{ta:`center`,fz:p,ff:`monospace`,fw:400,lh:1,"aria-hidden":!0,children:[l,o>36&&`%`]})}),(0,H.jsxs)(o_,{gap:2,style:{minWidth:0},"aria-hidden":!0,children:[(0,H.jsx)(q,{size:`sm`,fw:500,lh:1.2,truncate:!0,title:r,children:r}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:d})]})]})}var Khe={desktop:Fv,laptop:dy,server:ay};function qhe({machine:e,selected:t,onSelect:n,onOpen:r,onReclaim:i}){let a=Date.now(),o=Khe[e.kind??`desktop`],s=a-Date.parse(e.lastSeen),c=!e.reachable&&s>6e5,l=()=>r?.(e),u=e=>{e.target.closest(`button, a`)||l()},d=e=>{e.key===`Enter`&&e.target===e.currentTarget&&(e.preventDefault(),l())},f=e.leftover.trees===0?`nothing left over`:`${e.leftover.trees} leftover · ${D1(e.leftover.bytes)} reclaimable`,p=(0,H.jsxs)(o_,{gap:8,children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{minWidth:0},children:[(0,H.jsx)(o,{size:16,"aria-hidden":!0,style:{color:`var(--driga-muted)`,flex:`none`}}),(0,H.jsx)(q,{size:`md`,fw:600,ff:`monospace`,lh:1.2,truncate:!0,title:e.name,style:{minWidth:0},children:e.name}),e.local&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,fw:500,styles:{root:{textTransform:`none`,flex:`none`}},children:`local`}),e.tls&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,fw:500,styles:{root:{textTransform:`none`,flex:`none`}},children:`mTLS`})]}),(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{flex:`none`},title:A1(e.lastSeen),children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:6,height:6,borderRadius:`50%`,background:e.reachable?`var(--mantine-color-success-filled)`:`transparent`,boxShadow:e.reachable?void 0:`inset 0 0 0 1.5px var(--driga-faint)`}}),(0,H.jsx)(q,{size:`xs`,lh:1.2,c:c?`danger`:`dimmed`,fw:c?500:void 0,style:{whiteSpace:`nowrap`},children:e.reachable?`reachable`:`last seen ${O1(s)} ago`})]})]}),e.cpuPercent!==void 0&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,children:`CPU`}),(0,H.jsx)(v0,{value:e.cpuPercent,max:100,format:e=>`${Math.round(e)}%`,label:`CPU on ${e.name}`,caption:`percent`})]}),e.diskTotal&&e.diskFree!==void 0?(0,H.jsxs)(K,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Pressure`,children:[(0,H.jsx)(D0,{value:e.memUsed,max:e.memTotal,format:D1,label:`Memory`,caption:D1(e.memUsed),size:36}),(0,H.jsx)(D0,{value:Math.max(0,e.diskTotal-e.diskFree),max:e.diskTotal,format:D1,label:`Disk`,caption:D1(e.diskTotal-e.diskFree),size:36})]}):(0,H.jsx)(v0,{value:e.memUsed,max:e.memTotal,format:D1,label:`Memory on ${e.name}`}),(0,H.jsxs)(K,{gap:10,wrap:`nowrap`,role:`group`,"aria-label":K1.map(t=>`${e.sessions[t]} ${q1[t]}`).join(`, `),children:[K1.map(t=>(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,title:q1[t],children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:6,height:6,borderRadius:`50%`,background:e.sessions[t]>0?s0(t):`transparent`,boxShadow:e.sessions[t]>0?void 0:`inset 0 0 0 1.5px ${s0(t)}`,opacity:e.sessions[t]>0?1:.5}}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,lh:1,c:e.sessions[t]>0?void 0:`dimmed`,children:e.sessions[t]})]},t)),!e.reachable&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,lh:1,children:`last known`})]}),e.strip&&(0,H.jsx)(w0,{cells:e.strip.cells,label:e.strip.label,from:e.strip.from,to:e.strip.to,height:10}),(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`xs`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,truncate:!0,title:f,style:{minWidth:0},children:f}),!n&&i&&e.leftover.trees>0&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,H.jsx)(pv,{size:12}),onClick:()=>i(e),style:{flex:`none`},children:`Reclaim`})]})]}),m=e.reachable?void 0:`dashed`;return n?(0,H.jsx)(il,{component:`button`,type:`button`,withBorder:!0,radius:`md`,p:`sm`,className:`w-row w-card`,"data-clickable":``,"aria-pressed":!!t,onClick:()=>n(e),style:{borderStyle:m,textAlign:`left`,width:`100%`,cursor:`pointer`},children:p}):(0,H.jsx)(il,{withBorder:!0,radius:`md`,p:`sm`,className:`w-row w-card`,"data-clickable":r?``:void 0,"data-selected":t?`true`:void 0,tabIndex:r?0:void 0,onClick:r?u:void 0,onKeyDown:r?d:void 0,style:{borderStyle:m},children:p})}function Jhe({groups:e,strips:t,selected:n,onSelect:r}){return(0,H.jsx)(e_,{minColWidth:280,autoFlow:`auto-fit`,spacing:`sm`,component:`ul`,"aria-label":`Machines`,m:0,p:0,style:{flex:`none`,listStyle:`none`,maxHeight:`min(40vh, 18rem)`,overflowY:`auto`},children:e.map(e=>(0,H.jsx)(`li`,{style:{minWidth:0},children:(0,H.jsx)(qhe,{machine:Mhe(e,t?.[e.machine.id]),selected:n===e.machine.id,onSelect:e=>r(n===e.id?null:e.id??null)})},e.machine.id))})}function Yhe(e){return Math.max(360,26*e+48)}function Xhe(e){let t=e.dataType===`edge`?e.data?.target:e.name;if(!t)return null;let[n,r]=[t.slice(0,2),t.slice(2)];return n===`m:`||n===`l:`?{kind:`machine`,id:r}:n===`p:`?{kind:`project`,id:r}:n===`s:`?Ohe(r):null}function O0(e){return e.replace(/[{}|]/g,` `)}function Zhe(e,t){let n={...t.states,brand:t.brand,machine:t.line,leftover:t.muted},r=new h0(e),{groups:i,machines:a,projects:o}=r,s=e.sessions.reduce((e,t)=>e+t.memory,0)+a.reduce((e,t)=>e+(t.leftover?.memory??0),0),c=Math.max(1,s/200),l=[],u=[],d={color:`gradient`,opacity:.22},f={color:n.waiting,opacity:.4};for(let e of i){let r=e.machine,i=e.projects.reduce((e,t)=>e+t.sessions.length,0);l.push({name:`m:${r.id}`,depth:0,text:O0(r.name),tip:`${I1(r.name)}${r.local?` · local`:``}
${r.reachable?`reachable`:`unreachable · last seen ${I1(k1(r.lastSeen))}`}
${I1(D1(r.memoryUsed))} of ${I1(D1(r.memoryTotal))} used · ${N1(i,`session`)}`,itemStyle:{color:n.machine,borderColor:r.reachable?n.machine:t.muted,borderWidth:1,borderType:r.reachable?`solid`:`dashed`},label:{position:`left`,fontFamily:Ky.sans,fontSize:Gy.small+1,fontWeight:600,color:t.text}})}for(let e of o){let i=r.projectMachines(e.id),a=r.projectSessions(e.id);l.push({name:`p:${e.id}`,depth:1,text:O0(e.name),tip:`${I1(e.name)}
${I1(e.repo)}
on ${I1(i.map(e=>e.name).join(`, `))} · ${N1(a.length,`session`)} · ${I1(D1(a.reduce((e,t)=>e+t.memory,0)))}`,itemStyle:{color:Dn(n.brand,.55)},label:{fontFamily:Ky.sans,fontSize:Gy.small,color:t.text}})}for(let e of i){let r=e.machine;r.leftover&&(l.push({name:`l:${r.id}`,depth:1,text:O0(`leftover · ${N1(r.leftover.processes,`proc`)} · ${D1(r.leftover.memory)}`),tip:`Leftover on ${I1(r.name)}
${N1(r.leftover.processes,`process`)} no session owns · ${I1(D1(r.leftover.memory))} reclaimable`,itemStyle:{color:`transparent`,borderColor:n.leftover,borderWidth:1,borderType:`dashed`},label:{fontFamily:Ky.mono,fontSize:Gy.small,color:t.muted}}),u.push({source:`m:${r.id}`,target:`l:${r.id}`,value:Math.max(r.leftover.memory,c),tip:`${I1(r.name)} → leftover: ${I1(D1(r.leftover.memory))}`,lineStyle:{color:n.leftover,opacity:.14}}))}for(let e of o)for(let t of i){let i=t.projects.find(t=>t.project.id===e.id);if(i){u.push({source:`m:${t.machine.id}`,target:`p:${e.id}`,value:Math.max(i.memory,c),tip:`${I1(t.machine.name)} → ${I1(e.name)}: ${I1(D1(i.memory))} in ${N1(i.sessions.length,`session`)}`,lineStyle:i.waiting?f:d});for(let a of i.sessions){let i=r.children(a).length,o=r.overlaps(a),s=`${i?` {dim|↳${i}}`:``}${o.length?` {bang|!}`:``}`;l.push({name:`s:${m0(a)}`,depth:2,text:`${O0(a.title)}${s}{dim| · ${O0(a.agent)} · ${D1(a.memory)}}`,tip:[`${I1(a.title)}`,`${I1(a.label??u0[a.state].label)}${a.inferred?` (inferred)`:``} · ${I1(X1(a.agent))}${a.branch?` · ${I1(a.branch)}`:``}`,`${I1(e.name)} on ${I1(t.machine.name)} · ${I1(D1(a.memory))}`,a.lastTool?`${I1(a.lastTool)} · ${I1(k1(a.lastActivity))}`:``,a.waiting?I1(a.waiting):``,i?N1(i,`subagent`):``,...o.map(e=>`also editing ${I1(e.files.map(e=>e.slice(e.lastIndexOf(`/`)+1)).join(`, `))} with ${I1(e.with.title)}`)].filter(Boolean).join(`
`),itemStyle:{color:n[a.state]}}),u.push({source:`p:${e.id}`,target:`s:${m0(a)}`,value:Math.max(a.memory,c),tip:`${I1(e.name)} → ${I1(a.title)}: ${I1(D1(a.memory))}`,lineStyle:a.state===`waiting`?f:d})}}}let p=p0(e.sessions);return rhe({nodes:l,links:u,description:`Fleet flow: ${N1(a.length,`machine`)}, ${N1(o.length,`project`)}, ${N1(e.sessions.length,`session`)}, ${p} needing you. Link width is memory, with a minimum width for visibility; node colour is state.`,rich:{dim:{color:t.muted,fontFamily:Ky.mono,fontSize:Gy.small},bang:{color:n.stuck,fontWeight:700,fontFamily:Ky.mono,fontSize:Gy.small}}},t)}var Qhe={desktop:Fv,laptop:dy,server:ay},k0=20;function $he({data:e,selected:t,onSelect:n,onOpen:r,onReply:i}){let a=new h0(e),o=a.groups,[s,c]=(0,h.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=(e,n)=>t?.kind===e&&t.id===n,d=e=>a.branch(e).map(({session:e,depth:a})=>(0,H.jsx)(nge,{session:e,level:a+2,selected:u(`session`,e.id)&&(!t?.machine||t.machine===e.machine),onSelect:n,onOpen:r,onReply:i},m0(e)));return(0,H.jsx)(C_.ScrollContainer,{minWidth:1032,type:`native`,children:(0,H.jsxs)(C_,{"aria-label":`Fleet tree`,layout:`fixed`,children:[(0,H.jsx)(C_.Thead,{children:(0,H.jsxs)(C_.Tr,{children:[(0,H.jsx)(C_.Th,{w:100,children:`State`}),(0,H.jsx)(C_.Th,{children:`Name`}),(0,H.jsx)(C_.Th,{w:120,children:`Agent`}),(0,H.jsx)(C_.Th,{w:100,children:`Branch`}),(0,H.jsx)(C_.Th,{w:124,ta:`right`,children:`Memory`}),(0,H.jsx)(C_.Th,{w:96,ta:`right`,children:`Last activity`}),(0,H.jsx)(C_.Th,{w:144,children:(0,H.jsx)(tl,{children:`Actions`})})]})}),(0,H.jsx)(C_.Tbody,{children:o.map(e=>{let t=!s.has(e.machine.id);return[(0,H.jsx)(ege,{group:e,open:t,selected:u(`machine`,e.machine.id),onToggle:()=>l(e.machine.id),onSelect:n},e.machine.id),...t?e.projects.flatMap(t=>[(0,H.jsx)(tge,{group:t,selected:u(`project`,t.project.id),onSelect:n},`${e.machine.id}/${t.project.id}`),...a.roots(e.machine.id,t.project.id).flatMap(d)]):[]]})})]})})}function ege({group:e,open:t,selected:n,onToggle:r,onSelect:i}){let a=e.machine,o=Qhe[a.kind??`desktop`],s=e.projects.reduce((e,t)=>e+t.sessions.length,0);return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":n,children:[(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(Vm,{size:7,color:a.reachable?`var(--mantine-color-success-filled)`:`transparent`,withShadow:!1,"aria-hidden":!0,style:{border:a.reachable?void 0:`1px solid var(--driga-muted)`,flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,truncate:!0,title:a.reachable?`reachable`:`last seen ${k1(a.lastSeen)}`,children:a.reachable?`reachable`:`seen ${k1(a.lastSeen)}`})]})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(lu,{size:`sm`,"aria-label":`${t?`Collapse`:`Expand`} ${a.name}`,"aria-expanded":t,onClick:r,children:t?(0,H.jsx)(hv,{size:14}):(0,H.jsx)(_v,{size:14})}),(0,H.jsx)(o,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)($c,{className:`fleet-row-title`,miw:0,onClick:()=>i({kind:`machine`,id:a.id}),"aria-pressed":n,children:(0,H.jsx)(q,{fz:`sm`,fw:600,ff:`monospace`,truncate:!0,title:a.name,children:a.name})}),a.local&&(0,H.jsx)(bm,{size:`xs`,variant:`default`,style:{flex:`none`},children:`local`}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:N1(s,`session`)})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsxs)(q,{fz:`xs`,ff:`monospace`,style:{whiteSpace:`nowrap`},children:[D1(a.memoryUsed),(0,H.jsxs)(q,{span:!0,fz:`xs`,ff:`monospace`,c:`dimmed`,children:[` / `,D1(a.memoryTotal)]})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{})]})}function tge({group:e,selected:t,onSelect:n}){return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":t,children:[(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,pl:k0,children:[(0,H.jsx)(qv,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)($c,{className:`fleet-row-title`,miw:0,onClick:()=>n({kind:`project`,id:e.project.id}),"aria-pressed":t,children:(0,H.jsx)(q,{fz:`sm`,fw:500,ff:`monospace`,truncate:!0,title:e.project.name,children:e.project.name})}),(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:N1(e.sessions.length,`session`)})]})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,children:D1(e.memory)})}),(0,H.jsx)(C_.Td,{}),(0,H.jsx)(C_.Td,{})]})}function nge({session:e,level:t,selected:n,onSelect:r,onOpen:i,onReply:a}){return(0,H.jsxs)(C_.Tr,{className:`fleet-row`,"data-selected":n,children:[(0,H.jsx)(C_.Td,{children:(0,H.jsx)(l0,{state:e.state,label:e.label,inferred:e.inferred,evidence:e.evidence})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,pl:k0*t,style:{minWidth:0},children:[t>2&&(0,H.jsx)(q,{fz:`xs`,c:`dimmed`,"aria-hidden":!0,style:{flex:`none`},children:`↳`}),(0,H.jsx)($c,{className:`fleet-row-title`,onClick:()=>r({kind:`session`,id:e.id,machine:e.machine}),"aria-pressed":n,style:{minWidth:0},children:(0,H.jsx)(q,{fz:`sm`,truncate:!0,title:e.title,children:e.title})}),(0,H.jsxs)(q,{fz:`xs`,c:`dimmed`,ff:`monospace`,style:{flex:`none`,whiteSpace:`nowrap`},children:[`#`,e.id]})]})}),(0,H.jsx)(C_.Td,{children:(0,H.jsx)(b0,{agent:e.agent,name:!0,size:16})}),(0,H.jsx)(C_.Td,{children:e.branch&&(0,H.jsxs)(K,{gap:3,wrap:`nowrap`,children:[(0,H.jsx)(Zv,{size:12,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,truncate:!0,title:e.branch,children:e.branch})]})}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,children:D1(e.memory)})}),(0,H.jsx)(C_.Td,{ta:`right`,children:(0,H.jsx)(q,{fz:`xs`,ff:`monospace`,c:`dimmed`,title:A1(e.lastActivity),children:k1(e.lastActivity)})}),(0,H.jsx)(C_.Td,{children:(0,H.jsxs)(K,{gap:2,wrap:`nowrap`,justify:`flex-end`,className:`fleet-row-actions`,children:[e.state===`waiting`&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,style:{flex:`none`,whiteSpace:`nowrap`},"aria-label":`Reply to ${e.title}`,onClick:()=>a(e),children:`Reply`}),(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,style:{flex:`none`,whiteSpace:`nowrap`},"aria-label":`Open ${e.title}`,onClick:()=>i(e),children:`Open`})]})})]})}var rge=[{value:`flow`,label:`Flow`},{value:`tree`,label:`Tree`}];function ige({machines:e,projects:t,sessions:n,strips:r,selected:i,defaultSelected:a,onSelect:o,onOpen:s,onReply:c,mode:l,defaultMode:u,onModeChange:d}){let f=(0,h.useMemo)(()=>({machines:e,projects:t,sessions:n}),[e,t,n]),[p,m]=oe({value:i,defaultValue:a,finalValue:null,onChange:o}),[g,_]=oe({value:l,defaultValue:u,finalValue:`flow`,onChange:d}),v=(0,h.useMemo)(()=>new h0(f).groups,[f]),y=p?.kind===`machine`&&e.some(e=>e.id===p.id)?p.id:null;(0,h.useEffect)(()=>{p?.kind===`machine`&&!e.some(e=>e.id===p.id)&&m(null)},[e,p,m]);let b=(0,h.useMemo)(()=>y?{machines:f.machines.filter(e=>e.id===y),projects:f.projects,sessions:f.sessions.filter(e=>e.machine===y)}:f,[f,y]),x=(0,h.useCallback)(e=>Zhe(b,e),[b]),S=(0,h.useCallback)((e,t)=>{let n=Xhe(t);n&&m(n)},[m]);return e.length?(0,H.jsxs)(o_,{gap:`sm`,h:`100%`,style:{minHeight:0},children:[(0,H.jsx)(g0,{...f,children:(0,H.jsx)(qg,{size:`xs`,value:g,onChange:e=>_(e),data:rge,"aria-label":`View`})}),(0,H.jsx)(Jhe,{groups:v,strips:r,selected:y,onSelect:e=>m(e?{kind:`machine`,id:e}:null)}),(0,H.jsxs)(xf,{className:`fleet-body`,direction:{base:`column`,lg:`row`},align:`stretch`,wrap:`nowrap`,gap:`sm`,role:`region`,"aria-label":`Fleet`,tabIndex:0,children:[(0,H.jsx)(Im,{padding:`sm`,className:`fleet-chart`,role:`region`,"aria-label":`Fleet flow`,tabIndex:0,children:g===`flow`?(0,H.jsxs)(o_,{gap:4,style:{flex:1,minHeight:0},children:[b.sessions.length?(0,H.jsx)(G,{style:{flex:1,minHeight:Yhe(b.sessions.length),display:`flex`,flexDirection:`column`},children:(0,H.jsx)(V1,{option:x,label:`Fleet flow from machines through projects to sessions`,height:`100%`,onEvent:S})}):(0,H.jsx)(q,{fz:`sm`,c:`dimmed`,py:`xl`,ta:`center`,children:`No sessions on this machine right now.`}),(0,H.jsx)(q,{ff:`monospace`,fz:`xs`,c:`dimmed`,style:{flex:`none`},children:`width = memory (minimum shown) · colour = state`})]}):(0,H.jsx)($he,{data:b,selected:p,onSelect:m,onOpen:s,onReply:c})}),(0,H.jsx)(Vhe,{data:f,selection:p,onSelect:m,onOpen:s,onReply:c})]})]}):(0,H.jsxs)(o_,{gap:`sm`,h:`100%`,children:[(0,H.jsx)(g0,{...f}),(0,H.jsx)(Che,{})]})}var age={name:`Fleet`,panels:[{id:`machines`,title:`Machines`,viz:`table`,source:`machines`,limit:200},{id:`sessions`,title:`Sessions`,viz:`table`,source:`sessions`,limit:200},{id:`flow`,title:`Flow`,viz:`table`,source:`flow`,columns:[`id`,`parent_id`,`started_at`,`ended_at`,`last_tool`,`reason`,`machine_id`],limit:200},{id:`orphans`,title:`Leftover`,viz:`table`,source:`orphans`,limit:200},{id:`projects`,title:`Projects`,viz:`table`,source:`projects`,limit:200},{id:`memory`,title:`Memory by role`,viz:`table`,source:`memory`,limit:200},{id:`heatmap`,title:`Tool calls by project`,viz:`timeseries`,source:`activity_heatmap`,by:`project`,measure:`sum:tool_calls`}]},A0=e=>e==null?``:String(e),j0=e=>typeof e==`number`?e:0,M0=e=>typeof e==`number`?e:void 0,N0=(e,t)=>JSON.stringify([A0(e),A0(t)]);function oge(e){try{let t=JSON.parse(A0(e));return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function sge(e){let t=c0(e);return t.state?{state:t.state,inferred:t.inferred}:t.label===`dead`?{state:`stuck`,label:`dead`,inferred:!0}:{state:`idle`,label:t.label||void 0,inferred:!0}}function P0(e,t){let n=t=>gS(e.results.find(e=>e.id===t)?.frame),r=Date.parse(e.observed_at)||Date.now(),i=new Map;for(let e of n(`orphans`)){let t=i.get(A0(e.machine_id))??{trees:0,processes:0,memory:0};i.set(A0(e.machine_id),{trees:t.trees+1,processes:t.processes+j0(e.processes),memory:t.memory+j0(e.rss_bytes)})}let a=new Map;for(let e of n(`memory`)){let t=[A0(e.agent),A0(e.role)].filter(Boolean).join(` · `);a.set(A0(e.machine),[...a.get(A0(e.machine))??[],{label:t,value:j0(e.rss_bytes)}])}let o=n(`machines`).map(e=>{let t=A0(e.machine_id),n=A0(e.machine),o=A0(e.state);return{id:t,name:n,kind:A0(e.os)===`linux`?`server`:`desktop`,local:o===`local`,reachable:o===`local`||o===`live`,lastSeen:new Date(r-j0(e.last_seen)).toISOString(),memoryUsed:j0(e.mem_used_bytes),memoryTotal:j0(e.mem_total_bytes),cpuPercent:typeof e.cpu_percent==`number`?e.cpu_percent:void 0,diskFree:M0(e.disk_free_bytes),diskTotal:M0(e.disk_total_bytes),leftover:i.get(t),memoryByRole:a.get(n)}}),s=[];for(let e of n(`projects`)){let t=A0(e.project);t&&!s.some(e=>e.id===t)&&s.push({id:t,name:t,repo:A0(e.path)})}let c=new Map(n(`flow`).map(e=>[N0(e.machine_id,e.id),e])),l=new Map;for(let e of gS(t?.results[0]?.frame))e.kind===`waiting`&&A0(e.session_id)&&A0(e.session_id)!==`0`&&l.set(N0(e.machine_id,e.session_id),[e.reason||`waiting`,e.tool,e.detail].filter(Boolean).join(` · `));let u=n(`sessions`).map(t=>{let n=A0(t.id),r=N0(t.machine_id,n),i=c.get(r),a=sge(A0(t.label));return{id:n,title:A0(t.title)||`Session ${n}`,state:a.state,label:a.label,inferred:a.inferred||t.inferred===!0,evidence:A0(t.evidence)||void 0,agent:A0(t.agent),project:A0(t.project),machine:A0(t.machine_id),branch:A0(t.branch)||void 0,memory:j0(t.mem_bytes),turns:A0(t.turns).split(`,`).filter(e=>[`ok`,`waited`,`failed`].includes(e)),files:oge(t.edited),parent:i&&A0(i.parent_id)&&A0(i.parent_id)!==`0`?A0(i.parent_id):void 0,lastTool:A0(i?.last_tool)||void 0,lastActivity:A0(t.last_activity_at)||e.observed_at,started:A0(i?.started_at)||void 0,waiting:a.state===`waiting`?l.get(r)??(A0(i?.reason)||void 0):void 0}});for(let e of u)e.project&&!s.some(t=>t.id===e.project)&&s.push({id:e.project,name:e.project,repo:``});return{machines:o,projects:s,sessions:u}}function cge({fragment:e,inbox:t,act:n}){let r=(0,h.useMemo)(()=>e?P0(e,t):null,[e,t]),i=(0,h.useMemo)(()=>i0(e),[e]),a=(0,h.useMemo)(()=>r?She(i,r0(r,i.polls)):{},[i,r]),{projects:o,cols:s,values:c}=(0,h.useMemo)(()=>{let t=gS(e?.results.find(e=>e.id===`heatmap`)?.frame),n=[...new Set(t.map(e=>String(e.series)))],r=[...new Set(t.map(e=>String(e.ts)))].sort(),i=new Map(t.map(e=>[JSON.stringify([e.series,e.ts]),Number(e.value??0)]));return{projects:n,cols:r.map(e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,hour12:!1})),values:n.map(e=>r.map(t=>i.get(JSON.stringify([e,t]))??0))}},[e]);if(!r)return(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`});let l=e=>{let t=Number(e.id);n&&Number.isSafeInteger(t)&&t>0&&n({kind:`jump`,row:{session_id:t,machine_id:e.machine}})};return(0,H.jsxs)(o_,{gap:`sm`,style:{flex:1,minHeight:0,overflowY:`auto`},children:[(0,H.jsx)(G,{style:{flex:1,minHeight:600},children:(0,H.jsx)(ige,{...r,strips:a,onSelect:()=>void 0,onOpen:l,onReply:l})}),o.length>0&&(0,H.jsxs)(G,{py:`sm`,children:[(0,H.jsx)(q,{size:`xs`,fw:600,c:`dimmed`,mb:6,children:`Tool calls by project · last 24 hours`}),(0,H.jsx)(dhe,{rows:o,cols:s,values:c,format:String,unit:`tool calls`,label:`Tool calls by project, last 24 hours`})]})]})}var F0=(0,h.createContext)({});function I0(){return(0,h.useContext)(F0)}var lge={jump:`Open pane`,ack:`Mark reviewed`,open:`Open`,stop:`Stop`,kill:`Kill`,force_kill:`Force kill`,cleanup:`Remove`,summarize:`Summarize`};function L0(e){return lge[e]}function R0(e,t,n){let r=!t.machine_id||t.machine_id===n;switch(e){case`orphans`:return r&&t.verified===!0&&t.young!==!0?[`kill`,`force_kill`]:[];case`cleanup`:return t.status===`ready`?[`cleanup`]:[];case`sessions`:case`flow`:return r&&t.label!==`ended`&&t.label!==`dead`?[`jump`,`stop`]:[];case`projects`:return r&&t.path?[`summarize`]:[];default:return[]}}var z0=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function B0(e,t,n){let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n});if(!r.ok)throw new z0((await r.text()).trim()||`${r.status}`,r.status);return r.json()}async function V0(e,t){let n=await fetch(e,{signal:t});if(!n.ok)throw new z0((await n.text()).trim()||`${n.status}`,n.status);return n.json()}var H0={reset:(e,t)=>B0(`/app/api/reset`,{id:e,base_version:t}).then(hS),catalog:()=>B0(`/app/api/catalog`,{}).then(e=>e.widgets),replace:(e,t,n,r,i)=>B0(`/app/api/replace`,{id:e,dashboard:t,base_version:n,vars:r,message:i}).then(hS),list:()=>B0(`/app/api/list`,{}).then(e=>e.dashboards),open:(e,t,n)=>B0(`/app/api/open`,{id:e,vars:t},n).then(hS),run:(e,t,n)=>B0(`/app/api/run`,{dashboard:e,vars:t},n).then(hS),create:(e,t)=>B0(`/app/api/create`,{dashboard:e,message:t}).then(hS),delete:e=>B0(`/app/api/delete`,{id:e}),edit:(e,t,n,r,i)=>B0(`/app/api/edit`,{id:e,operations:t,base_version:n,vars:r,message:i}).then(hS)};async function U0(e,t){try{let n=await B0(`/app/confirm`,{message:e,request:t});return n.confirmed===!0?n:{confirmed:!1}}catch{return{confirmed:!1}}}async function W0(e){return(await U0(e)).confirmed}async function uge(e,t){let n=await U0(e,t);return!n.confirmed||typeof n.token!=`string`||n.token.length===0?!1:(await G0({...t,token:n.token}),!0)}function G0(e){return B0(`/app/action`,e)}var K0={history:()=>V0(`/chat/api/history`),create:()=>B0(`/chat/api/new`,{}),send:(e,t,n)=>B0(`/chat/api/send`,{id:e,text:t,context:n}),stop:e=>B0(`/chat/api/stop`,{id:e}),decide:(e,t,n)=>B0(`/chat/api/decide`,{id:e,action:t,allow:n}),decideSimilar:(e,t)=>B0(`/chat/api/decide`,{id:e,action:t,allow:!0,similar:!0}),answerSimilar:e=>B0(`/chat/api/prompt-answer`,{id:e,allow:!0,similar:!0}),revokeGrant:e=>B0(`/chat/api/grant-revoke`,{id:e}),grantHistory:()=>V0(`/chat/api/grant-history`).then(e=>e??[]),setMode:(e,t)=>B0(`/chat/api/mode`,{id:e,mode:t}),bursts:()=>V0(`/chat/api/prompt-bursts`).then(e=>e??[]),decideBurst:(e,t,n)=>B0(`/chat/api/burst-decide`,{id:e,members:t,allow:n}),prompts:()=>V0(`/chat/api/prompts`).then(e=>e??[]),answer:(e,t)=>B0(`/chat/api/prompt-answer`,{id:e,allow:t}),wait:(e,t,n)=>V0(`/chat/api/wait?id=${encodeURIComponent(e)}&after=${t}`,n)};function dge(e){return fge(e)||typeof e==`function`||pge(e)}function fge(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function pge(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function q0(e,t){return e==null?null:dge(e)?h.createElement(e,t):e}function mge(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?q0(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:q0(n.cell,t.getContext())}return`header`in e&&e.header?q0(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?q0(e.footer.column.columnDef.footer,e.footer.getContext()):null}function hge({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function gge(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var J0=[],Y0=0,{link:X0,unlink:_ge,propagate:vge,checkDirty:Z0,shallowPropagate:Q0}=hge({update(e){return e._update()},notify(e){J0[e2++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,r2(e))}}),$0=0,e2=0,t2,n2=0;function yge(e){try{++n2,e()}finally{--n2||i2()}}function r2(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=_ge(n,e)}function i2(){if(!(n2>0)){for(;$0{i.get(),n.current?(t2=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=t2,o=t?.compare??Object.is;if(n)t2=i,++Y0,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{t2=a,n&&(i.flags&=-5),r2(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Z0(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Q0(e)}}else e&32&&(i.flags=e&-33);return t2!==void 0&&X0(i,t2,Y0),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(vge(e),Q0(e),i2())}},i}function xge(e){let t=()=>{let t=t2;t2=n,++Y0,n.depsTail=void 0,n.flags=6;try{return e()}finally{t2=t,n.flags&=-5,r2(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Z0(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,r2(this)}};return t(),n}function a2(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=o2(e);if(n.length!==o2(t).length)return!1;for(let r=0;r{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Cge=o(((e,t)=>{t.exports=Sge()})),wge=o((e=>{var t=m(),n=Cge();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Tge=o(((e,t)=>{t.exports=wge()}))();function Ege(e,t){return e===t}function s2(e,t=e=>e,n){let r=n?.compare??Ege,i=(0,h.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,h.useCallback)(()=>e.get(),[e]);return(0,Tge.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function Dge(e){let t=s2(e.source,e.selector,{compare:a2});return typeof e.children==`function`?e.children(t):e.children}function Oge(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function kge(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return a&&i(o,t)||(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function Age(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{n&&t(r,e)||i(e)})}}function jge(){return kge({createAtom:bge,batch:yge})}function c2(e,t){return typeof e==`function`?e(t):e}function l2(e){if(Array.isArray(e))return e.map(l2);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?u2():{},r=Object.keys(e);for(let t=0;t{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>c2(n,e))}}function f2(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function p2(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Pge=3;function Fge(e,t){return m2(e,t,Pge)}function m2(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!f2(e)||!f2(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=p2(e),i=p2(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e{let t=c2(n,e);return r(e,t)?e:t})}function Lge(e){return e instanceof Function}function Rge(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var zge=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e{t?e():t=!0}}function g2({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return zge({...a,...o})}function _2(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function v2(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=_2(r);t[n]=a?g2({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function y2(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=_2(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=g2({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function Bge(e){return e.row.getValue(e.column.id)}function Vge(e){return e.getValue()??e.table.options.renderFallbackValue}function Hge(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Uge={assignCellPrototype:(e,t)=>{y2(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Bge(e)},cell_renderValue:{fn:e=>Vge(e)},cell_getContext:{fn:e=>Hge(e),memoDeps:e=>[e]}})}};function Wge(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let n=t;for(let t=0;te[i.accessorKey]}if(!s)throw Error();let l=Wge(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;ee.getFlatColumns())]}function $ge(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return x2(e.table,t)}return[e]}function e_e(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function C2(e,t,n,r=0){let i=Array(t.length);for(let a=0;ae.getFlatColumns())}function r_e(e){let t=u2(),n=e.getAllFlatColumns();for(let e=0;ee.getLeafColumns()))}function a_e(e){let t=u2(),n=e.getAllLeafColumns();for(let e=0;e{y2(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>Qge(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>$ge(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{v2(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>e_e(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>t_e(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>n_e(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>r_e(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>i_e(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>a_e(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>o_e(e,t)}})}};function c_e(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n0&&E2(s,t-1,n,r,i,a)}function D2(e){for(let t=0;te.id),e)}function g_e(e){return[...e.getHeaderGroups()].reverse()}function __e(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e{y2(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>p_e(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>m_e(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{v2(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>h_e(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>g_e(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>__e(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>v_e(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function b_e(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let s=b_e(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=u2(),c._valuesCache=u2(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;eg2({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>C_e(e,e.options.data),onAfterUpdate:h2(()=>{Yge(e),S2(e),Xge(e),Zge(e)})})}function k2(e,t,n,r=0,i){let a=[];for(let o=0;o{v2(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>w_e(e)},table_getPreFilteredRowModel:{fn:()=>T_e(e)},table_getFilteredRowModel:{fn:()=>E_e(e)},table_getPreGroupedRowModel:{fn:()=>D_e(e)},table_getGroupedRowModel:{fn:()=>O_e(e)},table_getPreSortedRowModel:{fn:()=>k_e(e)},table_getSortedRowModel:{fn:()=>A_e(e)},table_getPreExpandedRowModel:{fn:()=>j_e(e)},table_getExpandedRowModel:{fn:()=>M_e(e)},table_getPrePaginatedRowModel:{fn:()=>N_e(e)},table_getPaginatedRowModel:{fn:()=>P_e(e)},table_getRowModel:{fn:()=>F_e(e)}})}};function L_e(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;ne.subRows)}function G_e(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e{y2(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>z_e(e)},row_getAllCellsByColumnId:{fn:e=>Y_e(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>J_e(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>W_e(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>K_e(e)},row_getParentRows:{fn:e=>q_e(e)},row_getUniqueValues:{fn:(e,t)=>H_e(e,t)},row_getValue:{fn:(e,t)=>V_e(e,t)},row_renderValue:{fn:(e,t)=>U_e(e,t)}})},constructTableAPIs:e=>{v2(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>B_e(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>X_e(t,e,n,r)},table_getRow:{fn:(t,n)=>Z_e(e,t,n)},table_getMaxSubRowDepth:{fn:()=>G_e(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function A2(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function j2(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{A2(e,t,n),e._reactivity.commit?.()})}function $_e(e){let t=l2(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;rr):e.options=r,n?.syncExternalState!==!1&&j2(e,r.state??null)}var tve={coreCellsFeature:Uge,coreColumnsFeature:s_e,coreHeadersFeature:y_e,coreRowModelsFeature:I_e,coreRowsFeature:Q_e,coreTablesFeature:{constructTableAPIs:e=>{v2(`coreTablesFeature`,e,{table_reset:{fn:()=>$_e(e)},table_setOptions:{fn:t=>M2(e,t)}})}}};function nve(e){return e}function rve(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),l2(t)}function ive(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...tve,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=rve(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&d2(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}A2(v),v.store=Oge(t.createReadonlyAtom(()=>{let e={};for(let t=0;t{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}var ove=N2({resolveDataValue:e=>cve(e).toLowerCase(),sort:(e,t)=>lve(e,t)}),P2=N2({sort:(e,t)=>sve(e,t)});function sve(e,t){return e===t?0:e>t?1:-1}function cve(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function lve(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n=48&&e<=57}function I2(e,t,n){let r=t+1;for(;ro)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function dve(e,t,n,r,i,a){let o=t;for(;oi?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function L2(e,t,n){let r=0;for(let i=t;i1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return P2}function H2(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&J2(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function G2(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??H2(e)===`desc`?`desc`:`asc`}function K2(e,t){let n=G2(e),r=Y2(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function q2(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function J2(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function Y2(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function mve(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function hve(e){z2(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function gve(e){let t=q2(e);return n=>{t&&W2(e,void 0,J2(e)?e.table.options.isMultiSortEvent?.(n):!1)}}var _ve={getInitialState(e){return{sorting:fve(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:Nge(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){y2(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>V2(e)},column_getAutoSortDir:{fn:e=>H2(e)},column_getSortFn:{fn:e=>U2(e)},column_toggleSorting:{fn:(e,t,n)=>W2(e,t,n)},column_getFirstSortDir:{fn:e=>G2(e)},column_getNextSortingOrder:{fn:(e,t)=>K2(e,t)},column_getCanSort:{fn:e=>q2(e)},column_getCanMultiSort:{fn:e=>J2(e)},column_getIsSorted:{fn:e=>Y2(e)},column_getSortIndex:{fn:e=>mve(e)},column_clearSorting:{fn:e=>hve(e)},column_getToggleSortingHandler:{fn:e=>gve(e)}})},constructTableAPIs(e){v2(`rowSortingFeature`,e,{table_autoResetSorting:{fn:()=>pve(e)},table_setSorting:{fn:t=>z2(e,t)},table_resetSorting:{fn:t=>B2(e,t)}})}};function vve(){return e=>{let t=e;return g2({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>yve(t),onAfterUpdate:h2(()=>S2(t))})}}function yve(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?q2(n):!1});if(!i.length)return t;let a=[];for(let t=0;t{for(let n=0;n{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i`u`?h.useEffect:h.useLayoutEffect;function xve(e,t){let[{table:n,rootSource:r}]=(0,h.useState)(()=>{let t=ive({...e,features:{coreReactivityFeature:jge(),...e.features}});return t.Subscribe=(e=>Dge({...e,source:e.source??t.store})),t.FlexRender=mge,{table:t,rootSource:Age(t.store,a2)}}),i=n;M2(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=s2(r,t,{compare:a2});return bve(()=>{r.markCommitted(o),j2(i,a??null,a2)}),(0,h.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}function Sve(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Cve=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tve={};function X2(e,t){return((t||Tve).jsx?wve:Cve).test(e)}var Eve=/[ \t\n\f\r]/g;function Dve(e){return typeof e==`object`?e.type===`text`&&Z2(e.value):Z2(e)}function Z2(e){return e.replace(Eve,``)===``}var Q2=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Q2.prototype.normal={},Q2.prototype.property={},Q2.prototype.space=void 0;function $2(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Q2(n,r,t)}function e4(e){return e.toLowerCase()}var t4=class{constructor(e,t){this.attribute=t,this.property=e}};t4.prototype.attribute=``,t4.prototype.booleanish=!1,t4.prototype.boolean=!1,t4.prototype.commaOrSpaceSeparated=!1,t4.prototype.commaSeparated=!1,t4.prototype.defined=!1,t4.prototype.mustUseProperty=!1,t4.prototype.number=!1,t4.prototype.overloadedBoolean=!1,t4.prototype.property=``,t4.prototype.spaceSeparated=!1,t4.prototype.space=void 0;var n4=s({boolean:()=>r4,booleanish:()=>i4,commaOrSpaceSeparated:()=>c4,commaSeparated:()=>s4,number:()=>$,overloadedBoolean:()=>a4,spaceSeparated:()=>o4}),Ove=0,r4=l4(),i4=l4(),a4=l4(),$=l4(),o4=l4(),s4=l4(),c4=l4();function l4(){return 2**++Ove}var u4=Object.keys(n4),d4=class extends t4{constructor(e,t,n,r){let i=-1;if(super(e,t),f4(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Nve.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(b4,Ive);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!b4.test(e)){let n=e.replace(Mve,Fve);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=d4}return new i(r,t)}function Fve(e){return`-`+e.toLowerCase()}function Ive(e){return e.charAt(1).toUpperCase()}var Lve=$2([m4,kve,_4,v4,y4],`html`),x4=$2([m4,Ave,_4,v4,y4],`svg`);function Rve(e){return e.join(` `).trim()}var zve=o(((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})),Bve=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(zve());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),Vve=o((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))}})),Hve=o(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Bve()),i=Vve();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),S4=w4(`end`),C4=w4(`start`);function w4(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 Uve(e){let t=C4(e),n=S4(e);if(t&&n)return{start:t,end:n}}function T4(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?D4(e.position):`start`in e||`end`in e?D4(e):`line`in e||`column`in e?E4(e):``}function E4(e){return O4(e&&e.line)+`:`+O4(e&&e.column)}function D4(e){return E4(e&&e.start)+`-`+E4(e&&e.end)}function O4(e){return e&&typeof e==`number`?e:1}var k4=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=T4(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}};k4.prototype.file=``,k4.prototype.name=``,k4.prototype.reason=``,k4.prototype.message=``,k4.prototype.stack=``,k4.prototype.column=void 0,k4.prototype.line=void 0,k4.prototype.ancestors=void 0,k4.prototype.cause=void 0,k4.prototype.fatal=void 0,k4.prototype.place=void 0,k4.prototype.ruleId=void 0,k4.prototype.source=void 0;var Wve=l(Hve(),1),A4={}.hasOwnProperty,Gve=new Map,Kve=/[A-Z]/g,qve=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Jve=new Set([`td`,`th`]),j4=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Yve(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=rye(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=nye(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`?x4:Lve,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=M4(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function M4(e,t,n){if(t.type===`element`)return Xve(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Zve(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return $ve(e,t,n);if(t.type===`mdxjsEsm`)return Qve(e,t);if(t.type===`root`)return eye(e,t,n);if(t.type===`text`)return tye(e,t)}function Xve(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=x4,e.schema=i),e.ancestors.push(t);let a=I4(e,t.tagName,!1),o=iye(e,t),s=F4(e,t);return qve.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Dve(e)})),N4(e,o,a,t),P4(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Zve(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)}L4(e,t.position)}function Qve(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);L4(e,t.position)}function $ve(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=x4,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:I4(e,t.name,!0),o=aye(e,t),s=F4(e,t);return N4(e,o,a,t),P4(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function eye(e,t,n){let r={};return P4(r,F4(e,t)),e.create(t,e.Fragment,r,n)}function tye(e,t){return t.value}function N4(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function P4(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function nye(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 rye(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=C4(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 iye(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&A4.call(t.properties,i)){let a=oye(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Jve.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 aye(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 L4(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 L4(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function F4(e,t){let n=[],r=-1,i=e.passKeys?new Map:Gve;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?(W4(e,e.length,0,t),e):t}var K4={}.hasOwnProperty;function q4(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 Y4(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var X4=a3(/[A-Za-z]/),Z4=a3(/[\dA-Za-z]/),hye=a3(/[#-'*+\--9=?A-Z^-~]/);function Q4(e){return e!==null&&(e<32||e===127)}var $4=a3(/\d/),gye=a3(/[\dA-Fa-f]/),_ye=a3(/[!-/:-@[-`{-~]/);function e3(e){return e!==null&&e<-2}function t3(e){return e!==null&&(e<0||e===32)}function n3(e){return e===-2||e===-1||e===32}var r3=a3(/\p{P}|\p{S}/u),i3=a3(/\s/);function a3(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function o3(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 s3(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return n3(r)?(e.enter(n),s(r)):t(r)}function s(r){return n3(r)&&a++0&&n3(t)?(e.enter(r),c(t)):l(t)}function c(t){return n3(t)&&o=i?t(e):n(e)}}var vye={tokenize:yye};function yye(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),s3(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);else return e3(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var l3=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){u3(this,e,t,n,!1)}addBefore(e,t,n){u3(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 u3(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 bye={tokenize:xye},d3={tokenize:Sye};function xye(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 Sye(e,t,n){return s3(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function f3(e){if(e===null||t3(e)||i3(e))return 1;if(r3(e))return 2}function p3(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};h3(o,-a),h3(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=G4(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=G4(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=G4(r,p3(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=G4(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=G4(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),W4(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&n3(t)?s3(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||e3(t)?e.check(b3,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||e3(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`),n3(t)?s3(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`),n3(t)?s3(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||e3(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var S3={name:`codeIndented`,tokenize:Iye},Fye={partial:!0,tokenize:Lye};function Iye(e,t,n){return r;function r(t){return e.enter(`codeIndented`),c3(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):e3(t)?e.attempt(Fye,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||e3(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Lye(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):e3(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):c3(e,t,a,`linePrefix`,4,4)(o)}function a(e){return e3(e)?i(e):n(e)}}var Rye={name:`codeText`,previous:Bye,resolve:zye,tokenize:Vye};function zye(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&&C3(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),C3(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),C3(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 T3(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||Q4(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||e3(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||t3(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):e3(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||e3(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!n3(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function D3(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):e3(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),s3(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||e3(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 O3(e,t){let n;return r;function r(i){return e3(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):n3(i)?s3(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Yye={name:`definition`,tokenize:Zye},Xye={partial:!0,tokenize:Qye};function Zye(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return E3.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Y4(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 t3(t)?O3(e,l)(t):l(t)}function l(t){return T3(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Xye,d,d)(t)}function d(t){return n3(t)?s3(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||e3(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Qye(e,t,n){return r;function r(t){return t3(t)?O3(e,i)(t):n(t)}function i(t){return D3(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return n3(t)?s3(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||e3(e)?t(e):n(e)}}var $ye={name:`hardBreakEscape`,tokenize:ebe};function ebe(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return e3(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var tbe={name:`headingAtx`,resolve:nbe,tokenize:rbe};function nbe(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`};W4(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function rbe(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||t3(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||e3(n)?(e.exit(`atxHeading`),t(n)):n3(n)?s3(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||t3(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ibe=`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(`.`),k3=[`pre`,`script`,`style`,`textarea`],abe={concrete:!0,name:`htmlFlow`,resolveTo:sbe,tokenize:cbe},obe={partial:!0,tokenize:lbe};function sbe(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 cbe(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:ee):X4(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):X4(a)?(e.consume(a),i=4,r.interrupt?t:ee):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ee):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 X4(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||t3(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&k3.includes(l)?(i=1,r.interrupt?t(s):O(s)):ibe.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||Z4(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 n3(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||X4(t)?(e.consume(t),b):n3(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Z4(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):n3(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):n3(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||e3(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||t3(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||n3(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||e3(t)?O(t):n3(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),ee):t===93&&i===5?(e.consume(t),F):e3(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(obe,te,k)(t)):t===null||e3(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(b3,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||e3(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ee):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return k3.includes(n)?(e.consume(t),I):O(t)}return X4(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),ee):O(t)}function ee(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),ee):O(t)}function I(t){return t===null||e3(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function lbe(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(g3,t,n)}}var ube={name:`htmlText`,tokenize:dbe};function dbe(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):X4(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):X4(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):e3(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):e3(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):e3(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):e3(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return X4(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Z4(t)?(e.consume(t),S):C(t)}function C(t){return e3(t)?(o=C,N(t)):n3(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Z4(t)?(e.consume(t),w):t===47||t===62||t3(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||X4(t)?(e.consume(t),E):e3(t)?(o=T,N(t)):n3(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Z4(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):e3(t)?(o=D,N(t)):n3(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):e3(t)?(o=O,N(t)):n3(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):e3(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||t3(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||t3(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return n3(t)?s3(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var A3={name:`labelEnd`,resolveAll:hbe,resolveTo:gbe,tokenize:_be},fbe={tokenize:vbe},pbe={tokenize:ybe},mbe={tokenize:bbe};function hbe(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(Y4(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(fbe,u,o?u:d)(t):t===91?e.attempt(pbe,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(mbe,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function vbe(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 t3(t)?O3(e,a)(t):a(t)}function a(t){return t===41?u(t):T3(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return t3(t)?O3(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?D3(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return t3(t)?O3(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 ybe(e,t,n){let r=this;return i;function i(t){return E3.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Y4(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function bbe(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 xbe={name:`labelStartImage`,resolveAll:A3.resolveAll,tokenize:Sbe};function Sbe(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 Cbe={name:`labelStartLink`,resolveAll:A3.resolveAll,tokenize:wbe};function wbe(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 j3={name:`lineEnding`,tokenize:Tbe};function Tbe(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),s3(e,t,`linePrefix`)}}var M3={name:`thematicBreak`,tokenize:Ebe};function Ebe(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||e3(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),n3(t)?s3(e,s,`whitespace`)(t):s(t))}}var N3={continuation:{tokenize:Abe},exit:Mbe,name:`list`,tokenize:kbe},Dbe={partial:!0,tokenize:Nbe},Obe={partial:!0,tokenize:jbe};function kbe(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:$4(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(M3,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 $4(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(g3,r.interrupt?n:u,e.attempt(Dbe,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return n3(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 Abe(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(g3,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,s3(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!n3(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(Obe,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,s3(e,e.attempt(N3,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function jbe(e,t,n){let r=this;return s3(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 Mbe(e){e.exit(this.containerState.type)}function Nbe(e,t,n){let r=this;return s3(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!n3(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var P3={name:`setextUnderline`,resolveTo:Pbe,tokenize:Fbe};function Pbe(e,t){let n=new l3,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 Fbe(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`),n3(t)?s3(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||e3(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Ibe={tokenize:Lbe};function Lbe(e){let t=this,n=e.attempt(g3,r,e.attempt(this.parser.constructs.flowInitial,i,s3(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Wye,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Rbe={resolveAll:I3()},zbe=F3(`string`),Bbe=F3(`text`);function F3(e){return{resolveAll:I3(e===`text`?Vbe: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);else 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(;++iXbe,contentInitial:()=>Wbe,disable:()=>Zbe,document:()=>Ube,flow:()=>Kbe,flowInitial:()=>Gbe,insideSpan:()=>Ybe,string:()=>qbe,text:()=>Jbe}),Ube={42:N3,43:N3,45:N3,48:N3,49:N3,50:N3,51:N3,52:N3,53:N3,54:N3,55:N3,56:N3,57:N3,62:_3},Wbe={91:Yye},Gbe={[-2]:S3,[-1]:S3,32:S3},Kbe={35:tbe,42:M3,45:[P3,M3],60:abe,61:P3,95:M3,96:x3,126:x3},qbe={38:y3,92:v3},Jbe={[-5]:j3,[-4]:j3,[-3]:j3,33:xbe,38:y3,42:m3,60:[Tye,ube],91:Cbe,92:[$ye,v3],93:A3,95:m3,96:Rye},Ybe={null:[m3,Rbe]},Xbe={null:[42,95]},Zbe={null:[]};function Qbe(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=G4(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=p3(a,l.events,l),l.events):[]}function f(e,t){return exe(p(e),t)}function p(e){return $be(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 exe(e,t){let n=-1,r=[],i;for(;++n0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),R3.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||V3).call(o,void 0,e[0])}for(r.position={start:z3(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:z3(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),R3.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||V3).call(o,void 0,e[0])}for(r.position={start:z3(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:z3(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function mxe(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hxe(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gxe(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=a3(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function _xe(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vxe(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function H3(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function yxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return H3(e,t);let i={src:a3(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function bxe(e,t){let n={src:a3(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xxe(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Sxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return H3(e,t);let i={href:a3(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Cxe(e,t){let n={href:a3(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wxe(e,t,n){let r=e.all(t),i=n?Txe(n):U3(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function mxe(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hxe(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gxe(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=o3(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function _xe(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vxe(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function H3(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function yxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return H3(e,t);let i={src:o3(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function bxe(e,t){let n={src:o3(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xxe(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Sxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return H3(e,t);let i={href:o3(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Cxe(e,t){let n={href:o3(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wxe(e,t,n){let r=e.all(t),i=n?Txe(n):U3(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s1}function Exe(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=S4(t.children[1]),o=x4(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function jxe(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(K3(t.slice(i),i>0,!1)),a.join(``)}function K3(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===W3||t===G3;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===W3||t===G3;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Pxe(e,t){let n={type:`text`,value:Nxe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Fxe(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Ixe={blockquote:dxe,break:fxe,code:pxe,delete:mxe,emphasis:hxe,footnoteReference:gxe,heading:_xe,html:vxe,imageReference:yxe,image:bxe,inlineCode:xxe,linkReference:Sxe,link:Cxe,listItem:wxe,list:Exe,paragraph:Dxe,root:Oxe,strong:kxe,table:Axe,tableCell:Mxe,tableRow:jxe,text:Pxe,thematicBreak:Fxe,toml:q3,yaml:q3,definition:q3,footnoteDefinition:q3};function q3(){}var{defineProperty:Lxe}=Object,J3=typeof self==`object`?self:globalThis,Y3=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new J3[e](t)},Rxe=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Lxe(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof J3[e]==`function`?Y3(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(Y3(a,o),i)};return r},X3=e=>Rxe(new Map,e)(0),Z3=``,{toString:zxe}={},{keys:Bxe,is:Vxe}=Object,Q3=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=zxe.call(e).slice(8,-1);switch(n){case`Array`:return[1,Z3];case`Object`:return[2,Z3];case`Date`:return[3,Z3];case`RegExp`:return[4,Z3];case`Map`:return[5,Z3];case`Set`:return[6,Z3];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},$3=([e,t])=>e===0&&(t===`function`||t===`symbol`),Hxe=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=Q3(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Vxe(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of Bxe(o))(e||!$3(Q3(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?Z3:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!($3(Q3(n))||$3(Q3(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!$3(Q3(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},e6=(e,{json:t,lossy:n}={})=>{let r=[];return Hxe(!(t||n),!!t,new Map,r)(e),r},t6=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?X3(e6(e,t)):structuredClone(e):(e,t)=>X3(e6(e,t));function Uxe(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Wxe(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Gxe(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Uxe,r=e.options.footnoteBackLabel||Wxe,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...t6(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` +`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Txe(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r1}function Exe(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=C4(t.children[1]),o=S4(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function jxe(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(K3(t.slice(i),i>0,!1)),a.join(``)}function K3(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===W3||t===G3;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===W3||t===G3;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Pxe(e,t){let n={type:`text`,value:Nxe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Fxe(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Ixe={blockquote:dxe,break:fxe,code:pxe,delete:mxe,emphasis:hxe,footnoteReference:gxe,heading:_xe,html:vxe,imageReference:yxe,image:bxe,inlineCode:xxe,linkReference:Sxe,link:Cxe,listItem:wxe,list:Exe,paragraph:Dxe,root:Oxe,strong:kxe,table:Axe,tableCell:Mxe,tableRow:jxe,text:Pxe,thematicBreak:Fxe,toml:q3,yaml:q3,definition:q3,footnoteDefinition:q3};function q3(){}var{defineProperty:Lxe}=Object,J3=typeof self==`object`?self:globalThis,Y3=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new J3[e](t)},Rxe=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Lxe(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof J3[e]==`function`?Y3(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(Y3(a,o),i)};return r},X3=e=>Rxe(new Map,e)(0),Z3=``,{toString:zxe}={},{keys:Bxe,is:Vxe}=Object,Q3=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=zxe.call(e).slice(8,-1);switch(n){case`Array`:return[1,Z3];case`Object`:return[2,Z3];case`Date`:return[3,Z3];case`RegExp`:return[4,Z3];case`Map`:return[5,Z3];case`Set`:return[6,Z3];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},$3=([e,t])=>e===0&&(t===`function`||t===`symbol`),Hxe=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=Q3(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Vxe(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of Bxe(o))(e||!$3(Q3(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?Z3:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!($3(Q3(n))||$3(Q3(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!$3(Q3(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},e6=(e,{json:t,lossy:n}={})=>{let r=[];return Hxe(!(t||n),!!t,new Map,r)(e),r},t6=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?X3(e6(e,t)):structuredClone(e):(e,t)=>X3(e6(e,t));function Uxe(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Wxe(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Gxe(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Uxe,r=e.options.footnoteBackLabel||Wxe,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...t6(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:` -`}]}}var n6=(function(e){if(e==null)return Yxe;if(typeof e==`function`)return r6(e);if(typeof e==`object`)return Array.isArray(e)?Kxe(e):qxe(e);if(typeof e==`string`)return Jxe(e);throw Error(`Expected function, string, or object as test`)});function Kxe(e){let t=[],n=-1;for(;++n`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=i6;if(s&&r&&(o=o6(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=i6;if(s&&r&&(o=o6(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e0&&n.push({type:`text`,value:` `}),n}function u6(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function d6(e,t){let n=tSe(e,t),r=n.one(e,void 0),i=Gxe(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` -`},i)),a}function oSe(e,t){return e&&`run`in e?async function(n,r){let i=d6(n,{file:r,...t});await e.run(i,r)}:function(n,r){return d6(n,{file:r,...e||t})}}function f6(e){if(e)throw e}var sSe=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var m6={basename:uSe,dirname:dSe,extname:fSe,join:pSe,sep:`/`};function uSe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);h6(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function dSe(e){if(h6(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function fSe(e){h6(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function pSe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function hSe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function h6(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var gSe={cwd:_Se};function _Se(){return`/`}function g6(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function vSe(e){if(typeof e==`string`)e=new URL(e);else if(!g6(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return ySe(e)}function ySe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];p6(o)&&p6(r)&&(r=(0,S6.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function C6(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function w6(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function T6(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function E6(e){if(!p6(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function D6(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function O6(e){return wSe(e)?e:new v6(e)}function wSe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function TSe(e){return typeof e==`string`||ESe(e)}function ESe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var k6=[],A6={allowDangerousHtml:!0},DSe=/^(https?|ircs?|mailto|xmpp)$/i,OSe=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function kSe(e){let t=ASe(e),n=jSe(e);return MSe(t.runSync(t.parse(n),n),e)}function ASe(e){let t=e.rehypePlugins||k6,n=e.remarkPlugins||k6,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...A6}:A6;return CSe().use(uxe).use(n).use(oSe,r).use(t)}function jSe(e){let t=e.children||``,n=new v6;return typeof t==`string`?n.value=t:``+t,n}function MSe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||NSe;for(let e of OSe)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return s6(e,l),Xve(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in L4)if(Object.hasOwn(L4,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=L4[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function NSe(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||DSe.test(e.slice(0,t))?e:``}function j6(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function PSe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function FSe(e,t,n){let r=n6((n||{}).ignore||[]),i=ISe(t),a=-1;for(;++a0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=j6(e,`(`),a=j6(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function F6(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||r3(n)||n3(n))&&(!t||n!==47)}I6.peek=aCe;function ZSe(){this.buffer()}function QSe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function $Se(){this.buffer()}function eCe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function tCe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J4(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nCe(e){this.exit(e)}function rCe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=J4(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iCe(e){this.exit(e)}function aCe(){return`[`}function I6(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function oCe(){return{enter:{gfmFootnoteCallString:ZSe,gfmFootnoteCall:QSe,gfmFootnoteDefinitionLabelString:$Se,gfmFootnoteDefinition:eCe},exit:{gfmFootnoteCallString:tCe,gfmFootnoteCall:nCe,gfmFootnoteDefinitionLabelString:rCe,gfmFootnoteDefinition:iCe}}}function sCe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:I6},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` +`},i)),a}function oSe(e,t){return e&&`run`in e?async function(n,r){let i=d6(n,{file:r,...t});await e.run(i,r)}:function(n,r){return d6(n,{file:r,...e||t})}}function f6(e){if(e)throw e}var sSe=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var m6={basename:uSe,dirname:dSe,extname:fSe,join:pSe,sep:`/`};function uSe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);h6(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function dSe(e){if(h6(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function fSe(e){h6(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function pSe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function hSe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function h6(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var gSe={cwd:_Se};function _Se(){return`/`}function g6(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function vSe(e){if(typeof e==`string`)e=new URL(e);else if(!g6(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return ySe(e)}function ySe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];p6(o)&&p6(r)&&(r=(0,S6.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function C6(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function w6(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function T6(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function E6(e){if(!p6(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function D6(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function O6(e){return wSe(e)?e:new v6(e)}function wSe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function TSe(e){return typeof e==`string`||ESe(e)}function ESe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var k6=[],A6={allowDangerousHtml:!0},DSe=/^(https?|ircs?|mailto|xmpp)$/i,OSe=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function kSe(e){let t=ASe(e),n=jSe(e);return MSe(t.runSync(t.parse(n),n),e)}function ASe(e){let t=e.rehypePlugins||k6,n=e.remarkPlugins||k6,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...A6}:A6;return CSe().use(uxe).use(n).use(oSe,r).use(t)}function jSe(e){let t=e.children||``,n=new v6;return typeof t==`string`?n.value=t:``+t,n}function MSe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||NSe;for(let e of OSe)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return s6(e,l),Yve(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in R4)if(Object.hasOwn(R4,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=R4[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function NSe(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||DSe.test(e.slice(0,t))?e:``}function j6(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function PSe(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function FSe(e,t,n){let r=n6((n||{}).ignore||[]),i=ISe(t),a=-1;for(;++a0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=j6(e,`(`),a=j6(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function F6(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||i3(n)||r3(n))&&(!t||n!==47)}I6.peek=aCe;function ZSe(){this.buffer()}function QSe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function $Se(){this.buffer()}function eCe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function tCe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Y4(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nCe(e){this.exit(e)}function rCe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Y4(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iCe(e){this.exit(e)}function aCe(){return`[`}function I6(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function oCe(){return{enter:{gfmFootnoteCallString:ZSe,gfmFootnoteCall:QSe,gfmFootnoteDefinitionLabelString:$Se,gfmFootnoteDefinition:eCe},exit:{gfmFootnoteCallString:tCe,gfmFootnoteCall:nCe,gfmFootnoteDefinitionLabelString:rCe,gfmFootnoteDefinition:iCe}}}function sCe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:I6},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?L6:cCe))),s(),o}}function cCe(e,t,n){return t===0?e:L6(e,t,n)}function L6(e,t,n){return(n?``:` `)+e}var lCe=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];R6.attention=mCe,R6.peek=hCe;function uCe(){return{canContainEols:[`delete`],enter:{strikethrough:fCe},exit:{strikethrough:pCe}}}function dCe(){return{handlers:{delete:R6},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:lCe}]}}function fCe(e){this.enter({type:`delete`,children:[],position:void 0},e)}function pCe(e){this.exit(e)}function R6(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function mCe(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function hCe(){return`~`}function gCe(e){return e.length}function _Ce(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||gCe,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),xCe);return i(),o}function xCe(e,t,n){return`>`+(n?``:` `)+e}function SCe(e,t){return B6(e,t.inConstruct,!0)&&!B6(e,t.notInConstruct,!1)}function B6(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` -`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function kCe(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}U6.attention=ACe,U6.peek=jCe;function U6(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function ACe(e,t){return{construct:`emphasis`,markers:kCe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function jCe(e,t,n){return n.options.emphasis||`*`}function MCe(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function NCe(e,t){let n=!1;return s6(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&R4(e)&&(t.options.setext||n))}function PCe(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(NCe(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` +`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function kCe(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}U6.attention=ACe,U6.peek=jCe;function U6(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function ACe(e,t){return{construct:`emphasis`,markers:kCe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function jCe(e,t,n){return n.options.emphasis||`*`}function MCe(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function NCe(e,t){let n=!1;return s6(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&z4(e)&&(t.options.setext||n))}function PCe(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(NCe(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` `,after:` `});return r(),t(),o+` `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(` `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:` -`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=MCe(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}W6.peek=FCe;function W6(e){return e.value||``}function FCe(){return`<`}G6.peek=ICe;function G6(e,t,n,r){let i=H6(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function ICe(){return`!`}K6.peek=LCe;function K6(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function LCe(){return`!`}q6.peek=RCe;function q6(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}Y6.peek=zCe;function Y6(e,t,n,r){let i=H6(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(J6(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function zCe(e,t,n){return J6(e,n)?`<`:`[`}X6.peek=BCe;function X6(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function BCe(){return`[`}function Z6(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function VCe(e){let t=Z6(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function HCe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Q6(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function UCe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?HCe(n):Z6(n),s=e.ordered?o===`.`?`)`:`.`:VCe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if(o!==`*`&&o!==`-`||!t||t.children&&t.children[0]||n.stack[n.stack.length-1]!==`list`||n.stack[n.stack.length-2]!==`listItem`||n.stack[n.stack.length-3]!==`list`||n.stack[n.stack.length-4]!==`listItem`||n.indexStack[n.indexStack.length-1]!==0||n.indexStack[n.indexStack.length-2]!==0||n.indexStack[n.indexStack.length-3]!==0||(c=!0),Q6(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function KCe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function qCe(e,t,n,r){if(!e.children.some(function(e){return yCe(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function JCe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$6.attention=YCe,$6.peek=XCe;function $6(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function YCe(e,t){return{construct:`strong`,markers:JCe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function XCe(e,t,n){return n.options.strong||`*`}function ZCe(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function QCe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function $Ce(e,t,n){let r=(Q6(n)+(n.options.ruleSpaces?` `:``)).repeat(QCe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var e8={blockquote:bCe,break:V6,code:ECe,definition:OCe,emphasis:U6,hardBreak:V6,heading:PCe,html:W6,image:G6,imageReference:K6,inlineCode:q6,link:Y6,linkReference:X6,list:UCe,listItem:GCe,paragraph:KCe,root:qCe,strong:$6,text:ZCe,thematicBreak:$Ce};function ewe(){return{enter:{table:twe,tableData:n8,tableHeader:n8,tableRow:rwe},exit:{codeText:iwe,table:nwe,tableData:t8,tableHeader:t8,tableRow:t8}}}function twe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function nwe(e){this.exit(e),this.data.inTable=void 0}function rwe(e){this.enter({type:`tableRow`,children:[]},e)}function t8(e){this.exit(e)}function n8(e){this.enter({type:`tableCell`,children:[]},e)}function iwe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,awe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function awe(e,t){return t===`|`?t:e}function owe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` +`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=MCe(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}W6.peek=FCe;function W6(e){return e.value||``}function FCe(){return`<`}G6.peek=ICe;function G6(e,t,n,r){let i=H6(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function ICe(){return`!`}K6.peek=LCe;function K6(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function LCe(){return`!`}q6.peek=RCe;function q6(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}Y6.peek=zCe;function Y6(e,t,n,r){let i=H6(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(J6(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function zCe(e,t,n){return J6(e,n)?`<`:`[`}X6.peek=BCe;function X6(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function BCe(){return`[`}function Z6(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function VCe(e){let t=Z6(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function HCe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Q6(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function UCe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?HCe(n):Z6(n),s=e.ordered?o===`.`?`)`:`.`:VCe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if(o!==`*`&&o!==`-`||!t||t.children&&t.children[0]||n.stack[n.stack.length-1]!==`list`||n.stack[n.stack.length-2]!==`listItem`||n.stack[n.stack.length-3]!==`list`||n.stack[n.stack.length-4]!==`listItem`||n.indexStack[n.indexStack.length-1]!==0||n.indexStack[n.indexStack.length-2]!==0||n.indexStack[n.indexStack.length-3]!==0||(c=!0),Q6(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function KCe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function qCe(e,t,n,r){if(!e.children.some(function(e){return yCe(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function JCe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$6.attention=YCe,$6.peek=XCe;function $6(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function YCe(e,t){return{construct:`strong`,markers:JCe(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function XCe(e,t,n){return n.options.strong||`*`}function ZCe(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function QCe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function $Ce(e,t,n){let r=(Q6(n)+(n.options.ruleSpaces?` `:``)).repeat(QCe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var e8={blockquote:bCe,break:V6,code:ECe,definition:OCe,emphasis:U6,hardBreak:V6,heading:PCe,html:W6,image:G6,imageReference:K6,inlineCode:q6,link:Y6,linkReference:X6,list:UCe,listItem:GCe,paragraph:KCe,root:qCe,strong:$6,text:ZCe,thematicBreak:$Ce};function ewe(){return{enter:{table:twe,tableData:n8,tableHeader:n8,tableRow:rwe},exit:{codeText:iwe,table:nwe,tableData:t8,tableHeader:t8,tableRow:t8}}}function twe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function nwe(e){this.exit(e),this.data.inTable=void 0}function rwe(e){this.enter({type:`tableRow`,children:[]},e)}function t8(e){this.exit(e)}function n8(e){this.enter({type:`tableCell`,children:[]},e)}function iwe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,awe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function awe(e,t){return t===`|`?t:e}function owe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` -`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return _Ce(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var wwe={tokenize:Mwe,partial:!0};function Twe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:kwe,continuation:{tokenize:Awe},exit:jwe}},text:{91:{name:`gfmFootnoteCall`,tokenize:Owe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Ewe,resolveTo:Dwe}}}}function Ewe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=J4(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Dwe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Owe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||e3(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(J4(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return e3(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function kwe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||e3(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=J4(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return e3(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),o3(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Awe(e,t,n){return e.check(g3,t,e.attempt(wwe,t,n))}function jwe(e){e.exit(`gfmFootnoteDefinition`)}function Mwe(e,t,n){let r=this;return o3(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Nwe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=d3(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Pwe=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){Fwe(this,e,t,n)}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 Fwe(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function Iwe(e,t){let n=!1,r=[];for(;t-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):$4(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):t3(t)?o3(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||e3(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,t3(t)?o3(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return t3(t)?o3(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$4(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return t3(t)?o3(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$4(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$4(n)?(e.exit(`tableRow`),t(n)):t3(n)?o3(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||e3(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function zwe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Pwe;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},y8(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function v8(e,t,n,r,i){let a=[],o=y8(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function y8(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Bwe={name:`tasklistCheck`,tokenize:Hwe};function Vwe(){return{text:{91:Bwe}}}function Hwe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return e3(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $4(r)?t(r):t3(r)?e.check({tokenize:Uwe},t,n)(r):n(r)}}function Uwe(e,t,n){return o3(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Wwe(e){return K4([hwe(),Twe(),Nwe(e),Lwe(),Vwe()])}var Gwe={};function Kwe(e){let t=this,n=e||Gwe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Wwe(n)),a.push(dwe()),o.push(fwe(n))}function qwe({items:e,format:t,label:n,max:r,onSelect:i,ranked:a}){let o=r??Math.max(0,...e.map(e=>e.value));return(0,H.jsx)(o_,{gap:4,role:`list`,"aria-label":n,children:e.map((e,n)=>{let r=o>0?`${Math.max(0,Math.min(100,e.value/o*100))}%`:`0%`,s=(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,align:`center`,className:i?`w-row`:void 0,"data-clickable":i?``:void 0,style:{borderRadius:`var(--mantine-radius-sm)`},children:[(0,H.jsxs)(G,{pos:`relative`,style:{flex:1,minWidth:0,height:28},children:[(0,H.jsx)(G,{"aria-hidden":!0,className:`w-bar`,pos:`absolute`,top:0,left:0,h:`100%`,w:r,style:{borderRadius:`var(--mantine-radius-sm)`,transition:`width 300ms ease-out`}}),(0,H.jsxs)(K,{pos:`relative`,gap:8,h:28,px:8,wrap:`nowrap`,style:{minWidth:0},children:[a&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,w:16,style:{flex:`none`},children:n+1}),(0,H.jsx)(q,{size:`sm`,fw:500,truncate:!0,title:e.label,style:{minWidth:0},children:e.label}),e.sub&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:e.sub,style:{minWidth:0,flex:`0 1 auto`},children:e.sub})]})]}),(0,H.jsx)(q,{size:`sm`,ff:`monospace`,ta:`right`,style:{flex:`none`,minWidth:64,whiteSpace:`nowrap`},children:t(e.value)})]});return(0,H.jsx)(G,{role:`listitem`,children:i?(0,H.jsx)($c,{w:`100%`,onClick:()=>i(e.id),children:s}):s},e.id)})})}var Jwe={empty:{color:`gray`,icon:Xte},"all-clear":{color:`success`,icon:Dv},error:{color:`danger`,icon:Qte}};function Ywe(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Xwe(e){let t=/^(.+?[.!?])\s+(.+)$/s.exec(e.trim());return t?{title:t[1],caption:t[2]}:{title:e.trim()}}function b8({kind:e=`empty`,title:t,caption:n,checkedAt:r,onRetry:i,command:a,action:o}){let{color:s,icon:c}=Jwe[e];return(0,H.jsxs)(K,{mih:56,px:`sm`,py:6,gap:`sm`,wrap:`nowrap`,role:e===`error`?`alert`:`status`,children:[(0,H.jsx)(E_,{variant:`light`,color:s,radius:`xl`,size:28,"aria-hidden":!0,styles:{root:{background:`var(--driga-tint-${e===`empty`?`neutral`:s})`}},children:(0,H.jsx)(c,{size:16})}),(0,H.jsxs)(o_,{gap:2,style:{flex:1,minWidth:0},children:[(0,H.jsx)(q,{size:`md`,fw:500,lh:1.2,children:t}),(n||r||a)&&(0,H.jsxs)(K,{gap:6,wrap:`wrap`,children:[n&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.3,children:n}),r&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.3,title:k1(r),children:[n?`· `:``,`checked `,Ywe(r)]}),a&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,className:`w-inset`,lh:1.3,style:{display:`inline-block`},children:a})]})]}),i&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,H.jsx)(Bte,{size:12}),onClick:i,style:{flex:`none`},children:`Retry`}),o&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,onClick:o.onClick,style:{flex:`none`},children:o.label})]})}var x8=[],Zwe=[`1h`,`6h`,`24h`];function Qwe({id:e,title:t,info:n,caption:r,range:i,onRange:a,series:o=x8,from:s=0,to:c=0,unit:l,waits:u,events:d,peak:f,option:p,state:m=`ready`,message:g,onRetry:_,actions:v,children:y,height:b=200,headingOrder:x=3,headerClassName:S}){let C=(0,h.useId)(),w=e?`panel-${e}`:C,T=(0,h.useCallback)(e=>A1(e,l),[l]),E=n?`${t}: ${n}`:t,D=m===`empty`?x8:o,O=(0,h.useCallback)(e=>p?p(e):che({series:D,from:s,to:c,unit:l,format:T,waits:u,events:d,peak:f,label:E},e),[p,D,s,c,l,T,u,d,f,E]),k=b===`fill`,A=k?void 0:b,j;j=y||(m===`loading`?(0,H.jsx)(G,{role:`img`,"aria-label":`Loading chart`,style:k?{flex:1}:void 0,children:(0,H.jsx)(r_,{h:A??`100%`,radius:`sm`})}):m===`error`?(0,H.jsx)(G,{h:A,style:{display:`flex`,alignItems:`center`,flex:k?1:void 0},children:(0,H.jsx)(b8,{kind:`error`,title:g??`This chart could not load.`,caption:`The last reading is not shown; it could be stale.`,onRetry:_})}):(0,H.jsxs)(G,{pos:`relative`,h:A,style:k?{flex:1,minHeight:0}:void 0,children:[(0,H.jsx)(B1,{option:O,label:E,height:k?`100%`:b}),m===`empty`&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,pos:`absolute`,top:`50%`,left:`50%`,style:{transform:`translate(-50%, -50%)`,whiteSpace:`nowrap`},children:g??(i?`no samples in the last ${i}`:`no samples`)})]}));let M=v&&(v.table||v.ask||v.remove);return(0,H.jsxs)(Im,{component:`article`,"aria-labelledby":w,h:k?`100%`:void 0,style:{display:`flex`,flexDirection:`column`,minHeight:0,gap:6},children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,className:S,style:{flex:`none`},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{minWidth:0},children:[(0,H.jsx)(k_,{order:x,id:w,fz:`md`,fw:600,lh:1.2,lineClamp:1,title:t,style:{letterSpacing:`-0.01em`,flex:`0 1 auto`},children:t}),n&&(0,H.jsx)(Bg,{label:n,multiline:!0,maw:320,children:(0,H.jsx)(lu,{size:`xs`,"aria-label":`About ${t}`,children:(0,H.jsx)(ly,{size:14})})}),r&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,truncate:!0,title:r,style:{minWidth:0},visibleFrom:`sm`,children:r})]}),(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,style:{flex:`none`},children:[i&&a&&(0,H.jsx)(qg,{size:`xs`,value:i,onChange:e=>a(e),data:Zwe,"aria-label":`${t} range`,styles:{label:{fontFamily:`var(--mantine-font-family-monospace)`,paddingInline:8}}}),M&&(0,H.jsxs)(ng,{position:`bottom-end`,withinPortal:!0,shadow:`md`,width:180,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`More for ${t}`,children:(0,H.jsx)(Vv,{size:18})})}),(0,H.jsxs)(ng.Dropdown,{children:[v.table&&(0,H.jsx)(ng.Item,{leftSection:y?(0,H.jsx)(Ute,{}):(0,H.jsx)(Yte,{}),onClick:v.table,children:y?`Show as chart`:`Show as table`}),v.ask&&(0,H.jsx)(ng.Item,{leftSection:(0,H.jsx)(Cv,{}),onClick:v.ask,children:`Ask Chat about it`}),v.remove&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ng.Divider,{}),(0,H.jsx)(ng.Item,{color:`danger`,leftSection:(0,H.jsx)(jy,{}),onClick:v.remove,children:`Remove`})]})]})]})]})]}),(0,H.jsx)(G,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:j})]})}var $we={permission:`warning`,question:`warning`,waiting:`warning`,stuck:`danger`,finished:`info`,machine:`warning`},eTe={permission:`Approve`,question:`Answer`,waiting:`Reply`,finished:`Mark reviewed`,stuck:null,machine:`Reclaim`};function tTe(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:D1(e)}function nTe(e,t){switch(e.kind){case`permission`:return`needs approval`;case`question`:return`asks a question`;case`waiting`:return`waits on you`;case`finished`:return e.turns&&e.turns>1?`finished · ${e.turns} turns`:`finished`;case`stuck`:return`quiet ${D1(t-Date.parse(e.since??e.at))}${e.quietExpected?`, expected ${D1(e.quietExpected)}`:``}`;case`machine`:return`machine`}}function S8({entry:e,selected:t,onApprove:n,onDeny:r,onOpen:i,onDismiss:a,armed:o=!0}){let s=Date.now(),c=$we[e.kind],l=eTe[e.kind],u=e.since?tTe(s-Date.parse(e.since)):null,d=[e.project,e.branch,e.machine].filter(Boolean).join(` · `),f=()=>i?.(e),p=t=>{t.target===t.currentTarget&&(t.key===`Enter`||t.key===`o`?(t.preventDefault(),f()):t.key===`a`&&l&&n&&o?(t.preventDefault(),n(e)):t.key===`x`&&a&&(t.preventDefault(),a(e)))},m=e=>{e.target.closest(`button, a`)||f()},h=(e,t)=>(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[e,(0,H.jsx)(yh,{size:`xs`,children:t})]}),g=t=>(0,H.jsxs)(H.Fragment,{children:[t,(0,H.jsxs)(tl,{children:[` · `,e.title]})]});return(0,H.jsx)(G,{className:`w-row`,"data-kind":e.kind,"data-clickable":i?``:void 0,"data-selected":t?`true`:void 0,tabIndex:i?0:void 0,onClick:i?m:void 0,onKeyDown:i?p:void 0,px:`sm`,py:8,style:{borderLeft:`3px solid var(--mantine-color-${c}-filled)`,borderRadius:`var(--mantine-radius-sm)`,background:`var(--driga-raised)`},children:(0,H.jsxs)(K,{gap:`sm`,wrap:`wrap`,align:`flex-start`,children:[(0,H.jsx)(G,{pt:2,style:{flex:`none`},children:e.kind===`machine`||!e.agent?(0,H.jsx)(G,{role:`img`,"aria-label":e.machine?`machine ${e.machine}`:`machine`,style:{width:20,height:20,borderRadius:`50%`,background:`var(--driga-inset)`,display:`grid`,placeItems:`center`,color:`var(--driga-muted)`},children:(0,H.jsx)(Fv,{size:12})}):(0,H.jsx)(y0,{agent:e.agent,waiting:e.kind===`permission`||e.kind===`question`||e.kind===`waiting`})}),(0,H.jsxs)(o_,{gap:4,style:{flex:`1 1 220px`,minWidth:0},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,align:`baseline`,style:{minWidth:0},children:[(0,H.jsx)(q,{size:`md`,fw:500,lh:1.2,truncate:!0,title:e.title,style:{minWidth:0,flex:`0 1 auto`},children:e.title}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`,flex:`none`},children:nTe(e,s)})]}),e.reason&&(0,H.jsx)(q,{size:`xs`,ff:e.kind===`question`||e.kind===`machine`?void 0:`monospace`,className:`w-inset`,lh:1.4,truncate:!0,title:e.reason,style:{display:`block`,maxWidth:`100%`,alignSelf:`flex-start`},children:e.reason}),d&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,truncate:!0,title:d,children:d}),e.review&&(0,H.jsxs)(K,{gap:6,wrap:`wrap`,children:[e.review.files>0&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:M1(e.review.files,`file`)}),!e.review.files&&!e.review.uncommitted&&!e.review.unpushed&&(e.review.checkout?(0,H.jsx)(Bg,{label:(0,H.jsx)(q,{size:`xs`,ff:`monospace`,children:e.review.checkout}),children:(0,H.jsx)(`span`,{className:`w-chip`,"data-tone":`neutral`,children:`clean`})}):(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:`no checkout`})),e.review.uncommitted>0&&(0,H.jsxs)(`span`,{className:`w-chip`,"data-tone":`warning`,children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:5,height:5,borderRadius:`50%`,background:`var(--mantine-color-warning-filled)`}}),e.review.uncommitted,` uncommitted`]}),e.review.unpushed>0&&(0,H.jsxs)(`span`,{className:`w-chip`,"data-tone":`neutral`,children:[e.review.unpushed,` unpushed`]})]})]}),(0,H.jsxs)(o_,{gap:2,align:`flex-end`,w:96,style:{flex:`none`},children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,lh:1.2,title:k1(e.at),style:{whiteSpace:`nowrap`},children:O1(e.at,s)}),u&&(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(G,{"aria-hidden":!0,className:e.kind===`permission`||e.kind===`question`||e.kind===`waiting`?`w-pulse`:void 0,style:{width:6,height:6,borderRadius:`50%`,background:`var(--mantine-color-${c}-filled)`,flex:`none`}}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:[e.kind===`stuck`?`quiet`:`waiting`,` `,u]})]})]}),(n||r||i||a)&&(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,className:`w-actions`,style:{flex:`none`},children:[l&&n&&(0,H.jsx)(Bg,{label:h(l,`a`),children:(0,H.jsx)(km,{size:`compact-xs`,variant:`light`,disabled:!o,onClick:()=>n(e),children:g(l)})}),e.kind===`permission`&&r&&(0,H.jsx)(km,{size:`compact-xs`,variant:`default`,disabled:!o,onClick:()=>r(e),children:g(`Deny`)}),i&&(0,H.jsx)(Bg,{label:h(`Open`,`o`),children:(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,onClick:f,children:g(`Open`)})}),a&&(0,H.jsx)(Bg,{label:h(`Dismiss`,`x`),children:(0,H.jsx)(lu,{size:`sm`,variant:`subtle`,color:`gray`,"aria-label":`Dismiss ${e.title}`,onClick:()=>a(e),children:(0,H.jsx)(Iy,{size:14})})})]})]})})}var rTe=[`working`,`waiting`,`stuck`,`idle`];function iTe(e){return e.map(e=>{let t=[];for(let n of[...e.segments].sort((e,t)=>e.from-t.from)){let e=t[t.length-1];e&&e.state===n.state&&e.to>=n.from?e.to=Math.max(e.to,n.to):t.push({...n})}return{...e,segments:t}})}function aTe({lanes:e,from:t,to:n,now:r,label:i,laneHeight:a=26,onSelect:o}){let s=(0,h.useMemo)(()=>iTe(e),[e]),c=(0,h.useCallback)(e=>uhe({lanes:s,from:t,to:n,now:r,label:i},e),[s,t,n,r,i]),l=(0,h.useCallback)((e,t)=>{let n=Array.isArray(t.value)?s[Number(t.value[0])]:void 0;n&&o?.(n.id)},[s,o]);return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(B1,{option:c,label:i,height:s.length*a+36,onEvent:o?l:void 0}),(0,H.jsx)(K,{gap:`md`,"aria-hidden":!0,children:rTe.map(e=>(0,H.jsx)(c0,{state:e},e))})]})}var oTe={jump:uv,open:uv,ack:Tv,stop:Jte,kill:$te,force_kill:py,cleanup:jy,summarize:Cy},sTe=new Set([`stop`,`kill`,`force_kill`,`cleanup`]);function C8(e){return e.find(e=>e===`jump`||e===`open`)}function w8(e,t,n){let r=C8(e);if(!n||!r)return{};let i=()=>void n({kind:r,row:t});return{title:I0(r),className:`row-act`,onClick:e=>{e.target.closest(`button, a, [role=menu]`)||i()}}}function T8({kinds:e,row:t,act:n,label:r}){if(e.length===0)return null;let i=C8(e),a=e.filter(e=>e!==i),o=e=>{let r=oTe[e];return(0,H.jsx)(ng.Item,{color:sTe.has(e)?`danger`:void 0,leftSection:(0,H.jsx)(r,{}),onClick:()=>void n({kind:e,row:t}),children:I0(e)},e)};return(0,H.jsxs)(ng,{position:`bottom-end`,withinPortal:!0,shadow:`md`,width:180,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{className:`row-menu`,style:{flex:`none`},"aria-label":`Actions for ${r}`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(Vv,{size:18})})}),(0,H.jsxs)(ng.Dropdown,{children:[i&&o(i),i&&a.length>0&&(0,H.jsx)(ng.Divider,{}),a.map(o)]})]})}var cTe={s:120,m:240,l:420};function lTe(e){let t=e.viz===`stat`||e.viz===`gauge`?`s`:e.viz===`inbox`?`l`:`m`;return cTe[e.height??t]}function E8({panel:e,result:t,act:n,fill:r}){let i=F0(),a=n??i.act,o=r?0:lTe(e),s=t?.title||e.title;if(e.viz===`timeseries`)return(0,H.jsx)(dTe,{panel:e,result:t,fill:r,height:o,title:s});let c;c=e.viz===`text`?(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(q,{component:`div`,size:`sm`,className:`markdown`,children:(0,H.jsx)(kSe,{remarkPlugins:[Kwe],components:{img:()=>null},children:e.content??``})})}):t?t.status===`error`?(0,H.jsx)(b8,{kind:`error`,title:t.message??`This panel could not run.`}):e.viz===`inbox`&&(i.prompts?.length||i.bursts?.length||i.grantHistory?.length||i.inboxFilter)?(0,H.jsx)(j8,{frame:t.frame??{columns:[],rows:[]},act:a,prompts:i.prompts,answer:i.answer,filter:i.inboxFilter}):!t.frame||t.status===`empty`?(0,H.jsx)(uTe,{panel:e,message:t.message}):(0,H.jsx)(pTe,{panel:e,result:t,frame:t.frame,act:a,filter:i.inboxFilter}):(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`});let l=e.viz===`bar`&&t?.frame?z1(t.frame,e):``;return(0,H.jsxs)(Im,{component:`article`,"aria-labelledby":`panel-${e.id}`,h:r?`100%`:void 0,style:{display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,mb:6,className:`panel-handle`,children:[(0,H.jsx)(k_,{order:2,id:`panel-${e.id}`,fz:`md`,fw:600,lineClamp:1,style:{letterSpacing:`-0.01em`,flex:`0 1 auto`,maxWidth:`75%`},title:s,children:s}),e.viz===`inbox`&&i.inboxFilter&&(0,H.jsxs)(Cg,{withRemoveButton:!0,onRemove:i.clearInboxFilter,removeButtonProps:{"aria-label":`Clear inbox filter`},children:[`Showing: `,{waiting:`Need you`,review:`To review`,stuck:`Stuck`}[i.inboxFilter]]}),e.description&&(0,H.jsx)(Bg,{label:e.description,multiline:!0,maw:320,children:(0,H.jsx)(lu,{size:`xs`,"aria-label":`About ${e.title}`,children:(0,H.jsx)(ly,{size:14})})}),l&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,ml:`auto`,ta:`right`,style:{flex:`1 1 0`,minWidth:0},title:l,children:l})]}),(0,H.jsx)(G,{style:{flex:1,minHeight:r?0:Math.min(o,120),display:`flex`,flexDirection:`column`},children:c})]})}function uTe({panel:e,message:t}){let{title:n,caption:r}=Xwe(t??(e.viz===`inbox`?`Nothing needs you right now.`:`Nothing matches right now.`));return(0,H.jsx)(b8,{kind:e.viz===`inbox`?`all-clear`:`empty`,title:n,caption:r})}function dTe({panel:e,result:t,fill:n,height:r,title:i}){let a=F0(),[o,s]=(0,h.useState)(!1),c=t?.frame,l=(0,h.useMemo)(()=>c?the(c,e):[],[c,e]),u=(0,h.useMemo)(()=>l.map((e,t)=>({name:e.name,points:e.points,color:t})),[l]),d=l.flatMap(e=>e.points.map(e=>e[0])),f=c?.columns[2]?.unit,p=t?t.status===`error`?`error`:l.length?`ready`:`empty`:`loading`,m=p===`error`?t?.message??`This panel could not run.`:p===`empty`?t?.message??`Nothing matches right now.`:void 0;return(0,H.jsx)(Qwe,{id:e.id,title:i,info:e.description,caption:c&&p===`ready`?z1(c,e):void 0,series:u,from:d.length?Math.min(...d):0,to:d.length?Math.max(...d):0,unit:f,state:p,message:m,actions:{table:p===`ready`?()=>s(e=>!e):void 0,ask:a.ask?()=>a.ask(`Tell me about "${i}" right now.`):void 0},height:n?`fill`:r-48,headingOrder:2,headerClassName:`panel-handle`,children:o&&c?(0,H.jsx)(D8,{frame:fTe(c,e),source:e.source}):void 0})}function fTe(e,t){if(t.viz!==`timeseries`)return e;let n=new Set(e.rows.map(e=>e[1])).size>1,r=n?e.columns:[e.columns[0],e.columns[2]],i=[...e.rows].reverse().map(e=>n?e:[e[0],e[2]]);return{columns:r.map(e=>e.name===`value`?{...e,name:t.measure?.split(`:`).pop()||`value`}:e.name===`ts`?{...e,name:`time`}:e),rows:i}}function pTe({panel:e,result:t,frame:n,act:r,filter:i}){switch(e.viz){case`stat`:return(0,H.jsx)(mTe,{frame:n,trend:t.trend,title:e.title,total:t.total,caption:t.caption});case`gauge`:return(0,H.jsx)(hTe,{frame:n,max:e.max,title:e.title});case`bar`:return(0,H.jsx)(gTe,{frame:n,title:e.title});case`inbox`:return(0,H.jsx)(j8,{frame:n,act:r,filter:i});case`list`:return(0,H.jsx)(bTe,{frame:n,source:e.source,act:r});case`cards`:return(0,H.jsx)(xTe,{frame:n,source:e.source,act:r});case`timeline`:return(0,H.jsx)(CTe,{frame:n,act:r,title:e.title});default:return(0,H.jsx)(D8,{frame:n,source:e.source,act:r})}}function mTe({frame:e,trend:t,title:n,total:r,caption:i}){return(0,H.jsxs)(o_,{gap:4,style:{flex:1},children:[(0,H.jsxs)(K,{gap:6,align:`baseline`,children:[(0,H.jsx)(b0,{n:e.rows[0]?.[0]??null,unit:e.columns[0]?.unit,total:r}),i!=null&&(0,H.jsxs)(q,{ff:`monospace`,size:`sm`,c:`dimmed`,children:[`· `,A1(i)]})]}),t&&t.length>1&&(0,H.jsx)(G,{style:{flex:1,minHeight:24},children:(0,H.jsx)(S0,{trend:t,title:n})})]})}function hTe({frame:e,max:t,title:n}){let r=Number(e.rows[0]?.[0]??0),i=t??100,a=e.columns[0]?.unit;return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(b0,{n:r,unit:a}),(0,H.jsx)(_0,{value:r,max:i,format:e=>A1(e,a),label:n,caption:!1}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`of `,A1(i,a)]})]})}function gTe({frame:e,title:t}){let n=e.columns[1]?.unit,r=e.rows.map((e,t)=>({id:`${t}`,label:String(e[0]??`–`)||`–`,value:Number(e[1]??0)}));return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(qwe,{items:r,format:e=>A1(e,n),label:t})})}var _Te=rve({rowSortingFeature:vve,sortedRowModel:yve(),sortFns:{basic:N2,alphanumeric:sve}});function vTe({v:e,column:t,row:n}){if((t.name===`label`||t.name===`state`)&&typeof e==`string`&&e){let t=s0(e),r=t.inferred||n?.inferred===!0,i=(0,H.jsx)(c0,{state:t.state,label:t.label,inferred:r}),a=typeof n?.evidence==`string`&&n.evidence?n.evidence:r?`Inferred from process and file activity, not reported by the agent.`:``;return a?(0,H.jsx)(Bg,{label:a,multiline:!0,maw:320,children:i}):i}let r=j1(e,t);return t.type===`time`&&typeof e==`string`?(0,H.jsx)(q,{span:!0,fz:`inherit`,title:k1(e),children:r}):t.type===`number`?(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`inherit`,children:r}):t.name===`title`||t.name===`branch`?(0,H.jsx)(q,{fz:`inherit`,truncate:!0,maw:t.name===`title`?240:140,title:r,children:r}):(0,H.jsx)(H.Fragment,{children:r})}function D8({frame:e,source:t,act:n}){let{local:r}=F0(),[i,a]=(0,h.useState)([]),o=(0,h.useMemo)(()=>e.rows.map(t=>yTe(e.columns,t)),[e]),s=Sve({features:_Te,data:o,columns:(0,h.useMemo)(()=>e.columns.filter(e=>!e.hidden).map(e=>({id:e.name,accessorFn:t=>t[e.name],header:N1(e.name),sortFn:e.type===`number`?`basic`:`alphanumeric`,sortDescFirst:e.type===`number`,cell:({row:t})=>(0,H.jsx)(vTe,{v:t.original[e.name],column:e,row:t.original}),meta:{column:e}})),[e.columns]),state:{sorting:i},onSortingChange:a}),c=e=>n?L0(t,e,r):[],l=!!n&&o.some(e=>c(e).length>0);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,"aria-label":`Table`,viewportProps:k8,children:(0,H.jsxs)(C_,{miw:420,children:[(0,H.jsx)(C_.Thead,{children:s.getHeaderGroups().map(e=>(0,H.jsxs)(C_.Tr,{children:[e.headers.map(e=>{let t=e.column.columnDef.meta.column,n=e.column.getIsSorted();return(0,H.jsx)(C_.Th,{ta:t.type===`number`?`right`:void 0,"aria-sort":n===`asc`?`ascending`:n===`desc`?`descending`:`none`,style:{whiteSpace:`nowrap`},children:(0,H.jsxs)($c,{onClick:e.column.getToggleSortingHandler(),fz:`xs`,fw:500,c:`dimmed`,children:[(0,H.jsx)(s.FlexRender,{header:e}),n===`asc`?(0,H.jsx)(Hte,{size:10}):n===`desc`?(0,H.jsx)(hv,{size:10}):null]})},e.id)}),l&&(0,H.jsx)(C_.Th,{w:36,children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]},e.id))}),(0,H.jsx)(C_.Tbody,{children:s.getRowModel().rows.map(e=>(0,H.jsxs)(C_.Tr,{...w8(c(e.original),e.original,n),children:[e.getAllCells().map(e=>{let t=e.column.columnDef.meta.column;return(0,H.jsx)(C_.Td,{ta:t.type===`number`?`right`:void 0,style:{whiteSpace:`nowrap`,maxWidth:320,overflow:`hidden`,textOverflow:`ellipsis`},children:(0,H.jsx)(s.FlexRender,{cell:e})},e.id)}),l&&(0,H.jsx)(C_.Td,{ta:`right`,py:0,children:(0,H.jsx)(T8,{kinds:c(e.original),row:e.original,act:n,label:O8(e.original)})})]},e.id))})]})})}function O8(e){return String(e.title||e.signature||e.project||e.path||e.id||`this row`)}var k8={tabIndex:0};function yTe(e,t){return Object.fromEntries(e.map((e,n)=>[e.name,t[n]??null]))}function bTe({frame:e,source:t,act:n}){let{local:r}=F0(),[i,...a]=e.columns.filter(e=>!e.hidden);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(o_,{gap:0,children:gS(e).map((e,o)=>{let s=n?L0(t,e,r):[];return(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,py:6,px:4,style:{borderBottom:`1px solid var(--driga-border-soft)`},...w8(s,e,n),className:`row-hover ${w8(s,e,n).className??``}`,children:[(0,H.jsx)(q,{size:`sm`,fw:500,truncate:!0,style:{minWidth:0},title:i?j1(e[i.name],i):void 0,children:i?j1(e[i.name],i):``}),(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,children:a.map(t=>j1(e[t.name],t)).join(` · `)}),s.length>0&&(0,H.jsx)(T8,{kinds:s,row:e,act:n,label:O8(e)})]})]},o)})})})}function A8(e,t){let n=String(e.kind??``),r=n===`waiting`,i=Number(e.session_id)>0?`Session ${e.session_id}`:``;if(!r&&n!==`finished`)return{id:String(e.id),kind:`machine`,title:`${N1(n)} on ${String(e.machine??`a machine`)}`,reason:String(e.summary??``)||void 0,machine:void 0,at:String(e.occurred_at??``)};let a={id:String(e.id),title:String(e.title||e.summary||i),agent:String(e.agent??``)||void 0,project:String(e.project??``)||void 0,branch:String(e.branch??``)||void 0,machine:String(e.machine??``)||void 0,at:String(e.occurred_at??``)};if(r){let n=String(e.reason??``);return{...a,kind:n===`permission`?`permission`:n===`question`?`question`:`waiting`,reason:[e.tool,e.detail].filter(Boolean).join(` · `)||void 0,since:typeof e.waited==`number`?new Date(t-e.waited).toISOString():void 0}}let o=String(e.summary??``);return{...a,kind:`finished`,turns:typeof e.turns==`number`?e.turns:void 0,reason:o&&o!==`turn finished`?o:e.last_commit?`last commit: ${e.last_commit}`:void 0,review:{files:Number(e.files??0),uncommitted:Number(e.dirty??0),unpushed:Number(e.unpushed??0),checkout:String(e.checkout??``)||void 0}}}function j8({frame:e,act:t,prompts:n,answer:r,filter:i}){let a=F0(),{stuck:o}=a,s=Date.now();if(i===`stuck`)return o?.rows.length?(0,H.jsx)(D8,{frame:o,source:`sessions`,act:t}):(0,H.jsx)(b8,{kind:`empty`,title:`No session looks stuck.`});let c=(a.bursts??[]).filter(e=>e.members.length>1),l=new Set(c.flatMap(e=>e.members.map(e=>e.id))),u=n?.filter(e=>!l.has(e.id))??[],d=gS(e),f=d.filter(e=>e.kind===`waiting`),p=d.filter(e=>e.kind!==`waiting`&&e.kind!==`finished`),m=d.filter(e=>e.kind===`finished`),h=e=>t&&Number(e.session_id)>0?()=>void t({kind:`jump`,row:e}):void 0,g=e=>t&&!e.ack_pending?()=>void t({kind:`ack`,row:e}):void 0,_=(e,t,n,r,i)=>r>0&&(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(G,{children:(0,H.jsx)(c0,{variant:`pill`,state:t,tone:n,label:`${e} · ${r}`})}),i]}),v=i!==`review`,y=i!==`waiting`;return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsxs)(o_,{gap:`sm`,children:[v&&_(`Permission prompts`,`waiting`,`warning`,u.length+c.length,(0,H.jsxs)(H.Fragment,{children:[c.map(e=>(0,H.jsx)(TTe,{burst:e,answer:r,decide:a.decideBurst},e.id)),u.map(e=>(0,H.jsx)(M8,{prompt:e,answer:r},e.id))]})),v&&_(`Needs you`,`waiting`,`warning`,f.length,f.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onOpen:h(e)},String(e.id)))),v&&_(`Machines`,`waiting`,`warning`,p.length,p.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onDismiss:g(e)},String(e.id)))),a.grantHistory?.map(e=>(0,H.jsxs)(il,{withBorder:!0,p:`xs`,radius:`md`,children:[(0,H.jsxs)(q,{size:`xs`,children:[e.attribution,` · `,e.session??e.conversation,` · `,e.time]}),(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,disabled:e.revoked,onClick:()=>void a.revokeGrant?.(e.grant_id),children:e.revoked?`Grant revoked`:`Revoke grant`})]},`${e.grant_id}/${e.action_id??e.prompt_id}`)),y&&_(`To review`,`finished`,`info`,m.length,m.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onApprove:g(e),onOpen:h(e)},String(e.id))))]})})}function xTe({frame:e,source:t,act:n}){let{local:r}=F0(),[i,...a]=e.columns.filter(e=>!e.hidden);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(G,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:10},children:gS(e).map((e,o)=>{let s=n?L0(t,e,r):[];return(0,H.jsxs)(il,{p:`sm`,withBorder:!0,style:{background:`var(--driga-inset)`},children:[(0,H.jsx)(q,{size:`sm`,fw:600,truncate:!0,mb:6,title:i?j1(e[i.name],i):void 0,children:i?j1(e[i.name],i):``}),(0,H.jsx)(e_,{cols:2,spacing:12,verticalSpacing:2,children:a.map(t=>{let n=e[t.name];if(n===null||n===``||n===void 0)return null;let r=typeof n==`number`&&n>0&&t.unit===`count`;return(0,H.jsxs)(K,{justify:`space-between`,gap:6,wrap:`nowrap`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:N1(t.name),children:N1(t.name)}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:r?`warning`:void 0,truncate:!0,title:j1(n,t),children:j1(n,t)})]},t.name)})}),s.length>0&&(0,H.jsx)(K,{justify:`flex-end`,mt:4,children:(0,H.jsx)(T8,{kinds:s,row:e,act:n,label:O8(e)})})]},o)})})})}function STe(e,t){return gS(e).map(n=>{let r=Date.parse(String(n.started_at))||t,i=Date.parse(String(n.ended_at??``))||t,a=s0(String(n.label??``)),o=n.ended_at?`finished`:a.state&&a.state!==`waiting`?a.state:`working`,s=(e.spans??[]).filter(e=>e.session_id===n.id&&e.machine_id===n.machine_id).map(e=>({from:Date.parse(String(e.from))||r,to:Date.parse(String(e.to??``))||t})).sort((e,t)=>e.from-t.from),c=[],l=r;for(let e of s){let t=Math.max(l,r,e.from),n=Math.min(i,e.to);n<=t||(t>l&&c.push({from:l,to:t,state:o}),c.push({from:t,to:n,state:`waiting`}),l=n)}return lDate.now(),[e]),i=(0,h.useMemo)(()=>STe(e,r),[e,r]),a=i.flatMap(e=>e.segments.map(e=>e.from)),o=a.length?Math.min(...a):r-36e5,s=new Map(gS(e).map(e=>[JSON.stringify([e.machine_id,e.id]),e]));return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(aTe,{lanes:i,from:o,to:r,now:r,label:n,onSelect:t?e=>{let n=s.get(e);n&&t({kind:`jump`,row:{...n,session_id:n.id}})}:void 0})})}function M8({prompt:e,answer:t}){let n=F0(),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);(0,h.useEffect)(()=>{i(!1);let e=window.setTimeout(()=>i(!0),600);return()=>window.clearTimeout(e)},[e.id,JSON.stringify(e.input)]);let s=async n=>{if(t){o(!0);try{await t(e,n)}finally{o(!1)}}},c=wTe(e),l={id:e.id,kind:`permission`,title:e.session,agent:`claude`,reason:c?`${e.tool}(${c})`:e.tool,project:e.cwd,at:e.created_at,since:e.created_at};return(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(S8,{entry:l,armed:r&&!a,onApprove:t?()=>void s(!0):void 0,onDeny:t?()=>void s(!1):void 0}),(0,H.jsx)(q,{component:`pre`,size:`xs`,ff:`monospace`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(e.input,null,2)}),e.grant_eligible&&n.answerSimilar&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:e.grant_pattern}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Expires `,e.grant_expires_at]}),(0,H.jsx)(km,{size:`compact-xs`,variant:`light`,disabled:!r||a,onClick:()=>{o(!0),n.answerSimilar(e).finally(()=>o(!1))},children:`Allow similar for this session`})]})]})}function wTe(e){let t=e.input??{};for(let e of[`command`,`file_path`,`url`,`pattern`])if(typeof t[e]==`string`)return String(t[e]);return``}function TTe({burst:e,answer:t,decide:n}){let r=`${e.id}/${e.members.map(e=>`${e.id}:${e.input_hash}`).join(`/`)}`,[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(),u=(0,h.useRef)(r);u.current=r;let d=(0,h.useRef)(!1);(0,h.useEffect)(()=>{a(!1),s(!1),l(void 0),d.current=!1;let e=window.setTimeout(()=>a(!0),600);return()=>window.clearTimeout(e)},[r]);let f=async()=>{if(!i||d.current||!n)return;d.current=!0,s(!0);let t=e.members.map(e=>e.id),a=r;try{await n(e.id,t,!0)}catch(e){u.current===a&&l(e.message)}finally{u.current===a&&(d.current=!1,s(!1))}};return(0,H.jsx)(il,{withBorder:!0,p:`xs`,radius:`md`,style:{background:`var(--driga-raised)`},children:(0,H.jsxs)(o_,{gap:`xs`,children:[(0,H.jsxs)(q,{size:`sm`,fw:600,children:[e.members.length,` permission prompts · `,e.session]}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:[`in `,e.cwd]}),e.members.map(e=>(0,H.jsx)(M8,{prompt:e.prompt,answer:t},`${e.id}/${e.input_hash}`)),n&&(0,H.jsxs)(km,{disabled:!i||o,onClick:()=>void f(),children:[`Allow all `,e.members.length]}),c&&(0,H.jsx)(q,{size:`xs`,c:`danger`,role:`alert`,children:c})]})})}var ETe={stat:3,gauge:3,timeseries:6,bar:6,table:12,list:6,inbox:8,cards:12,timeline:12,text:6};function N8({fragment:e,onVars:t,act:n,compact:r,stacked:i,bare:a}){let{dashboard:o}=e,s=new Map(e.results.map(e=>[e.id,e])),c=e.vars??{};return(0,H.jsxs)(o_,{gap:`sm`,p:a?0:r?`xs`:`md`,children:[!a&&(0,H.jsxs)(K,{justify:`space-between`,align:`flex-end`,gap:`xs`,children:[(0,H.jsxs)(G,{children:[(0,H.jsx)(k_,{order:1,fz:`md`,fw:600,children:o.name}),o.description&&!r&&(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:o.description})]}),(0,H.jsxs)(K,{gap:`xs`,children:[t&&o.variables?.map(n=>(0,H.jsx)(Jg,{size:`xs`,w:140,label:n.name,placeholder:`All`,clearable:!0,data:e.options?.[n.name]??[],value:c[n.name]||null,onChange:e=>t({...c,[n.name]:e??``})},n.name)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,title:k1(e.observed_at),children:[`observed `,O1(e.observed_at)]})]})]}),(0,H.jsx)(G,{style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:12,gridAutoFlow:`row dense`},children:o.panels.map(e=>{let t=i?12:Math.min(12,e.grid?.w??e.width??ETe[e.viz]);return(0,H.jsx)(G,{style:{gridColumn:`span ${t}`,minWidth:0},children:(0,H.jsx)(E8,{panel:e,result:s.get(e.id),act:n})},e.id)})})]})}var P8=new Set([`create_dashboard`,`edit_dashboard`,`replace_dashboard`,`restore_dashboard_version`]);function F8(e,t){if(e.viz===`text`){let t=(e.content??``).split(` -`).filter(e=>/^\s*\|/.test(e)&&!/^\s*\|[\s:|-]+\|\s*$/.test(e)).length;return t>1?`table, ${t-1} rows`:`note`}if(!t)return`loading`;if(t.status===`error`)return t.message??`failed`;if(t.status===`empty`||!t.frame?.rows.length)return t.message??`nothing right now`;let n=t.frame;if(e.viz===`stat`||e.viz===`gauge`){let e=n.rows[0]?.[0],r=n.columns[0]?.unit;return typeof e==`number`?typeof t.total==`number`?`${A1(e,r)} of ${A1(t.total,r)}`:A1(e,r):`no reading`}return e.viz===`bar`||e.viz===`timeseries`?z1(n,e)||`${n.rows.length} points`:`${n.rows.length} ${n.rows.length===1?`row`:`rows`}`}function DTe(e){let t=e.filter(e=>e.status===`error`).length;return t?`${t} failed`:``}function OTe(e,t){let n=e=>t?.panels.find(t=>t.id===e)?.title??e;return e.tool===`create_dashboard`?[`Created`]:e.tool===`replace_dashboard`?[`Replaced`]:e.tool===`restore_dashboard_version`?[`Restored version ${e.input.version??`?`}`]:(e.input.operations??[]).map(e=>{switch(e.op){case`add`:return`Added ${e.panel.title}`;case`update`:return`Changed ${e.panel?.title??n(e.id)}`;case`remove`:return`Removed ${n(e.id)}`;case`move`:return`Moved ${n(e.id)}`;case`layout`:return`Moved panels`;case`rename`:return`Renamed to ${e.name}`}})}function kTe({text:e,open:t,onOpen:n}){let[r,i]=(0,h.useState)(!!t),a=(0,h.useRef)(!1);(0,h.useEffect)(()=>{a.current||i(!!t)},[t]);let[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(null);if((0,h.useEffect)(()=>{let t=new AbortController;g(null),p(null),s(!1);let n;try{n=JSON.parse(e)}catch{g(`This card could not be read.`);return}if(d(n),n.error)return;let r=n.input?.dashboard,i=n.saved?.id??n.input?.id;if(!r&&!i)g(`This card names no dashboard.`);else return(i&&(P8.has(n.tool)||n.tool===`open_dashboard`)?V0.open(i,n.input?.vars,t.signal):V0.run(r,n.input?.vars,t.signal)).then(e=>{t.signal.aborted||p(e)},e=>{t.signal.aborted||(s(e instanceof R0&&e.status===404),g(e.message))}),()=>t.abort()},[e]),m&&u&&o&&(u.saved||u.input.id))return(0,H.jsxs)(q,{size:`sm`,c:`dimmed`,children:[u.input.dashboard?.name??`This dashboard`,` was deleted since.`]});if(m)return(0,H.jsx)(q,{size:`sm`,c:`danger`,children:m});if(u?.error)return(0,H.jsx)(il,{withBorder:!0,radius:`md`,p:`sm`,style:{background:`var(--driga-raised)`},children:(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`sm`,fw:600,children:u.status===`unknown`?`Outcome unknown: ${u.input.dashboard?.name??u.input.id??`dashboard`}`:P8.has(u.tool)?`Draft rejected: ${u.input.dashboard?.name??u.input.id??`dashboard`}`:`These panels could not run`}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:u.error})]})});if(!u||!f)return(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading panels…`});let _=f.dashboard,v=P8.has(u.tool)&&!!(u.saved??f.id),y=new Map(f.results.map(e=>[e.id,e])),b=_.panels,x=v?OTe(u):[],S=v?u.saved?.version??f.version:void 0,C=DTe(f.results),w=v?`Saved ${_.name}`:_.name;return(0,H.jsxs)(il,{withBorder:!0,radius:`md`,p:`sm`,style:{background:`var(--driga-raised)`},children:[(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)($c,{"aria-expanded":r,onClick:()=>{a.current=!0,i(e=>!e)},style:{flex:1,minWidth:0},children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[r?(0,H.jsx)(hv,{size:14,"aria-hidden":!0}):(0,H.jsx)(_v,{size:14,"aria-hidden":!0}),v?(0,H.jsx)(Gv,{size:16,"aria-hidden":!0}):(0,H.jsx)(bv,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{size:`sm`,fw:600,truncate:!0,title:w,children:w}),S?(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`version `,S]}):null,C&&(0,H.jsx)(q,{size:`xs`,c:`danger`,style:{whiteSpace:`nowrap`},children:C})]})}),v&&(0,H.jsx)(Bg,{label:`Open dashboard`,children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`Open dashboard`,onClick:()=>n(f.id),children:(0,H.jsx)(Ty,{size:16})})}),(0,H.jsx)(Bg,{label:`Full screen`,children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`Full screen`,onClick:()=>l(!0),children:(0,H.jsx)(Vte,{size:16})})})]}),x.length>0&&(0,H.jsx)(K,{gap:4,children:x.map(e=>(0,H.jsx)(bm,{size:`sm`,variant:`light`,color:`gray`,tt:`none`,children:e},e))}),r?(0,H.jsx)(N8,{fragment:f,compact:!0,stacked:!0,bare:!0}):(0,H.jsxs)(o_,{gap:2,component:`ul`,m:0,p:0,style:{listStyle:`none`},children:[b.slice(0,6).map(e=>{let t=y.get(e.id);return(0,H.jsxs)(K,{component:`li`,gap:8,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{size:`xs`,truncate:!0,title:t?.title||e.title,children:t?.title||e.title}),(0,H.jsx)(q,{size:`xs`,c:t?.status===`error`?`danger`:`dimmed`,ff:`monospace`,truncate:!0,ta:`right`,style:{maxWidth:`55%`},title:F8(e,t),children:F8(e,t)})]},e.id)}),b.length>6&&(0,H.jsxs)(q,{component:`li`,size:`xs`,c:`dimmed`,children:[`and `,b.length-6,` more`]})]})]}),(0,H.jsx)(gg,{opened:c,onClose:()=>l(!1),fullScreen:!0,title:w,radius:0,children:(0,H.jsx)(N8,{fragment:f})})]})}function ATe(e){let t=(e??``).trim();return t!==``&&![`{}`,`[]`,`null`,`""`,`"{}"`,`"[]"`].includes(t)}function jTe({conversation:e,action:t}){let n=t.status===`pending`,[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),l=(0,h.useRef)(!1),u=`${e}/${t.id}/${t.status}`,d=(0,h.useRef)(u);d.current=u,(0,h.useEffect)(()=>{l.current=!1,i(!1),c(null),o(!1)},[u]);let f=async(n,r=!1)=>{let a=u;if(!l.current){l.current=!0,i(!0),c(null);try{r?await G0.decideSimilar(e,t.id):await G0.decide(e,t.id,n)}catch(e){if(d.current!==a)return;c(e.message),l.current=!1,i(!1)}}};return(0,H.jsxs)(il,{withBorder:!0,p:`xs`,radius:`md`,style:{background:`var(--driga-raised)`,borderColor:n?`var(--mantine-color-warning-filled)`:void 0},children:[(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[t.tool,` · `,t.status]}),(0,H.jsx)(q,{size:`sm`,fw:600,style:{overflowWrap:`anywhere`},children:t.command?.summary??t.title}),t.command?(0,H.jsxs)(o_,{gap:4,mt:`xs`,children:[(0,H.jsxs)(q,{size:`xs`,children:[t.command.class,` · `,t.command.boundary]}),(0,H.jsx)(q,{component:`pre`,size:`xs`,ff:`monospace`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:t.command.requested.script??JSON.stringify(t.command.requested.argv)}),t.command.effective.map((e,t)=>(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[`Effective: `,JSON.stringify(e)]},t)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Timeout: `,t.command.requested.timeout_seconds,`s`]}),t.command.error&&(0,H.jsx)(q,{role:`alert`,size:`xs`,c:`danger`,children:t.command.error}),[{label:`${t.command.count} process targets`,rows:t.command.targets},...[`stopped`,`vanished`,`skipped`,`survivors`].map(e=>({label:e,rows:t.command[e]??[]}))].filter(e=>e.rows.length>0).map(e=>(0,H.jsx)(Rf,{variant:`contained`,transitionDuration:0,children:(0,H.jsxs)(Rf.Item,{value:`targets`,children:[(0,H.jsx)(Rf.Control,{"aria-label":`Inspect ${e.label}`,children:e.label}),(0,H.jsx)(Rf.Panel,{children:(0,H.jsx)(G,{mah:300,tabIndex:0,"aria-label":e.label,style:{overflowY:`auto`},children:(0,H.jsx)(o_,{gap:`xs`,children:e.rows.map(e=>(0,H.jsxs)(G,{children:[(0,H.jsxs)(q,{size:`xs`,fw:600,children:[`PID `,e.pid,` · `,e.owner,` · `,E1(e.memory_bytes)]}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[e.started_at,` · `,e.executable,` +`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return _Ce(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var wwe={tokenize:Mwe,partial:!0};function Twe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:kwe,continuation:{tokenize:Awe},exit:jwe}},text:{91:{name:`gfmFootnoteCall`,tokenize:Owe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Ewe,resolveTo:Dwe}}}}function Ewe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Y4(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Dwe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Owe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||t3(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Y4(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return t3(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function kwe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||t3(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Y4(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return t3(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),s3(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Awe(e,t,n){return e.check(g3,t,e.attempt(wwe,t,n))}function jwe(e){e.exit(`gfmFootnoteDefinition`)}function Mwe(e,t,n){let r=this;return s3(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Nwe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=f3(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Pwe=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){Fwe(this,e,t,n)}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 Fwe(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function Iwe(e,t){let n=!1,r=[];for(;t-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):e3(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):n3(t)?s3(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||t3(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,n3(t)?s3(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return n3(t)?s3(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||e3(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return n3(t)?s3(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||e3(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||e3(n)?(e.exit(`tableRow`),t(n)):n3(n)?s3(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||t3(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function zwe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Pwe;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},y8(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function v8(e,t,n,r,i){let a=[],o=y8(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function y8(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Bwe={name:`tasklistCheck`,tokenize:Hwe};function Vwe(){return{text:{91:Bwe}}}function Hwe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return t3(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return e3(r)?t(r):n3(r)?e.check({tokenize:Uwe},t,n)(r):n(r)}}function Uwe(e,t,n){return s3(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Wwe(e){return q4([hwe(),Twe(),Nwe(e),Lwe(),Vwe()])}var Gwe={};function Kwe(e){let t=this,n=e||Gwe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Wwe(n)),a.push(dwe()),o.push(fwe(n))}function qwe({items:e,format:t,label:n,max:r,onSelect:i,ranked:a}){let o=r??Math.max(0,...e.map(e=>e.value));return(0,H.jsx)(o_,{gap:4,role:`list`,"aria-label":n,children:e.map((e,n)=>{let r=o>0?`${Math.max(0,Math.min(100,e.value/o*100))}%`:`0%`,s=(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,align:`center`,className:i?`w-row`:void 0,"data-clickable":i?``:void 0,style:{borderRadius:`var(--mantine-radius-sm)`},children:[(0,H.jsxs)(G,{pos:`relative`,style:{flex:1,minWidth:0,height:28},children:[(0,H.jsx)(G,{"aria-hidden":!0,className:`w-bar`,pos:`absolute`,top:0,left:0,h:`100%`,w:r,style:{borderRadius:`var(--mantine-radius-sm)`,transition:`width 300ms ease-out`}}),(0,H.jsxs)(K,{pos:`relative`,gap:8,h:28,px:8,wrap:`nowrap`,style:{minWidth:0},children:[a&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:`dimmed`,w:16,style:{flex:`none`},children:n+1}),(0,H.jsx)(q,{size:`sm`,fw:500,truncate:!0,title:e.label,style:{minWidth:0},children:e.label}),e.sub&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:e.sub,style:{minWidth:0,flex:`0 1 auto`},children:e.sub})]})]}),(0,H.jsx)(q,{size:`sm`,ff:`monospace`,ta:`right`,style:{flex:`none`,minWidth:64,whiteSpace:`nowrap`},children:t(e.value)})]});return(0,H.jsx)(G,{role:`listitem`,children:i?(0,H.jsx)($c,{w:`100%`,onClick:()=>i(e.id),children:s}):s},e.id)})})}var Jwe={empty:{color:`gray`,icon:Xte},"all-clear":{color:`success`,icon:Dv},error:{color:`danger`,icon:Qte}};function Ywe(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function Xwe(e){let t=/^(.+?[.!?])\s+(.+)$/s.exec(e.trim());return t?{title:t[1],caption:t[2]}:{title:e.trim()}}function b8({kind:e=`empty`,title:t,caption:n,checkedAt:r,onRetry:i,command:a,action:o}){let{color:s,icon:c}=Jwe[e];return(0,H.jsxs)(K,{mih:56,px:`sm`,py:6,gap:`sm`,wrap:`nowrap`,role:e===`error`?`alert`:`status`,children:[(0,H.jsx)(E_,{variant:`light`,color:s,radius:`xl`,size:28,"aria-hidden":!0,styles:{root:{background:`var(--driga-tint-${e===`empty`?`neutral`:s})`}},children:(0,H.jsx)(c,{size:16})}),(0,H.jsxs)(o_,{gap:2,style:{flex:1,minWidth:0},children:[(0,H.jsx)(q,{size:`md`,fw:500,lh:1.2,children:t}),(n||r||a)&&(0,H.jsxs)(K,{gap:6,wrap:`wrap`,children:[n&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.3,children:n}),r&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.3,title:A1(r),children:[n?`· `:``,`checked `,Ywe(r)]}),a&&(0,H.jsx)(q,{size:`xs`,ff:`monospace`,className:`w-inset`,lh:1.3,style:{display:`inline-block`},children:a})]})]}),i&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,leftSection:(0,H.jsx)(Bte,{size:12}),onClick:i,style:{flex:`none`},children:`Retry`}),o&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,onClick:o.onClick,style:{flex:`none`},children:o.label})]})}var x8=[],Zwe=[`1h`,`6h`,`24h`];function Qwe({id:e,title:t,info:n,caption:r,range:i,onRange:a,series:o=x8,from:s=0,to:c=0,unit:l,waits:u,events:d,peak:f,option:p,state:m=`ready`,message:g,onRetry:_,actions:v,children:y,height:b=200,headingOrder:x=3,headerClassName:S}){let C=(0,h.useId)(),w=e?`panel-${e}`:C,T=(0,h.useCallback)(e=>j1(e,l),[l]),E=n?`${t}: ${n}`:t,D=m===`empty`?x8:o,O=(0,h.useCallback)(e=>p?p(e):she({series:D,from:s,to:c,unit:l,format:T,waits:u,events:d,peak:f,label:E},e),[p,D,s,c,l,T,u,d,f,E]),k=b===`fill`,A=k?void 0:b,j;j=y||(m===`loading`?(0,H.jsx)(G,{role:`img`,"aria-label":`Loading chart`,style:k?{flex:1}:void 0,children:(0,H.jsx)(r_,{h:A??`100%`,radius:`sm`})}):m===`error`?(0,H.jsx)(G,{h:A,style:{display:`flex`,alignItems:`center`,flex:k?1:void 0},children:(0,H.jsx)(b8,{kind:`error`,title:g??`This chart could not load.`,caption:`The last reading is not shown; it could be stale.`,onRetry:_})}):(0,H.jsxs)(G,{pos:`relative`,h:A,style:k?{flex:1,minHeight:0}:void 0,children:[(0,H.jsx)(V1,{option:O,label:E,height:k?`100%`:b}),m===`empty`&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,pos:`absolute`,top:`50%`,left:`50%`,style:{transform:`translate(-50%, -50%)`,whiteSpace:`nowrap`},children:g??(i?`no samples in the last ${i}`:`no samples`)})]}));let M=v&&(v.table||v.ask||v.remove);return(0,H.jsxs)(Im,{component:`article`,"aria-labelledby":w,h:k?`100%`:void 0,style:{display:`flex`,flexDirection:`column`,minHeight:0,gap:6},children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,className:S,style:{flex:`none`},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,style:{minWidth:0},children:[(0,H.jsx)(k_,{order:x,id:w,fz:`md`,fw:600,lh:1.2,lineClamp:1,title:t,style:{letterSpacing:`-0.01em`,flex:`0 1 auto`},children:t}),n&&(0,H.jsx)(Bg,{label:n,multiline:!0,maw:320,children:(0,H.jsx)(lu,{size:`xs`,"aria-label":`About ${t}`,children:(0,H.jsx)(ly,{size:14})})}),r&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,truncate:!0,title:r,style:{minWidth:0},visibleFrom:`sm`,children:r})]}),(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,style:{flex:`none`},children:[i&&a&&(0,H.jsx)(qg,{size:`xs`,value:i,onChange:e=>a(e),data:Zwe,"aria-label":`${t} range`,styles:{label:{fontFamily:`var(--mantine-font-family-monospace)`,paddingInline:8}}}),M&&(0,H.jsxs)(ng,{position:`bottom-end`,withinPortal:!0,shadow:`md`,width:180,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`More for ${t}`,children:(0,H.jsx)(Vv,{size:18})})}),(0,H.jsxs)(ng.Dropdown,{children:[v.table&&(0,H.jsx)(ng.Item,{leftSection:y?(0,H.jsx)(Ute,{}):(0,H.jsx)(Yte,{}),onClick:v.table,children:y?`Show as chart`:`Show as table`}),v.ask&&(0,H.jsx)(ng.Item,{leftSection:(0,H.jsx)(Cv,{}),onClick:v.ask,children:`Ask Chat about it`}),v.remove&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ng.Divider,{}),(0,H.jsx)(ng.Item,{color:`danger`,leftSection:(0,H.jsx)(jy,{}),onClick:v.remove,children:`Remove`})]})]})]})]})]}),(0,H.jsx)(G,{style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:j})]})}var $we={permission:`warning`,question:`warning`,waiting:`warning`,stuck:`danger`,finished:`info`,machine:`warning`},eTe={permission:`Approve`,question:`Answer`,waiting:`Reply`,finished:`Mark reviewed`,stuck:null,machine:`Reclaim`};function tTe(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:O1(e)}function nTe(e,t){switch(e.kind){case`permission`:return`needs approval`;case`question`:return`asks a question`;case`waiting`:return`waits on you`;case`finished`:return e.turns&&e.turns>1?`finished · ${e.turns} turns`:`finished`;case`stuck`:return`quiet ${O1(t-Date.parse(e.since??e.at))}${e.quietExpected?`, expected ${O1(e.quietExpected)}`:``}`;case`machine`:return`machine`}}function S8({entry:e,selected:t,onApprove:n,onDeny:r,onOpen:i,onDismiss:a,armed:o=!0}){let s=Date.now(),c=$we[e.kind],l=eTe[e.kind],u=e.since?tTe(s-Date.parse(e.since)):null,d=[e.project,e.branch,e.machine].filter(Boolean).join(` · `),f=()=>i?.(e),p=t=>{t.target===t.currentTarget&&(t.key===`Enter`||t.key===`o`?(t.preventDefault(),f()):t.key===`a`&&l&&n&&o?(t.preventDefault(),n(e)):t.key===`x`&&a&&(t.preventDefault(),a(e)))},m=e=>{e.target.closest(`button, a`)||f()},h=(e,t)=>(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[e,(0,H.jsx)(yh,{size:`xs`,children:t})]}),g=t=>(0,H.jsxs)(H.Fragment,{children:[t,(0,H.jsxs)(tl,{children:[` · `,e.title]})]});return(0,H.jsx)(G,{className:`w-row`,"data-kind":e.kind,"data-clickable":i?``:void 0,"data-selected":t?`true`:void 0,tabIndex:i?0:void 0,onClick:i?m:void 0,onKeyDown:i?p:void 0,px:`sm`,py:8,style:{borderLeft:`3px solid var(--mantine-color-${c}-filled)`,borderRadius:`var(--mantine-radius-sm)`,background:`var(--driga-raised)`},children:(0,H.jsxs)(K,{gap:`sm`,wrap:`wrap`,align:`flex-start`,children:[(0,H.jsx)(G,{pt:2,style:{flex:`none`},children:e.kind===`machine`||!e.agent?(0,H.jsx)(G,{role:`img`,"aria-label":e.machine?`machine ${e.machine}`:`machine`,style:{width:20,height:20,borderRadius:`50%`,background:`var(--driga-inset)`,display:`grid`,placeItems:`center`,color:`var(--driga-muted)`},children:(0,H.jsx)(Fv,{size:12})}):(0,H.jsx)(b0,{agent:e.agent,waiting:e.kind===`permission`||e.kind===`question`||e.kind===`waiting`})}),(0,H.jsxs)(o_,{gap:4,style:{flex:`1 1 220px`,minWidth:0},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,align:`baseline`,style:{minWidth:0},children:[(0,H.jsx)(q,{size:`md`,fw:500,lh:1.2,truncate:!0,title:e.title,style:{minWidth:0,flex:`0 1 auto`},children:e.title}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`,flex:`none`},children:nTe(e,s)})]}),e.reason&&(0,H.jsx)(q,{size:`xs`,ff:e.kind===`question`||e.kind===`machine`?void 0:`monospace`,className:`w-inset`,lh:1.4,truncate:!0,title:e.reason,style:{display:`block`,maxWidth:`100%`,alignSelf:`flex-start`},children:e.reason}),d&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,lh:1.2,truncate:!0,title:d,children:d}),e.review&&(0,H.jsxs)(K,{gap:6,wrap:`wrap`,children:[e.review.files>0&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:N1(e.review.files,`file`)}),!e.review.files&&!e.review.uncommitted&&!e.review.unpushed&&(e.review.checkout?(0,H.jsx)(Bg,{label:(0,H.jsx)(q,{size:`xs`,ff:`monospace`,children:e.review.checkout}),children:(0,H.jsx)(`span`,{className:`w-chip`,"data-tone":`neutral`,children:`clean`})}):(0,H.jsx)(q,{size:`xs`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:`no checkout`})),e.review.uncommitted>0&&(0,H.jsxs)(`span`,{className:`w-chip`,"data-tone":`warning`,children:[(0,H.jsx)(G,{"aria-hidden":!0,style:{width:5,height:5,borderRadius:`50%`,background:`var(--mantine-color-warning-filled)`}}),e.review.uncommitted,` uncommitted`]}),e.review.unpushed>0&&(0,H.jsxs)(`span`,{className:`w-chip`,"data-tone":`neutral`,children:[e.review.unpushed,` unpushed`]})]})]}),(0,H.jsxs)(o_,{gap:2,align:`flex-end`,w:96,style:{flex:`none`},children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,lh:1.2,title:A1(e.at),style:{whiteSpace:`nowrap`},children:k1(e.at,s)}),u&&(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)(G,{"aria-hidden":!0,className:e.kind===`permission`||e.kind===`question`||e.kind===`waiting`?`w-pulse`:void 0,style:{width:6,height:6,borderRadius:`50%`,background:`var(--mantine-color-${c}-filled)`,flex:`none`}}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,lh:1.2,style:{whiteSpace:`nowrap`},children:[e.kind===`stuck`?`quiet`:`waiting`,` `,u]})]})]}),(n||r||i||a)&&(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,className:`w-actions`,style:{flex:`none`},children:[l&&n&&(0,H.jsx)(Bg,{label:h(l,`a`),children:(0,H.jsx)(km,{size:`compact-xs`,variant:`light`,disabled:!o,onClick:()=>n(e),children:g(l)})}),e.kind===`permission`&&r&&(0,H.jsx)(km,{size:`compact-xs`,variant:`default`,disabled:!o,onClick:()=>r(e),children:g(`Deny`)}),i&&(0,H.jsx)(Bg,{label:h(`Open`,`o`),children:(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,color:`gray`,onClick:f,children:g(`Open`)})}),a&&(0,H.jsx)(Bg,{label:h(`Dismiss`,`x`),children:(0,H.jsx)(lu,{size:`sm`,variant:`subtle`,color:`gray`,"aria-label":`Dismiss ${e.title}`,onClick:()=>a(e),children:(0,H.jsx)(Iy,{size:14})})})]})]})})}var rTe=[`working`,`waiting`,`stuck`,`idle`];function iTe(e){return e.map(e=>{let t=[];for(let n of[...e.segments].sort((e,t)=>e.from-t.from)){let e=t[t.length-1];e&&e.state===n.state&&e.to>=n.from?e.to=Math.max(e.to,n.to):t.push({...n})}return{...e,segments:t}})}function aTe({lanes:e,from:t,to:n,now:r,label:i,laneHeight:a=26,onSelect:o}){let s=(0,h.useMemo)(()=>iTe(e),[e]),c=(0,h.useCallback)(e=>lhe({lanes:s,from:t,to:n,now:r,label:i},e),[s,t,n,r,i]),l=(0,h.useCallback)((e,t)=>{let n=Array.isArray(t.value)?s[Number(t.value[0])]:void 0;n&&o?.(n.id)},[s,o]);return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(V1,{option:c,label:i,height:s.length*a+36,onEvent:o?l:void 0}),(0,H.jsx)(K,{gap:`md`,"aria-hidden":!0,children:rTe.map(e=>(0,H.jsx)(l0,{state:e},e))})]})}var oTe={jump:uv,open:uv,ack:Tv,stop:Jte,kill:$te,force_kill:py,cleanup:jy,summarize:Cy},sTe=new Set([`stop`,`kill`,`force_kill`,`cleanup`]);function C8(e){return e.find(e=>e===`jump`||e===`open`)}function w8(e,t,n){let r=C8(e);if(!n||!r)return{};let i=()=>void n({kind:r,row:t});return{title:L0(r),className:`row-act`,onClick:e=>{e.target.closest(`button, a, [role=menu]`)||i()}}}function T8({kinds:e,row:t,act:n,label:r}){if(e.length===0)return null;let i=C8(e),a=e.filter(e=>e!==i),o=e=>{let r=oTe[e];return(0,H.jsx)(ng.Item,{color:sTe.has(e)?`danger`:void 0,leftSection:(0,H.jsx)(r,{}),onClick:()=>void n({kind:e,row:t}),children:L0(e)},e)};return(0,H.jsxs)(ng,{position:`bottom-end`,withinPortal:!0,shadow:`md`,width:180,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{className:`row-menu`,style:{flex:`none`},"aria-label":`Actions for ${r}`,onClick:e=>e.stopPropagation(),children:(0,H.jsx)(Vv,{size:18})})}),(0,H.jsxs)(ng.Dropdown,{children:[i&&o(i),i&&a.length>0&&(0,H.jsx)(ng.Divider,{}),a.map(o)]})]})}var cTe={s:120,m:240,l:420};function lTe(e){let t=e.viz===`stat`||e.viz===`gauge`?`s`:e.viz===`inbox`?`l`:`m`;return cTe[e.height??t]}function E8({panel:e,result:t,act:n,fill:r}){let i=I0(),a=n??i.act,o=r?0:lTe(e),s=t?.title||e.title;if(e.viz===`timeseries`)return(0,H.jsx)(dTe,{panel:e,result:t,fill:r,height:o,title:s});let c;c=e.viz===`text`?(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(q,{component:`div`,size:`sm`,className:`markdown`,children:(0,H.jsx)(kSe,{remarkPlugins:[Kwe],components:{img:()=>null},children:e.content??``})})}):t?t.status===`error`?(0,H.jsx)(b8,{kind:`error`,title:t.message??`This panel could not run.`}):e.viz===`inbox`&&(i.prompts?.length||i.bursts?.length||i.grantHistory?.length||i.inboxFilter)?(0,H.jsx)(j8,{frame:t.frame??{columns:[],rows:[]},act:a,prompts:i.prompts,answer:i.answer,filter:i.inboxFilter}):!t.frame||t.status===`empty`?(0,H.jsx)(uTe,{panel:e,message:t.message}):(0,H.jsx)(pTe,{panel:e,result:t,frame:t.frame,act:a,filter:i.inboxFilter}):(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`});let l=e.viz===`bar`&&t?.frame?B1(t.frame,e):``;return(0,H.jsxs)(Im,{component:`article`,"aria-labelledby":`panel-${e.id}`,h:r?`100%`:void 0,style:{display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,mb:6,className:`panel-handle`,children:[(0,H.jsx)(k_,{order:2,id:`panel-${e.id}`,fz:`md`,fw:600,lineClamp:1,style:{letterSpacing:`-0.01em`,flex:`0 1 auto`,maxWidth:`75%`},title:s,children:s}),e.viz===`inbox`&&i.inboxFilter&&(0,H.jsxs)(Cg,{withRemoveButton:!0,onRemove:i.clearInboxFilter,removeButtonProps:{"aria-label":`Clear inbox filter`},children:[`Showing: `,{waiting:`Need you`,review:`To review`,stuck:`Stuck`}[i.inboxFilter]]}),e.description&&(0,H.jsx)(Bg,{label:e.description,multiline:!0,maw:320,children:(0,H.jsx)(lu,{size:`xs`,"aria-label":`About ${e.title}`,children:(0,H.jsx)(ly,{size:14})})}),l&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,ml:`auto`,ta:`right`,style:{flex:`1 1 0`,minWidth:0},title:l,children:l})]}),(0,H.jsx)(G,{style:{flex:1,minHeight:r?0:Math.min(o,120),display:`flex`,flexDirection:`column`},children:c})]})}function uTe({panel:e,message:t}){let{title:n,caption:r}=Xwe(t??(e.viz===`inbox`?`Nothing needs you right now.`:`Nothing matches right now.`));return(0,H.jsx)(b8,{kind:e.viz===`inbox`?`all-clear`:`empty`,title:n,caption:r})}function dTe({panel:e,result:t,fill:n,height:r,title:i}){let a=I0(),[o,s]=(0,h.useState)(!1),c=t?.frame,l=(0,h.useMemo)(()=>c?ehe(c,e):[],[c,e]),u=(0,h.useMemo)(()=>l.map((e,t)=>({name:e.name,points:e.points,color:t})),[l]),d=l.flatMap(e=>e.points.map(e=>e[0])),f=c?.columns[2]?.unit,p=t?t.status===`error`?`error`:l.length?`ready`:`empty`:`loading`,m=p===`error`?t?.message??`This panel could not run.`:p===`empty`?t?.message??`Nothing matches right now.`:void 0;return(0,H.jsx)(Qwe,{id:e.id,title:i,info:e.description,caption:c&&p===`ready`?B1(c,e):void 0,series:u,from:d.length?Math.min(...d):0,to:d.length?Math.max(...d):0,unit:f,state:p,message:m,actions:{table:p===`ready`?()=>s(e=>!e):void 0,ask:a.ask?()=>a.ask(`Tell me about "${i}" right now.`):void 0},height:n?`fill`:r-48,headingOrder:2,headerClassName:`panel-handle`,children:o&&c?(0,H.jsx)(D8,{frame:fTe(c,e),source:e.source}):void 0})}function fTe(e,t){if(t.viz!==`timeseries`)return e;let n=new Set(e.rows.map(e=>e[1])).size>1,r=n?e.columns:[e.columns[0],e.columns[2]],i=[...e.rows].reverse().map(e=>n?e:[e[0],e[2]]);return{columns:r.map(e=>e.name===`value`?{...e,name:t.measure?.split(`:`).pop()||`value`}:e.name===`ts`?{...e,name:`time`}:e),rows:i}}function pTe({panel:e,result:t,frame:n,act:r,filter:i}){switch(e.viz){case`stat`:return(0,H.jsx)(mTe,{frame:n,trend:t.trend,title:e.title,total:t.total,caption:t.caption});case`gauge`:return(0,H.jsx)(hTe,{frame:n,max:e.max,title:e.title});case`bar`:return(0,H.jsx)(gTe,{frame:n,title:e.title});case`inbox`:return(0,H.jsx)(j8,{frame:n,act:r,filter:i});case`list`:return(0,H.jsx)(bTe,{frame:n,source:e.source,act:r});case`cards`:return(0,H.jsx)(xTe,{frame:n,source:e.source,act:r});case`timeline`:return(0,H.jsx)(CTe,{frame:n,act:r,title:e.title});default:return(0,H.jsx)(D8,{frame:n,source:e.source,act:r})}}function mTe({frame:e,trend:t,title:n,total:r,caption:i}){return(0,H.jsxs)(o_,{gap:4,style:{flex:1},children:[(0,H.jsxs)(K,{gap:6,align:`baseline`,children:[(0,H.jsx)(x0,{n:e.rows[0]?.[0]??null,unit:e.columns[0]?.unit,total:r}),i!=null&&(0,H.jsxs)(q,{ff:`monospace`,size:`sm`,c:`dimmed`,children:[`· `,j1(i)]})]}),t&&t.length>1&&(0,H.jsx)(G,{style:{flex:1,minHeight:24},children:(0,H.jsx)(C0,{trend:t,title:n})})]})}function hTe({frame:e,max:t,title:n}){let r=Number(e.rows[0]?.[0]??0),i=t??100,a=e.columns[0]?.unit;return(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(x0,{n:r,unit:a}),(0,H.jsx)(v0,{value:r,max:i,format:e=>j1(e,a),label:n,caption:!1}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`of `,j1(i,a)]})]})}function gTe({frame:e,title:t}){let n=e.columns[1]?.unit,r=e.rows.map((e,t)=>({id:`${t}`,label:String(e[0]??`–`)||`–`,value:Number(e[1]??0)}));return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(qwe,{items:r,format:e=>j1(e,n),label:t})})}var _Te=nve({rowSortingFeature:_ve,sortedRowModel:vve(),sortFns:{basic:P2,alphanumeric:ove}});function vTe({v:e,column:t,row:n}){if((t.name===`label`||t.name===`state`)&&typeof e==`string`&&e){let t=c0(e),r=t.inferred||n?.inferred===!0,i=(0,H.jsx)(l0,{state:t.state,label:t.label,inferred:r}),a=typeof n?.evidence==`string`&&n.evidence?n.evidence:r?`Inferred from process and file activity, not reported by the agent.`:``;return a?(0,H.jsx)(Bg,{label:a,multiline:!0,maw:320,children:i}):i}let r=M1(e,t);return t.type===`time`&&typeof e==`string`?(0,H.jsx)(q,{span:!0,fz:`inherit`,title:A1(e),children:r}):t.type===`number`?(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`inherit`,children:r}):t.name===`title`||t.name===`branch`?(0,H.jsx)(q,{fz:`inherit`,truncate:!0,maw:t.name===`title`?240:140,title:r,children:r}):(0,H.jsx)(H.Fragment,{children:r})}function D8({frame:e,source:t,act:n}){let{local:r}=I0(),[i,a]=(0,h.useState)([]),o=(0,h.useMemo)(()=>e.rows.map(t=>yTe(e.columns,t)),[e]),s=xve({features:_Te,data:o,columns:(0,h.useMemo)(()=>e.columns.filter(e=>!e.hidden).map(e=>({id:e.name,accessorFn:t=>t[e.name],header:P1(e.name),sortFn:e.type===`number`?`basic`:`alphanumeric`,sortDescFirst:e.type===`number`,cell:({row:t})=>(0,H.jsx)(vTe,{v:t.original[e.name],column:e,row:t.original}),meta:{column:e}})),[e.columns]),state:{sorting:i},onSortingChange:a}),c=e=>n?R0(t,e,r):[],l=!!n&&o.some(e=>c(e).length>0);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,"aria-label":`Table`,viewportProps:k8,children:(0,H.jsxs)(C_,{miw:420,children:[(0,H.jsx)(C_.Thead,{children:s.getHeaderGroups().map(e=>(0,H.jsxs)(C_.Tr,{children:[e.headers.map(e=>{let t=e.column.columnDef.meta.column,n=e.column.getIsSorted();return(0,H.jsx)(C_.Th,{ta:t.type===`number`?`right`:void 0,"aria-sort":n===`asc`?`ascending`:n===`desc`?`descending`:`none`,style:{whiteSpace:`nowrap`},children:(0,H.jsxs)($c,{onClick:e.column.getToggleSortingHandler(),fz:`xs`,fw:500,c:`dimmed`,children:[(0,H.jsx)(s.FlexRender,{header:e}),n===`asc`?(0,H.jsx)(Hte,{size:10}):n===`desc`?(0,H.jsx)(hv,{size:10}):null]})},e.id)}),l&&(0,H.jsx)(C_.Th,{w:36,children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]},e.id))}),(0,H.jsx)(C_.Tbody,{children:s.getRowModel().rows.map(e=>(0,H.jsxs)(C_.Tr,{...w8(c(e.original),e.original,n),children:[e.getAllCells().map(e=>{let t=e.column.columnDef.meta.column;return(0,H.jsx)(C_.Td,{ta:t.type===`number`?`right`:void 0,style:{whiteSpace:`nowrap`,maxWidth:320,overflow:`hidden`,textOverflow:`ellipsis`},children:(0,H.jsx)(s.FlexRender,{cell:e})},e.id)}),l&&(0,H.jsx)(C_.Td,{ta:`right`,py:0,children:(0,H.jsx)(T8,{kinds:c(e.original),row:e.original,act:n,label:O8(e.original)})})]},e.id))})]})})}function O8(e){return String(e.title||e.signature||e.project||e.path||e.id||`this row`)}var k8={tabIndex:0};function yTe(e,t){return Object.fromEntries(e.map((e,n)=>[e.name,t[n]??null]))}function bTe({frame:e,source:t,act:n}){let{local:r}=I0(),[i,...a]=e.columns.filter(e=>!e.hidden);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(o_,{gap:0,children:gS(e).map((e,o)=>{let s=n?R0(t,e,r):[];return(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,py:6,px:4,style:{borderBottom:`1px solid var(--driga-border-soft)`},...w8(s,e,n),className:`row-hover ${w8(s,e,n).className??``}`,children:[(0,H.jsx)(q,{size:`sm`,fw:500,truncate:!0,style:{minWidth:0},title:i?M1(e[i.name],i):void 0,children:i?M1(e[i.name],i):``}),(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,ff:`monospace`,children:a.map(t=>M1(e[t.name],t)).join(` · `)}),s.length>0&&(0,H.jsx)(T8,{kinds:s,row:e,act:n,label:O8(e)})]})]},o)})})})}function A8(e,t){let n=String(e.kind??``),r=n===`waiting`,i=Number(e.session_id)>0?`Session ${e.session_id}`:``;if(!r&&n!==`finished`)return{id:String(e.id),kind:`machine`,title:`${P1(n)} on ${String(e.machine??`a machine`)}`,reason:String(e.summary??``)||void 0,machine:void 0,at:String(e.occurred_at??``)};let a={id:String(e.id),title:String(e.title||e.summary||i),agent:String(e.agent??``)||void 0,project:String(e.project??``)||void 0,branch:String(e.branch??``)||void 0,machine:String(e.machine??``)||void 0,at:String(e.occurred_at??``)};if(r){let n=String(e.reason??``);return{...a,kind:n===`permission`?`permission`:n===`question`?`question`:`waiting`,reason:[e.tool,e.detail].filter(Boolean).join(` · `)||void 0,since:typeof e.waited==`number`?new Date(t-e.waited).toISOString():void 0}}let o=String(e.summary??``);return{...a,kind:`finished`,turns:typeof e.turns==`number`?e.turns:void 0,reason:o&&o!==`turn finished`?o:e.last_commit?`last commit: ${e.last_commit}`:void 0,review:{files:Number(e.files??0),uncommitted:Number(e.dirty??0),unpushed:Number(e.unpushed??0),checkout:String(e.checkout??``)||void 0}}}function j8({frame:e,act:t,prompts:n,answer:r,filter:i}){let a=I0(),{stuck:o}=a,s=Date.now();if(i===`stuck`)return o?.rows.length?(0,H.jsx)(D8,{frame:o,source:`sessions`,act:t}):(0,H.jsx)(b8,{kind:`empty`,title:`No session looks stuck.`});let c=(a.bursts??[]).filter(e=>e.members.length>1),l=new Set(c.flatMap(e=>e.members.map(e=>e.id))),u=n?.filter(e=>!l.has(e.id))??[],d=gS(e),f=d.filter(e=>e.kind===`waiting`),p=d.filter(e=>e.kind!==`waiting`&&e.kind!==`finished`),m=d.filter(e=>e.kind===`finished`),h=e=>t&&Number(e.session_id)>0?()=>void t({kind:`jump`,row:e}):void 0,g=e=>t&&!e.ack_pending?()=>void t({kind:`ack`,row:e}):void 0,_=(e,t,n,r,i)=>r>0&&(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsx)(G,{children:(0,H.jsx)(l0,{variant:`pill`,state:t,tone:n,label:`${e} · ${r}`})}),i]}),v=i!==`review`,y=i!==`waiting`;return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsxs)(o_,{gap:`sm`,children:[v&&_(`Permission prompts`,`waiting`,`warning`,u.length+c.length,(0,H.jsxs)(H.Fragment,{children:[c.map(e=>(0,H.jsx)(TTe,{burst:e,answer:r,decide:a.decideBurst},e.id)),u.map(e=>(0,H.jsx)(M8,{prompt:e,answer:r},e.id))]})),v&&_(`Needs you`,`waiting`,`warning`,f.length,f.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onOpen:h(e)},String(e.id)))),v&&_(`Machines`,`waiting`,`warning`,p.length,p.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onDismiss:g(e)},String(e.id)))),a.grantHistory?.map(e=>(0,H.jsxs)(il,{withBorder:!0,p:`xs`,radius:`md`,children:[(0,H.jsxs)(q,{size:`xs`,children:[e.attribution,` · `,e.session??e.conversation,` · `,e.time]}),(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,disabled:e.revoked,onClick:()=>void a.revokeGrant?.(e.grant_id),children:e.revoked?`Grant revoked`:`Revoke grant`})]},`${e.grant_id}/${e.action_id??e.prompt_id}`)),y&&_(`To review`,`finished`,`info`,m.length,m.map(e=>(0,H.jsx)(S8,{entry:A8(e,s),onApprove:g(e),onOpen:h(e)},String(e.id))))]})})}function xTe({frame:e,source:t,act:n}){let{local:r}=I0(),[i,...a]=e.columns.filter(e=>!e.hidden);return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(G,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`,gap:10},children:gS(e).map((e,o)=>{let s=n?R0(t,e,r):[];return(0,H.jsxs)(il,{p:`sm`,withBorder:!0,style:{background:`var(--driga-inset)`},children:[(0,H.jsx)(q,{size:`sm`,fw:600,truncate:!0,mb:6,title:i?M1(e[i.name],i):void 0,children:i?M1(e[i.name],i):``}),(0,H.jsx)(e_,{cols:2,spacing:12,verticalSpacing:2,children:a.map(t=>{let n=e[t.name];if(n===null||n===``||n===void 0)return null;let r=typeof n==`number`&&n>0&&t.unit===`count`;return(0,H.jsxs)(K,{justify:`space-between`,gap:6,wrap:`nowrap`,children:[(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:P1(t.name),children:P1(t.name)}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,c:r?`warning`:void 0,truncate:!0,title:M1(n,t),children:M1(n,t)})]},t.name)})}),s.length>0&&(0,H.jsx)(K,{justify:`flex-end`,mt:4,children:(0,H.jsx)(T8,{kinds:s,row:e,act:n,label:O8(e)})})]},o)})})})}function STe(e,t){return gS(e).map(n=>{let r=Date.parse(String(n.started_at))||t,i=Date.parse(String(n.ended_at??``))||t,a=c0(String(n.label??``)),o=n.ended_at?`finished`:a.state&&a.state!==`waiting`?a.state:`working`,s=(e.spans??[]).filter(e=>e.session_id===n.id&&e.machine_id===n.machine_id).map(e=>({from:Date.parse(String(e.from))||r,to:Date.parse(String(e.to??``))||t})).sort((e,t)=>e.from-t.from),c=[],l=r;for(let e of s){let t=Math.max(l,r,e.from),n=Math.min(i,e.to);n<=t||(t>l&&c.push({from:l,to:t,state:o}),c.push({from:t,to:n,state:`waiting`}),l=n)}return lDate.now(),[e]),i=(0,h.useMemo)(()=>STe(e,r),[e,r]),a=i.flatMap(e=>e.segments.map(e=>e.from)),o=a.length?Math.min(...a):r-36e5,s=new Map(gS(e).map(e=>[JSON.stringify([e.machine_id,e.id]),e]));return(0,H.jsx)(Yc,{style:{flex:1},type:`auto`,viewportProps:k8,children:(0,H.jsx)(aTe,{lanes:i,from:o,to:r,now:r,label:n,onSelect:t?e=>{let n=s.get(e);n&&t({kind:`jump`,row:{...n,session_id:n.id}})}:void 0})})}function M8({prompt:e,answer:t}){let n=I0(),[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);(0,h.useEffect)(()=>{i(!1);let e=window.setTimeout(()=>i(!0),600);return()=>window.clearTimeout(e)},[e.id,JSON.stringify(e.input)]);let s=async n=>{if(t){o(!0);try{await t(e,n)}finally{o(!1)}}},c=wTe(e),l={id:e.id,kind:`permission`,title:e.session,agent:`claude`,reason:c?`${e.tool}(${c})`:e.tool,project:e.cwd,at:e.created_at,since:e.created_at};return(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(S8,{entry:l,armed:r&&!a,onApprove:t?()=>void s(!0):void 0,onDeny:t?()=>void s(!1):void 0}),(0,H.jsx)(q,{component:`pre`,size:`xs`,ff:`monospace`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(e.input,null,2)}),e.grant_eligible&&n.answerSimilar&&(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:e.grant_pattern}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Expires `,e.grant_expires_at]}),(0,H.jsx)(km,{size:`compact-xs`,variant:`light`,disabled:!r||a,onClick:()=>{o(!0),n.answerSimilar(e).finally(()=>o(!1))},children:`Allow similar for this session`})]})]})}function wTe(e){let t=e.input??{};for(let e of[`command`,`file_path`,`url`,`pattern`])if(typeof t[e]==`string`)return String(t[e]);return``}function TTe({burst:e,answer:t,decide:n}){let r=`${e.id}/${e.members.map(e=>`${e.id}:${e.input_hash}`).join(`/`)}`,[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(),u=(0,h.useRef)(r);u.current=r;let d=(0,h.useRef)(!1);(0,h.useEffect)(()=>{a(!1),s(!1),l(void 0),d.current=!1;let e=window.setTimeout(()=>a(!0),600);return()=>window.clearTimeout(e)},[r]);let f=async()=>{if(!i||d.current||!n)return;d.current=!0,s(!0);let t=e.members.map(e=>e.id),a=r;try{await n(e.id,t,!0)}catch(e){u.current===a&&l(e.message)}finally{u.current===a&&(d.current=!1,s(!1))}};return(0,H.jsx)(il,{withBorder:!0,p:`xs`,radius:`md`,style:{background:`var(--driga-raised)`},children:(0,H.jsxs)(o_,{gap:`xs`,children:[(0,H.jsxs)(q,{size:`sm`,fw:600,children:[e.members.length,` permission prompts · `,e.session]}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:[`in `,e.cwd]}),e.members.map(e=>(0,H.jsx)(M8,{prompt:e.prompt,answer:t},`${e.id}/${e.input_hash}`)),n&&(0,H.jsxs)(km,{disabled:!i||o,onClick:()=>void f(),children:[`Allow all `,e.members.length]}),c&&(0,H.jsx)(q,{size:`xs`,c:`danger`,role:`alert`,children:c})]})})}var ETe={stat:3,gauge:3,timeseries:6,bar:6,table:12,list:6,inbox:8,cards:12,timeline:12,text:6};function N8({fragment:e,onVars:t,act:n,compact:r,stacked:i,bare:a}){let{dashboard:o}=e,s=new Map(e.results.map(e=>[e.id,e])),c=e.vars??{};return(0,H.jsxs)(o_,{gap:`sm`,p:a?0:r?`xs`:`md`,children:[!a&&(0,H.jsxs)(K,{justify:`space-between`,align:`flex-end`,gap:`xs`,children:[(0,H.jsxs)(G,{children:[(0,H.jsx)(k_,{order:1,fz:`md`,fw:600,children:o.name}),o.description&&!r&&(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:o.description})]}),(0,H.jsxs)(K,{gap:`xs`,children:[t&&o.variables?.map(n=>(0,H.jsx)(Jg,{size:`xs`,w:140,label:n.name,placeholder:`All`,clearable:!0,data:e.options?.[n.name]??[],value:c[n.name]||null,onChange:e=>t({...c,[n.name]:e??``})},n.name)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,title:A1(e.observed_at),children:[`observed `,k1(e.observed_at)]})]})]}),(0,H.jsx)(G,{style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:12,gridAutoFlow:`row dense`},children:o.panels.map(e=>{let t=i?12:Math.min(12,e.grid?.w??e.width??ETe[e.viz]);return(0,H.jsx)(G,{style:{gridColumn:`span ${t}`,minWidth:0},children:(0,H.jsx)(E8,{panel:e,result:s.get(e.id),act:n})},e.id)})})]})}var P8=new Set([`create_dashboard`,`edit_dashboard`,`replace_dashboard`,`restore_dashboard_version`]);function F8(e,t){if(e.viz===`text`){let t=(e.content??``).split(` +`).filter(e=>/^\s*\|/.test(e)&&!/^\s*\|[\s:|-]+\|\s*$/.test(e)).length;return t>1?`table, ${t-1} rows`:`note`}if(!t)return`loading`;if(t.status===`error`)return t.message??`failed`;if(t.status===`empty`||!t.frame?.rows.length)return t.message??`nothing right now`;let n=t.frame;if(e.viz===`stat`||e.viz===`gauge`){let e=n.rows[0]?.[0],r=n.columns[0]?.unit;return typeof e==`number`?typeof t.total==`number`?`${j1(e,r)} of ${j1(t.total,r)}`:j1(e,r):`no reading`}return e.viz===`bar`||e.viz===`timeseries`?B1(n,e)||`${n.rows.length} points`:`${n.rows.length} ${n.rows.length===1?`row`:`rows`}`}function DTe(e){let t=e.filter(e=>e.status===`error`).length;return t?`${t} failed`:``}function OTe(e,t){let n=e=>t?.panels.find(t=>t.id===e)?.title??e;return e.tool===`create_dashboard`?[`Created`]:e.tool===`replace_dashboard`?[`Replaced`]:e.tool===`restore_dashboard_version`?[`Restored version ${e.input.version??`?`}`]:(e.input.operations??[]).map(e=>{switch(e.op){case`add`:return`Added ${e.panel.title}`;case`update`:return`Changed ${e.panel?.title??n(e.id)}`;case`remove`:return`Removed ${n(e.id)}`;case`move`:return`Moved ${n(e.id)}`;case`layout`:return`Moved panels`;case`rename`:return`Renamed to ${e.name}`}})}function kTe({text:e,open:t,onOpen:n}){let[r,i]=(0,h.useState)(!!t),a=(0,h.useRef)(!1);(0,h.useEffect)(()=>{a.current||i(!!t)},[t]);let[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(!1),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(null);if((0,h.useEffect)(()=>{let t=new AbortController;g(null),p(null),s(!1);let n;try{n=JSON.parse(e)}catch{g(`This card could not be read.`);return}if(d(n),n.error)return;let r=n.input?.dashboard,i=n.saved?.id??n.input?.id;if(!r&&!i)g(`This card names no dashboard.`);else return(i&&(P8.has(n.tool)||n.tool===`open_dashboard`)?H0.open(i,n.input?.vars,t.signal):H0.run(r,n.input?.vars,t.signal)).then(e=>{t.signal.aborted||p(e)},e=>{t.signal.aborted||(s(e instanceof z0&&e.status===404),g(e.message))}),()=>t.abort()},[e]),m&&u&&o&&(u.saved||u.input.id))return(0,H.jsxs)(q,{size:`sm`,c:`dimmed`,children:[u.input.dashboard?.name??`This dashboard`,` was deleted since.`]});if(m)return(0,H.jsx)(q,{size:`sm`,c:`danger`,children:m});if(u?.error)return(0,H.jsx)(il,{withBorder:!0,radius:`md`,p:`sm`,style:{background:`var(--driga-raised)`},children:(0,H.jsxs)(o_,{gap:4,children:[(0,H.jsx)(q,{size:`sm`,fw:600,children:u.status===`unknown`?`Outcome unknown: ${u.input.dashboard?.name??u.input.id??`dashboard`}`:P8.has(u.tool)?`Draft rejected: ${u.input.dashboard?.name??u.input.id??`dashboard`}`:`These panels could not run`}),(0,H.jsx)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:u.error})]})});if(!u||!f)return(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading panels…`});let _=f.dashboard,v=P8.has(u.tool)&&!!(u.saved??f.id),y=new Map(f.results.map(e=>[e.id,e])),b=_.panels,x=v?OTe(u):[],S=v?u.saved?.version??f.version:void 0,C=DTe(f.results),w=v?`Saved ${_.name}`:_.name;return(0,H.jsxs)(il,{withBorder:!0,radius:`md`,p:`sm`,style:{background:`var(--driga-raised)`},children:[(0,H.jsxs)(o_,{gap:6,children:[(0,H.jsxs)(K,{gap:4,wrap:`nowrap`,children:[(0,H.jsx)($c,{"aria-expanded":r,onClick:()=>{a.current=!0,i(e=>!e)},style:{flex:1,minWidth:0},children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[r?(0,H.jsx)(hv,{size:14,"aria-hidden":!0}):(0,H.jsx)(_v,{size:14,"aria-hidden":!0}),v?(0,H.jsx)(Gv,{size:16,"aria-hidden":!0}):(0,H.jsx)(bv,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{size:`sm`,fw:600,truncate:!0,title:w,children:w}),S?(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:[`version `,S]}):null,C&&(0,H.jsx)(q,{size:`xs`,c:`danger`,style:{whiteSpace:`nowrap`},children:C})]})}),v&&(0,H.jsx)(Bg,{label:`Open dashboard`,children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`Open dashboard`,onClick:()=>n(f.id),children:(0,H.jsx)(Ty,{size:16})})}),(0,H.jsx)(Bg,{label:`Full screen`,children:(0,H.jsx)(lu,{size:`sm`,"aria-label":`Full screen`,onClick:()=>l(!0),children:(0,H.jsx)(Vte,{size:16})})})]}),x.length>0&&(0,H.jsx)(K,{gap:4,children:x.map(e=>(0,H.jsx)(bm,{size:`sm`,variant:`light`,color:`gray`,tt:`none`,children:e},e))}),r?(0,H.jsx)(N8,{fragment:f,compact:!0,stacked:!0,bare:!0}):(0,H.jsxs)(o_,{gap:2,component:`ul`,m:0,p:0,style:{listStyle:`none`},children:[b.slice(0,6).map(e=>{let t=y.get(e.id);return(0,H.jsxs)(K,{component:`li`,gap:8,wrap:`nowrap`,justify:`space-between`,children:[(0,H.jsx)(q,{size:`xs`,truncate:!0,title:t?.title||e.title,children:t?.title||e.title}),(0,H.jsx)(q,{size:`xs`,c:t?.status===`error`?`danger`:`dimmed`,ff:`monospace`,truncate:!0,ta:`right`,style:{maxWidth:`55%`},title:F8(e,t),children:F8(e,t)})]},e.id)}),b.length>6&&(0,H.jsxs)(q,{component:`li`,size:`xs`,c:`dimmed`,children:[`and `,b.length-6,` more`]})]})]}),(0,H.jsx)(gg,{opened:c,onClose:()=>l(!1),fullScreen:!0,title:w,radius:0,children:(0,H.jsx)(N8,{fragment:f})})]})}function ATe(e){let t=(e??``).trim();return t!==``&&![`{}`,`[]`,`null`,`""`,`"{}"`,`"[]"`].includes(t)}function jTe({conversation:e,action:t}){let n=t.status===`pending`,[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),l=(0,h.useRef)(!1),u=`${e}/${t.id}/${t.status}`,d=(0,h.useRef)(u);d.current=u,(0,h.useEffect)(()=>{l.current=!1,i(!1),c(null),o(!1)},[u]);let f=async(n,r=!1)=>{let a=u;if(!l.current){l.current=!0,i(!0),c(null);try{r?await K0.decideSimilar(e,t.id):await K0.decide(e,t.id,n)}catch(e){if(d.current!==a)return;c(e.message),l.current=!1,i(!1)}}};return(0,H.jsxs)(il,{withBorder:!0,p:`xs`,radius:`md`,style:{background:`var(--driga-raised)`,borderColor:n?`var(--mantine-color-warning-filled)`:void 0},children:[(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[t.tool,` · `,t.status]}),(0,H.jsx)(q,{size:`sm`,fw:600,style:{overflowWrap:`anywhere`},children:t.command?.summary??t.title}),t.command?(0,H.jsxs)(o_,{gap:4,mt:`xs`,children:[(0,H.jsxs)(q,{size:`xs`,children:[t.command.class,` · `,t.command.boundary]}),(0,H.jsx)(q,{component:`pre`,size:`xs`,ff:`monospace`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:t.command.requested.script??JSON.stringify(t.command.requested.argv)}),t.command.effective.map((e,t)=>(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[`Effective: `,JSON.stringify(e)]},t)),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Timeout: `,t.command.requested.timeout_seconds,`s`]}),t.command.error&&(0,H.jsx)(q,{role:`alert`,size:`xs`,c:`danger`,children:t.command.error}),[{label:`${t.command.count} process targets`,rows:t.command.targets},...[`stopped`,`vanished`,`skipped`,`survivors`].map(e=>({label:e,rows:t.command[e]??[]}))].filter(e=>e.rows.length>0).map(e=>(0,H.jsx)(Rf,{variant:`contained`,transitionDuration:0,children:(0,H.jsxs)(Rf.Item,{value:`targets`,children:[(0,H.jsx)(Rf.Control,{"aria-label":`Inspect ${e.label}`,children:e.label}),(0,H.jsx)(Rf.Panel,{children:(0,H.jsx)(G,{mah:300,tabIndex:0,"aria-label":e.label,style:{overflowY:`auto`},children:(0,H.jsx)(o_,{gap:`xs`,children:e.rows.map(e=>(0,H.jsxs)(G,{children:[(0,H.jsxs)(q,{size:`xs`,fw:600,children:[`PID `,e.pid,` · `,e.owner,` · `,D1(e.memory_bytes)]}),(0,H.jsxs)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:[e.started_at,` · `,e.executable,` `,JSON.stringify(e.argv),` · `,e.command_line,e.reason&&` · ${e.reason}`]})]},e.pid))})})})]})},e.label))]}):(0,H.jsx)(q,{component:`pre`,size:`xs`,ff:`monospace`,my:`xs`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:JSON.stringify(t.input,null,2)}),t.delegated&&(0,H.jsxs)(q,{component:`pre`,size:`xs`,ff:`monospace`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[t.delegated.tool,` · `,t.delegated.cwd,` -`,JSON.stringify(t.delegated.input,null,2)]}),t.directory&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:[`in `,t.directory]}),t.decided_by&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Decided by `,t.decided_by]}),ATe(t.result)&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,mt:2,style:{overflowWrap:`anywhere`},children:t.result}),t.grant_id&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,disabled:a,onClick:()=>{let e=u;G0.revokeGrant(t.grant_id).then(()=>{d.current===e&&o(!0)},t=>{d.current===e&&c(t.message)})},children:a?`Grant revoked`:`Revoke grant`}),n&&t.grant_eligible&&(0,H.jsxs)(o_,{gap:4,mt:`xs`,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:t.grant_pattern}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Expires `,t.grant_expires_at]}),(0,H.jsx)(km,{variant:`light`,disabled:r,onClick:()=>void f(!0,!0),children:`Allow similar for this conversation`})]}),n&&(0,H.jsxs)(K,{gap:6,mt:`xs`,children:[(0,H.jsx)(km,{disabled:r||!!t.command?.error,"aria-label":`Allow ${t.title}`,onClick:()=>void f(!0),children:`Allow`}),(0,H.jsx)(km,{variant:`default`,disabled:r,"aria-label":`Deny ${t.title}`,onClick:()=>void f(!1),children:`Deny`})]}),s&&(0,H.jsx)(q,{size:`xs`,c:`danger`,role:`alert`,children:s})]})}function MTe({inbox:e,act:t,ask:n}){let r=e?.result?.frame?.rows.filter(t=>t[e.result.frame.columns.findIndex(e=>e.name===`kind`)]===`waiting`).length??0,{prompts:i=[],inboxFilter:a}=F0(),o=(e?.result?.frame?.rows.length??0)+i.length,s=[r?`What needs me first, and why?`:`Is anything stuck?`,`What finished since I was away, and is it safe to merge?`,`Make a dashboard for the project I am working on`,`Which processes can I reclaim?`];return(0,H.jsxs)(o_,{gap:`sm`,children:[r||i.length?(0,H.jsxs)(q,{size:`sm`,c:`dimmed`,children:[i.length>0&&`${i.length} permission ${i.length===1?`prompt`:`prompts`} to answer. `,r?`${r} ${r===1?`session needs`:`sessions need`} you.`:``]}):(0,H.jsx)(b8,{kind:`all-clear`,title:`Nothing is waiting on you.`}),e&&!e.listed&&(o>0||a)&&(0,H.jsx)(E8,{panel:e.panel,result:e.result,act:t}),(0,H.jsx)(o_,{gap:6,align:`flex-start`,children:s.map(e=>(0,H.jsx)(km,{variant:`default`,radius:`xl`,leftSection:(0,H.jsx)(Cy,{}),onClick:()=>n(e),styles:{label:{whiteSpace:`normal`,textAlign:`left`,lineHeight:1.35,overflow:`visible`}},h:`auto`,py:6,children:e},e))})]})}function NTe(e){let t=[],n=null;for(let r of e)r.role===`user`?(n&&t.push(n),n=null,t.push(r)):r.role===`assistant`?(n&&t.push(n),n=r):t.push(r);return n&&t.push(n),t}function PTe({inbox:e,act:t,ask:n,onOpen:r,onClose:i}){let[a,o]=(0,h.useState)(null),[s,c]=(0,h.useState)(`loading`),[l,u]=(0,h.useState)([]),[d,f]=(0,h.useState)(new Map),[p,m]=(0,h.useState)(!1),[g,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(),[b,x]=(0,h.useState)(Date.now),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(!1),[D,O]=(0,h.useState)(``),[k,A]=(0,h.useState)(null),[j,M]=(0,h.useState)(``),N=(0,h.useRef)(null),P=(0,h.useRef)(null),F=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(O(n.text),P.current?.focus())},[n]),(0,h.useEffect)(()=>{let e=!0;return G0.history().then(t=>{e&&(c(t.length?`loading`:`empty`),t.length&&!F.current&&o(e=>e??t[0].id))},()=>{e&&c(`unavailable`)}),()=>{e=!1}},[]),(0,h.useEffect)(()=>{if(!a)return;let e=new AbortController,t=0,n=new Map,r=[],i=e=>{let t=n.get(e.id);if(n.set(e.id,e),t?.created_at===e.created_at)return;t&&r.splice(r.indexOf(e.id),1);let i=0,a=r.length;for(;i>>1;n.get(r[t]).created_at.localeCompare(e.created_at)<=0?i=t+1:a=t}r.splice(i,0,e.id)},o=()=>u(r.map(e=>n.get(e))),s=e=>{_(e.mode),y(e.until),x(Date.now()),e.reset&&(n.clear(),r.length=0,e.messages.forEach(i),f(new Map(e.actions.map(e=>[e.id,e]))),t=e.cursor);for(let r of e.events??[])if(!(r.seq<=t)){if(t=r.seq,r.action&&f(e=>new Map(e).set(r.action.id,r.action)),r.kind===`delta`&&r.message_id){let e=n.get(r.message_id);e&&n.set(e.id,{...e,text:e.text+(r.text??``),html:``})}r.message&&i(r.message)}e.cursor>t&&(t=e.cursor),m(!!e.active),o()};return(async()=>{for(;!e.signal.aborted;)try{let n=await G0.wait(a,t,e.signal);if(e.signal.aborted)return;s(n),A(null)}catch{if(e.signal.aborted)return;A(`Reconnecting…`),await new Promise(e=>setTimeout(e,1e3))}})(),()=>e.abort()},[a]),(0,h.useEffect)(()=>{if(g!==`full auto`)return;let e=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(e)},[g]),(0,h.useEffect)(()=>{N.current?.scrollTo({top:N.current.scrollHeight})},[l]);let ee=async e=>{if(!a||E.current)return!1;E.current=!0,T(!0),A(null),C(!1);try{return await G0.setMode(a,e),!0}catch(e){return A(e.message),!1}finally{E.current=!1,T(!1)}},I=async()=>{(g!==`full auto`||await ee(`confirm`))&&i?.()},te={confirm:`Confirm`,auto:`Auto`,"full auto":`Full auto`},L=g?`Mode: ${te[g]}`:!a&&s===`empty`?`Mode: Confirm`:!a&&s===`unavailable`?`Mode unavailable`:`Loading mode…`;g===`full auto`&&v&&(L+=` · ${Math.max(0,Math.ceil((Date.parse(v)-b)/6e4))}m left`);let ne=async e=>{let t=e.trim();if(t&&!F.current){F.current=!0,O(``);try{let e=a;e||(e=(await G0.create()).id,o(e)),await G0.send(e,t,{page:`/app/`}),M(t)}catch(e){O(e=>e||t),A(e.message)}finally{F.current=!1}}},re=j&&!p?(0,H.jsx)(km,{size:`compact-xs`,variant:`default`,onClick:()=>void ne(j),children:`Retry`}):null,ie=NTe(l),ae=e=>(e.role===`user`||e.role===`assistant`)&&!e.text.trim()&&e.status!==`streaming`&&e.status!==`queued`,oe=ie.findIndex(ae),se=ie.map(e=>e.role).lastIndexOf(`assistant`),R=ie.map(e=>e.role).lastIndexOf(`panel`);return(0,H.jsxs)(o_,{component:`section`,"aria-label":`Chat`,h:`100%`,gap:0,children:[(0,H.jsxs)(K,{justify:`space-between`,px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--driga-border)`},children:[(0,H.jsxs)(K,{gap:8,align:`baseline`,wrap:`nowrap`,children:[(0,H.jsx)(k_,{order:2,fz:`sm`,fw:600,children:`Chat`}),(0,H.jsx)(q,{size:`xs`,c:g===`full auto`?`danger`:`dimmed`,fw:g===`full auto`?600:void 0,"aria-label":`Current trust mode`,style:{whiteSpace:`nowrap`},children:L})]}),i&&(0,H.jsx)(lu,{"aria-label":`Close chat`,disabled:w,onClick:()=>void I(),children:(0,H.jsx)(Iy,{})})]}),(0,H.jsx)(Yc,{viewportRef:N,style:{flex:1},type:`auto`,children:(0,H.jsxs)(o_,{gap:`sm`,p:`md`,children:[l.every(ae)&&(0,H.jsx)(MTe,{inbox:e,act:t,ask:e=>void ne(e)}),ie.map((e,t)=>{if((e.role===`user`||e.role===`assistant`)&&!e.text.trim())return e.status===`streaming`||e.status===`queued`?null:e.role===`assistant`&&e.status===`error`&&t===se?(0,H.jsx)(b8,{kind:`error`,title:`This reply failed`,caption:`The error is in the service's log.`,command:`driga service logs`,onRetry:j&&!p?()=>void ne(j):void 0},e.id):t===oe?(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Earlier messages aren't kept. Set `,(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`inherit`,children:`capture_text = "snippets"`}),` to keep Chat history.`]},e.id):null;if(e.role===`panel`)return e.text?(0,H.jsx)(kTe,{text:e.text,open:t===R,onOpen:r},e.id):null;if(e.role===`tool`)return(0,H.jsxs)(K,{gap:4,c:`dimmed`,children:[(0,H.jsx)(Tv,{size:12}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,children:e.text.replace(/^mcp__driga__/,``)})]},e.id);if(e.role===`action`){let t=d.get(e.id);return t&&a?(0,H.jsx)(jTe,{conversation:a,action:t},e.id):null}if(e.role===`user`)return(0,H.jsx)(il,{px:`sm`,py:6,radius:`lg`,maw:`85%`,style:{alignSelf:`flex-end`,background:`var(--driga-hover)`,whiteSpace:`pre-wrap`},children:(0,H.jsx)(q,{size:`sm`,children:e.text})},e.id);let n=e.role===`assistant`&&e.status===`error`&&t===se;return(0,H.jsxs)(G,{"aria-live":e.role===`assistant`&&t===se?`polite`:void 0,"aria-atomic":!1,fz:`sm`,className:`markdown`,c:n?`danger`:void 0,children:[e.html?(0,H.jsx)(`div`,{dangerouslySetInnerHTML:{__html:e.html}}):(0,H.jsx)(q,{size:`sm`,c:`inherit`,children:e.text}),n&&re&&(0,H.jsx)(G,{mt:4,children:re})]},e.id)}),p&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,children:`Working…`}),k&&(0,H.jsx)(q,{size:`xs`,c:`danger`,children:k})]})}),(0,H.jsxs)(G,{component:`form`,p:`sm`,style:{borderTop:`1px solid var(--driga-border)`},onSubmit:e=>{e.preventDefault(),ne(D)},children:[(0,H.jsx)(gh,{ref:P,"aria-label":`Ask or act`,autosize:!0,minRows:2,maxRows:8,value:D,placeholder:`Ask about your agents, or tell Driga what to show`,onChange:e=>O(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ne(D))}}),(0,H.jsxs)(K,{justify:`space-between`,mt:8,children:[(0,H.jsx)(K,{gap:4,"aria-label":`Trust mode`,children:[`confirm`,`auto`,`full auto`].map(e=>(0,H.jsx)(km,{size:`compact-xs`,variant:g===e?`light`:`default`,color:e===`full auto`?`danger`:void 0,"aria-pressed":g===e,disabled:!a||!g||w,onClick:()=>e===`full auto`?C(!0):void ee(e),children:te[e]},e))}),p?(0,H.jsx)(km,{variant:`default`,onClick:()=>a&&void G0.stop(a),children:`Stop`}):(0,H.jsx)(km,{type:`submit`,disabled:!D.trim(),children:`Send`})]})]}),S&&(0,H.jsxs)(gg,{opened:!0,onClose:()=>C(!1),title:`Enable Full auto?`,centered:!0,children:[(0,H.jsx)(q,{size:`sm`,children:`Full auto runs reads and sandboxed Other commands automatically for 30 minutes. Process and Destructive commands still ask.`}),(0,H.jsxs)(K,{justify:`flex-end`,mt:`md`,children:[(0,H.jsx)(km,{variant:`default`,onClick:()=>C(!1),children:`Cancel`}),(0,H.jsx)(km,{color:`danger`,onClick:()=>void ee(`full auto`),children:`Enable Full auto`})]})]})]})}function FTe(){var e=[...arguments];return(0,h.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var I8=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function L8(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function R8(e){return`nodeType`in e}function z8(e){return e?L8(e)?e:R8(e)?e.ownerDocument?.defaultView??window:window:window}function B8(e){let{Document:t}=z8(e);return e instanceof t}function V8(e){return!L8(e)&&e instanceof z8(e).HTMLElement}function H8(e){return e instanceof z8(e).SVGElement}function U8(e){return e?L8(e)?e.document:R8(e)?B8(e)?e:V8(e)||H8(e)?e.ownerDocument:document:document:document}var W8=I8?h.useLayoutEffect:h.useEffect;function G8(e){let t=(0,h.useRef)(e);return W8(()=>{t.current=e}),(0,h.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function ITe(){let e=(0,h.useRef)(null);return[(0,h.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,h.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function K8(e,t){t===void 0&&(t=[e]);let n=(0,h.useRef)(e);return W8(()=>{n.current!==e&&(n.current=e)},t),n}function q8(e,t){let n=(0,h.useRef)();return(0,h.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function J8(e){let t=G8(e),n=(0,h.useRef)(null);return[n,(0,h.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Y8(e){let t=(0,h.useRef)();return(0,h.useEffect)(()=>{t.current=e},[e]),t.current}var X8={};function Z8(e,t){return(0,h.useMemo)(()=>{if(t)return t;let n=X8[e]==null?0:X8[e]+1;return X8[e]=n,e+`-`+n},[e,t])}function Q8(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var $8=Q8(1),e5=Q8(-1);function LTe(e){return`clientX`in e&&`clientY`in e}function t5(e){if(!e)return!1;let{KeyboardEvent:t}=z8(e.target);return t&&e instanceof t}function RTe(e){if(!e)return!1;let{TouchEvent:t}=z8(e.target);return t&&e instanceof t}function n5(e){if(RTe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LTe(e)?{x:e.clientX,y:e.clientY}:null}var r5=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[r5.Translate.toString(e),r5.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),i5=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function zTe(e){return e.matches(i5)?e:e.querySelector(i5)}var BTe={display:`none`};function VTe(e){let{id:t,value:n}=e;return h.createElement(`div`,{id:t,style:BTe},n)}function HTe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return h.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function UTe(){let[e,t]=(0,h.useState)(``);return{announce:(0,h.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var a5=(0,h.createContext)(null);function WTe(e){let t=(0,h.useContext)(a5);(0,h.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of `);return t(e)},[e,t])}function GTe(){let[e]=(0,h.useState)(()=>new Set),t=(0,h.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,h.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var KTe={draggable:` +`,JSON.stringify(t.delegated.input,null,2)]}),t.directory&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:[`in `,t.directory]}),t.decided_by&&(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Decided by `,t.decided_by]}),ATe(t.result)&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,mt:2,style:{overflowWrap:`anywhere`},children:t.result}),t.grant_id&&(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,disabled:a,onClick:()=>{let e=u;K0.revokeGrant(t.grant_id).then(()=>{d.current===e&&o(!0)},t=>{d.current===e&&c(t.message)})},children:a?`Grant revoked`:`Revoke grant`}),n&&t.grant_eligible&&(0,H.jsxs)(o_,{gap:4,mt:`xs`,children:[(0,H.jsx)(q,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:t.grant_pattern}),(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Expires `,t.grant_expires_at]}),(0,H.jsx)(km,{variant:`light`,disabled:r,onClick:()=>void f(!0,!0),children:`Allow similar for this conversation`})]}),n&&(0,H.jsxs)(K,{gap:6,mt:`xs`,children:[(0,H.jsx)(km,{disabled:r||!!t.command?.error,"aria-label":`Allow ${t.title}`,onClick:()=>void f(!0),children:`Allow`}),(0,H.jsx)(km,{variant:`default`,disabled:r,"aria-label":`Deny ${t.title}`,onClick:()=>void f(!1),children:`Deny`})]}),s&&(0,H.jsx)(q,{size:`xs`,c:`danger`,role:`alert`,children:s})]})}function MTe({inbox:e,act:t,ask:n}){let r=e?.result?.frame?.rows.filter(t=>t[e.result.frame.columns.findIndex(e=>e.name===`kind`)]===`waiting`).length??0,{prompts:i=[],inboxFilter:a}=I0(),o=(e?.result?.frame?.rows.length??0)+i.length,s=[r?`What needs me first, and why?`:`Is anything stuck?`,`What finished since I was away, and is it safe to merge?`,`Make a dashboard for the project I am working on`,`Which processes can I reclaim?`];return(0,H.jsxs)(o_,{gap:`sm`,children:[r||i.length?(0,H.jsxs)(q,{size:`sm`,c:`dimmed`,children:[i.length>0&&`${i.length} permission ${i.length===1?`prompt`:`prompts`} to answer. `,r?`${r} ${r===1?`session needs`:`sessions need`} you.`:``]}):(0,H.jsx)(b8,{kind:`all-clear`,title:`Nothing is waiting on you.`}),e&&!e.listed&&(o>0||a)&&(0,H.jsx)(E8,{panel:e.panel,result:e.result,act:t}),(0,H.jsx)(o_,{gap:6,align:`flex-start`,children:s.map(e=>(0,H.jsx)(km,{variant:`default`,radius:`xl`,leftSection:(0,H.jsx)(Cy,{}),onClick:()=>n(e),styles:{label:{whiteSpace:`normal`,textAlign:`left`,lineHeight:1.35,overflow:`visible`}},h:`auto`,py:6,children:e},e))})]})}function NTe(e){let t=[],n=null;for(let r of e)r.role===`user`?(n&&t.push(n),n=null,t.push(r)):r.role===`assistant`?(n&&t.push(n),n=r):t.push(r);return n&&t.push(n),t}var PTe={claude:`Claude Code`,codex:`Codex`,copilot:`GitHub Copilot CLI`};function FTe({inbox:e,act:t,ask:n,onOpen:r,onClose:i}){let[a,o]=(0,h.useState)(null),[s,c]=(0,h.useState)(`loading`),[l,u]=(0,h.useState)([]),[d,f]=(0,h.useState)(new Map),[p,m]=(0,h.useState)(!1),[g,_]=(0,h.useState)(),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(),[S,C]=(0,h.useState)(Date.now),[w,T]=(0,h.useState)(!1),[E,D]=(0,h.useState)(!1),O=(0,h.useRef)(!1),[k,A]=(0,h.useState)(``),[j,M]=(0,h.useState)(null),[N,P]=(0,h.useState)(``),F=(0,h.useRef)(null),ee=(0,h.useRef)(null),I=(0,h.useRef)(!1);(0,h.useEffect)(()=>{n&&(A(n.text),ee.current?.focus())},[n]),(0,h.useEffect)(()=>{let e=!0;return K0.history().then(t=>{e&&(c(t.length?`loading`:`empty`),t.length&&!I.current&&o(e=>e??t[0].id))},()=>{e&&c(`unavailable`)}),()=>{e=!1}},[]),(0,h.useEffect)(()=>{if(_(void 0),!a)return;let e=new AbortController,t=0,n=new Map,r=[],i=e=>{let t=n.get(e.id);if(n.set(e.id,e),t?.created_at===e.created_at)return;t&&r.splice(r.indexOf(e.id),1);let i=0,a=r.length;for(;i>>1;n.get(r[t]).created_at.localeCompare(e.created_at)<=0?i=t+1:a=t}r.splice(i,0,e.id)},o=()=>u(r.map(e=>n.get(e))),s=e=>{_(e.conversation.agent),y(e.mode),x(e.until),C(Date.now()),e.reset&&(n.clear(),r.length=0,e.messages.forEach(i),f(new Map(e.actions.map(e=>[e.id,e]))),t=e.cursor);for(let r of e.events??[])if(!(r.seq<=t)){if(t=r.seq,r.action&&f(e=>new Map(e).set(r.action.id,r.action)),r.kind===`delta`&&r.message_id){let e=n.get(r.message_id);e&&n.set(e.id,{...e,text:e.text+(r.text??``),html:``})}r.message&&i(r.message)}e.cursor>t&&(t=e.cursor),m(!!e.active),o()};return(async()=>{for(;!e.signal.aborted;)try{let n=await K0.wait(a,t,e.signal);if(e.signal.aborted)return;s(n),M(null)}catch{if(e.signal.aborted)return;M(`Reconnecting…`),await new Promise(e=>setTimeout(e,1e3))}})(),()=>e.abort()},[a]),(0,h.useEffect)(()=>{if(v!==`full auto`)return;let e=setInterval(()=>C(Date.now()),1e3);return()=>clearInterval(e)},[v]),(0,h.useEffect)(()=>{F.current?.scrollTo({top:F.current.scrollHeight})},[l]);let te=async e=>{if(!a||O.current)return!1;O.current=!0,D(!0),M(null),T(!1);try{return await K0.setMode(a,e),!0}catch(e){return M(e.message),!1}finally{O.current=!1,D(!1)}},L=async()=>{(v!==`full auto`||await te(`confirm`))&&i?.()},ne={confirm:`Confirm`,auto:`Auto`,"full auto":`Full auto`},re=v?`Mode: ${ne[v]}`:!a&&s===`empty`?`Mode: Confirm`:!a&&s===`unavailable`?`Mode unavailable`:`Loading mode…`;v===`full auto`&&b&&(re+=` · ${Math.max(0,Math.ceil((Date.parse(b)-S)/6e4))}m left`);let ie=async e=>{let t=e.trim();if(t&&!I.current){I.current=!0,A(``);try{let e=a;e||(e=(await K0.create()).id,o(e)),await K0.send(e,t,{page:`/app/`}),P(t)}catch(e){A(e=>e||t),M(e.message)}finally{I.current=!1}}},ae=N&&!p?(0,H.jsx)(km,{size:`compact-xs`,variant:`default`,onClick:()=>void ie(N),children:`Retry`}):null,oe=NTe(l),se=e=>(e.role===`user`||e.role===`assistant`)&&!e.text.trim()&&e.status!==`streaming`&&e.status!==`queued`,R=oe.findIndex(se),ce=oe.map(e=>e.role).lastIndexOf(`assistant`),le=oe.map(e=>e.role).lastIndexOf(`panel`);return(0,H.jsxs)(o_,{component:`section`,"aria-label":`Chat`,h:`100%`,gap:0,children:[(0,H.jsxs)(K,{justify:`space-between`,px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--driga-border)`},children:[(0,H.jsxs)(K,{gap:8,align:`baseline`,wrap:`nowrap`,children:[(0,H.jsx)(k_,{order:2,fz:`sm`,fw:600,children:`Chat`}),(0,H.jsx)(q,{size:`xs`,c:v===`full auto`?`danger`:`dimmed`,fw:v===`full auto`?600:void 0,"aria-label":`Current trust mode`,style:{whiteSpace:`nowrap`},children:re})]}),i&&(0,H.jsx)(lu,{"aria-label":`Close chat`,disabled:E,onClick:()=>void L(),children:(0,H.jsx)(Iy,{})})]}),g&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,px:`md`,py:4,"aria-label":`Assistant provider`,children:PTe[g]??`Assistant`}),(0,H.jsx)(Yc,{viewportRef:F,style:{flex:1},type:`auto`,children:(0,H.jsxs)(o_,{gap:`sm`,p:`md`,children:[l.every(se)&&(0,H.jsx)(MTe,{inbox:e,act:t,ask:e=>void ie(e)}),oe.map((e,t)=>{if((e.role===`user`||e.role===`assistant`)&&!e.text.trim())return e.status===`streaming`||e.status===`queued`?null:e.role===`assistant`&&e.status===`error`&&t===ce?(0,H.jsx)(b8,{kind:`error`,title:`This reply failed`,caption:`The error is in the service's log.`,command:`driga service logs`,onRetry:N&&!p?()=>void ie(N):void 0},e.id):t===R?(0,H.jsxs)(q,{size:`xs`,c:`dimmed`,children:[`Earlier messages aren't kept. Set `,(0,H.jsx)(q,{span:!0,ff:`monospace`,fz:`inherit`,children:`capture_text = "snippets"`}),` to keep Chat history.`]},e.id):null;if(e.role===`panel`)return e.text?(0,H.jsx)(kTe,{text:e.text,open:t===le,onOpen:r},e.id):null;if(e.role===`tool`)return(0,H.jsxs)(K,{gap:4,c:`dimmed`,children:[(0,H.jsx)(Tv,{size:12}),(0,H.jsx)(q,{size:`xs`,ff:`monospace`,children:e.text.replace(/^mcp__driga__/,``)})]},e.id);if(e.role===`action`){let t=d.get(e.id);return t&&a?(0,H.jsx)(jTe,{conversation:a,action:t},e.id):null}if(e.role===`user`)return(0,H.jsx)(il,{px:`sm`,py:6,radius:`lg`,maw:`85%`,style:{alignSelf:`flex-end`,background:`var(--driga-hover)`,whiteSpace:`pre-wrap`},children:(0,H.jsx)(q,{size:`sm`,children:e.text})},e.id);let n=e.role===`assistant`&&e.status===`error`&&t===ce;return(0,H.jsxs)(G,{"aria-live":e.role===`assistant`&&t===ce?`polite`:void 0,"aria-atomic":!1,fz:`sm`,className:`markdown`,c:n?`danger`:void 0,children:[e.html?(0,H.jsx)(`div`,{dangerouslySetInnerHTML:{__html:e.html}}):(0,H.jsx)(q,{size:`sm`,c:`inherit`,children:e.text}),n&&ae&&(0,H.jsx)(G,{mt:4,children:ae})]},e.id)}),p&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,children:`Working…`}),j&&(0,H.jsx)(q,{size:`xs`,c:`danger`,children:j})]})}),(0,H.jsxs)(G,{component:`form`,p:`sm`,style:{borderTop:`1px solid var(--driga-border)`},onSubmit:e=>{e.preventDefault(),ie(k)},children:[(0,H.jsx)(gh,{ref:ee,"aria-label":`Ask or act`,autosize:!0,minRows:2,maxRows:8,value:k,placeholder:`Ask about your agents, or tell Driga what to show`,onChange:e=>A(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ie(k))}}),(0,H.jsxs)(K,{justify:`space-between`,mt:8,children:[(0,H.jsx)(K,{gap:4,"aria-label":`Trust mode`,children:[`confirm`,`auto`,`full auto`].map(e=>(0,H.jsx)(km,{size:`compact-xs`,variant:v===e?`light`:`default`,color:e===`full auto`?`danger`:void 0,"aria-pressed":v===e,disabled:!a||!v||E,onClick:()=>e===`full auto`?T(!0):void te(e),children:ne[e]},e))}),p?(0,H.jsx)(km,{variant:`default`,onClick:()=>a&&void K0.stop(a),children:`Stop`}):(0,H.jsx)(km,{type:`submit`,disabled:!k.trim(),children:`Send`})]})]}),w&&(0,H.jsxs)(gg,{opened:!0,onClose:()=>T(!1),title:`Enable Full auto?`,centered:!0,children:[(0,H.jsx)(q,{size:`sm`,children:`Full auto runs reads and sandboxed Other commands automatically for 30 minutes. Process and Destructive commands still ask.`}),(0,H.jsxs)(K,{justify:`flex-end`,mt:`md`,children:[(0,H.jsx)(km,{variant:`default`,onClick:()=>T(!1),children:`Cancel`}),(0,H.jsx)(km,{color:`danger`,onClick:()=>void te(`full auto`),children:`Enable Full auto`})]})]})]})}function ITe(){var e=[...arguments];return(0,h.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var I8=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function L8(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function R8(e){return`nodeType`in e}function z8(e){return e?L8(e)?e:R8(e)?e.ownerDocument?.defaultView??window:window:window}function B8(e){let{Document:t}=z8(e);return e instanceof t}function V8(e){return!L8(e)&&e instanceof z8(e).HTMLElement}function H8(e){return e instanceof z8(e).SVGElement}function U8(e){return e?L8(e)?e.document:R8(e)?B8(e)?e:V8(e)||H8(e)?e.ownerDocument:document:document:document}var W8=I8?h.useLayoutEffect:h.useEffect;function G8(e){let t=(0,h.useRef)(e);return W8(()=>{t.current=e}),(0,h.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function LTe(){let e=(0,h.useRef)(null);return[(0,h.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,h.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function K8(e,t){t===void 0&&(t=[e]);let n=(0,h.useRef)(e);return W8(()=>{n.current!==e&&(n.current=e)},t),n}function q8(e,t){let n=(0,h.useRef)();return(0,h.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function J8(e){let t=G8(e),n=(0,h.useRef)(null);return[n,(0,h.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Y8(e){let t=(0,h.useRef)();return(0,h.useEffect)(()=>{t.current=e},[e]),t.current}var X8={};function Z8(e,t){return(0,h.useMemo)(()=>{if(t)return t;let n=X8[e]==null?0:X8[e]+1;return X8[e]=n,e+`-`+n},[e,t])}function Q8(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var $8=Q8(1),e5=Q8(-1);function RTe(e){return`clientX`in e&&`clientY`in e}function t5(e){if(!e)return!1;let{KeyboardEvent:t}=z8(e.target);return t&&e instanceof t}function zTe(e){if(!e)return!1;let{TouchEvent:t}=z8(e.target);return t&&e instanceof t}function n5(e){if(zTe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return RTe(e)?{x:e.clientX,y:e.clientY}:null}var r5=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[r5.Translate.toString(e),r5.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),i5=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function BTe(e){return e.matches(i5)?e:e.querySelector(i5)}var VTe={display:`none`};function HTe(e){let{id:t,value:n}=e;return h.createElement(`div`,{id:t,style:VTe},n)}function UTe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return h.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function WTe(){let[e,t]=(0,h.useState)(``);return{announce:(0,h.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var a5=(0,h.createContext)(null);function GTe(e){let t=(0,h.useContext)(a5);(0,h.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of `);return t(e)},[e,t])}function KTe(){let[e]=(0,h.useState)(()=>new Set),t=(0,h.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,h.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var qTe={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},qTe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function JTe(e){let{announcements:t=qTe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=KTe}=e,{announce:a,announcement:o}=UTe(),s=Z8(`DndLiveRegion`),[c,l]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{l(!0)},[]),WTe((0,h.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=h.createElement(h.Fragment,null,h.createElement(VTe,{id:r,value:i.draggable}),h.createElement(HTe,{id:s,announcement:o}));return n?(0,Ae.createPortal)(u,n):u}var o5;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(o5||={});function s5(){}function c5(e,t){return(0,h.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function YTe(){var e=[...arguments];return(0,h.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var l5=Object.freeze({x:0,y:0});function u5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function d5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function XTe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function f5(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function p5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function m5(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ZTe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=m5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=u5(m5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(d5)},QTe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=f5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=f5(r),o=i.reduce((e,t,r)=>e+u5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(d5)};function $Te(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$Te(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(XTe)};function tEe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function h5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:l5}function nEe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var rEe=nEe(1);function iEe(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function aEe(e,t,n){let r=iEe(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var oEe={ignoreTransform:!1};function g5(e,t){t===void 0&&(t=oEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=z8(e).getComputedStyle(e);t&&(n=aEe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function _5(e){return g5(e,{ignoreTransform:!0})}function sEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function cEe(e,t){return t===void 0&&(t=z8(e).getComputedStyle(e)),t.position===`fixed`}function lEe(e,t){t===void 0&&(t=z8(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function v5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(B8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!V8(i)||H8(i)||n.includes(i))return n;let a=z8(e).getComputedStyle(i);return i!==e&&lEe(i,a)&&n.push(i),cEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function y5(e){let[t]=v5(e,1);return t??null}function b5(e){return!I8||!e?null:L8(e)?e:R8(e)?B8(e)||e===U8(e).scrollingElement?window:V8(e)?e:null:null}function x5(e){return L8(e)?e.scrollX:e.scrollLeft}function S5(e){return L8(e)?e.scrollY:e.scrollTop}function C5(e){return{x:x5(e),y:S5(e)}}var w5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(w5||={});function T5(e){return!I8||!e?!1:e===document.scrollingElement}function E5(e){let t={x:0,y:0},n=T5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var uEe={x:.2,y:.2};function dEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=uEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=E5(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=w5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=w5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=w5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=w5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function fEe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function D5(e){return e.reduce((e,t)=>$8(e,C5(t)),l5)}function pEe(e){return e.reduce((e,t)=>e+x5(t),0)}function mEe(e){return e.reduce((e,t)=>e+S5(t),0)}function hEe(e,t){if(t===void 0&&(t=g5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);y5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var gEe=[[`x`,[`left`,`right`],pEe],[`y`,[`top`,`bottom`],mEe]],O5=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=v5(t),r=D5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of gEe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},k5=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function _Ee(e){let{EventTarget:t}=z8(e);return e instanceof t?e:U8(e)}function A5(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var j5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(j5||={});function M5(e){e.preventDefault()}function vEe(e){e.stopPropagation()}var N5;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(N5||={});var P5={start:[N5.Space,N5.Enter],cancel:[N5.Esc],end:[N5.Space,N5.Enter,N5.Tab]},yEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N5.Right:return{...n,x:n.x+25};case N5.Left:return{...n,x:n.x-25};case N5.Down:return{...n,y:n.y+25};case N5.Up:return{...n,y:n.y-25}}},F5=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new k5(U8(t)),this.windowListeners=new k5(z8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(j5.Resize,this.handleCancel),this.windowListeners.add(j5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(j5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&hEe(n),t(l5)}handleKeyDown(e){if(t5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=P5,coordinateGetter:a=yEe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:l5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=e5(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=E5(n),p=fEe(n),m={x:Math.min(i===N5.Right?p.right-p.width/2:p.right,Math.max(i===N5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===N5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===N5.Down?p.top:p.top+p.height/2,u.y))},h=i===N5.Right&&!s||i===N5.Left&&!c,g=i===N5.Down&&!l||i===N5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===N5.Right&&e<=d.x||i===N5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===N5.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===N5.Down&&e<=d.y||i===N5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===N5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,$8(e5(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};F5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=P5,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function I5(e){return!!(e&&`distance`in e)}function L5(e){return!!(e&&`delay`in e)}var R5=class{constructor(e,t,n){n===void 0&&(n=_Ee(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=U8(i),this.documentListeners=new k5(this.document),this.listeners=new k5(n),this.windowListeners=new k5(z8(i)),this.initialCoordinates=n5(r)??l5,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(j5.Resize,this.handleCancel),this.windowListeners.add(j5.DragStart,M5),this.windowListeners.add(j5.VisibilityChange,this.handleCancel),this.windowListeners.add(j5.ContextMenu,M5),this.documentListeners.add(j5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(L5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(I5(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(j5.Click,vEe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(j5.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=n5(e)??l5,s=e5(n,o);if(!t&&a){if(I5(a)){if(a.tolerance!=null&&A5(s,a.tolerance))return this.handleCancel();if(A5(s,a.distance))return this.handleStart()}if(L5(a)&&A5(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===N5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},bEe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},z5=class extends R5{constructor(e){let{event:t}=e,n=U8(t.target);super(e,bEe,n)}};z5.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var xEe={move:{name:`mousemove`},end:{name:`mouseup`}},B5;(function(e){e[e.RightClick=2]=`RightClick`})(B5||={});var SEe=class extends R5{constructor(e){super(e,xEe,U8(e.event.target))}};SEe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==B5.RightClick&&(r?.({event:n}),!0)}}];var V5={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},CEe=class extends R5{constructor(e){super(e,V5)}static setup(){return window.addEventListener(V5.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(V5.move.name,e)};function e(){}}};CEe.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var H5;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(H5||={});var U5;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(U5||={});function wEe(e){let{acceleration:t,activator:n=H5.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=U5.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=EEe({delta:d,disabled:!a}),[m,g]=ITe(),_=(0,h.useRef)({x:0,y:0}),v=(0,h.useRef)({x:0,y:0}),y=(0,h.useMemo)(()=>{switch(n){case H5.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case H5.DraggableRect:return i}},[n,i,c]),b=(0,h.useRef)(null),x=(0,h.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,h.useMemo)(()=>s===U5.TreeOrder?[...l].reverse():l,[s,l]);(0,h.useEffect)(()=>{if(!a||!l.length||!y)g();else{for(let e of S){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=dEe(e,i,y,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){g(),b.current=e,m(x,o),_.current=s,v.current=a;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()}},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var TEe={x:{[w5.Backward]:!1,[w5.Forward]:!1},y:{[w5.Backward]:!1,[w5.Forward]:!1}};function EEe(e){let{delta:t,disabled:n}=e,r=Y8(t);return q8(e=>{if(n||!r||!e)return TEe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[w5.Backward]:e.x[w5.Backward]||i.x===-1,[w5.Forward]:e.x[w5.Forward]||i.x===1},y:{[w5.Backward]:e.y[w5.Backward]||i.y===-1,[w5.Forward]:e.y[w5.Forward]||i.y===1}}},[n,t,r])}function DEe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return q8(e=>t==null?null:r??e??null,[r,t])}function OEe(e,t){return(0,h.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var W5;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(W5||={});var G5;(function(e){e.Optimized=`optimized`})(G5||={});var K5=new Map;function kEe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,h.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,h.useRef)(e),d=_(),f=K8(d),p=(0,h.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,h.useRef)(null),g=q8(t=>{if(d&&!n)return K5;if(!t||t===K5||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new O5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,h.useEffect)(()=>{u.current=e},[e]),(0,h.useEffect)(()=>{d||p()},[n,d]),(0,h.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,h.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:a!=null};function _(){switch(l){case W5.Always:return!1;case W5.BeforeDragging:return n;default:return!n}}}function q5(e,t){return q8(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function AEe(e,t){return q5(e,t)}function jEe(e){let{callback:t,disabled:n}=e,r=G8(t),i=(0,h.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,h.useEffect)(()=>()=>i?.disconnect(),[i]),i}function J5(e){let{callback:t,disabled:n}=e,r=G8(t),i=(0,h.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,h.useEffect)(()=>()=>i?.disconnect(),[i]),i}function MEe(e){return new O5(g5(e),e)}function Y5(e,t,n){t===void 0&&(t=MEe);let[r,i]=(0,h.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=jEe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=J5({callback:a});return W8(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function NEe(e){return h5(e,q5(e))}var X5=[];function PEe(e){let t=(0,h.useRef)(e),n=q8(n=>e?n&&n!==X5&&e&&t.current&&e.parentNode===t.current.parentNode?n:v5(e):X5,[e]);return(0,h.useEffect)(()=>{t.current=e},[e]),n}function FEe(e){let[t,n]=(0,h.useState)(null),r=(0,h.useRef)(e),i=(0,h.useCallback)(e=>{let t=b5(e.target);t&&n(e=>e?(e.set(t,C5(t)),new Map(e)):null)},[]);return(0,h.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=b5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,C5(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{b5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,h.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>$8(e,t),l5):D5(e):l5,[e,t])}function Z5(e,t){t===void 0&&(t=[]);let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{n.current=null},t),(0,h.useEffect)(()=>{let t=e!==l5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?e5(e,n.current):l5}function IEe(e){(0,h.useEffect)(()=>{if(!I8)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function LEe(e,t){return(0,h.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Q5(e){return(0,h.useMemo)(()=>e?sEe(e):null,[e])}var $5=[];function REe(e,t){t===void 0&&(t=g5);let[n]=e,r=Q5(n?z8(n):null),[i,a]=(0,h.useState)($5);function o(){a(()=>e.length?e.map(e=>T5(e)?r:new O5(t(e),e)):$5)}let s=J5({callback:o});return W8(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function zEe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return V8(t)?t:e}function BEe(e){let{measure:t}=e,[n,r]=(0,h.useState)(null),i=J5({callback:(0,h.useCallback)(e=>{for(let{target:n}of e)if(V8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=J8((0,h.useCallback)(e=>{let n=zEe(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,h.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var VEe=[{sensor:z5,options:{}},{sensor:F5,options:{}}],HEe={current:{}},e7={draggable:{measure:_5},droppable:{measure:_5,strategy:W5.WhileDragging,frequency:G5.Optimized},dragOverlay:{measure:g5}},t7=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},UEe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new t7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:s5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:e7,measureDroppableContainers:s5,windowRect:null,measuringScheduled:!1},WEe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:s5,draggableNodes:new Map,over:null,measureDroppableContainers:s5},n7=(0,h.createContext)(WEe),r7=(0,h.createContext)(UEe);function GEe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new t7}}}function KEe(e,t){switch(t.type){case o5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case o5.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case o5.DragEnd:case o5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case o5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new t7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case o5.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new t7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case o5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new t7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function qEe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,h.useContext)(n7),a=Y8(r),o=Y8(n?.id);return(0,h.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!t5(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=zTe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function JEe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function YEe(e){return(0,h.useMemo)(()=>({draggable:{...e7.draggable,...e?.draggable},droppable:{...e7.droppable,...e?.droppable},dragOverlay:{...e7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function XEe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,h.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;W8(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=h5(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=y5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var i7=(0,h.createContext)({...l5,scaleX:1,scaleY:1}),a7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(a7||={});var ZEe=(0,h.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=VEe,collisionDetection:o=eEe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,h.useReducer)(KEe,void 0,GEe),[f,p]=GTe(),[m,g]=(0,h.useState)(a7.Uninitialized),_=m===a7.Initialized,{draggable:{active:v,nodes:y,translate:b},droppable:{containers:x}}=u,S=v==null?null:y.get(v),C=(0,h.useRef)({initial:null,translated:null}),w=(0,h.useMemo)(()=>v==null?null:{id:v,data:S?.data??HEe,rect:C},[v,S]),T=(0,h.useRef)(null),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),A=K8(l,Object.values(l)),j=Z8(`DndDescribedBy`,t),M=(0,h.useMemo)(()=>x.getEnabled(),[x]),N=YEe(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:ee}=kEe(M,{dragging:_,dependencies:[b.x,b.y],config:N.droppable}),I=DEe(y,v),te=(0,h.useMemo)(()=>O?n5(O):null,[O]),L=ke(),ne=AEe(I,N.draggable.measure);XEe({activeNode:v==null?null:y.get(v),config:L.layoutShiftCompensation,initialRect:ne,measure:N.draggable.measure});let re=Y5(I,N.draggable.measure,ne),ie=Y5(I?I.parentElement:null),ae=(0,h.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=x.getNodeFor(ae.current.over?.id),se=BEe({measure:N.dragOverlay.measure}),R=se.nodeRef.current??I,ce=_?se.rect??re:null,le=!!(se.nodeRef.current&&se.rect),z=NEe(le?null:re),ue=Q5(R?z8(R):null),de=PEe(_?oe??I:null),fe=REe(de),pe=JEe(c,{transform:{x:b.x-z.x,y:b.y-z.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:re,containerNodeRect:ie,draggingNodeRect:ce,over:ae.current.over,overlayNodeRect:se.rect,scrollableAncestors:de,scrollableAncestorRects:fe,windowRect:ue}),me=te?$8(te,b):null,he=FEe(de),ge=Z5(he),_e=Z5(he,[re]),ve=$8(pe,ge),B=ce?rEe(ce,pe):null,ye=w&&B?o({active:w,collisionRect:B,droppableRects:P,droppableContainers:M,pointerCoordinates:me}):null,be=p5(ye,`id`),[xe,Se]=(0,h.useState)(null),Ce=tEe(le?pe:$8(pe,_e),xe?.rect??null,re),we=(0,h.useRef)(null),Te=(0,h.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=y.get(T.current);if(!i)return;let a=e.nativeEvent,o=new n({active:T.current,activeNode:i,event:a,options:r,context:ae,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,Ae.unstable_batchedUpdates)(()=>{r?.(i),g(a7.Initializing),d({type:o5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(we.current),k(a)})},onMove(e){d({type:o5.DragMove,coordinates:e})},onEnd:s(o5.DragEnd),onCancel:s(o5.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ae.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===o5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=o5.DragCancel)}T.current=null,(0,Ae.unstable_batchedUpdates)(()=>{d({type:e}),g(a7.Uninitialized),Se(null),D(null),k(null),we.current=null;let t=e===o5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ee=OEe(a,(0,h.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Te(n,t))},[y,Te]));IEe(a),W8(()=>{re&&m===a7.Initializing&&g(a7.Initialized)},[re,m]),(0,h.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=ae.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ve.x,y:ve.y},over:i};(0,Ae.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ve.x,ve.y]),(0,h.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ae.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Ae.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),W8(()=>{ae.current={activatorEvent:O,active:w,activeNode:I,collisionRect:B,collisions:ye,droppableRects:P,draggableNodes:y,draggingNode:R,draggingNodeRect:ce,droppableContainers:x,over:xe,scrollableAncestors:de,scrollAdjustedTranslate:ve},C.current={initial:ce,translated:B}},[w,I,ye,B,y,R,ce,P,x,xe,de,ve]),wEe({...L,delta:b,draggingRect:B,pointerCoordinates:me,scrollableAncestors:de,scrollableAncestorRects:fe});let De=(0,h.useMemo)(()=>({active:w,activeNode:I,activeNodeRect:re,activatorEvent:O,collisions:ye,containerNodeRect:ie,dragOverlay:se,draggableNodes:y,droppableContainers:x,droppableRects:P,over:xe,measureDroppableContainers:F,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:N,measuringScheduled:ee,windowRect:ue}),[w,I,re,O,ye,ie,se,y,x,P,xe,F,de,fe,N,ee,ue]),Oe=(0,h.useMemo)(()=>({activatorEvent:O,activators:Ee,active:w,activeNodeRect:re,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:xe,measureDroppableContainers:F}),[O,Ee,w,re,d,j,y,xe,F]);return h.createElement(a5.Provider,{value:p},h.createElement(n7.Provider,{value:Oe},h.createElement(r7.Provider,{value:De},h.createElement(i7.Provider,{value:Ce},i)),h.createElement(qEe,{disabled:n?.restoreFocus===!1})),h.createElement(JTe,{...n,hiddenTextDescribedById:j}));function ke(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=_&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),QEe=(0,h.createContext)(null),o7=`button`,$Ee=`Draggable`;function eDe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Z8($Ee),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,h.useContext)(n7),{role:p=o7,roleDescription:m=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,h.useContext)(_?i7:QEe),[y,b]=J8(),[x,S]=J8(),C=LEe(o,t),w=K8(n);return W8(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,h.useMemo)(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&p===o7?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,_,m,u.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function tDe(){return(0,h.useContext)(r7)}var nDe=`Droppable`,rDe={timeout:25};function iDe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Z8(nDe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,h.useContext)(n7),u=(0,h.useRef)({disabled:n}),d=(0,h.useRef)(!1),f=(0,h.useRef)(null),p=(0,h.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:_}={...rDe,...i},v=K8(g??r),y=J5({callback:(0,h.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),p.current=null},_)):d.current=!0},[_]),disabled:m||!o}),[b,x]=J8((0,h.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=K8(t);return(0,h.useEffect)(()=>{y&&b.current&&(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,h.useEffect)(()=>(s({type:o5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:o5.UnregisterDroppable,key:a,id:r})),[r]),(0,h.useEffect)(()=>{n!==u.current.disabled&&(s({type:o5.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function s7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function aDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function c7(e){return e!==null&&e>=0}function oDe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=lDe(t,a,r);if(a===r){let e=t[i];return e?{x:rr&&a<=i?{x:-o.width-s,y:0,...l7}:a=i?{x:o.width+s,y:0,...l7}:{x:0,y:0,...l7}};function lDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=s7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},d7={scaleX:1,scaleY:1},uDe=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:tt&&r<=a?{x:0,y:-o.height-s,...d7}:r=a?{x:0,y:o.height+s,...d7}:{x:0,y:0,...d7}};function dDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?nr.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,g=o?p.indexOf(o.id):-1,_=l?p.indexOf(l.id):-1,v=(0,h.useRef)(p),y=!oDe(p,v.current),b=_!==-1&&g===-1||y,x=sDe(a);W8(()=>{y&&m&&u(p)},[y,p,m,u]),(0,h.useEffect)(()=>{v.current=p},[p]);let S=(0,h.useMemo)(()=>({activeIndex:g,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:_,useDragOverlay:f,sortedRects:aDe(p,c),strategy:i}),[g,d,x.draggable,x.droppable,b,p,_,c,f,i]);return h.createElement(p7.Provider,{value:S},t)}var fDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return s7(n,r,i).indexOf(t)},pDe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},mDe={duration:200,easing:`ease`},h7=`transform`,hDe=r5.Transition.toString({property:h7,duration:0,easing:`linear`}),gDe={roleDescription:`sortable`};function _De(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,h.useState)(null),s=(0,h.useRef)(n);return W8(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=g5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,h.useEffect)(()=>{a&&o(null)},[a]),a}function vDe(e){let{animateLayoutChanges:t=pDe,attributes:n,disabled:r,data:i,getNewIndex:a=fDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=mDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,h.useContext)(p7),b=yDe(r,p),x=u.indexOf(o),S=(0,h.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,h.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=iDe({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:ee,transform:I}=eDe({id:o,data:S,attributes:{...gDe,...n},disabled:b.draggable}),te=FTe(D,M),L=!!O,ne=L&&!m&&c7(f)&&c7(_),re=!v&&P,ie=ne?(re&&ne?I:null)??(s??y)({rects:g,activeNodeRect:A,activeIndex:f,overIndex:_,index:x}):null,ae=c7(f)&&c7(_)?a({id:o,items:u,activeIndex:f,overIndex:_}):x,oe=O?.id,se=(0,h.useRef)({activeId:oe,items:u,newIndex:ae,containerId:d}),R=u!==se.current.items,ce=t({active:O,containerId:d,isDragging:P,isSorting:L,id:o,index:x,items:u,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:l,wasDragging:se.current.activeId!=null}),le=_De({disabled:!ce,index:x,node:T,rect:w});return(0,h.useEffect)(()=>{L&&se.current.newIndex!==ae&&(se.current.newIndex=ae),d!==se.current.containerId&&(se.current.containerId=d),u!==se.current.items&&(se.current.items=u)},[L,ae,d,u]),(0,h.useEffect)(()=>{if(oe===se.current.activeId)return;if(oe!=null&&se.current.activeId==null){se.current.activeId=oe;return}let e=setTimeout(()=>{se.current.activeId=oe},50);return()=>clearTimeout(e)},[oe]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:ae,items:u,isOver:E,isSorting:L,isDragging:P,listeners:N,node:T,overIndex:_,over:F,setNodeRef:te,setActivatorNodeRef:ee,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:le??ie,transition:z()};function z(){if(le||R&&se.current.newIndex===x)return hDe;if(!(re&&!t5(k)||!l)&&(L||ce))return r5.Transition.toString({...l,property:h7})}}function yDe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function g7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var bDe=[N5.Down,N5.Right,N5.Up,N5.Left],xDe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(bDe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case N5.Down:r.topa.top&&t.push(n);break;case N5.Left:r.left>a.left&&t.push(n);break;case N5.Right:r.left1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=v5(c).some((e,t)=>s[t]!==e),i=_7(e,t),a=SDe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:e5(u,l)}}}};function _7(e,t){return!g7(e)||!g7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function SDe(e,t){return!g7(e)||!g7(t)||!_7(e,t)?!1:e.data.current.sortable.index0?`more`:`less`} than ${r} ago${n===`good`?`, good`:n===`bad`?`, worse`:``}`}function wDe({delta:e,amount:t,polarity:n,window:r=`1h`}){let i=e>0?`▲`:e<0?`▼`:null,a=CDe(e,t,n,r);return(0,H.jsxs)(q,{component:`span`,fz:12,ff:`monospace`,lh:1.4,px:5,title:a,style:{display:`inline-flex`,alignItems:`center`,gap:4,borderRadius:`var(--mantine-radius-sm)`,background:`var(--driga-tint-neutral)`,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[(0,H.jsxs)(`span`,{"aria-hidden":`true`,children:[i&&`${i} `,e===0?`steady`:t,r&&` · ${r}`]}),(0,H.jsx)(tl,{children:a})]})}var TDe={waiting:`warning`,review:`info`,stuck:`danger`};function EDe(e,t){return t===`neutral`||Math.abs(e)<1e-9?`neutral`:e>0==(t===`up-good`)?`good`:`bad`}function DDe({label:e,sublabel:t,icon:n,value:r,unit:i,total:a,caption:o,detail:s,delta:c,direction:l=`neutral`,trend:u,attention:d,description:f,tooltip:p,selected:m,onClick:g,shortcut:_,size:v=`board`,menu:y,children:b,visual:x,menuItem:S,visibleFrom:C,hiddenFrom:w}){let T=Yn(`dark`),[E,D]=(0,h.useState)(!1),O=r===null||r===0,k=d&&typeof r==`number`&&r>0?TDe[d]:void 0,A=v===`header`,j=c&&!O?(0,H.jsx)(wDe,{delta:c.change,amount:A1(Math.abs(c.change),i),polarity:EDe(c.change,l),window:c.window}):null,M=u&&u.length>1&&!O?(0,H.jsx)(S0,{trend:u,title:e,color:Uy[T][k??`brand`]}):null,N=S?ng.Item:g?$c:G,P=(0,H.jsx)(N,{className:`w-tile`,"data-size":v,"data-clickable":g?``:void 0,"data-selected":m?`true`:void 0,"data-attention":k,"aria-pressed":!S&&g&&m!==void 0?m:void 0,"aria-keyshortcuts":_,onClick:g,onContextMenu:e=>{y?.length&&(e.preventDefault(),D(!0))},title:f,px:A?8:`sm`,py:A?1:`sm`,children:x??(0,H.jsxs)(o_,{gap:A?2:4,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,c:k||`var(--driga-faint)`,children:[n&&(0,H.jsx)(n,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsxs)(q,{size:`xs`,fw:500,tt:`uppercase`,lts:`0.04em`,c:k?`var(--driga-text)`:`dimmed`,lh:A?1.25:1.2,truncate:!0,title:t?`${e} · ${t}`:e,style:{whiteSpace:`nowrap`},children:[e,t&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(q,{span:!0,fz:`xs`,fw:500,ff:`monospace`,tt:`none`,lts:0,lh:`inherit`,c:`dimmed`,children:t})]})]})]}),(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,align:`center`,children:[k&&(0,H.jsx)(Vm,{size:6,color:`var(--mantine-color-${k}-filled)`,withShadow:!1,"aria-hidden":!0,className:d===`waiting`?`w-pulse`:void 0,style:{flex:`none`}}),(0,H.jsx)(G,{c:O?`dimmed`:void 0,style:{whiteSpace:`nowrap`},children:(0,H.jsx)(b0,{n:r,unit:i,total:a,size:A?20:22,lineHeight:A?1.2:1.1})}),o&&(0,H.jsxs)(q,{fz:12,ff:`monospace`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:[`· `,o]}),s&&(0,H.jsxs)(tl,{children:[` `,s]}),A&&M&&(0,H.jsx)(G,{w:72,h:20,"aria-hidden":!0,style:{flex:`none`},children:M}),A&&j&&(0,H.jsx)(G,{visibleFrom:`lg`,children:j})]}),!A&&(j||M)&&(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:6,h:24,children:[j??(0,H.jsx)(`span`,{}),M&&(0,H.jsx)(G,{h:24,style:{flex:`1 1 48px`,minWidth:40,maxWidth:96},children:M})]}),A?(0,H.jsx)(G,{h:3,"aria-hidden":!b||void 0,children:b}):b]})});return(0,H.jsxs)(G,{className:`w-tile-box`,visibleFrom:C,hiddenFrom:w,style:A?{display:`inline-block`}:void 0,children:[p?(0,H.jsx)(Bg,{label:p,events:{hover:!0,focus:!0,touch:!0},children:P}):P,y&&y.length>0&&(0,H.jsxs)(ng,{opened:E,onChange:D,position:`bottom-end`,withinPortal:!S,shadow:`md`,width:200,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{className:`w-tile-menu`,size:18,"aria-label":`More for ${e}`,children:(0,H.jsx)(Vv,{size:14})})}),(0,H.jsx)(ng.Dropdown,{children:y.map(e=>{let t=e.icon,n=(0,H.jsx)(ng.Item,{disabled:e.disabled,leftSection:t?(0,H.jsx)(t,{}):void 0,onClick:e.onClick,children:e.label},e.label);return e.hint?(0,H.jsx)(Bg,{label:e.hint,events:{hover:!0,focus:!0,touch:!0},children:(0,H.jsx)(G,{tabIndex:0,children:n})},e.label):n})})]})]})}function ODe(){return(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,"aria-label":`Driga`,role:`img`,children:[(0,H.jsx)(`img`,{src:`/static/brand/murmur.svg`,width:24,height:24,alt:``}),(0,H.jsx)(`span`,{className:`wordmark`,"aria-hidden":`true`})]})}var v7={tile:`_tile_1nf1e_4`,slot:`_slot_1nf1e_15`,drag:`_drag_1nf1e_22`,measuring:`_measuring_1nf1e_26`,more:`_more_1nf1e_27`};function kDe(){return(0,H.jsx)(Gm,{orientation:`vertical`,h:24,color:`var(--driga-border)`,style:{alignSelf:`center`}})}function ADe({m:e,now:t}){let n=$1(e),r=e.reachable?n?o0(n):`var(--driga-faint)`:`transparent`;return(0,H.jsx)(Bg,{label:_he(e,t),events:{hover:!0,focus:!1,touch:!0},children:(0,H.jsx)(G,{w:8,h:8,"aria-hidden":!0,style:{borderRadius:`50%`,background:r,flex:`none`,boxShadow:e.reachable?void 0:`inset 0 0 0 1.5px var(--driga-faint)`,outline:e.local?`1px solid var(--mantine-color-brand-filled)`:void 0,outlineOffset:1}})})}var jDe=8,y7=6;function MDe(e,t,n,r,i,a){return[{label:`Show on Home`,icon:Ty,onClick:()=>t(e)},...n?[{label:`Ask Chat about it`,icon:Cv,onClick:()=>n(e.title)}]:[],...r?[{label:`Remove from header`,disabled:i||a,hint:i?`The header needs one widget`:void 0,onClick:()=>r(e.id)}]:[]]}function NDe({tile:e,enabled:t,children:n}){let{setNodeRef:r,setActivatorNodeRef:i,attributes:a,listeners:o,transform:s,transition:c}=vDe({id:e.id,disabled:!t});return(0,H.jsxs)(G,{ref:r,"data-header-tile":e.id,"data-reorderable":t||void 0,className:v7.slot,onPointerDown:e=>{e.target.closest(`.w-tile`)&&o?.onPointerDown?.(e)},style:{transition:c,transform:s?`translate3d(${s.x}px, ${s.y}px, 0)`:void 0,zIndex:s?1:void 0},children:[n,t&&(0,H.jsx)(lu,{ref:i,className:v7.drag,size:16,...a,...o,"aria-label":`Reorder ${e.title}`,children:(0,H.jsx)(zv,{size:12})})]})}function b7({id:e,onWidth:t,children:n}){let{ref:r,width:i}=le({box:`border-box`});return(0,h.useLayoutEffect)(()=>{i>0&&t(e,Math.ceil(i))},[e,i,t]),(0,H.jsx)(G,{ref:r,className:v7.slot,children:n})}function PDe({data:e,filter:t,chatOpen:n,onFilter:r,onOpenFleet:i,onSearch:a,onToggleChat:o,onShow:s,onAsk:c,search:l,editor:u,busy:d,onRemove:f,onMove:p}){let{ref:m,width:g}=le(),_=YTe(c5(z5,{activationConstraint:{distance:6}}),c5(F5,{coordinateGetter:xDe})),v=e?.tiles??[],[y,b]=(0,h.useState)({}),x=(0,h.useCallback)((e,t)=>{b(n=>n[e]===t?n:{...n,[e]:t})},[]),S=Array.from({length:Math.max(1,v.length)},(e,t)=>`+${t+1}`),C=Math.max(0,...S.map(e=>y[e]??0)),w=0,T=0;for(let e=0;eMath.floor(g))break;T=n,w=e+1}let E=v.slice(w),D=(n,i=!1,a=!1)=>{let o=n.behavior.attention,l=n.trend,u=l?.[0],m=l?.[l.length-1],h=typeof u==`number`&&typeof m==`number`&&l.length>1?{change:m-u,window:`1h`}:void 0,g=n.viz===`gauge`&&n.value!==null,_=n.value===null?null:g?e0(n.value,n.max??100):n.total==null?null:e0(n.value,n.total),y=(n.viz===`stat`||g)&&_!==null,b=n.error??(o?`${Z1[o].hint} · ${yhe({count:n.value??0,trend:l??[],delta:h?.change??0})}`:n.panel.description??n.title),S=(0,H.jsx)(DDe,{menuItem:i,size:`header`,label:n.title,sublabel:n.behavior.sublabel?e?.localMachine:void 0,icon:n.behavior.icon,value:n.value,unit:n.unit,total:g?void 0:n.total??void 0,caption:n.caption==null?void 0:hhe(n.panel,n.caption),trend:y?void 0:l,delta:y?void 0:h,direction:n.behavior.direction,attention:o,selected:o?t===o:void 0,shortcut:!a&&o?Z1[o].key:void 0,tooltip:a?void 0:b,onClick:a?void 0:()=>o?r(o):s(n.panel),menu:a?void 0:MDe(n.panel,s,c,f,v.length===1,d),children:y&&(0,H.jsx)(Ng,{size:`xs`,value:_,color:g?g0(_/100):g0(_/100,[.9,.9]),"aria-label":`${_}% of ${n.title.toLowerCase()} used`,styles:{root:{background:`var(--driga-border)`}}})});return a?(0,H.jsx)(b7,{id:n.id,onWidth:x,children:S},n.id):(0,H.jsx)(NDe,{tile:n,enabled:!!p&&!d,children:S},n.id)},O=e?.machines??[];return(0,H.jsxs)(K,{h:`100%`,gap:8,wrap:`nowrap`,"data-header-row":!0,"data-header-ready":v.every(e=>y[e.id])&&S.every(e=>y[e]),children:[(0,H.jsx)(ODe,{}),e&&(0,H.jsx)(kDe,{}),(0,H.jsxs)(G,{ref:m,style:{flex:1,minWidth:C,position:`relative`},children:[(0,H.jsx)(ZEe,{sensors:_,collisionDetection:ZTe,onDragEnd:({active:e,over:t})=>{if(!t||e.id===t.id||!p||d)return;let n=v.findIndex(t=>t.id===e.id),r=v.findIndex(e=>e.id===t.id);if(n<0||r<0)return;let i=s7(v,n,r);p(String(e.id),i[r+1]?.id)},children:(0,H.jsx)(m7,{items:v.map(e=>e.id),strategy:cDe,children:(0,H.jsxs)(K,{gap:y7,wrap:`nowrap`,children:[v.slice(0,w).map(e=>D(e)),E.length>0&&(0,H.jsxs)(ng,{position:`bottom-end`,width:`auto`,withinPortal:!0,shadow:`md`,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsxs)(km,{className:v7.more,miw:C||void 0,variant:`subtle`,size:`compact-sm`,"aria-label":`+${E.length}`,children:[`+`,E.length]})}),(0,H.jsx)(ng.Dropdown,{mah:`70vh`,style:{overflowY:`auto`},children:(0,H.jsx)(m7,{items:E.map(e=>e.id),strategy:uDe,children:E.map(e=>D(e,!0))})})]})]})})}),(0,H.jsxs)(G,{className:v7.measuring,"aria-hidden":`true`,inert:!0,children:[v.map(e=>D(e,!1,!0)),S.map(e=>(0,H.jsx)(b7,{id:e,onWidth:x,children:(0,H.jsx)(km,{component:`div`,className:v7.more,variant:`subtle`,size:`compact-sm`,children:e})},e))]})]}),u,e&&(0,H.jsx)(Bg,{label:t0(O),children:(0,H.jsx)($c,{className:v7.tile,px:8,h:32,onClick:i,"aria-label":t0(O),"aria-keyshortcuts":`g f`,children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[O.slice(0,jDe).map(e=>(0,H.jsx)(ADe,{m:e,now:Date.now()},e.id)),O.length===0&&(0,H.jsx)(Dy,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{fz:12,ff:`monospace`,c:`dimmed`,children:O.length})]})})}),l??(0,H.jsx)($c,{className:`search-button`,onClick:a,"aria-keyshortcuts":`Meta+K`,title:`Search sessions and dashboards (⌘K)`,children:(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,children:[(0,H.jsx)(hy,{size:16,"aria-hidden":!0}),(0,H.jsx)(tl,{children:`Search`}),(0,H.jsx)(yh,{size:`xs`,"aria-hidden":!0,children:`⌘K`})]})}),(0,H.jsx)(Bg,{label:n?`Hide Chat`:`Show Chat`,children:(0,H.jsx)(lu,{size:`lg`,variant:n?`light`:`subtle`,color:n?`brand`:`gray`,"aria-pressed":n,"aria-label":`Chat`,onClick:o,children:(0,H.jsx)(Cv,{size:20})})})]})}function x7(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function S7(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function C7(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=x7(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=S7(r,u,s[0]),f=S7(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function FDe(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=x7(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=T7(d,0,s-r),f=T7(f,0,l-i),{x:d,y:f}}function w7(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=x7(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function IDe(e,t,n){let{margin:r,rowHeight:i}=e,a=x7(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function T7(e,t,n){return Math.max(Math.min(e,n),t)}function E7(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function D7(e,t){for(let n=0;nE7(e,t))}function LDe(e,t){return t===`horizontal`?A7(e):t===`vertical`||t===`wrap`?k7(e):[...e]}function k7(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function A7(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function j7(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function M7(e,t){for(let n=0;ne.static===!0)}function P7(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function F7(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=j7(n)),!i.static)n.push(i);else for(;D7(n,i);)i.y++}}return e}function L7(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=LDe(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=O7(d,t),p=f.length>0;if(p&&c)return F7(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return L7(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return L7(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return L7(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:L7(e,n,l,u,r,c,i)}function z7(e,t,n){return Math.max(t,Math.min(n,e))}var B7=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:z7(t,0,Math.max(0,r-e.w)),y:z7(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:z7(t,1,Math.max(1,o)),h:z7(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:z7(t,e.minW??1,e.maxW??1/0),h:z7(n,e.minH??1,e.maxH??1/0)}}}];function V7(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function BDe(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function H7({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function VDe({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function U7(e){return e*100+`%`}function HDe(e,t,n,r){return e+n>r?t:n}function W7(e,t,n){return e<0?t:n}function UDe(e){return Math.max(0,e)}function G7(e){return Math.max(0,e)}var K7=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:W7(o,e.height,i),top:G7(o)}},q7=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:HDe(e.left,e.width,o,n),left:UDe(i)}},J7=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:G7(r),left:0}:{height:i,width:a,top:G7(r),left:o}},Y7=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:W7(r,e.height,a),top:G7(r)}},WDe={n:K7,ne:(e,t,n)=>K7(e,q7(e,t,n)),e:q7,se:(e,t,n)=>Y7(e,q7(e,t,n)),s:Y7,sw:(e,t,n)=>Y7(e,J7(e,t)),w:J7,nw:(e,t,n)=>K7(e,J7(e,t))};function GDe(e,t,n,r){let i=WDe[e];return i?i(t,{...t,...n},r):n}var KDe={type:`transform`,scale:1,calcStyle(e){return H7(e)}},qDe={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},JDe={enabled:!0,bounded:!1,threshold:3},YDe={enabled:!0,handles:[`se`]},XDe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function X7(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??N7(e).length>0;for(let i=o+1;it.y+t.h)break;E7(t,o)&&X7(e,o,n+t[a],r,s)}}t[r]=n}function ZDe(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!D7(e,t);)t.y--;let i;for(;(i=D7(e,t))!==void 0;)X7(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function QDe(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!D7(e,t);)t.x--;let i;for(;(i=D7(e,t))!==void 0;)if(X7(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!D7(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Z7={type:`vertical`,allowOverlap:!1,compact(e,t){let n=N7(e),r=j7(n),i=k7(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function n9(e,t){let n=t9(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function r9(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function i9(e,t,n,r,i,a){let o=e[n];if(o)return F7(o);let s=e[r],c=t9(t),l=c.slice(c.indexOf(n));for(let t=0;t{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))}));function rOe(e){let t=typeof globalThis.getComputedStyle==`function`?globalThis.getComputedStyle(e):null;if(!t)return e.clientWidth;let n=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},r=Number.parseFloat(t.width);return Number.isFinite(r)?Math.max(0,r):Math.max(0,e.clientWidth-n(t.paddingLeft)-n(t.paddingRight))}function iOe(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280,debounceTimeout:r}=e,[i,a]=(0,h.useState)(n),[o,s]=(0,h.useState)(!t),c=(0,h.useRef)(null),l=(0,h.useRef)(null),u=(0,h.useCallback)(()=>{let e=c.current;if(e){let t=Math.round(rOe(e));a(e=>e===t?e:t),o||s(!0)}},[o]);return(0,h.useEffect)(()=>{let e=c.current;if(e){if(u(),typeof ResizeObserver<`u`){let t=null,n;return l.current=new ResizeObserver(e=>{let i=e[0];if(i){let e=Math.round(i.contentRect.width);if(r&&r>0){window.clearTimeout(n),n=window.setTimeout(()=>{a(t=>t===e?t:e),n=void 0},r);return}t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{a(t=>t===e?t:e),t=null})}}),l.current.observe(e),()=>{t!==null&&cancelAnimationFrame(t),window.clearTimeout(n),n=void 0,l.current&&=(l.current.disconnect(),null)}}return()=>{l.current&&=(l.current.disconnect(),null)}}},[u,r]),{width:i,mounted:o,containerRef:c,measureWidth:u}}var o9=l(I_(),1);function s9(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&&s9(e.changedTouches,e=>t===e.identifier)}function _Oe(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function vOe(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function yOe(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??vOe();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} + `},JTe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function YTe(e){let{announcements:t=JTe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=qTe}=e,{announce:a,announcement:o}=WTe(),s=Z8(`DndLiveRegion`),[c,l]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{l(!0)},[]),GTe((0,h.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=h.createElement(h.Fragment,null,h.createElement(HTe,{id:r,value:i.draggable}),h.createElement(UTe,{id:s,announcement:o}));return n?(0,Ae.createPortal)(u,n):u}var o5;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(o5||={});function s5(){}function c5(e,t){return(0,h.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function XTe(){var e=[...arguments];return(0,h.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var l5=Object.freeze({x:0,y:0});function u5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function d5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ZTe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function f5(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function p5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function m5(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var QTe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=m5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=u5(m5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(d5)},$Te=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=f5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=f5(r),o=i.reduce((e,t,r)=>e+u5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(d5)};function eEe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=eEe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ZTe)};function nEe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function h5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:l5}function rEe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var iEe=rEe(1);function aEe(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function oEe(e,t,n){let r=aEe(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var sEe={ignoreTransform:!1};function g5(e,t){t===void 0&&(t=sEe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=z8(e).getComputedStyle(e);t&&(n=oEe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function _5(e){return g5(e,{ignoreTransform:!0})}function cEe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function lEe(e,t){return t===void 0&&(t=z8(e).getComputedStyle(e)),t.position===`fixed`}function uEe(e,t){t===void 0&&(t=z8(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function v5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(B8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!V8(i)||H8(i)||n.includes(i))return n;let a=z8(e).getComputedStyle(i);return i!==e&&uEe(i,a)&&n.push(i),lEe(i,a)?n:r(i.parentNode)}return e?r(e):n}function y5(e){let[t]=v5(e,1);return t??null}function b5(e){return!I8||!e?null:L8(e)?e:R8(e)?B8(e)||e===U8(e).scrollingElement?window:V8(e)?e:null:null}function x5(e){return L8(e)?e.scrollX:e.scrollLeft}function S5(e){return L8(e)?e.scrollY:e.scrollTop}function C5(e){return{x:x5(e),y:S5(e)}}var w5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(w5||={});function T5(e){return!I8||!e?!1:e===document.scrollingElement}function E5(e){let t={x:0,y:0},n=T5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var dEe={x:.2,y:.2};function fEe(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=dEe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=E5(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=w5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=w5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=w5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=w5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function pEe(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function D5(e){return e.reduce((e,t)=>$8(e,C5(t)),l5)}function mEe(e){return e.reduce((e,t)=>e+x5(t),0)}function hEe(e){return e.reduce((e,t)=>e+S5(t),0)}function gEe(e,t){if(t===void 0&&(t=g5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);y5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var _Ee=[[`x`,[`left`,`right`],mEe],[`y`,[`top`,`bottom`],hEe]],O5=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=v5(t),r=D5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of _Ee)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},k5=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function vEe(e){let{EventTarget:t}=z8(e);return e instanceof t?e:U8(e)}function A5(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var j5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(j5||={});function M5(e){e.preventDefault()}function yEe(e){e.stopPropagation()}var N5;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(N5||={});var P5={start:[N5.Space,N5.Enter],cancel:[N5.Esc],end:[N5.Space,N5.Enter,N5.Tab]},bEe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N5.Right:return{...n,x:n.x+25};case N5.Left:return{...n,x:n.x-25};case N5.Down:return{...n,y:n.y+25};case N5.Up:return{...n,y:n.y-25}}},F5=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new k5(U8(t)),this.windowListeners=new k5(z8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(j5.Resize,this.handleCancel),this.windowListeners.add(j5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(j5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&gEe(n),t(l5)}handleKeyDown(e){if(t5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=P5,coordinateGetter:a=bEe,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:l5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=e5(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=E5(n),p=pEe(n),m={x:Math.min(i===N5.Right?p.right-p.width/2:p.right,Math.max(i===N5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===N5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===N5.Down?p.top:p.top+p.height/2,u.y))},h=i===N5.Right&&!s||i===N5.Left&&!c,g=i===N5.Down&&!l||i===N5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===N5.Right&&e<=d.x||i===N5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===N5.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===N5.Down&&e<=d.y||i===N5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===N5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,$8(e5(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};F5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=P5,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function I5(e){return!!(e&&`distance`in e)}function L5(e){return!!(e&&`delay`in e)}var R5=class{constructor(e,t,n){n===void 0&&(n=vEe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=U8(i),this.documentListeners=new k5(this.document),this.listeners=new k5(n),this.windowListeners=new k5(z8(i)),this.initialCoordinates=n5(r)??l5,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(j5.Resize,this.handleCancel),this.windowListeners.add(j5.DragStart,M5),this.windowListeners.add(j5.VisibilityChange,this.handleCancel),this.windowListeners.add(j5.ContextMenu,M5),this.documentListeners.add(j5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(L5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(I5(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(j5.Click,yEe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(j5.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=n5(e)??l5,s=e5(n,o);if(!t&&a){if(I5(a)){if(a.tolerance!=null&&A5(s,a.tolerance))return this.handleCancel();if(A5(s,a.distance))return this.handleStart()}if(L5(a)&&A5(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===N5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},xEe={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},z5=class extends R5{constructor(e){let{event:t}=e,n=U8(t.target);super(e,xEe,n)}};z5.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var SEe={move:{name:`mousemove`},end:{name:`mouseup`}},B5;(function(e){e[e.RightClick=2]=`RightClick`})(B5||={});var CEe=class extends R5{constructor(e){super(e,SEe,U8(e.event.target))}};CEe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==B5.RightClick&&(r?.({event:n}),!0)}}];var V5={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},wEe=class extends R5{constructor(e){super(e,V5)}static setup(){return window.addEventListener(V5.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(V5.move.name,e)};function e(){}}};wEe.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var H5;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(H5||={});var U5;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(U5||={});function TEe(e){let{acceleration:t,activator:n=H5.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=U5.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=DEe({delta:d,disabled:!a}),[m,g]=LTe(),_=(0,h.useRef)({x:0,y:0}),v=(0,h.useRef)({x:0,y:0}),y=(0,h.useMemo)(()=>{switch(n){case H5.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case H5.DraggableRect:return i}},[n,i,c]),b=(0,h.useRef)(null),x=(0,h.useCallback)(()=>{let e=b.current;if(!e)return;let t=_.current.x*v.current.x,n=_.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,h.useMemo)(()=>s===U5.TreeOrder?[...l].reverse():l,[s,l]);(0,h.useEffect)(()=>{if(!a||!l.length||!y)g();else{for(let e of S){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=fEe(e,i,y,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){g(),b.current=e,m(x,o),_.current=s,v.current=a;return}}_.current={x:0,y:0},v.current={x:0,y:0},g()}},[t,x,r,g,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var EEe={x:{[w5.Backward]:!1,[w5.Forward]:!1},y:{[w5.Backward]:!1,[w5.Forward]:!1}};function DEe(e){let{delta:t,disabled:n}=e,r=Y8(t);return q8(e=>{if(n||!r||!e)return EEe;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[w5.Backward]:e.x[w5.Backward]||i.x===-1,[w5.Forward]:e.x[w5.Forward]||i.x===1},y:{[w5.Backward]:e.y[w5.Backward]||i.y===-1,[w5.Forward]:e.y[w5.Forward]||i.y===1}}},[n,t,r])}function OEe(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return q8(e=>t==null?null:r??e??null,[r,t])}function kEe(e,t){return(0,h.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var W5;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(W5||={});var G5;(function(e){e.Optimized=`optimized`})(G5||={});var K5=new Map;function AEe(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,h.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,h.useRef)(e),d=_(),f=K8(d),p=(0,h.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,h.useRef)(null),g=q8(t=>{if(d&&!n)return K5;if(!t||t===K5||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new O5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,h.useEffect)(()=>{u.current=e},[e]),(0,h.useEffect)(()=>{d||p()},[n,d]),(0,h.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,h.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:a!=null};function _(){switch(l){case W5.Always:return!1;case W5.BeforeDragging:return n;default:return!n}}}function q5(e,t){return q8(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function jEe(e,t){return q5(e,t)}function MEe(e){let{callback:t,disabled:n}=e,r=G8(t),i=(0,h.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,h.useEffect)(()=>()=>i?.disconnect(),[i]),i}function J5(e){let{callback:t,disabled:n}=e,r=G8(t),i=(0,h.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,h.useEffect)(()=>()=>i?.disconnect(),[i]),i}function NEe(e){return new O5(g5(e),e)}function Y5(e,t,n){t===void 0&&(t=NEe);let[r,i]=(0,h.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=MEe({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=J5({callback:a});return W8(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function PEe(e){return h5(e,q5(e))}var X5=[];function FEe(e){let t=(0,h.useRef)(e),n=q8(n=>e?n&&n!==X5&&e&&t.current&&e.parentNode===t.current.parentNode?n:v5(e):X5,[e]);return(0,h.useEffect)(()=>{t.current=e},[e]),n}function IEe(e){let[t,n]=(0,h.useState)(null),r=(0,h.useRef)(e),i=(0,h.useCallback)(e=>{let t=b5(e.target);t&&n(e=>e?(e.set(t,C5(t)),new Map(e)):null)},[]);return(0,h.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=b5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,C5(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{b5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,h.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>$8(e,t),l5):D5(e):l5,[e,t])}function Z5(e,t){t===void 0&&(t=[]);let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{n.current=null},t),(0,h.useEffect)(()=>{let t=e!==l5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?e5(e,n.current):l5}function LEe(e){(0,h.useEffect)(()=>{if(!I8)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function REe(e,t){return(0,h.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Q5(e){return(0,h.useMemo)(()=>e?cEe(e):null,[e])}var $5=[];function zEe(e,t){t===void 0&&(t=g5);let[n]=e,r=Q5(n?z8(n):null),[i,a]=(0,h.useState)($5);function o(){a(()=>e.length?e.map(e=>T5(e)?r:new O5(t(e),e)):$5)}let s=J5({callback:o});return W8(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function BEe(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return V8(t)?t:e}function VEe(e){let{measure:t}=e,[n,r]=(0,h.useState)(null),i=J5({callback:(0,h.useCallback)(e=>{for(let{target:n}of e)if(V8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=J8((0,h.useCallback)(e=>{let n=BEe(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,h.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var HEe=[{sensor:z5,options:{}},{sensor:F5,options:{}}],UEe={current:{}},e7={draggable:{measure:_5},droppable:{measure:_5,strategy:W5.WhileDragging,frequency:G5.Optimized},dragOverlay:{measure:g5}},t7=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},WEe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new t7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:s5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:e7,measureDroppableContainers:s5,windowRect:null,measuringScheduled:!1},GEe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:s5,draggableNodes:new Map,over:null,measureDroppableContainers:s5},n7=(0,h.createContext)(GEe),r7=(0,h.createContext)(WEe);function KEe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new t7}}}function qEe(e,t){switch(t.type){case o5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case o5.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case o5.DragEnd:case o5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case o5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new t7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case o5.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new t7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case o5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new t7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function JEe(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,h.useContext)(n7),a=Y8(r),o=Y8(n?.id);return(0,h.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!t5(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=BTe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function YEe(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function XEe(e){return(0,h.useMemo)(()=>({draggable:{...e7.draggable,...e?.draggable},droppable:{...e7.droppable,...e?.droppable},dragOverlay:{...e7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ZEe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,h.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;W8(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=h5(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=y5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var i7=(0,h.createContext)({...l5,scaleX:1,scaleY:1}),a7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(a7||={});var QEe=(0,h.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=HEe,collisionDetection:o=tEe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,h.useReducer)(qEe,void 0,KEe),[f,p]=KTe(),[m,g]=(0,h.useState)(a7.Uninitialized),_=m===a7.Initialized,{draggable:{active:v,nodes:y,translate:b},droppable:{containers:x}}=u,S=v==null?null:y.get(v),C=(0,h.useRef)({initial:null,translated:null}),w=(0,h.useMemo)(()=>v==null?null:{id:v,data:S?.data??UEe,rect:C},[v,S]),T=(0,h.useRef)(null),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),A=K8(l,Object.values(l)),j=Z8(`DndDescribedBy`,t),M=(0,h.useMemo)(()=>x.getEnabled(),[x]),N=XEe(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:ee}=AEe(M,{dragging:_,dependencies:[b.x,b.y],config:N.droppable}),I=OEe(y,v),te=(0,h.useMemo)(()=>O?n5(O):null,[O]),L=ke(),ne=jEe(I,N.draggable.measure);ZEe({activeNode:v==null?null:y.get(v),config:L.layoutShiftCompensation,initialRect:ne,measure:N.draggable.measure});let re=Y5(I,N.draggable.measure,ne),ie=Y5(I?I.parentElement:null),ae=(0,h.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=x.getNodeFor(ae.current.over?.id),se=VEe({measure:N.dragOverlay.measure}),R=se.nodeRef.current??I,ce=_?se.rect??re:null,le=!!(se.nodeRef.current&&se.rect),z=PEe(le?null:re),ue=Q5(R?z8(R):null),de=FEe(_?oe??I:null),fe=zEe(de),pe=YEe(c,{transform:{x:b.x-z.x,y:b.y-z.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:re,containerNodeRect:ie,draggingNodeRect:ce,over:ae.current.over,overlayNodeRect:se.rect,scrollableAncestors:de,scrollableAncestorRects:fe,windowRect:ue}),me=te?$8(te,b):null,he=IEe(de),ge=Z5(he),_e=Z5(he,[re]),ve=$8(pe,ge),B=ce?iEe(ce,pe):null,ye=w&&B?o({active:w,collisionRect:B,droppableRects:P,droppableContainers:M,pointerCoordinates:me}):null,be=p5(ye,`id`),[xe,Se]=(0,h.useState)(null),Ce=nEe(le?pe:$8(pe,_e),xe?.rect??null,re),we=(0,h.useRef)(null),Te=(0,h.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=y.get(T.current);if(!i)return;let a=e.nativeEvent,o=new n({active:T.current,activeNode:i,event:a,options:r,context:ae,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,Ae.unstable_batchedUpdates)(()=>{r?.(i),g(a7.Initializing),d({type:o5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(we.current),k(a)})},onMove(e){d({type:o5.DragMove,coordinates:e})},onEnd:s(o5.DragEnd),onCancel:s(o5.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ae.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===o5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=o5.DragCancel)}T.current=null,(0,Ae.unstable_batchedUpdates)(()=>{d({type:e}),g(a7.Uninitialized),Se(null),D(null),k(null),we.current=null;let t=e===o5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),Ee=kEe(a,(0,h.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Te(n,t))},[y,Te]));LEe(a),W8(()=>{re&&m===a7.Initializing&&g(a7.Initialized)},[re,m]),(0,h.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=ae.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ve.x,y:ve.y},over:i};(0,Ae.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ve.x,ve.y]),(0,h.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ae.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Ae.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),W8(()=>{ae.current={activatorEvent:O,active:w,activeNode:I,collisionRect:B,collisions:ye,droppableRects:P,draggableNodes:y,draggingNode:R,draggingNodeRect:ce,droppableContainers:x,over:xe,scrollableAncestors:de,scrollAdjustedTranslate:ve},C.current={initial:ce,translated:B}},[w,I,ye,B,y,R,ce,P,x,xe,de,ve]),TEe({...L,delta:b,draggingRect:B,pointerCoordinates:me,scrollableAncestors:de,scrollableAncestorRects:fe});let De=(0,h.useMemo)(()=>({active:w,activeNode:I,activeNodeRect:re,activatorEvent:O,collisions:ye,containerNodeRect:ie,dragOverlay:se,draggableNodes:y,droppableContainers:x,droppableRects:P,over:xe,measureDroppableContainers:F,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:N,measuringScheduled:ee,windowRect:ue}),[w,I,re,O,ye,ie,se,y,x,P,xe,F,de,fe,N,ee,ue]),Oe=(0,h.useMemo)(()=>({activatorEvent:O,activators:Ee,active:w,activeNodeRect:re,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:xe,measureDroppableContainers:F}),[O,Ee,w,re,d,j,y,xe,F]);return h.createElement(a5.Provider,{value:p},h.createElement(n7.Provider,{value:Oe},h.createElement(r7.Provider,{value:De},h.createElement(i7.Provider,{value:Ce},i)),h.createElement(JEe,{disabled:n?.restoreFocus===!1})),h.createElement(YTe,{...n,hiddenTextDescribedById:j}));function ke(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=_&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),$Ee=(0,h.createContext)(null),o7=`button`,eDe=`Draggable`;function tDe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Z8(eDe),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,h.useContext)(n7),{role:p=o7,roleDescription:m=`draggable`,tabIndex:g=0}=i??{},_=c?.id===t,v=(0,h.useContext)(_?i7:$Ee),[y,b]=J8(),[x,S]=J8(),C=REe(o,t),w=K8(n);return W8(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,h.useMemo)(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":_&&p===o7?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,_,m,u.draggable]),isDragging:_,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function nDe(){return(0,h.useContext)(r7)}var rDe=`Droppable`,iDe={timeout:25};function aDe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Z8(rDe),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,h.useContext)(n7),u=(0,h.useRef)({disabled:n}),d=(0,h.useRef)(!1),f=(0,h.useRef)(null),p=(0,h.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:_}={...iDe,...i},v=K8(g??r),y=J5({callback:(0,h.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),p.current=null},_)):d.current=!0},[_]),disabled:m||!o}),[b,x]=J8((0,h.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=K8(t);return(0,h.useEffect)(()=>{y&&b.current&&(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,h.useEffect)(()=>(s({type:o5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:o5.UnregisterDroppable,key:a,id:r})),[r]),(0,h.useEffect)(()=>{n!==u.current.disabled&&(s({type:o5.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function s7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function oDe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function c7(e){return e!==null&&e>=0}function sDe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=uDe(t,a,r);if(a===r){let e=t[i];return e?{x:rr&&a<=i?{x:-o.width-s,y:0,...l7}:a=i?{x:o.width+s,y:0,...l7}:{x:0,y:0,...l7}};function uDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=s7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},d7={scaleX:1,scaleY:1},dDe=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:tt&&r<=a?{x:0,y:-o.height-s,...d7}:r=a?{x:0,y:o.height+s,...d7}:{x:0,y:0,...d7}};function fDe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?nr.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,g=o?p.indexOf(o.id):-1,_=l?p.indexOf(l.id):-1,v=(0,h.useRef)(p),y=!sDe(p,v.current),b=_!==-1&&g===-1||y,x=cDe(a);W8(()=>{y&&m&&u(p)},[y,p,m,u]),(0,h.useEffect)(()=>{v.current=p},[p]);let S=(0,h.useMemo)(()=>({activeIndex:g,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:_,useDragOverlay:f,sortedRects:oDe(p,c),strategy:i}),[g,d,x.draggable,x.droppable,b,p,_,c,f,i]);return h.createElement(p7.Provider,{value:S},t)}var pDe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return s7(n,r,i).indexOf(t)},mDe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},hDe={duration:200,easing:`ease`},h7=`transform`,gDe=r5.Transition.toString({property:h7,duration:0,easing:`linear`}),_De={roleDescription:`sortable`};function vDe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,h.useState)(null),s=(0,h.useRef)(n);return W8(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=g5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,h.useEffect)(()=>{a&&o(null)},[a]),a}function yDe(e){let{animateLayoutChanges:t=mDe,attributes:n,disabled:r,data:i,getNewIndex:a=pDe,id:o,strategy:s,resizeObserverConfig:c,transition:l=hDe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:g,overIndex:_,useDragOverlay:v,strategy:y}=(0,h.useContext)(p7),b=bDe(r,p),x=u.indexOf(o),S=(0,h.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,h.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=aDe({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:ee,transform:I}=tDe({id:o,data:S,attributes:{..._De,...n},disabled:b.draggable}),te=ITe(D,M),L=!!O,ne=L&&!m&&c7(f)&&c7(_),re=!v&&P,ie=ne?(re&&ne?I:null)??(s??y)({rects:g,activeNodeRect:A,activeIndex:f,overIndex:_,index:x}):null,ae=c7(f)&&c7(_)?a({id:o,items:u,activeIndex:f,overIndex:_}):x,oe=O?.id,se=(0,h.useRef)({activeId:oe,items:u,newIndex:ae,containerId:d}),R=u!==se.current.items,ce=t({active:O,containerId:d,isDragging:P,isSorting:L,id:o,index:x,items:u,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:l,wasDragging:se.current.activeId!=null}),le=vDe({disabled:!ce,index:x,node:T,rect:w});return(0,h.useEffect)(()=>{L&&se.current.newIndex!==ae&&(se.current.newIndex=ae),d!==se.current.containerId&&(se.current.containerId=d),u!==se.current.items&&(se.current.items=u)},[L,ae,d,u]),(0,h.useEffect)(()=>{if(oe===se.current.activeId)return;if(oe!=null&&se.current.activeId==null){se.current.activeId=oe;return}let e=setTimeout(()=>{se.current.activeId=oe},50);return()=>clearTimeout(e)},[oe]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:ae,items:u,isOver:E,isSorting:L,isDragging:P,listeners:N,node:T,overIndex:_,over:F,setNodeRef:te,setActivatorNodeRef:ee,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:le??ie,transition:z()};function z(){if(le||R&&se.current.newIndex===x)return gDe;if(!(re&&!t5(k)||!l)&&(L||ce))return r5.Transition.toString({...l,property:h7})}}function bDe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function g7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var xDe=[N5.Down,N5.Right,N5.Up,N5.Left],SDe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(xDe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case N5.Down:r.topa.top&&t.push(n);break;case N5.Left:r.left>a.left&&t.push(n);break;case N5.Right:r.left1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=v5(c).some((e,t)=>s[t]!==e),i=_7(e,t),a=CDe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:e5(u,l)}}}};function _7(e,t){return!g7(e)||!g7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function CDe(e,t){return!g7(e)||!g7(t)||!_7(e,t)?!1:e.data.current.sortable.index0?`more`:`less`} than ${r} ago${n===`good`?`, good`:n===`bad`?`, worse`:``}`}function TDe({delta:e,amount:t,polarity:n,window:r=`1h`}){let i=e>0?`▲`:e<0?`▼`:null,a=wDe(e,t,n,r);return(0,H.jsxs)(q,{component:`span`,fz:12,ff:`monospace`,lh:1.4,px:5,title:a,style:{display:`inline-flex`,alignItems:`center`,gap:4,borderRadius:`var(--mantine-radius-sm)`,background:`var(--driga-tint-neutral)`,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[(0,H.jsxs)(`span`,{"aria-hidden":`true`,children:[i&&`${i} `,e===0?`steady`:t,r&&` · ${r}`]}),(0,H.jsx)(tl,{children:a})]})}var EDe={waiting:`warning`,review:`info`,stuck:`danger`};function DDe(e,t){return t===`neutral`||Math.abs(e)<1e-9?`neutral`:e>0==(t===`up-good`)?`good`:`bad`}function ODe({label:e,sublabel:t,icon:n,value:r,unit:i,total:a,caption:o,detail:s,delta:c,direction:l=`neutral`,trend:u,attention:d,description:f,tooltip:p,selected:m,onClick:g,shortcut:_,size:v=`board`,menu:y,children:b,visual:x,menuItem:S,visibleFrom:C,hiddenFrom:w}){let T=Yn(`dark`),[E,D]=(0,h.useState)(!1),O=r===null||r===0,k=d&&typeof r==`number`&&r>0?EDe[d]:void 0,A=v===`header`,j=c&&!O?(0,H.jsx)(TDe,{delta:c.change,amount:j1(Math.abs(c.change),i),polarity:DDe(c.change,l),window:c.window}):null,M=u&&u.length>1&&!O?(0,H.jsx)(C0,{trend:u,title:e,color:Uy[T][k??`brand`]}):null,N=S?ng.Item:g?$c:G,P=(0,H.jsx)(N,{className:`w-tile`,"data-size":v,"data-clickable":g?``:void 0,"data-selected":m?`true`:void 0,"data-attention":k,"aria-pressed":!S&&g&&m!==void 0?m:void 0,"aria-keyshortcuts":_,onClick:g,onContextMenu:e=>{y?.length&&(e.preventDefault(),D(!0))},title:f,px:A?8:`sm`,py:A?1:`sm`,children:x??(0,H.jsxs)(o_,{gap:A?2:4,children:[(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,c:k||`var(--driga-faint)`,children:[n&&(0,H.jsx)(n,{size:14,"aria-hidden":!0,style:{flex:`none`}}),(0,H.jsxs)(q,{size:`xs`,fw:500,tt:`uppercase`,lts:`0.04em`,c:k?`var(--driga-text)`:`dimmed`,lh:A?1.25:1.2,truncate:!0,title:t?`${e} · ${t}`:e,style:{whiteSpace:`nowrap`},children:[e,t&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(q,{span:!0,fz:`xs`,fw:500,ff:`monospace`,tt:`none`,lts:0,lh:`inherit`,c:`dimmed`,children:t})]})]})]}),(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,align:`center`,children:[k&&(0,H.jsx)(Vm,{size:6,color:`var(--mantine-color-${k}-filled)`,withShadow:!1,"aria-hidden":!0,className:d===`waiting`?`w-pulse`:void 0,style:{flex:`none`}}),(0,H.jsx)(G,{c:O?`dimmed`:void 0,style:{whiteSpace:`nowrap`},children:(0,H.jsx)(x0,{n:r,unit:i,total:a,size:A?20:22,lineHeight:A?1.2:1.1})}),o&&(0,H.jsxs)(q,{fz:12,ff:`monospace`,c:`dimmed`,lh:1.2,style:{whiteSpace:`nowrap`},children:[`· `,o]}),s&&(0,H.jsxs)(tl,{children:[` `,s]}),A&&M&&(0,H.jsx)(G,{w:72,h:20,"aria-hidden":!0,style:{flex:`none`},children:M}),A&&j&&(0,H.jsx)(G,{visibleFrom:`lg`,children:j})]}),!A&&(j||M)&&(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:6,h:24,children:[j??(0,H.jsx)(`span`,{}),M&&(0,H.jsx)(G,{h:24,style:{flex:`1 1 48px`,minWidth:40,maxWidth:96},children:M})]}),A?(0,H.jsx)(G,{h:3,"aria-hidden":!b||void 0,children:b}):b]})});return(0,H.jsxs)(G,{className:`w-tile-box`,visibleFrom:C,hiddenFrom:w,style:A?{display:`inline-block`}:void 0,children:[p?(0,H.jsx)(Bg,{label:p,events:{hover:!0,focus:!0,touch:!0},children:P}):P,y&&y.length>0&&(0,H.jsxs)(ng,{opened:E,onChange:D,position:`bottom-end`,withinPortal:!S,shadow:`md`,width:200,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{className:`w-tile-menu`,size:18,"aria-label":`More for ${e}`,children:(0,H.jsx)(Vv,{size:14})})}),(0,H.jsx)(ng.Dropdown,{children:y.map(e=>{let t=e.icon,n=(0,H.jsx)(ng.Item,{disabled:e.disabled,leftSection:t?(0,H.jsx)(t,{}):void 0,onClick:e.onClick,children:e.label},e.label);return e.hint?(0,H.jsx)(Bg,{label:e.hint,events:{hover:!0,focus:!0,touch:!0},children:(0,H.jsx)(G,{tabIndex:0,children:n})},e.label):n})})]})]})}function kDe(){return(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,"aria-label":`Driga`,role:`img`,children:[(0,H.jsx)(`img`,{src:`/static/brand/murmur.svg`,width:24,height:24,alt:``}),(0,H.jsx)(`span`,{className:`wordmark`,"aria-hidden":`true`})]})}var v7={tile:`_tile_1nf1e_4`,slot:`_slot_1nf1e_15`,drag:`_drag_1nf1e_22`,measuring:`_measuring_1nf1e_26`,more:`_more_1nf1e_27`};function ADe(){return(0,H.jsx)(Gm,{orientation:`vertical`,h:24,color:`var(--driga-border)`,style:{alignSelf:`center`}})}function jDe({m:e,now:t}){let n=e0(e),r=e.reachable?n?s0(n):`var(--driga-faint)`:`transparent`;return(0,H.jsx)(Bg,{label:ghe(e,t),events:{hover:!0,focus:!1,touch:!0},children:(0,H.jsx)(G,{w:8,h:8,"aria-hidden":!0,style:{borderRadius:`50%`,background:r,flex:`none`,boxShadow:e.reachable?void 0:`inset 0 0 0 1.5px var(--driga-faint)`,outline:e.local?`1px solid var(--mantine-color-brand-filled)`:void 0,outlineOffset:1}})})}var MDe=8,y7=6;function NDe(e,t,n,r,i,a){return[{label:`Show on Home`,icon:Ty,onClick:()=>t(e)},...n?[{label:`Ask Chat about it`,icon:Cv,onClick:()=>n(e.title)}]:[],...r?[{label:`Remove from header`,disabled:i||a,hint:i?`The header needs one widget`:void 0,onClick:()=>r(e.id)}]:[]]}function PDe({tile:e,enabled:t,children:n}){let{setNodeRef:r,setActivatorNodeRef:i,attributes:a,listeners:o,transform:s,transition:c}=yDe({id:e.id,disabled:!t});return(0,H.jsxs)(G,{ref:r,"data-header-tile":e.id,"data-reorderable":t||void 0,className:v7.slot,onPointerDown:e=>{e.target.closest(`.w-tile`)&&o?.onPointerDown?.(e)},style:{transition:c,transform:s?`translate3d(${s.x}px, ${s.y}px, 0)`:void 0,zIndex:s?1:void 0},children:[n,t&&(0,H.jsx)(lu,{ref:i,className:v7.drag,size:16,...a,...o,"aria-label":`Reorder ${e.title}`,children:(0,H.jsx)(zv,{size:12})})]})}function b7({id:e,onWidth:t,children:n}){let{ref:r,width:i}=le({box:`border-box`});return(0,h.useLayoutEffect)(()=>{i>0&&t(e,Math.ceil(i))},[e,i,t]),(0,H.jsx)(G,{ref:r,className:v7.slot,children:n})}function FDe({data:e,filter:t,chatOpen:n,onFilter:r,onOpenFleet:i,onSearch:a,onToggleChat:o,onShow:s,onAsk:c,search:l,editor:u,busy:d,onRemove:f,onMove:p}){let{ref:m,width:g}=le(),_=XTe(c5(z5,{activationConstraint:{distance:6}}),c5(F5,{coordinateGetter:SDe})),v=e?.tiles??[],[y,b]=(0,h.useState)({}),x=(0,h.useCallback)((e,t)=>{b(n=>n[e]===t?n:{...n,[e]:t})},[]),S=Array.from({length:Math.max(1,v.length)},(e,t)=>`+${t+1}`),C=Math.max(0,...S.map(e=>y[e]??0)),w=0,T=0;for(let e=0;eMath.floor(g))break;T=n,w=e+1}let E=v.slice(w),D=(n,i=!1,a=!1)=>{let o=n.behavior.attention,l=n.trend,u=l?.[0],m=l?.[l.length-1],h=typeof u==`number`&&typeof m==`number`&&l.length>1?{change:m-u,window:`1h`}:void 0,g=n.viz===`gauge`&&n.value!==null,_=n.value===null?null:g?t0(n.value,n.max??100):n.total==null?null:t0(n.value,n.total),y=(n.viz===`stat`||g)&&_!==null,b=n.error??(o?`${Q1[o].hint} · ${vhe({count:n.value??0,trend:l??[],delta:h?.change??0})}`:n.panel.description??n.title),S=(0,H.jsx)(ODe,{menuItem:i,size:`header`,label:n.title,sublabel:n.behavior.sublabel?e?.localMachine:void 0,icon:n.behavior.icon,value:n.value,unit:n.unit,total:g?void 0:n.total??void 0,caption:n.caption==null?void 0:mhe(n.panel,n.caption),trend:y?void 0:l,delta:y?void 0:h,direction:n.behavior.direction,attention:o,selected:o?t===o:void 0,shortcut:!a&&o?Q1[o].key:void 0,tooltip:a?void 0:b,onClick:a?void 0:()=>o?r(o):s(n.panel),menu:a?void 0:NDe(n.panel,s,c,f,v.length===1,d),children:y&&(0,H.jsx)(Ng,{size:`xs`,value:_,color:g?_0(_/100):_0(_/100,[.9,.9]),"aria-label":`${_}% of ${n.title.toLowerCase()} used`,styles:{root:{background:`var(--driga-border)`}}})});return a?(0,H.jsx)(b7,{id:n.id,onWidth:x,children:S},n.id):(0,H.jsx)(PDe,{tile:n,enabled:!!p&&!d,children:S},n.id)},O=e?.machines??[];return(0,H.jsxs)(K,{h:`100%`,gap:8,wrap:`nowrap`,"data-header-row":!0,"data-header-ready":v.every(e=>y[e.id])&&S.every(e=>y[e]),children:[(0,H.jsx)(kDe,{}),e&&(0,H.jsx)(ADe,{}),(0,H.jsxs)(G,{ref:m,style:{flex:1,minWidth:C,position:`relative`},children:[(0,H.jsx)(QEe,{sensors:_,collisionDetection:QTe,onDragEnd:({active:e,over:t})=>{if(!t||e.id===t.id||!p||d)return;let n=v.findIndex(t=>t.id===e.id),r=v.findIndex(e=>e.id===t.id);if(n<0||r<0)return;let i=s7(v,n,r);p(String(e.id),i[r+1]?.id)},children:(0,H.jsx)(m7,{items:v.map(e=>e.id),strategy:lDe,children:(0,H.jsxs)(K,{gap:y7,wrap:`nowrap`,children:[v.slice(0,w).map(e=>D(e)),E.length>0&&(0,H.jsxs)(ng,{position:`bottom-end`,width:`auto`,withinPortal:!0,shadow:`md`,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsxs)(km,{className:v7.more,miw:C||void 0,variant:`subtle`,size:`compact-sm`,"aria-label":`+${E.length}`,children:[`+`,E.length]})}),(0,H.jsx)(ng.Dropdown,{mah:`70vh`,style:{overflowY:`auto`},children:(0,H.jsx)(m7,{items:E.map(e=>e.id),strategy:dDe,children:E.map(e=>D(e,!0))})})]})]})})}),(0,H.jsxs)(G,{className:v7.measuring,"aria-hidden":`true`,inert:!0,children:[v.map(e=>D(e,!1,!0)),S.map(e=>(0,H.jsx)(b7,{id:e,onWidth:x,children:(0,H.jsx)(km,{component:`div`,className:v7.more,variant:`subtle`,size:`compact-sm`,children:e})},e))]})]}),u,e&&(0,H.jsx)(Bg,{label:n0(O),children:(0,H.jsx)($c,{className:v7.tile,px:8,h:32,onClick:i,"aria-label":n0(O),"aria-keyshortcuts":`g f`,children:(0,H.jsxs)(K,{gap:6,wrap:`nowrap`,children:[O.slice(0,MDe).map(e=>(0,H.jsx)(jDe,{m:e,now:Date.now()},e.id)),O.length===0&&(0,H.jsx)(Dy,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{fz:12,ff:`monospace`,c:`dimmed`,children:O.length})]})})}),l??(0,H.jsx)($c,{className:`search-button`,onClick:a,"aria-keyshortcuts":`Meta+K`,title:`Search sessions and dashboards (⌘K)`,children:(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,children:[(0,H.jsx)(hy,{size:16,"aria-hidden":!0}),(0,H.jsx)(tl,{children:`Search`}),(0,H.jsx)(yh,{size:`xs`,"aria-hidden":!0,children:`⌘K`})]})}),(0,H.jsx)(Bg,{label:n?`Hide Chat`:`Show Chat`,children:(0,H.jsx)(lu,{size:`lg`,variant:n?`light`:`subtle`,color:n?`brand`:`gray`,"aria-pressed":n,"aria-label":`Chat`,onClick:o,children:(0,H.jsx)(Cv,{size:20})})})]})}function x7(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function S7(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function C7(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=x7(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=S7(r,u,s[0]),f=S7(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function IDe(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=x7(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=T7(d,0,s-r),f=T7(f,0,l-i),{x:d,y:f}}function w7(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=x7(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function LDe(e,t,n){let{margin:r,rowHeight:i}=e,a=x7(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function T7(e,t,n){return Math.max(Math.min(e,n),t)}function E7(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function D7(e,t){for(let n=0;nE7(e,t))}function RDe(e,t){return t===`horizontal`?A7(e):t===`vertical`||t===`wrap`?k7(e):[...e]}function k7(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function A7(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function j7(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function M7(e,t){for(let n=0;ne.static===!0)}function P7(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function F7(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=j7(n)),!i.static)n.push(i);else for(;D7(n,i);)i.y++}}return e}function L7(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=RDe(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=O7(d,t),p=f.length>0;if(p&&c)return F7(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return L7(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return L7(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return L7(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:L7(e,n,l,u,r,c,i)}function z7(e,t,n){return Math.max(t,Math.min(n,e))}var B7=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:z7(t,0,Math.max(0,r-e.w)),y:z7(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:z7(t,1,Math.max(1,o)),h:z7(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:z7(t,e.minW??1,e.maxW??1/0),h:z7(n,e.minH??1,e.maxH??1/0)}}}];function V7(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function VDe(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function H7({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function HDe({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function U7(e){return e*100+`%`}function UDe(e,t,n,r){return e+n>r?t:n}function W7(e,t,n){return e<0?t:n}function WDe(e){return Math.max(0,e)}function G7(e){return Math.max(0,e)}var K7=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:W7(o,e.height,i),top:G7(o)}},q7=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:UDe(e.left,e.width,o,n),left:WDe(i)}},J7=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:G7(r),left:0}:{height:i,width:a,top:G7(r),left:o}},Y7=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:W7(r,e.height,a),top:G7(r)}},GDe={n:K7,ne:(e,t,n)=>K7(e,q7(e,t,n)),e:q7,se:(e,t,n)=>Y7(e,q7(e,t,n)),s:Y7,sw:(e,t,n)=>Y7(e,J7(e,t)),w:J7,nw:(e,t,n)=>K7(e,J7(e,t))};function KDe(e,t,n,r){let i=GDe[e];return i?i(t,{...t,...n},r):n}var qDe={type:`transform`,scale:1,calcStyle(e){return H7(e)}},JDe={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},YDe={enabled:!0,bounded:!1,threshold:3},XDe={enabled:!0,handles:[`se`]},ZDe={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function X7(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??N7(e).length>0;for(let i=o+1;it.y+t.h)break;E7(t,o)&&X7(e,o,n+t[a],r,s)}}t[r]=n}function QDe(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!D7(e,t);)t.y--;let i;for(;(i=D7(e,t))!==void 0;)X7(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function $De(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!D7(e,t);)t.x--;let i;for(;(i=D7(e,t))!==void 0;)if(X7(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!D7(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Z7={type:`vertical`,allowOverlap:!1,compact(e,t){let n=N7(e),r=j7(n),i=k7(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function n9(e,t){let n=t9(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function r9(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function i9(e,t,n,r,i,a){let o=e[n];if(o)return F7(o);let s=e[r],c=t9(t),l=c.slice(c.indexOf(n));for(let t=0;t{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(n,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function O(e,t){return D(e,t,new WeakMap)}var k=c(r(S,{createIsNestedEqual:function(){return o}}));function A(e,t){return k(e,t,new WeakMap)}function j(e){return c(r(x,e(x)))}function M(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=O,e.circularShallowEqual=A,e.createCustomCircularEqual=M,e.createCustomEqual=j,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))}));function iOe(e){let t=typeof globalThis.getComputedStyle==`function`?globalThis.getComputedStyle(e):null;if(!t)return e.clientWidth;let n=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},r=Number.parseFloat(t.width);return Number.isFinite(r)?Math.max(0,r):Math.max(0,e.clientWidth-n(t.paddingLeft)-n(t.paddingRight))}function aOe(e={}){let{measureBeforeMount:t=!1,initialWidth:n=1280,debounceTimeout:r}=e,[i,a]=(0,h.useState)(n),[o,s]=(0,h.useState)(!t),c=(0,h.useRef)(null),l=(0,h.useRef)(null),u=(0,h.useCallback)(()=>{let e=c.current;if(e){let t=Math.round(iOe(e));a(e=>e===t?e:t),o||s(!0)}},[o]);return(0,h.useEffect)(()=>{let e=c.current;if(e){if(u(),typeof ResizeObserver<`u`){let t=null,n;return l.current=new ResizeObserver(e=>{let i=e[0];if(i){let e=Math.round(i.contentRect.width);if(r&&r>0){window.clearTimeout(n),n=window.setTimeout(()=>{a(t=>t===e?t:e),n=void 0},r);return}t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{a(t=>t===e?t:e),t=null})}}),l.current.observe(e),()=>{t!==null&&cancelAnimationFrame(t),window.clearTimeout(n),n=void 0,l.current&&=(l.current.disconnect(),null)}}return()=>{l.current&&=(l.current.disconnect(),null)}}},[u,r]),{width:i,mounted:o,containerRef:c,measureWidth:u}}var o9=l(I_(),1);function s9(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&&s9(e.changedTouches,e=>t===e.identifier)}function vOe(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function yOe(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function bOe(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??yOe();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&&bOe(e.body,`react-draggable-transparent-selection`)}function y9(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{b9(e)}):b9(e)}function b9(e){if(e)try{e.body&&xOe(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 bOe(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function xOe(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function SOe(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:TOe(r);let i=T9(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+u9(s.paddingLeft)+u9(o.marginLeft),top:-i.offsetTop+u9(s.paddingTop)+u9(o.marginTop),right:fOe(a)-uOe(i)-i.offsetLeft+u9(s.paddingRight)-u9(o.marginRight),bottom:dOe(a)-lOe(i)-i.offsetTop+u9(s.paddingBottom)-u9(o.marginBottom)}}return l9(r.right)&&(t=Math.min(t,r.right)),l9(r.bottom)&&(n=Math.min(n,r.bottom)),l9(r.left)&&(t=Math.max(t,r.left)),l9(r.top)&&(n=Math.max(n,r.top)),[t,n]}function x9(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function COe(e){return e.props.axis===`both`||e.props.axis===`x`}function wOe(e){return e.props.axis===`both`||e.props.axis===`y`}function S9(e,t,n){let r=typeof t==`number`?gOe(e,t):null;if(typeof t==`number`&&!r)return null;let i=T9(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return pOe(r||e,a,n.props.scale)}function C9(e,t,n){let r=!l9(e.lastX),i=T9(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 w9(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 TOe(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function T9(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var E9=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},D9={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},O9=D9.mouse,k9=class extends h.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&&!h9(e.target,this.props.handle,t)||this.props.cancel&&h9(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=_Oe(e);this.touchIdentifier=r;let i=S9(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=C9(this,a,o);E9(`DraggableCore: handleDragStart: %j`,s),E9(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&yOe(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,g9(n,O9.move,this.handleDrag),g9(n,O9.stop,this.handleDragStop))},this.handleDrag=e=>{let t=S9(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]=x9(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=C9(this,n,r);if(E9(`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)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=S9(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]=x9(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=C9(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&y9(a.ownerDocument),E9(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(E9(`DraggableCore: Removing handlers`),_9(a.ownerDocument,O9.move,this.handleDrag),_9(a.ownerDocument,O9.stop,this.handleDragStop))},this.onMouseDown=e=>(O9=D9.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(O9=D9.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(O9=D9.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(O9=D9.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&g9(e,D9.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;_9(t,D9.mouse.move,this.handleDrag),_9(t,D9.touch.move,this.handleDrag),_9(t,D9.mouse.stop,this.handleDragStop),_9(t,D9.touch.stop,this.handleDragStop),_9(e,D9.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&y9(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ae.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(E9(`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 h.cloneElement(h.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};k9.displayName=`DraggableCore`,k9.propTypes={allowAnyClick:o9.default.bool,allowMobileScroll:o9.default.bool,children:o9.default.node.isRequired,disabled:o9.default.bool,enableUserSelectHack:o9.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:o9.default.arrayOf(o9.default.number),handle:o9.default.string,cancel:o9.default.string,nodeRef:o9.default.object,nonce:o9.default.string,onStart:o9.default.func,onDrag:o9.default.func,onStop:o9.default.func,onMouseDown:o9.default.func,scale:o9.default.number,className:d9,style:d9,transform:d9},k9.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var A9=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(E9(`Draggable: onDragStart: %j`,t),this.props.onStart(e,w9(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;E9(`Draggable: onDrag: %j`,t);let n=w9(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]=SOe(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,w9(this,t))===!1)return!1;E9(`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)?(E9(`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=Ae.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,g={x:COe(this)&&p?this.state.x:m.x,y:wOe(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=hOe(g,c):d=mOe(g,c);let _=h.Children.only(n),v=tn(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(k9,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:v,style:{..._.props.style,...d},transform:f}))}};A9.displayName=`Draggable`,A9.propTypes={...k9.propTypes,axis:o9.default.oneOf([`both`,`x`,`y`,`none`]),bounds:o9.default.oneOfType([o9.default.shape({left:o9.default.number,right:o9.default.number,top:o9.default.number,bottom:o9.default.number}),o9.default.string,o9.default.oneOf([!1])]),defaultClassName:o9.default.string,defaultClassNameDragging:o9.default.string,defaultClassNameDragged:o9.default.string,defaultPosition:o9.default.shape({x:o9.default.number,y:o9.default.number}),positionOffset:o9.default.shape({x:o9.default.oneOfType([o9.default.number,o9.default.string]),y:o9.default.oneOfType([o9.default.number,o9.default.string])}),position:o9.default.shape({x:o9.default.number,y:o9.default.number}),className:d9,style:d9,transform:d9},A9.defaultProps={...k9.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var EOe=o(((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 n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{DraggableCore:()=>Ce,default:()=>we}),t.exports=d(f);var p=u(m()),h=u(I_()),g=u(ke()),_=EOe();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 ie(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ae(){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??ae();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&xOe(e.body,`react-draggable-transparent-selection`)}function y9(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{b9(e)}):b9(e)}function b9(e){if(e)try{e.body&&SOe(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 xOe(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function SOe(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function COe(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:EOe(r);let i=T9(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+u9(s.paddingLeft)+u9(o.marginLeft),top:-i.offsetTop+u9(s.paddingTop)+u9(o.marginTop),right:pOe(a)-dOe(i)-i.offsetLeft+u9(s.paddingRight)-u9(o.marginRight),bottom:fOe(a)-uOe(i)-i.offsetTop+u9(s.paddingBottom)-u9(o.marginBottom)}}return l9(r.right)&&(t=Math.min(t,r.right)),l9(r.bottom)&&(n=Math.min(n,r.bottom)),l9(r.left)&&(t=Math.max(t,r.left)),l9(r.top)&&(n=Math.max(n,r.top)),[t,n]}function x9(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function wOe(e){return e.props.axis===`both`||e.props.axis===`x`}function TOe(e){return e.props.axis===`both`||e.props.axis===`y`}function S9(e,t,n){let r=typeof t==`number`?_Oe(e,t):null;if(typeof t==`number`&&!r)return null;let i=T9(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return mOe(r||e,a,n.props.scale)}function C9(e,t,n){let r=!l9(e.lastX),i=T9(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 w9(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 EOe(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function T9(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var E9=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},D9={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},O9=D9.mouse,k9=class extends h.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&&!h9(e.target,this.props.handle,t)||this.props.cancel&&h9(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=vOe(e);this.touchIdentifier=r;let i=S9(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=C9(this,a,o);E9(`DraggableCore: handleDragStart: %j`,s),E9(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&bOe(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,g9(n,O9.move,this.handleDrag),g9(n,O9.stop,this.handleDragStop))},this.handleDrag=e=>{let t=S9(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]=x9(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=C9(this,n,r);if(E9(`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)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=S9(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]=x9(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=C9(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&y9(a.ownerDocument),E9(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(E9(`DraggableCore: Removing handlers`),_9(a.ownerDocument,O9.move,this.handleDrag),_9(a.ownerDocument,O9.stop,this.handleDragStop))},this.onMouseDown=e=>(O9=D9.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(O9=D9.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(O9=D9.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(O9=D9.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&g9(e,D9.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;_9(t,D9.mouse.move,this.handleDrag),_9(t,D9.touch.move,this.handleDrag),_9(t,D9.mouse.stop,this.handleDragStop),_9(t,D9.touch.stop,this.handleDragStop),_9(e,D9.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&y9(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ae.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(E9(`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 h.cloneElement(h.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};k9.displayName=`DraggableCore`,k9.propTypes={allowAnyClick:o9.default.bool,allowMobileScroll:o9.default.bool,children:o9.default.node.isRequired,disabled:o9.default.bool,enableUserSelectHack:o9.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:o9.default.arrayOf(o9.default.number),handle:o9.default.string,cancel:o9.default.string,nodeRef:o9.default.object,nonce:o9.default.string,onStart:o9.default.func,onDrag:o9.default.func,onStop:o9.default.func,onMouseDown:o9.default.func,scale:o9.default.number,className:d9,style:d9,transform:d9},k9.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var A9=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(E9(`Draggable: onDragStart: %j`,t),this.props.onStart(e,w9(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;E9(`Draggable: onDrag: %j`,t);let n=w9(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]=COe(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,w9(this,t))===!1)return!1;E9(`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)?(E9(`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=Ae.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,g={x:wOe(this)&&p?this.state.x:m.x,y:TOe(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=gOe(g,c):d=hOe(g,c);let _=h.Children.only(n),v=tn(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(k9,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:v,style:{..._.props.style,...d},transform:f}))}};A9.displayName=`Draggable`,A9.propTypes={...k9.propTypes,axis:o9.default.oneOf([`both`,`x`,`y`,`none`]),bounds:o9.default.oneOfType([o9.default.shape({left:o9.default.number,right:o9.default.number,top:o9.default.number,bottom:o9.default.number}),o9.default.string,o9.default.oneOf([!1])]),defaultClassName:o9.default.string,defaultClassNameDragging:o9.default.string,defaultClassNameDragged:o9.default.string,defaultPosition:o9.default.shape({x:o9.default.number,y:o9.default.number}),positionOffset:o9.default.shape({x:o9.default.oneOfType([o9.default.number,o9.default.string]),y:o9.default.oneOfType([o9.default.number,o9.default.string])}),position:o9.default.shape({x:o9.default.number,y:o9.default.number}),className:d9,style:d9,transform:d9},A9.defaultProps={...k9.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var DOe=o(((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 n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{DraggableCore:()=>Ce,default:()=>we}),t.exports=d(f);var p=u(m()),h=u(I_()),g=u(ke()),_=DOe();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 ie(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function ae(){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??ae();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 se(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{R(e)}):R(e)}function R(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 z(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(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+x(s.paddingLeft)+x(o.marginLeft),top:-i.offsetTop+x(s.paddingTop)+x(o.marginTop),right:ee(a)-P(i)-i.offsetLeft+x(s.paddingRight)-x(o.marginRight),bottom:F(a)-N(i)-i.offsetTop+x(s.paddingBottom)-x(o.marginBottom)}}return b(r.right)&&(t=Math.min(t,r.right)),b(r.bottom)&&(n=Math.min(n,r.bottom)),b(r.left)&&(t=Math.max(t,r.left)),b(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return I(r||e,a,n.props.scale)}function me(e,t,n){let r=!b(e.lastX),i=_e(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 he(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 ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=u(m()),B=u(I_()),ye=u(ke()),be=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},xe={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Se=xe.mouse,Ce=class extends ve.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&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);be(`DraggableCore: handleDragStart: %j`,s),be(`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,j(n,Se.move,this.handleDrag),j(n,Se.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(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]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(be(`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)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(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]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&se(a.ownerDocument),be(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(be(`DraggableCore: Removing handlers`),M(a.ownerDocument,Se.move,this.handleDrag),M(a.ownerDocument,Se.stop,this.handleDragStop))},this.onMouseDown=e=>(Se=xe.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Se=xe.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Se=xe.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Se=xe.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,xe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,xe.mouse.move,this.handleDrag),M(t,xe.touch.move,this.handleDrag),M(t,xe.mouse.stop,this.handleDragStop),M(t,xe.touch.stop,this.handleDragStop),M(e,xe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&se(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ye.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(be(`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 ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Ce.displayName=`DraggableCore`,Ce.propTypes={allowAnyClick:B.default.bool,allowMobileScroll:B.default.bool,children:B.default.node.isRequired,disabled:B.default.bool,enableUserSelectHack:B.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:B.default.arrayOf(B.default.number),handle:B.default.string,cancel:B.default.string,nodeRef:B.default.object,nonce:B.default.string,onStart:B.default.func,onDrag:B.default.func,onStop:B.default.func,onMouseDown:B.default.func,scale:B.default.number,className:S,style:S,transform:S},Ce.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var we=class extends p.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(be(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;be(`Draggable: onDrag: %j`,t);let n=he(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]=z(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,he(this,t))===!1)return!1;be(`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)?(be(`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,m=!s||this.state.dragging,h=s||r,g={x:de(this)&&m?this.state.x:h.x,y:fe(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=L(g,c):d=te(g,c);let v=p.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return p.createElement(Ce,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},p.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};we.displayName=`Draggable`,we.propTypes={...Ce.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:S,style:S,transform:S},we.defaultProps={...Ce.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:Ce})})),j9=o(((e,t)=>{var n=DOe(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),OOe=o((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(m());function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(I_());j9();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)}}})),N9=o((e=>{e.__esModule=!0,e.default=void 0;var t=o(m()),n=j9(),r=OOe(),i=M9(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=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 s(){return s=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,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=u({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,i=e.children,o=e.className,l=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 d=e.resizeHandles;e.transformScale;let f=c(e,a);return(0,r.cloneElement)(i,u(u({},f),{},{className:(o?o+` `:``)+`react-resizable`,children:[...t.Children.toArray(i.props.children),...d.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=h,h.propTypes=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),kOe=o((e=>{e.__esModule=!0,e.default=void 0;var t=s(m()),n=o(I_()),r=o(N9()),i=M9(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}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;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,n=e.handle,i=e.handleSize;e.onResize;let o=e.onResizeStart,s=e.onResizeStop,l=e.draggableOpts,d=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,a);return t.createElement(r.default,{axis:m,draggableOpts:l,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:d,onResizeStart:o,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,c({},y,{style:u(u({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),AOe=o(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=N9().default,t.exports.ResizableBox=kOe().default}))(),P9=nOe(),F9=50,I9=12;function jOe(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 MOe(e){let t=jOe(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=-I9:i>s.bottom-F9&&l+c0?h=-I9:r>s.right-F9&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,h.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,h.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:fe.current}),[ye]),xe=(0,h.useMemo)(()=>ee??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[ee,M,w,T,E,D,O,k,A,j]),Se=(0,h.useCallback)(e=>{if(_?.calcStyle)return _.calcStyle(e);if(p)return H7(e);let t=VDe(e);return m?{...t,left:U7(e.left/r),width:U7(e.width/r)}:t},[_,p,m,r]),Ce=(0,h.useCallback)((e,{node:t})=>{if(!te)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/g,o=r.left/g,s=i.top/g,c=r.top/g,l;if(_?.calcDragPosition){let t=e;l=_.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(z.current=l,ve.current||=MOe(t instanceof HTMLElement?t:null),v>0){let t=e;ge.current={x:t.clientX,y:t.clientY},he.current=!0,_e.current=!1,se(!0);return}se(!0);let u=w7(B,l.top,l.left),{x:d,y:f}=V7(F,xe,u.x,u.y,be());te(M,d,f,{e,node:t,newPosition:l})},[te,g,B,_,v,F,xe,be,M]),we=(0,h.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!L||!oe)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||!oe)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){se(!1),z.current={left:0,top:0};return}let{left:r,top:i}=z.current,a={top:i,left:r};se(!1),z.current={left:0,top:0};let o=w7(B,i,r),{x:s,y:c}=V7(F,xe,o.x,o.y,be());ne(M,s,c,{e,node:t,newPosition:a})},[ne,oe,B,F,xe,be,M]);pe.current=Ce,me.current=we;let Ee=(0,h.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?GDe(i,a,n,r):{...n,top:a.top,left:a.left},ue.current=c;let l=t?.offsetParent?.clientHeight??0,u=IDe(B,c.width,c.height),{w:d,h:f}=BDe(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[re,ie,ae,r,B,M,F,xe,be]),De=(0,h.useCallback)((e,t)=>{ce(!0);let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,B,w,T,E,D]),Oe=(0,h.useCallback)((e,t)=>{let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,B,w,T,E,D]),ke=(0,h.useCallback)((e,t)=>{ce(!1),ue.current={top:0,left:0,width:0,height:0};let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,B,w,T,E,D]);(0,h.useEffect)(()=>{if(!y)return;let e=le.current;if(!e)return;let t=de.current||{left:0,top:0},n=oe&&(y.left!==t.left||y.top!==t.top);if(!oe){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-z.current.left,deltaY:y.top-z.current.top,lastX:z.current.left,lastY:z.current.top,x:y.left,y:y.top};me.current?.(y.e,t)}de.current=y},[y,oe,M]);let Ae=C7(B,w,T,E,D,oe?z.current:null,R?ue.current:null),je=h.Children.only(t),Me=x7(B),Ne=[S7(O,Me,i[0]),S7(A,o,i[1])],Pe=[S7(k,Me,i[0]),S7(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=h.cloneElement(je,{ref:le,className:tn(`react-grid-item`,Ie,b,{static:f,resizing:R,"react-draggable":c,"react-draggable-dragging":oe,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(AOe.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:g,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(k9,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:g,allowMobileScroll:d,nodeRef:le,children:Re}),Re}var L9=h.memo(NOe,(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);L9.displayName=`GridItem`;function R9(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},_=x7(g),v=S7(i.w,_,u[0]),y=S7(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:FDe(g,D,E,i.w,i.h)}}var z9=()=>{},B9=`react-grid-layout`,V9=!1;try{V9=/firefox/i.test(navigator.userAgent)}catch{}function POe(e,t){let n=h.Children.toArray(e),r=h.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!h.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(P7(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:j7(i),w:1,h:1})}});let o=I7(i,{cols:n});return r.compact(o,n)}function U9(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=KDe,compactor:c,constraints:l=B7,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:g,onLayoutChange:_=z9,onDragStart:v=z9,onDrag:y=z9,onDragStop:b=z9,onResizeStart:x=z9,onResize:S=z9,onResizeStop:C=z9,onDrop:w=z9,onDropDragOver:T=z9}=e,E=(0,h.useMemo)(()=>({...qDe,...r}),[r]),D=(0,h.useMemo)(()=>({...JDe,...i}),[i]),O=(0,h.useMemo)(()=>({...YDe,...a}),[a]),k=(0,h.useMemo)(()=>({...XDe,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:ee,handle:I,cancel:te,threshold:L,allowMobileScroll:ne}=D,{enabled:re,handles:ie,handleComponent:ae}=O,{enabled:oe,defaultItem:se,onDragOver:R,touchEnabled:ce=!0,touchDragSource:le=`[data-rgl-draggable]`}=k,z=c??e9(`vertical`),ue=z.type,de=z.allowOverlap,fe=z.preventCollision??!1,pe=(0,h.useMemo)(()=>d??{i:`__dropping-elem__`,...se},[d,se]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,h.useState)(!1),[B,ye]=(0,h.useState)(()=>H9(u,t,A,z)),[be,xe]=(0,h.useState)(null),[Se,Ce]=(0,h.useState)(!1),[we,Te]=(0,h.useState)(null),[Ee,De]=(0,h.useState)(),Oe=(0,h.useRef)(void 0);Oe.current=Ee;let ke=(0,h.useRef)(null),Ae=(0,h.useRef)(null),je=(0,h.useRef)(null),Me=(0,h.useRef)(0),Ne=(0,h.useRef)(B),Pe=(0,h.useRef)(u),Fe=(0,h.useRef)(t),Ie=(0,h.useRef)(ue),Le=(0,h.useRef)(null),Re=(0,h.useRef)(!1),ze=(0,h.useRef)(null),Be=(0,h.useRef)(null);Be.current=we;let Ve=(0,h.useRef)(w);(0,h.useLayoutEffect)(()=>{Ve.current=w});let He=(0,h.useRef)(B);He.current=B,(0,h.useEffect)(()=>{ve(!0),(0,P9.deepEqual)(B,u)||_(B)},[]),(0,h.useEffect)(()=>{if(be||we)return;let e=!(0,P9.deepEqual)(u,Pe.current),n=!POe(t,Fe.current),r=ue!==Ie.current;if(e||n||r){let n=H9(e?u:B,t,A,z);(0,P9.deepEqual)(n,B)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=ue},[u,t,A,ue,z,be,we,B]),(0,h.useEffect)(()=>{if(!be&&!we&&!(0,P9.deepEqual)(B,Ne.current)){Ne.current=B;let e=B.filter(e=>e.i!==pe.i);_(e)}},[B,be,we,_,pe.i]);let Ue=(0,h.useMemo)(()=>{if(!f)return;let e=j7(B),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,B,j,N,ge]),We=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=M7(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=P7(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=M7(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=L7(i,o,t,n,!0,fe,ue,A,de);y(c,a,o,s,r.e,r.node),ye(z.compact(c,A)),xe(s)},[fe,ue,A,de,z,y]),Ke=(0,h.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=M7(i,e);if(!o)return;let s=L7(i,o,t,n,!0,fe,ue,A,de),c=z.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,P9.deepEqual)(l,c)&&_(c)},[fe,ue,A,de,z,b,_]),qe=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=M7(i,e);a&&(Ae.current=P7(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=zDe(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&&O7(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=L7(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=z.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[fe,ue,A,de,z,S]),Ye=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=M7(i,e),s=z.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,P9.deepEqual)(c,s)&&_(s)},[A,z,C,_]),Xe=(0,h.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(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{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,h.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=R9({clientX:e,clientY:t,gridElement:i,droppingItem:pe,event:r,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Xe(pe,a,o,!!Be.current)},[pe,he,A,N,M,j,n,ge,Xe]),Qe=(0,h.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===pe.i)){Te(null),xe(null),De(void 0);return}let t=z.compact(e.filter(e=>e.i!==pe.i),A);ye(t),Te(null),xe(null),De(void 0)},[pe.i,A,z]),$e=(0,h.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),V9&&!e.nativeEvent.target?.classList.contains(B9))return!1;let t=R?R(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},{newDroppingPosition:s,calculatedXY:c}=R9({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});Xe(o,s,c,!!we)},[we,pe,R,T,Qe,Xe,he,A,N,M,j,n,ge]),et=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,h.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===pe.i);Qe(),Ve.current(t,n,e)},[pe.i,Qe]),rt=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,h.useEffect)(()=>{if(!oe||!ce)return;let e=Le.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(le)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);n&&(t(n.clientX,n.clientY)?Ze(n.clientX,n.clientY,e):Be.current&&Qe())},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);Re.current=!1,ze.current=null,n&&(t(n.clientX,n.clientY)?nt(e):Qe())},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},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)}},[oe,ce,le,Ze,Qe,nt,pe.i]);let it=(0,h.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=M7(B,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&&ee&&r.isBounded!==!1,u=ae;return(0,H.jsx)(L9,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:te,handle:I,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:ne,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:L,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?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:B,children:e},r.i)},[B,n,A,N,ge,M,j,te,I,We,Ge,Ke,qe,Je,Ye,F,re,ee,me,_e,he,s,L,Ee,ie,ae,l]),at=()=>be?(0,H.jsx)(L9,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`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:B,children:(0,H.jsx)(`div`,{})}):null,ot=(0,h.useCallback)(e=>{Le.current=e,typeof g==`function`?g(e):g&&`current`in g&&(g.current=e)},[g]),st=tn(B9,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:oe?rt:void 0,onDragLeave:oe?et:void 0,onDragEnter:oe?tt:void 0,onDragOver:oe?$e:void 0,children:[h.Children.map(t,e=>h.isValidElement(e)?it(e):null),oe&&we&&it(we,!0),at()]})}var FOe={lg:1200,md:996,sm:768,xs:480,xxs:0},IOe={lg:12,md:10,sm:6,xs:4,xxs:2},W9=()=>{};function LOe(e,t,n,r,i=!1){let a=[];h.Children.forEach(t,t=>{if(!h.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:j7(a),w:1,h:1})});let o=I7(a,{cols:n});return r.compact(o,n)}function ROe(e){let{children:t,width:n,breakpoint:r,breakpoints:i=FOe,cols:a=IOe,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=W9,onLayoutChange:p=W9,onWidthChange:m=W9,...g}=e,_=d??e9(`vertical`),v=_.type,y=_.allowOverlap,b=(0,h.useMemo)(()=>r??n9(i,n),[]),x=(0,h.useMemo)(()=>r9(b,a),[b,a]),S=(0,h.useMemo)(()=>i9(o,i,b,b,x,v),[]),[C,w]=(0,h.useState)(b),[T,E]=(0,h.useState)(x),[D,O]=(0,h.useState)(S),[k,A]=(0,h.useState)(o),j=(0,h.useRef)(n),M=(0,h.useRef)(r),N=(0,h.useRef)(i),P=(0,h.useRef)(a),F=(0,h.useRef)(o),ee=(0,h.useRef)(v),I=(0,h.useRef)(k);(0,h.useEffect)(()=>{I.current=k},[k]);let te=(0,h.useMemo)(()=>(0,P9.deepEqual)(o,F.current)?null:i9(o,i,C,C,T,_),[o,i,C,T,_]),L=te??D;(0,h.useEffect)(()=>{te!==null&&(O(te),A(o),I.current=o,F.current=o)},[te,o]),(0,h.useEffect)(()=>{if(v!==ee.current){let e=_.compact(F7(L),T),t={...I.current,[C]:e};O(e),A(t),I.current=t,p(e,t),ee.current=v}},[v,_,L,T,y,C,p]),(0,h.useEffect)(()=>{let e=n!==j.current,o=r!==M.current,s=!(0,P9.deepEqual)(i,N.current),c=!(0,P9.deepEqual)(a,P.current);if(e||o||s||c){let e=r??n9(i,n),o=r9(e,a),d=C;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=F7(D));let r=i9(n,i,e,d,o,_),a=!n[e];r=LOe(r,t,o,_,a),n[e]=r,w(e),E(o),O(r),A(n),I.current=n,f(e,o),p(r,n)}let h=a9(l,e),g=u?a9(u,e):null;m(n,h,o,g),j.current=n,M.current=r,N.current=i,P.current=a}},[n,r,i,a,C,T,D,t,_,v,y,l,u,f,p,m]);let ne=(0,h.useCallback)(e=>{let t={...I.current,[C]:e};O(e),A(t),I.current=t,p(e,t)},[C,p]),re=(0,h.useMemo)(()=>a9(l,C),[l,C]),ie=(0,h.useMemo)(()=>u===null?null:a9(u,C),[u,C]),ae=(0,h.useMemo)(()=>({cols:T,rowHeight:s,maxRows:c,margin:re,containerPadding:ie}),[T,s,c,re,ie]);return(0,H.jsx)(U9,{...g,width:n,gridConfig:ae,compactor:_,onLayoutChange:ne,layout:L,children:t})}var zOe=h.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(ROe,{...r,innerRef:i})});zOe.displayName=`ResponsiveGridLayout`;var G9=36,BOe={s:2,m:7,l:12},VOe={stat:3,gauge:3,timeseries:6,bar:6,table:12,list:6,inbox:8,cards:12,timeline:12,text:6};function HOe(e){return{w:Math.min(12,e.width??VOe[e.viz]),h:BOe[e.height??(e.viz===`stat`||e.viz===`gauge`?`s`:e.viz===`inbox`?`l`:`m`)]}}var K9=12,q9=48,J9=58;function UOe(e,t,n,r){if(t?.status===`empty`||t?.frame&&t.frame.rows.length===0)return 2;let i=t?.frame?.rows.length;if(i===void 0)return;let a;switch(e.viz){case`table`:a=90+31*i;break;case`list`:a=J9+33*i;break;case`inbox`:{let e=t?.frame?.columns.findIndex(e=>e.name===`kind`)??-1,n=e<0?i:t.frame.rows.filter(t=>t[e]===`waiting`).length;a=142+72*n+36*(i-n);break}case`cards`:{let e=Math.max(1,Math.floor(r*n/12/230));a=J9+160*Math.ceil(i/e);break}case`stat`:return 2;case`gauge`:return 3;default:return}return Math.max(2,Math.ceil((a+K9)/q9))}function WOe(e){let t=[],n=(e,n,r,i)=>t.every(t=>e+r<=t.x||t.x+t.w<=e||n+i<=t.y||t.y+t.h<=n);for(let n of e)n.grid&&t.push({i:n.id,...n.grid});for(let r of e){if(r.grid)continue;let{w:e,h:i}=HOe(r),a;for(let t=0;!a;t++)for(let r=0;r+e<=12&&!a;r++)n(r,t,e,i)&&(a={x:r,y:t});t.push({i:r.id,...a,w:e,h:i})}return t}function GOe(e,t,n,r,i){let a=e.map(e=>({...e,h:Math.min(Math.max(e.h,12),UOe(t.get(e.i),n.get(e.i),e.w,r)??e.h)})),o=(e,t)=>e.x!a.some(n=>n!==e&&o({...e,...t},n)),c=()=>{for(let e of[...a].sort((e,t)=>e.y-t.y||e.x-t.x))for(;e.y>0&&a.every(t=>t===e||t.y>e.y||!o({...e,y:e.y-1},t));)e.y--},l=()=>Math.max(0,...a.map(e=>e.y+e.h)),u=[];for(let e of[...a].sort((e,t)=>e.y-t.y||e.x-t.x)){for(;u.some(t=>o(e,t));)e.y++;u.push(e)}c();let d=new Set([`bar`,`timeseries`,`timeline`]),f=e=>d.has(t.get(e.i).viz)?4:Math.min(5,e.h),p=new Map(e.map((e,t)=>[e.i,t]));for(;l()>i;){let e=a.filter(e=>e.h>f(e)).sort((e,t)=>p.get(t.i)-p.get(e.i))[0]??a.filter(e=>e.h>3).sort((e,t)=>t.h-e.h)[0];if(!e)break;e.h--,c()}for(let e of a){for(;e.x>0&&s(e,{x:e.x-1,w:1});)e.x--,e.w++;for(;e.x+e.w<12&&s(e,{x:e.x+e.w,w:1});)e.w++}let m=Math.max(i,l());for(let e of[...a].sort((e,t)=>e.y-t.y))for(;e.y+e.h{let e=t.current;if(!e)return;let n=()=>r({height:e.clientHeight,width:e.clientWidth});n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),{ref:t,...n}}function qOe({fragment:e,editing:t,act:n,onLayout:r,onRemove:i}){let{inboxFilter:a}=F0(),{width:o,containerRef:s,mounted:c}=iOe(),l=KOe(t),u=new Map(e.results.map(e=>[e.id,e])),d=new Map(e.dashboard.panels.map(e=>[e.id,e])),f=t?[]:e.dashboard.panels.filter(e=>u.get(e.id)?.status===`empty`&&!(e.viz===`inbox`&&a)),p=t?e.dashboard.panels:e.dashboard.panels.filter(e=>!f.includes(e)),m=Math.max(1,Math.floor((l.height+K9)/q9)),h=GOe(WOe(p),d,u,l.width,m),g=e=>{l.ref.current=e,s.current=e},_=l.height>0&&l.width>0;if(!t){let e=Math.max(1,...h.map(e=>e.y+e.h));return(0,H.jsxs)(H.Fragment,{children:[f.length>0&&(0,H.jsx)(JOe,{panels:f,results:u}),(0,H.jsx)(G,{ref:g,style:{flex:1,minHeight:0,display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:K9,gridTemplateRows:`repeat(${e}, minmax(${G9}px, 1fr))`},children:_&&h.map(e=>(0,H.jsx)(G,{style:{minWidth:0,minHeight:0,gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`},children:(0,H.jsx)(E8,{panel:d.get(e.i),result:u.get(e.i),act:n,fill:!0})},e.i))})]})}let v=e=>{e.some(e=>{let t=h.find(t=>t.i===e.i);return!t||t.x!==e.x||t.y!==e.y||t.w!==e.w||t.h!==e.h})&&r(Object.fromEntries(e.map(e=>[e.i,{x:e.x,y:e.y,w:e.w,h:e.h}])))};return(0,H.jsx)(G,{ref:g,className:`editing`,style:{flex:1,minHeight:0,overflow:`auto`},children:_&&c&&(0,H.jsx)(U9,{width:o,layout:h,gridConfig:{cols:12,rowHeight:G9,margin:[K9,K9],containerPadding:[0,0]},dragConfig:{enabled:!0,handle:`.panel-handle`},resizeConfig:{enabled:!0},onDragStop:e=>v(e),onResizeStop:e=>v(e),children:h.map(e=>(0,H.jsxs)(`div`,{style:{position:`relative`},children:[(0,H.jsx)(E8,{panel:d.get(e.i),result:u.get(e.i),fill:!0}),(0,H.jsx)(lu,{variant:`default`,pos:`absolute`,top:8,right:8,"aria-label":`Remove ${d.get(e.i).title}`,onClick:()=>{U0(`Remove ${d.get(e.i).title} from this dashboard?`).then(t=>{t&&i(e.i)})},children:(0,H.jsx)(Iy,{})})]},e.i))})})}function JOe({panels:e,results:t}){return(0,H.jsx)(K,{role:`group`,gap:`lg`,mb:8,px:2,"aria-label":`Nothing to show`,children:e.map(e=>(0,H.jsx)(Bg,{label:t.get(e.id)?.message??e.empty??`Nothing matches right now.`,multiline:!0,maw:300,children:(0,H.jsxs)(K,{id:`panel-${e.id}`,gap:6,wrap:`nowrap`,c:`dimmed`,children:[(0,H.jsx)(Dv,{"aria-hidden":!0}),(0,H.jsxs)(q,{size:`sm`,id:`panel-${e.id}`,children:[e.title,`: `,(0,H.jsx)(q,{span:!0,c:`dimmed`,size:`sm`,children:`none`})]})]})},e.id))})}function YOe({panels:e,busy:t,onAdd:n,onReset:r,onAsk:i}){let[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(``),[l,u]=(0,h.useState)(``),d=async()=>{u(``);try{o(await V0.catalog())}catch(e){o([]),u(e.message)}},f=am({onDropdownOpen:()=>{f.focusSearchInput(),d()},onDropdownClose:e=>{f.resetSelectedOption(),c(``),e===`keyboard`&&f.focusTarget()}}),p=a.filter(t=>!e.some(e=>e.id===t.id)),m=p.filter(e=>e.title.toLowerCase().includes(s.toLowerCase())),g=e.length>=16;return(0,h.useEffect)(()=>{f.dropdownOpened&&f.selectFirstOption()},[a,s,f.dropdownOpened]),(0,H.jsxs)(K,{gap:2,wrap:`nowrap`,style:{flex:`none`},children:[(0,H.jsxs)(cm,{store:f,width:280,position:`bottom-end`,withinPortal:!0,onOptionSubmit:e=>{let r=p.find(t=>t.id===e);r&&!g&&!t&&n(r),f.closeDropdown()},children:[(0,H.jsx)(cm.Target,{targetType:`button`,withExpandedAttribute:!0,children:(0,H.jsx)(lu,{variant:`subtle`,"aria-label":`Add widget`,disabled:t,onClick:()=>f.toggleDropdown(),children:(0,H.jsx)(Kte,{})})}),(0,H.jsxs)(cm.Dropdown,{children:[(0,H.jsx)(cm.Search,{"aria-label":`Find a widget`,placeholder:`Find a widget`,value:s,onChange:e=>{c(e.currentTarget.value)}}),(0,H.jsxs)(cm.Options,{mah:320,style:{overflowY:`auto`},children:[m.map(e=>(0,H.jsx)(cm.Option,{value:e.id,disabled:g||t,children:e.title},e.id)),m.length===0&&(0,H.jsx)(cm.Empty,{children:l||`No matching widgets`})]}),g&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,p:`xs`,children:`The header shows at most 16 widgets`}),(0,H.jsx)(km,{variant:`subtle`,fullWidth:!0,size:`xs`,onClick:()=>{f.closeDropdown(),i(`Add a header widget that shows `)},children:`Ask Chat for another…`})]})]}),(0,H.jsxs)(ng,{withinPortal:!0,position:`bottom-end`,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{variant:`subtle`,"aria-label":`Header options`,disabled:t,children:(0,H.jsx)(Vv,{})})}),(0,H.jsx)(ng.Dropdown,{children:(0,H.jsx)(ng.Item,{onClick:r,children:`Reset header`})})]})]})}var XOe={name:`Search`,panels:[{id:`live`,title:`Live`,viz:`table`,source:`sessions`},{id:`ended`,title:`Ended`,viz:`table`,source:`history`}]},Y9=(e,t)=>{let n=Date.parse(String(t??``));return n?`${D1(Math.max(0,e-n))} ago`:``};function ZOe(e,t,n,r,i){let a=e=>Date.parse(String(e.last_activity_at??``))||0,o=e=>String(e.title||`Session ${e.id}`),s=e=>[e.project,e.branch,e.agent,e.machine,e.state].filter(e=>typeof e==`string`&&e!==``);return[{group:`Live sessions`,actions:[...e].sort((e,t)=>a(t)-a(e)).map(e=>({id:`live-${e.machine_id}-${e.id}`,label:o(e),description:[e.project,e.branch,e.agent,e.machine,a(e)?`active ${Y9(n,e.last_activity_at)}`:``].filter(Boolean).join(` · `),keywords:s(e),leftSection:(0,H.jsx)(uv,{size:16,"aria-hidden":!0}),rightSection:e.label?(0,H.jsx)(c0,{...s0(String(e.label)),inferred:e.inferred===!0||String(e.label).startsWith(`~`)}):void 0,onClick:()=>void r({kind:`jump`,row:{...e,session_id:e.id}})}))},{group:`Ended sessions`,actions:t.map(e=>({id:`ended-${e.machine_id}-${e.id}`,label:o(e),description:[e.project,e.branch,e.agent,e.machine,`ended ${Y9(n,e.ended_at)}`].filter(Boolean).join(` · `),keywords:s(e),leftSection:e.resume?(0,H.jsx)(jv,{size:16,"aria-hidden":!0}):(0,H.jsx)(Cv,{size:16,"aria-hidden":!0}),rightSection:(0,H.jsx)(q,{className:`search-hint`,size:`xs`,c:`var(--driga-text)`,style:{whiteSpace:`nowrap`},children:e.resume?`Copy resume command`:`Ask Chat`}),onClick:()=>i(e)}))}].filter(e=>e.actions.length>0)}var QOe=(e,t)=>{let n=e.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return t;let r=e=>{let t=[e.label,e.description,...Array.isArray(e.keywords)?e.keywords:[e.keywords]].filter(Boolean).join(` `).toLowerCase();return n.every(e=>t.includes(e))},i=[];for(let e of t){if(!cb(e)){r(e)&&i.push(e);continue}let t=e.actions.filter(r);t.length&&i.push({...e,actions:t})}return i};function $Oe({list:e,act:t,ask:n,open:r,onFleet:i,say:a}){let[o,s]=(0,h.useState)({live:[],ended:[]}),[c,l]=(0,h.useState)(!1),u=(e,t)=>gS(e.results.find(e=>e.id===t)?.frame??{columns:[],rows:[]}),d=()=>V0.run(XOe).then(e=>{s({live:u(e,`live`),ended:u(e,`ended`)}),l(!1)},()=>l(!0)),f=e=>{let t=String(e.title||`Session ${e.id}`);typeof e.resume!=`string`||!e.resume?n(`Tell me about session ${e.id}, "${t}": what it did and what it left uncommitted.`):navigator.clipboard?.writeText(e.resume).then(()=>a(`Copied the command that resumes ${t}. Paste it in a terminal.`),()=>a(`Couldn't copy. Resume with: ${e.resume}`))},p={group:`Dashboards`,actions:e.map(e=>({id:`dashboard-${e.id}`,label:e.name,leftSection:(0,H.jsx)(Ty,{size:16,"aria-hidden":!0}),onClick:()=>r(e.id)}))},m={group:`Pages`,actions:i?[{id:`page-fleet`,label:`Fleet`,description:`Every machine, project and session, and where the memory goes`,keywords:[`machines`,`sessions`],leftSection:(0,H.jsx)(Dy,{size:16,"aria-hidden":!0}),onClick:i}]:[]};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($c,{className:`search-button`,onClick:sb.open,"aria-keyshortcuts":`Meta+K`,title:`Search sessions and dashboards (⌘K)`,children:(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,children:[(0,H.jsx)(hy,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{size:`sm`,c:`dimmed`,visibleFrom:`lg`,children:`Search`}),(0,H.jsx)(tl,{hiddenFrom:`lg`,children:`Search`}),(0,H.jsx)(yh,{size:`xs`,visibleFrom:`lg`,"aria-hidden":!0,children:`⌘K`})]})}),(0,H.jsx)(yb,{title:`Search sessions and dashboards`,styles:{actionDescription:{color:`var(--driga-text)`,opacity:1},actionSection:{opacity:1}},shortcut:[`mod + K`],filter:QOe,onSpotlightOpen:()=>void d(),limit:40,highlightQuery:!0,scrollable:!0,maxHeight:480,actions:[...ZOe(o.live,o.ended,Date.now(),t,f),...p.actions.length?[p]:[],...m.actions.length?[m]:[]],nothingFound:c?`Driga can't reach its service, so there is nothing to search.`:`No session or dashboard matches. Sessions that ended more than two weeks ago aren't listed.`,searchProps:{"aria-label":`Search sessions and dashboards`,leftSection:(0,H.jsx)(hy,{size:18,"aria-hidden":!0}),placeholder:`Search sessions by title, project, branch, agent or machine`}})]})}var X9=5e3,Z9=`header`,Q9=`home`,eke={name:`Inbox`,panels:[{id:`inbox`,title:`Inbox`,viz:`inbox`,source:`inbox`}]},$9={at:0,failed:!1};function tke({id:e,vars:t,onError:n,onMissing:r}){let[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)({id:e,navigation:0,fragment:null,fresh:$9}),[f,p]=(0,h.useState)([]),[m,g]=(0,h.useState)([]),[_,v]=(0,h.useState)([]),[y,b]=(0,h.useState)([]),[x,S]=(0,h.useState)(!1),C=(0,h.useRef)({scope:{id:e,vars:t,mutations:0,reconcile:!1,navigation:0},generation:0,refreshing:-1,request:null,editing:!1,headerMutations:0}),w=(0,h.useRef)({onError:n,onMissing:r});w.current={onError:n,onMissing:r};let T=C.current;(T.scope.id!==e||T.scope.vars!==t)&&(T.scope={id:e,vars:t,mutations:0,reconcile:!1,navigation:T.scope.navigation+Number(T.scope.id!==e)},T.generation++);let E=u.navigation===T.scope.navigation?u.fragment:null,D=u.navigation===T.scope.navigation?u.fresh:$9,O=(0,h.useCallback)(async(n=!1)=>{let r=C.current;if(r.scope.id!==e||r.scope.vars!==t||r.scope.mutations>0||r.headerMutations>0||r.editing&&!n||!n&&r.refreshing===r.generation)return;let i=r.scope,o=++r.generation;r.request?.abort();let c=new AbortController;r.request=c,r.refreshing=o;let u=()=>r.generation===o&&r.scope===i,f=(e,t)=>e.then(e=>{u()&&t(e)},()=>void 0),m=async()=>{try{let n=await V0.open(e,t,c.signal);u()&&d({id:e,navigation:i.navigation,fragment:n,fresh:{at:Date.now(),failed:!1}})}catch(t){if(!u())return;d(t=>({id:e,navigation:i.navigation,fragment:t.navigation===i.navigation?t.fragment:null,fresh:{at:t.navigation===i.navigation?t.fresh.at:0,failed:!0}})),w.current.onError(t.message),e!==`home`&&w.current.onMissing()}};try{G0.bursts().then(e=>{u()&&g(e)},()=>void 0),G0.grantHistory().then(e=>{u()&&p(e)},()=>void 0),G0.prompts().then(e=>{u()&&v(e)},()=>void 0),await Promise.all([m(),f(V0.open(Z9,void 0,c.signal),a),f(V0.run(eke,void 0,c.signal),s),f(V0.run(oge,void 0,c.signal),l)])}finally{r.request===c&&(r.request=null),r.refreshing===o&&(r.refreshing=-1)}},[e,t]),k=(0,h.useRef)(()=>O(!0));return k.current=()=>O(!0),(0,h.useEffect)(()=>(O(!0),()=>{C.current.generation++,C.current.request?.abort()}),[O]),(0,h.useEffect)(()=>{if(x)return;let e=window.setInterval(()=>{document.visibilityState===`visible`&&O()},X9);return()=>window.clearInterval(e)},[O,x]),(0,h.useEffect)(()=>{let e=!0;return V0.list().then(t=>{e&&b(t.filter(e=>e.id!==Z9))},()=>void 0),()=>{e=!1}},[E?.id,E?.version]),{fragment:E,header:i,inbox:o,fleet:c,prompts:_,bursts:m,grantHistory:f,list:y,fresh:D,editing:x,setEditing:(0,h.useCallback)(e=>{let t=C.current,n=typeof e==`function`?e(t.editing):e;n!==t.editing&&(t.editing=n,t.generation++,S(n))},[]),refresh:()=>O(!0),edit:async(e,t,n,r)=>{let i=C.current,o=i.scope;i.generation++,o.mutations++;try{let s=await V0.edit(e,n,t,e===`header`?void 0:o.vars,r);return i.scope===o?(e===`header`?a(s):e===o.id&&d({id:o.id,navigation:o.navigation,fragment:s,fresh:{at:Date.now(),failed:!1}}),s):void 0}catch(e){i.scope===o&&(w.current.onError(e.message),o.reconcile=!0)}finally{o.mutations--,i.scope===o&&(i.generation++,o.reconcile&&o.mutations===0&&(o.reconcile=!1,O(!0)))}},mutateHeader:async e=>{let t=C.current;if(t.headerMutations>0)return;let n=t.scope;t.headerMutations++,t.generation++;try{let t=await e();return a(t),t}catch(e){let t=e instanceof Error&&`status`in e&&e.status===409;try{a(await V0.open(Z9)),w.current.onError(t?`Header changed elsewhere; reloaded`:e.message)}catch(e){w.current.onError(e.message)}}finally{t.headerMutations--,t.generation++,t.scope!==n&&k.current()}},forgetPrompt:e=>{C.current.generation++,v(t=>t.filter(t=>t.id!==e)),g(t=>t.map(t=>({...t,members:t.members.filter(t=>t.id!==e)})).filter(e=>e.members.length>0))}}}function nke(){return new URLSearchParams(location.search).get(`dashboard`)||`home`}function rke(){return new URLSearchParams(location.search).get(`page`)===`fleet`?`fleet`:`board`}var ike={inbox:`inbox`,stuck:`stuck`,leftover:`orphans`,reclaim:`orphans`,memory:`machine_memory`};function ake(e){let t=document.getElementById(`panel-${e}`),n=t?.closest(`.mantine-Card-root`)??t;n&&(n.scrollIntoView({behavior:`smooth`,block:`nearest`}),n.classList.add(`panel-shown`),window.setTimeout(()=>n.classList.remove(`panel-shown`),1600))}function oke(e){try{return localStorage.getItem(e)}catch{return null}}function ske(e,t){try{localStorage.setItem(e,t)}catch{}}function cke(e){return e instanceof HTMLElement&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName))}function lke(){let[e,t]=(0,h.useState)(nke),[n,r]=(0,h.useState)(rke),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(()=>oke(`driga-chat-open`)!==`false`),[f,p]=(0,h.useState)(null),m=e=>at.show({message:e,autoClose:4e3,closeButtonProps:{"aria-label":`Dismiss`}}),{fragment:g,header:_,inbox:v,fleet:y,prompts:b,bursts:x,grantHistory:S,list:C,fresh:w,editing:T,setEditing:E,refresh:D,edit:O,mutateHeader:k,forgetPrompt:A}=tke({id:e,vars:i,onError:m,onMissing:()=>t(Q9)});(0,h.useEffect)(()=>{ske(`driga-chat-open`,String(u))},[u]);let j=dS(),M=oS({id:`driga-split`,panelIds:[`board`,`chat`],onlySaveAfterUserInteractions:!0});(0,h.useEffect)(()=>{let e=j.current;e&&(u&&e.isCollapsed()&&e.expand(),!u&&!e.isCollapsed()&&e.collapse())},[u,j]),(0,h.useEffect)(()=>{history.replaceState(null,``,n===`fleet`?`/app/?page=fleet`:e===`home`?`/app/`:`/app/?dashboard=${encodeURIComponent(e)}`)},[e,n]);let N=(0,h.useMemo)(()=>y?N0(y,v):null,[y,v]),P=(0,h.useMemo)(()=>r0(_),[_]),F=(0,h.useMemo)(()=>_?She(_,N,P):null,[_,N,P]);(0,h.useEffect)(()=>{if(!o||e!==`home`||n!==`board`||g?.id!==`home`)return;let t=()=>document.getElementById(`panel-${o}`)?(ake(o),s(null),!0):!1;if(t())return;let r=new MutationObserver(()=>{t()&&r.disconnect()});return r.observe(document.body,{childList:!0,subtree:!0}),()=>r.disconnect()},[o,e,n,g]);let ee=e=>{E(!1),a({}),t(e),r(`board`)},I=(0,h.useCallback)(()=>{E(!1),r(`fleet`)},[]),te=t=>{(e!==`home`||n!==`board`)&&ee(Q9),s(ike[t])},L=async t=>{try{let r=g?.id===`home`?g:await V0.open(Q9),i=r.dashboard.panels.find(e=>e.source===t.source&&(e.measure??`count`)===(t.measure??`count`));if(!i){let e=t.id;for(let n=2;r.dashboard.panels.some(t=>t.id===e);n++)e=`${t.id}_${n}`;let n={...Object.fromEntries((_?.dashboard.variables??[]).map(e=>[e.name,e.default??``])),..._?.vars},a=t.title;for(let e of Object.keys(n).sort((e,t)=>t.length-e.length))a=a.replaceAll(`$${e}`,n[e]||`all ${e}s`);if(i={...t,id:e,title:a,...t.where?{where:t.where.flatMap(e=>{if(!e.value.startsWith(`$`))return[e];let t=n[e.value.slice(1)];return t?[{...e,value:t}]:[]})}:{}},!await O(`home`,r.version??0,[{op:`add`,panel:i}],`Added a header widget to Home`))return}(e!==`home`||n!==`board`)&&ee(Q9),s(i.id)}catch(e){m(e.message)}},ne=e=>l(t=>t===e?null:e),re=e=>{d(!0),p({text:e,at:Date.now()})},[ie,ae]=(0,h.useState)(!1),oe=(0,h.useRef)(!1),se=async(e,t,n)=>{if(!oe.current){oe.current=!0,ae(!0);try{let r=await k(e);if(!r)return;let i=at.show({autoClose:8e3,closeButtonProps:{"aria-label":`Dismiss`},message:(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,children:[n,(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,onClick:()=>{oe.current||(at.hide(i),se(()=>V0.replace(Z9,t,r.version??0,void 0,`Undid a header edit`),structuredClone(r.dashboard),`Header restored`))},children:`Undo`})]})})}finally{oe.current=!1,ae(!1)}}},R=(e,t)=>{_&&se(()=>V0.edit(Z9,e,_.version??0,void 0,t),structuredClone(_.dashboard),t)},ce=()=>{_&&se(()=>V0.reset(Z9,_.version??0),structuredClone(_.dashboard),`Header reset`)},le=async({kind:e,row:t})=>{let n=t.machine_id,r=Number(t.session_id??t.id),i=String(t.title??t.signature??t.project??t.path??t.id??``),a=async(e,t)=>{let n=await dge(e,t);return n||m(`Cancelled`),n};try{switch(e){case`jump`:case`open`:await W0({action:`jump`,session_id:r,machine:n}),m(`Opened the session's pane`);return;case`ack`:{let e=typeof t.ids==`string`&&t.ids?t.ids.split(`,`):[t.id];for(let t of e)await W0({action:`ack_inbox`,id:t,machine:n});m(e.length>1?`Acknowledged ${e.length} turns`:`Acknowledged`);break}case`stop`:if(!await a(`Stop ${i}? Its agent and the processes it started are ended.`,{action:`kill`,session_id:r,machine:n}))return;m(`Stopped ${i}`);break;case`kill`:case`force_kill`:{let r=e===`force_kill`;if(!await a(`${r?`Force kill`:`Kill`} the ${i} process tree? ${r?`Processes get SIGKILL without a chance to clean up.`:`Processes get SIGTERM first.`}`,{action:`kill`,id:t.id,machine:n,force:r}))return;m(`Killed ${i}`);break}case`cleanup`:if(!await a(`Remove ${i}? Driga checks it again before removing it.`,{action:`cleanup`,id:t.id,machine:n}))return;m(`Removed ${i}`);break;case`summarize`:await W0({action:`summarize`,project:t.path,machine:n}),m(`Summarizing ${i}`);return}D()}catch(e){m(e.message)}},z=async(e,t)=>{try{await G0.answer(e.id,t),A(e.id),m(t?`Allowed ${e.tool}`:`Denied ${e.tool}`)}catch(e){m(e.message)}},ue=async(e,t,n)=>{try{await G0.decideBurst(e,t,n),t.forEach(A)}catch(e){throw D(),e}},de=async e=>{try{await G0.answerSimilar(e.id),A(e.id),D()}catch(e){m(e.message)}},fe=async e=>{try{await G0.revokeGrant(e),D()}catch(e){m(e.message)}},pe=async()=>{if(!g?.id)return;let e=g.dashboard.name;if(!await U0(`Delete the ${e} dashboard and its history?`))m(`Cancelled`);else try{await V0.delete(g.id),g.id===`home`?D():ee(Q9),m(g.id===`home`?`Home is back to the default`:`Deleted ${e}`)}catch(e){m(e.message)}},me=y?.results.find(e=>e.id===`sessions`)?.frame,he=gS(me),ge={clearInboxFilter:()=>l(null),stuck:me?{...me,rows:me.rows.filter((e,t)=>he[t].state===`stuck`||he[t].label===`stuck`)}:void 0,act:le,local:(g??_)?.local_machine,prompts:b,bursts:x,decideBurst:ue,answer:z,answerSimilar:de,grantHistory:S,revokeGrant:fe,inboxFilter:c,ask:re};(0,h.useEffect)(()=>{window.drigaCommand=(e,t)=>{e===`reload`?D():e===`back`?history.back():e===`forward`?history.forward():e===`find`?sb.open():e===`view`&&t===`fleet`?I():e===`view`&&t===`inbox`?(l(null),te(`inbox`)):e===`openSession`&&t&&typeof t==`object`&&`session_id`in t&&typeof t.session_id==`number`&&le({kind:`jump`,row:t})}}),(0,h.useEffect)(()=>{let e=-1/0,t=t=>{if(t.metaKey||t.ctrlKey||t.altKey||cke(t.target)||document.querySelector(`[aria-modal="true"]`)){e=-1/0;return}let n=performance.now()-e<800;if(e=-1/0,t.key===`g`){e=performance.now();return}if(t.key===`f`&&n){I();return}let r=X1[Number(t.key)-1];r&&(t.preventDefault(),l(e=>e===r?null:r))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[I]);let _e=v?.dashboard.panels[0],ve=n===`fleet`?!1:!g||g.dashboard.panels.some(e=>e.viz===`inbox`),B=_e?{panel:_e,result:v.results[0],listed:!!ve}:void 0,ye=g?.dashboard;return(0,H.jsx)(P0.Provider,{value:ge,children:(0,H.jsxs)(Op,{header:{height:56},padding:0,children:[(0,H.jsx)(Op.Header,{px:`md`,style:{background:`color-mix(in srgb, var(--driga-ground) 88%, transparent)`,backdropFilter:`blur(10px)`,borderColor:`var(--driga-border)`},children:(0,H.jsx)(PDe,{data:F,filter:c,chatOpen:u,onFilter:ne,onOpenFleet:I,onSearch:sb.open,onToggleChat:()=>d(e=>!e),onShow:e=>void L(e),busy:ie,onRemove:e=>R([{op:`remove`,id:e}],`Removed a header widget`),onMove:(e,t)=>R([{op:`move`,id:e,...t?{before:t}:{}}],`Reordered header widgets`),editor:_&&(0,H.jsx)(YOe,{panels:_.dashboard.panels,busy:ie,onAdd:e=>R([{op:`add`,panel:e}],`Added a header widget`),onReset:ce,onAsk:re}),onAsk:e=>re(`Tell me about "${e}" right now.`),search:(0,H.jsx)($Oe,{list:C,act:le,say:m,open:ee,onFleet:I,ask:re})})}),(0,H.jsx)(Op.Main,{style:{height:`100dvh`,display:`flex`},children:(0,H.jsxs)(rS,{orientation:`horizontal`,id:`driga-split`,defaultLayout:M.defaultLayout,onLayoutChanged:M.onLayoutChanged,style:{flex:1,minWidth:0},children:[(0,H.jsx)(lS,{id:`board`,minSize:360,style:{display:`flex`,flexDirection:`column`,minWidth:0},children:n===`fleet`?(0,H.jsx)(G,{px:`md`,pt:`sm`,pb:`md`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:(0,H.jsx)(lge,{fragment:y,inbox:v,act:le})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,px:`md`,pt:`sm`,pb:8,children:[(0,H.jsxs)(G,{style:{minWidth:0},children:[(0,H.jsx)(k_,{order:1,fz:28,fw:650,lh:1.2,style:{letterSpacing:`-0.02em`},children:ye?.name??`Loading…`}),w.failed&&w.at>0?(0,H.jsxs)(q,{size:`xs`,c:`warning`,truncate:!0,role:`status`,title:`Not updated since ${new Date(w.at).toLocaleTimeString([],{timeStyle:`medium`})}. Retrying; check driga service status.`,children:[`Not updated since `,new Date(w.at).toLocaleTimeString([],{timeStyle:`medium`}),`. Retrying; check `,(0,H.jsx)(q,{span:!0,size:`xs`,ff:`monospace`,children:`driga service status`}),`.`]}):w.failed?(0,H.jsxs)(q,{size:`xs`,c:`warning`,role:`status`,children:[`Driga can't reach its service. Retrying every `,X9/1e3,`s.`]}):ye?.description&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:ye.description,children:ye.description})]}),(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,children:[ye?.variables?.map(e=>(0,H.jsx)(Jg,{size:`xs`,w:140,"aria-label":e.name,placeholder:`All ${e.name}s`,clearable:!0,data:g?.options?.[e.name]??[],value:i[e.name]||null,onChange:t=>a(n=>({...n,[e.name]:t??``}))},e.name)),C.length>1&&(0,H.jsx)(Jg,{size:`xs`,w:170,"aria-label":`Dashboard`,allowDeselect:!1,data:C.map(e=>({value:e.id,label:e.name})),value:e,onChange:e=>e&&ee(e)}),T&&(0,H.jsx)(km,{variant:`light`,color:`danger`,onClick:()=>void pe(),children:e===`home`?`Reset Home`:`Delete dashboard`}),(0,H.jsx)(km,{variant:T?`filled`:`default`,leftSection:(0,H.jsx)(Wte,{}),"aria-pressed":T,onClick:()=>E(e=>!e),children:T?`Done`:`Edit`})]})]}),T&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,px:`md`,pb:6,children:`Drag panels by their title, resize from the corner, or ask Chat to change any of it.`}),(0,H.jsx)(G,{px:`md`,pb:`md`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:g?(0,H.jsx)(qOe,{fragment:g,editing:T,act:le,onLayout:e=>{g&&O(g.id,g.version??0,[{op:`layout`,grids:e}],`Moved panels`)},onRemove:e=>{g&&O(g.id,g.version??0,[{op:`remove`,id:e}],`Removed a panel`)}}):(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`})})]})}),(0,H.jsx)(mS,{className:`split-handle`,"aria-label":`Resize Chat`}),(0,H.jsx)(lS,{id:`chat`,inert:!u,panelRef:j,defaultSize:400,minSize:300,maxSize:`65`,collapsible:!0,collapsedSize:0,onResize:e=>{let t=e.inPixels>0;t!==u&&d(t)},style:{background:`var(--driga-inset)`,borderLeft:`1px solid var(--driga-border)`,minWidth:0},children:(0,H.jsx)(PTe,{inbox:B,act:le,ask:f,onOpen:ee,onClose:()=>d(!1)})})]})})]})})}(0,Wee.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(h.StrictMode,{children:(0,H.jsxs)(fne,{children:[(0,H.jsx)(av,{position:`bottom-center`}),(0,H.jsx)(lke,{})]})})); \ No newline at end of file +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ce(e.body,`react-draggable-transparent-selection`)}function se(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{R(e)}):R(e)}function R(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 z(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(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+x(s.paddingLeft)+x(o.marginLeft),top:-i.offsetTop+x(s.paddingTop)+x(o.marginTop),right:ee(a)-P(i)-i.offsetLeft+x(s.paddingRight)-x(o.marginRight),bottom:F(a)-N(i)-i.offsetTop+x(s.paddingBottom)-x(o.marginBottom)}}return b(r.right)&&(t=Math.min(t,r.right)),b(r.bottom)&&(n=Math.min(n,r.bottom)),b(r.left)&&(t=Math.max(t,r.left)),b(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return I(r||e,a,n.props.scale)}function me(e,t,n){let r=!b(e.lastX),i=_e(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 he(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 ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=u(m()),B=u(I_()),ye=u(ke()),be=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},xe={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Se=xe.mouse,Ce=class extends ve.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&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);be(`DraggableCore: handleDragStart: %j`,s),be(`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,j(n,Se.move,this.handleDrag),j(n,Se.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(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]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(be(`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)}else this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(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]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&se(a.ownerDocument),be(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(be(`DraggableCore: Removing handlers`),M(a.ownerDocument,Se.move,this.handleDrag),M(a.ownerDocument,Se.stop,this.handleDragStop))},this.onMouseDown=e=>(Se=xe.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Se=xe.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Se=xe.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Se=xe.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,xe.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,xe.mouse.move,this.handleDrag),M(t,xe.touch.move,this.handleDrag),M(t,xe.mouse.stop,this.handleDragStop),M(t,xe.touch.stop,this.handleDragStop),M(e,xe.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&se(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=ye.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(be(`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 ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Ce.displayName=`DraggableCore`,Ce.propTypes={allowAnyClick:B.default.bool,allowMobileScroll:B.default.bool,children:B.default.node.isRequired,disabled:B.default.bool,enableUserSelectHack:B.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:B.default.arrayOf(B.default.number),handle:B.default.string,cancel:B.default.string,nodeRef:B.default.object,nonce:B.default.string,onStart:B.default.func,onDrag:B.default.func,onStop:B.default.func,onMouseDown:B.default.func,scale:B.default.number,className:S,style:S,transform:S},Ce.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var we=class extends p.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(be(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;be(`Draggable: onDrag: %j`,t);let n=he(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]=z(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,he(this,t))===!1)return!1;be(`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)?(be(`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,m=!s||this.state.dragging,h=s||r,g={x:de(this)&&m?this.state.x:h.x,y:fe(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=L(g,c):d=te(g,c);let v=p.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return p.createElement(Ce,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},p.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};we.displayName=`Draggable`,we.propTypes={...Ce.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:S,style:S,transform:S},we.defaultProps={...Ce.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(t.exports={DraggableCore:Ce})})),j9=o(((e,t)=>{var n=OOe(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),kOe=o((e=>{e.__esModule=!0,e.cloneElement=c;var t=n(m());function n(e){return e&&e.__esModule?e:{default:e}}function r(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 i(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(I_());j9();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)}}})),N9=o((e=>{e.__esModule=!0,e.default=void 0;var t=o(m()),n=j9(),r=kOe(),i=M9(),a=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function o(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(o=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 s(){return s=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,n){let r=this.props.handle;if(!r)return t.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:n});if(typeof r==`function`)return r(e,n);let i=typeof r.type==`string`,a=u({ref:n},i?{}:{handleAxis:e});return t.cloneElement(r,a)}render(){let e=this.props,i=e.children,o=e.className,l=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 d=e.resizeHandles;e.transformScale;let f=c(e,a);return(0,r.cloneElement)(i,u(u({},f),{},{className:(o?o+` `:``)+`react-resizable`,children:[...t.Children.toArray(i.props.children),...d.map(e=>{let r=this.handleRefs[e]??(this.handleRefs[e]=t.createRef());return t.createElement(n.DraggableCore,s({},l,{nodeRef:r,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,r))})]}))}};e.default=h,h.propTypes=i.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),AOe=o((e=>{e.__esModule=!0,e.default=void 0;var t=s(m()),n=o(I_()),r=o(N9()),i=M9(),a=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function o(e){return e&&e.__esModule?e:{default:e}}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;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,n=e.handle,i=e.handleSize;e.onResize;let o=e.onResizeStart,s=e.onResizeStop,l=e.draggableOpts,d=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,a);return t.createElement(r.default,{axis:m,draggableOpts:l,handle:n,handleSize:i,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:d,onResizeStart:o,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},t.createElement(`div`,c({},y,{style:u(u({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=u(u({},i.resizableProps),{},{children:n.default.element})})),jOe=o(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=N9().default,t.exports.ResizableBox=AOe().default}))(),P9=rOe(),F9=50,I9=12;function MOe(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 NOe(e){let t=MOe(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=-I9:i>s.bottom-F9&&l+c0?h=-I9:r>s.right-F9&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,h.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,h.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:fe.current}),[ye]),xe=(0,h.useMemo)(()=>ee??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[ee,M,w,T,E,D,O,k,A,j]),Se=(0,h.useCallback)(e=>{if(_?.calcStyle)return _.calcStyle(e);if(p)return H7(e);let t=HDe(e);return m?{...t,left:U7(e.left/r),width:U7(e.width/r)}:t},[_,p,m,r]),Ce=(0,h.useCallback)((e,{node:t})=>{if(!te)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/g,o=r.left/g,s=i.top/g,c=r.top/g,l;if(_?.calcDragPosition){let t=e;l=_.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(z.current=l,ve.current||=NOe(t instanceof HTMLElement?t:null),v>0){let t=e;ge.current={x:t.clientX,y:t.clientY},he.current=!0,_e.current=!1,se(!0);return}se(!0);let u=w7(B,l.top,l.left),{x:d,y:f}=V7(F,xe,u.x,u.y,be());te(M,d,f,{e,node:t,newPosition:l})},[te,g,B,_,v,F,xe,be,M]),we=(0,h.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!L||!oe)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||!oe)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){se(!1),z.current={left:0,top:0};return}let{left:r,top:i}=z.current,a={top:i,left:r};se(!1),z.current={left:0,top:0};let o=w7(B,i,r),{x:s,y:c}=V7(F,xe,o.x,o.y,be());ne(M,s,c,{e,node:t,newPosition:a})},[ne,oe,B,F,xe,be,M]);pe.current=Ce,me.current=we;let Ee=(0,h.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?KDe(i,a,n,r):{...n,top:a.top,left:a.left},ue.current=c;let l=t?.offsetParent?.clientHeight??0,u=LDe(B,c.width,c.height),{w:d,h:f}=VDe(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[re,ie,ae,r,B,M,F,xe,be]),De=(0,h.useCallback)((e,t)=>{ce(!0);let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,B,w,T,E,D]),Oe=(0,h.useCallback)((e,t)=>{let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,B,w,T,E,D]),ke=(0,h.useCallback)((e,t)=>{ce(!1),ue.current={top:0,left:0,width:0,height:0};let n=C7(B,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,B,w,T,E,D]);(0,h.useEffect)(()=>{if(!y)return;let e=le.current;if(!e)return;let t=de.current||{left:0,top:0},n=oe&&(y.left!==t.left||y.top!==t.top);if(!oe){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-z.current.left,deltaY:y.top-z.current.top,lastX:z.current.left,lastY:z.current.top,x:y.left,y:y.top};me.current?.(y.e,t)}de.current=y},[y,oe,M]);let Ae=C7(B,w,T,E,D,oe?z.current:null,R?ue.current:null),je=h.Children.only(t),Me=x7(B),Ne=[S7(O,Me,i[0]),S7(A,o,i[1])],Pe=[S7(k,Me,i[0]),S7(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=h.cloneElement(je,{ref:le,className:tn(`react-grid-item`,Ie,b,{static:f,resizing:R,"react-draggable":c,"react-draggable-dragging":oe,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(jOe.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:g,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(k9,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:g,allowMobileScroll:d,nodeRef:le,children:Re}),Re}var L9=h.memo(POe,(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);L9.displayName=`GridItem`;function R9(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},_=x7(g),v=S7(i.w,_,u[0]),y=S7(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:IDe(g,D,E,i.w,i.h)}}var z9=()=>{},B9=`react-grid-layout`,V9=!1;try{V9=/firefox/i.test(navigator.userAgent)}catch{}function FOe(e,t){let n=h.Children.toArray(e),r=h.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!h.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(P7(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:j7(i),w:1,h:1})}});let o=I7(i,{cols:n});return r.compact(o,n)}function U9(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=qDe,compactor:c,constraints:l=B7,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:g,onLayoutChange:_=z9,onDragStart:v=z9,onDrag:y=z9,onDragStop:b=z9,onResizeStart:x=z9,onResize:S=z9,onResizeStop:C=z9,onDrop:w=z9,onDropDragOver:T=z9}=e,E=(0,h.useMemo)(()=>({...JDe,...r}),[r]),D=(0,h.useMemo)(()=>({...YDe,...i}),[i]),O=(0,h.useMemo)(()=>({...XDe,...a}),[a]),k=(0,h.useMemo)(()=>({...ZDe,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:ee,handle:I,cancel:te,threshold:L,allowMobileScroll:ne}=D,{enabled:re,handles:ie,handleComponent:ae}=O,{enabled:oe,defaultItem:se,onDragOver:R,touchEnabled:ce=!0,touchDragSource:le=`[data-rgl-draggable]`}=k,z=c??e9(`vertical`),ue=z.type,de=z.allowOverlap,fe=z.preventCollision??!1,pe=(0,h.useMemo)(()=>d??{i:`__dropping-elem__`,...se},[d,se]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,h.useState)(!1),[B,ye]=(0,h.useState)(()=>H9(u,t,A,z)),[be,xe]=(0,h.useState)(null),[Se,Ce]=(0,h.useState)(!1),[we,Te]=(0,h.useState)(null),[Ee,De]=(0,h.useState)(),Oe=(0,h.useRef)(void 0);Oe.current=Ee;let ke=(0,h.useRef)(null),Ae=(0,h.useRef)(null),je=(0,h.useRef)(null),Me=(0,h.useRef)(0),Ne=(0,h.useRef)(B),Pe=(0,h.useRef)(u),Fe=(0,h.useRef)(t),Ie=(0,h.useRef)(ue),Le=(0,h.useRef)(null),Re=(0,h.useRef)(!1),ze=(0,h.useRef)(null),Be=(0,h.useRef)(null);Be.current=we;let Ve=(0,h.useRef)(w);(0,h.useLayoutEffect)(()=>{Ve.current=w});let He=(0,h.useRef)(B);He.current=B,(0,h.useEffect)(()=>{ve(!0),(0,P9.deepEqual)(B,u)||_(B)},[]),(0,h.useEffect)(()=>{if(be||we)return;let e=!(0,P9.deepEqual)(u,Pe.current),n=!FOe(t,Fe.current),r=ue!==Ie.current;if(e||n||r){let n=H9(e?u:B,t,A,z);(0,P9.deepEqual)(n,B)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=ue},[u,t,A,ue,z,be,we,B]),(0,h.useEffect)(()=>{if(!be&&!we&&!(0,P9.deepEqual)(B,Ne.current)){Ne.current=B;let e=B.filter(e=>e.i!==pe.i);_(e)}},[B,be,we,_,pe.i]);let Ue=(0,h.useMemo)(()=>{if(!f)return;let e=j7(B),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,B,j,N,ge]),We=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=M7(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=P7(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=M7(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=L7(i,o,t,n,!0,fe,ue,A,de);y(c,a,o,s,r.e,r.node),ye(z.compact(c,A)),xe(s)},[fe,ue,A,de,z,y]),Ke=(0,h.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=M7(i,e);if(!o)return;let s=L7(i,o,t,n,!0,fe,ue,A,de),c=z.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,P9.deepEqual)(l,c)&&_(c)},[fe,ue,A,de,z,b,_]),qe=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=M7(i,e);a&&(Ae.current=P7(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=BDe(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&&O7(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=L7(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=z.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[fe,ue,A,de,z,S]),Ye=(0,h.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=M7(i,e),s=z.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,P9.deepEqual)(c,s)&&_(s)},[A,z,C,_]),Xe=(0,h.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(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{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,h.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=R9({clientX:e,clientY:t,gridElement:i,droppingItem:pe,event:r,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Xe(pe,a,o,!!Be.current)},[pe,he,A,N,M,j,n,ge,Xe]),Qe=(0,h.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===pe.i)){Te(null),xe(null),De(void 0);return}let t=z.compact(e.filter(e=>e.i!==pe.i),A);ye(t),Te(null),xe(null),De(void 0)},[pe.i,A,z]),$e=(0,h.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),V9&&!e.nativeEvent.target?.classList.contains(B9))return!1;let t=R?R(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},{newDroppingPosition:s,calculatedXY:c}=R9({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});Xe(o,s,c,!!we)},[we,pe,R,T,Qe,Xe,he,A,N,M,j,n,ge]),et=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,h.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===pe.i);Qe(),Ve.current(t,n,e)},[pe.i,Qe]),rt=(0,h.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,h.useEffect)(()=>{if(!oe||!ce)return;let e=Le.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(le)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);n&&(t(n.clientX,n.clientY)?Ze(n.clientX,n.clientY,e):Be.current&&Qe())},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);Re.current=!1,ze.current=null,n&&(t(n.clientX,n.clientY)?nt(e):Qe())},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},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)}},[oe,ce,le,Ze,Qe,nt,pe.i]);let it=(0,h.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=M7(B,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&&ee&&r.isBounded!==!1,u=ae;return(0,H.jsx)(L9,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:te,handle:I,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:ne,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:L,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?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:B,children:e},r.i)},[B,n,A,N,ge,M,j,te,I,We,Ge,Ke,qe,Je,Ye,F,re,ee,me,_e,he,s,L,Ee,ie,ae,l]),at=()=>be?(0,H.jsx)(L9,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`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:B,children:(0,H.jsx)(`div`,{})}):null,ot=(0,h.useCallback)(e=>{Le.current=e,typeof g==`function`?g(e):g&&`current`in g&&(g.current=e)},[g]),st=tn(B9,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:oe?rt:void 0,onDragLeave:oe?et:void 0,onDragEnter:oe?tt:void 0,onDragOver:oe?$e:void 0,children:[h.Children.map(t,e=>h.isValidElement(e)?it(e):null),oe&&we&&it(we,!0),at()]})}var IOe={lg:1200,md:996,sm:768,xs:480,xxs:0},LOe={lg:12,md:10,sm:6,xs:4,xxs:2},W9=()=>{};function ROe(e,t,n,r,i=!1){let a=[];h.Children.forEach(t,t=>{if(!h.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:j7(a),w:1,h:1})});let o=I7(a,{cols:n});return r.compact(o,n)}function zOe(e){let{children:t,width:n,breakpoint:r,breakpoints:i=IOe,cols:a=LOe,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=W9,onLayoutChange:p=W9,onWidthChange:m=W9,...g}=e,_=d??e9(`vertical`),v=_.type,y=_.allowOverlap,b=(0,h.useMemo)(()=>r??n9(i,n),[]),x=(0,h.useMemo)(()=>r9(b,a),[b,a]),S=(0,h.useMemo)(()=>i9(o,i,b,b,x,v),[]),[C,w]=(0,h.useState)(b),[T,E]=(0,h.useState)(x),[D,O]=(0,h.useState)(S),[k,A]=(0,h.useState)(o),j=(0,h.useRef)(n),M=(0,h.useRef)(r),N=(0,h.useRef)(i),P=(0,h.useRef)(a),F=(0,h.useRef)(o),ee=(0,h.useRef)(v),I=(0,h.useRef)(k);(0,h.useEffect)(()=>{I.current=k},[k]);let te=(0,h.useMemo)(()=>(0,P9.deepEqual)(o,F.current)?null:i9(o,i,C,C,T,_),[o,i,C,T,_]),L=te??D;(0,h.useEffect)(()=>{te!==null&&(O(te),A(o),I.current=o,F.current=o)},[te,o]),(0,h.useEffect)(()=>{if(v!==ee.current){let e=_.compact(F7(L),T),t={...I.current,[C]:e};O(e),A(t),I.current=t,p(e,t),ee.current=v}},[v,_,L,T,y,C,p]),(0,h.useEffect)(()=>{let e=n!==j.current,o=r!==M.current,s=!(0,P9.deepEqual)(i,N.current),c=!(0,P9.deepEqual)(a,P.current);if(e||o||s||c){let e=r??n9(i,n),o=r9(e,a),d=C;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=F7(D));let r=i9(n,i,e,d,o,_),a=!n[e];r=ROe(r,t,o,_,a),n[e]=r,w(e),E(o),O(r),A(n),I.current=n,f(e,o),p(r,n)}let h=a9(l,e),g=u?a9(u,e):null;m(n,h,o,g),j.current=n,M.current=r,N.current=i,P.current=a}},[n,r,i,a,C,T,D,t,_,v,y,l,u,f,p,m]);let ne=(0,h.useCallback)(e=>{let t={...I.current,[C]:e};O(e),A(t),I.current=t,p(e,t)},[C,p]),re=(0,h.useMemo)(()=>a9(l,C),[l,C]),ie=(0,h.useMemo)(()=>u===null?null:a9(u,C),[u,C]),ae=(0,h.useMemo)(()=>({cols:T,rowHeight:s,maxRows:c,margin:re,containerPadding:ie}),[T,s,c,re,ie]);return(0,H.jsx)(U9,{...g,width:n,gridConfig:ae,compactor:_,onLayoutChange:ne,layout:L,children:t})}var BOe=h.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(zOe,{...r,innerRef:i})});BOe.displayName=`ResponsiveGridLayout`;var G9=36,VOe={s:2,m:7,l:12},HOe={stat:3,gauge:3,timeseries:6,bar:6,table:12,list:6,inbox:8,cards:12,timeline:12,text:6};function UOe(e){return{w:Math.min(12,e.width??HOe[e.viz]),h:VOe[e.height??(e.viz===`stat`||e.viz===`gauge`?`s`:e.viz===`inbox`?`l`:`m`)]}}var K9=12,q9=48,J9=58;function WOe(e,t,n,r){if(t?.status===`empty`||t?.frame&&t.frame.rows.length===0)return 2;let i=t?.frame?.rows.length;if(i===void 0)return;let a;switch(e.viz){case`table`:a=90+31*i;break;case`list`:a=J9+33*i;break;case`inbox`:{let e=t?.frame?.columns.findIndex(e=>e.name===`kind`)??-1,n=e<0?i:t.frame.rows.filter(t=>t[e]===`waiting`).length;a=142+72*n+36*(i-n);break}case`cards`:{let e=Math.max(1,Math.floor(r*n/12/230));a=J9+160*Math.ceil(i/e);break}case`stat`:return 2;case`gauge`:return 3;default:return}return Math.max(2,Math.ceil((a+K9)/q9))}function GOe(e){let t=[],n=(e,n,r,i)=>t.every(t=>e+r<=t.x||t.x+t.w<=e||n+i<=t.y||t.y+t.h<=n);for(let n of e)n.grid&&t.push({i:n.id,...n.grid});for(let r of e){if(r.grid)continue;let{w:e,h:i}=UOe(r),a;for(let t=0;!a;t++)for(let r=0;r+e<=12&&!a;r++)n(r,t,e,i)&&(a={x:r,y:t});t.push({i:r.id,...a,w:e,h:i})}return t}function KOe(e,t,n,r,i){let a=e.map(e=>({...e,h:Math.min(Math.max(e.h,12),WOe(t.get(e.i),n.get(e.i),e.w,r)??e.h)})),o=(e,t)=>e.x!a.some(n=>n!==e&&o({...e,...t},n)),c=()=>{for(let e of[...a].sort((e,t)=>e.y-t.y||e.x-t.x))for(;e.y>0&&a.every(t=>t===e||t.y>e.y||!o({...e,y:e.y-1},t));)e.y--},l=()=>Math.max(0,...a.map(e=>e.y+e.h)),u=[];for(let e of[...a].sort((e,t)=>e.y-t.y||e.x-t.x)){for(;u.some(t=>o(e,t));)e.y++;u.push(e)}c();let d=new Set([`bar`,`timeseries`,`timeline`]),f=e=>d.has(t.get(e.i).viz)?4:Math.min(5,e.h),p=new Map(e.map((e,t)=>[e.i,t]));for(;l()>i;){let e=a.filter(e=>e.h>f(e)).sort((e,t)=>p.get(t.i)-p.get(e.i))[0]??a.filter(e=>e.h>3).sort((e,t)=>t.h-e.h)[0];if(!e)break;e.h--,c()}for(let e of a){for(;e.x>0&&s(e,{x:e.x-1,w:1});)e.x--,e.w++;for(;e.x+e.w<12&&s(e,{x:e.x+e.w,w:1});)e.w++}let m=Math.max(i,l());for(let e of[...a].sort((e,t)=>e.y-t.y))for(;e.y+e.h{let e=t.current;if(!e)return;let n=()=>r({height:e.clientHeight,width:e.clientWidth});n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),{ref:t,...n}}function JOe({fragment:e,editing:t,act:n,onLayout:r,onRemove:i}){let{inboxFilter:a}=I0(),{width:o,containerRef:s,mounted:c}=aOe(),l=qOe(t),u=new Map(e.results.map(e=>[e.id,e])),d=new Map(e.dashboard.panels.map(e=>[e.id,e])),f=t?[]:e.dashboard.panels.filter(e=>u.get(e.id)?.status===`empty`&&!(e.viz===`inbox`&&a)),p=t?e.dashboard.panels:e.dashboard.panels.filter(e=>!f.includes(e)),m=Math.max(1,Math.floor((l.height+K9)/q9)),h=KOe(GOe(p),d,u,l.width,m),g=e=>{l.ref.current=e,s.current=e},_=l.height>0&&l.width>0;if(!t){let e=Math.max(1,...h.map(e=>e.y+e.h));return(0,H.jsxs)(H.Fragment,{children:[f.length>0&&(0,H.jsx)(YOe,{panels:f,results:u}),(0,H.jsx)(G,{ref:g,style:{flex:1,minHeight:0,display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:K9,gridTemplateRows:`repeat(${e}, minmax(${G9}px, 1fr))`},children:_&&h.map(e=>(0,H.jsx)(G,{style:{minWidth:0,minHeight:0,gridColumn:`${e.x+1} / span ${e.w}`,gridRow:`${e.y+1} / span ${e.h}`},children:(0,H.jsx)(E8,{panel:d.get(e.i),result:u.get(e.i),act:n,fill:!0})},e.i))})]})}let v=e=>{e.some(e=>{let t=h.find(t=>t.i===e.i);return!t||t.x!==e.x||t.y!==e.y||t.w!==e.w||t.h!==e.h})&&r(Object.fromEntries(e.map(e=>[e.i,{x:e.x,y:e.y,w:e.w,h:e.h}])))};return(0,H.jsx)(G,{ref:g,className:`editing`,style:{flex:1,minHeight:0,overflow:`auto`},children:_&&c&&(0,H.jsx)(U9,{width:o,layout:h,gridConfig:{cols:12,rowHeight:G9,margin:[K9,K9],containerPadding:[0,0]},dragConfig:{enabled:!0,handle:`.panel-handle`},resizeConfig:{enabled:!0},onDragStop:e=>v(e),onResizeStop:e=>v(e),children:h.map(e=>(0,H.jsxs)(`div`,{style:{position:`relative`},children:[(0,H.jsx)(E8,{panel:d.get(e.i),result:u.get(e.i),fill:!0}),(0,H.jsx)(lu,{variant:`default`,pos:`absolute`,top:8,right:8,"aria-label":`Remove ${d.get(e.i).title}`,onClick:()=>{W0(`Remove ${d.get(e.i).title} from this dashboard?`).then(t=>{t&&i(e.i)})},children:(0,H.jsx)(Iy,{})})]},e.i))})})}function YOe({panels:e,results:t}){return(0,H.jsx)(K,{role:`group`,gap:`lg`,mb:8,px:2,"aria-label":`Nothing to show`,children:e.map(e=>(0,H.jsx)(Bg,{label:t.get(e.id)?.message??e.empty??`Nothing matches right now.`,multiline:!0,maw:300,children:(0,H.jsxs)(K,{id:`panel-${e.id}`,gap:6,wrap:`nowrap`,c:`dimmed`,children:[(0,H.jsx)(Dv,{"aria-hidden":!0}),(0,H.jsxs)(q,{size:`sm`,id:`panel-${e.id}`,children:[e.title,`: `,(0,H.jsx)(q,{span:!0,c:`dimmed`,size:`sm`,children:`none`})]})]})},e.id))})}function XOe({panels:e,busy:t,onAdd:n,onReset:r,onAsk:i}){let[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(``),[l,u]=(0,h.useState)(``),d=async()=>{u(``);try{o(await H0.catalog())}catch(e){o([]),u(e.message)}},f=am({onDropdownOpen:()=>{f.focusSearchInput(),d()},onDropdownClose:e=>{f.resetSelectedOption(),c(``),e===`keyboard`&&f.focusTarget()}}),p=a.filter(t=>!e.some(e=>e.id===t.id)),m=p.filter(e=>e.title.toLowerCase().includes(s.toLowerCase())),g=e.length>=16;return(0,h.useEffect)(()=>{f.dropdownOpened&&f.selectFirstOption()},[a,s,f.dropdownOpened]),(0,H.jsxs)(K,{gap:2,wrap:`nowrap`,style:{flex:`none`},children:[(0,H.jsxs)(cm,{store:f,width:280,position:`bottom-end`,withinPortal:!0,onOptionSubmit:e=>{let r=p.find(t=>t.id===e);r&&!g&&!t&&n(r),f.closeDropdown()},children:[(0,H.jsx)(cm.Target,{targetType:`button`,withExpandedAttribute:!0,children:(0,H.jsx)(lu,{variant:`subtle`,"aria-label":`Add widget`,disabled:t,onClick:()=>f.toggleDropdown(),children:(0,H.jsx)(Kte,{})})}),(0,H.jsxs)(cm.Dropdown,{children:[(0,H.jsx)(cm.Search,{"aria-label":`Find a widget`,placeholder:`Find a widget`,value:s,onChange:e=>{c(e.currentTarget.value)}}),(0,H.jsxs)(cm.Options,{mah:320,style:{overflowY:`auto`},children:[m.map(e=>(0,H.jsx)(cm.Option,{value:e.id,disabled:g||t,children:e.title},e.id)),m.length===0&&(0,H.jsx)(cm.Empty,{children:l||`No matching widgets`})]}),g&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,p:`xs`,children:`The header shows at most 16 widgets`}),(0,H.jsx)(km,{variant:`subtle`,fullWidth:!0,size:`xs`,onClick:()=>{f.closeDropdown(),i(`Add a header widget that shows `)},children:`Ask Chat for another…`})]})]}),(0,H.jsxs)(ng,{withinPortal:!0,position:`bottom-end`,children:[(0,H.jsx)(ng.Target,{children:(0,H.jsx)(lu,{variant:`subtle`,"aria-label":`Header options`,disabled:t,children:(0,H.jsx)(Vv,{})})}),(0,H.jsx)(ng.Dropdown,{children:(0,H.jsx)(ng.Item,{onClick:r,children:`Reset header`})})]})]})}var ZOe={name:`Search`,panels:[{id:`live`,title:`Live`,viz:`table`,source:`sessions`},{id:`ended`,title:`Ended`,viz:`table`,source:`history`}]},Y9=(e,t)=>{let n=Date.parse(String(t??``));return n?`${O1(Math.max(0,e-n))} ago`:``};function QOe(e,t,n,r,i){let a=e=>Date.parse(String(e.last_activity_at??``))||0,o=e=>String(e.title||`Session ${e.id}`),s=e=>[e.project,e.branch,e.agent,e.machine,e.state].filter(e=>typeof e==`string`&&e!==``);return[{group:`Live sessions`,actions:[...e].sort((e,t)=>a(t)-a(e)).map(e=>({id:`live-${e.machine_id}-${e.id}`,label:o(e),description:[e.project,e.branch,e.agent,e.machine,a(e)?`active ${Y9(n,e.last_activity_at)}`:``].filter(Boolean).join(` · `),keywords:s(e),leftSection:(0,H.jsx)(uv,{size:16,"aria-hidden":!0}),rightSection:e.label?(0,H.jsx)(l0,{...c0(String(e.label)),inferred:e.inferred===!0||String(e.label).startsWith(`~`)}):void 0,onClick:()=>void r({kind:`jump`,row:{...e,session_id:e.id}})}))},{group:`Ended sessions`,actions:t.map(e=>({id:`ended-${e.machine_id}-${e.id}`,label:o(e),description:[e.project,e.branch,e.agent,e.machine,`ended ${Y9(n,e.ended_at)}`].filter(Boolean).join(` · `),keywords:s(e),leftSection:e.resume?(0,H.jsx)(jv,{size:16,"aria-hidden":!0}):(0,H.jsx)(Cv,{size:16,"aria-hidden":!0}),rightSection:(0,H.jsx)(q,{className:`search-hint`,size:`xs`,c:`var(--driga-text)`,style:{whiteSpace:`nowrap`},children:e.resume?`Copy resume command`:`Ask Chat`}),onClick:()=>i(e)}))}].filter(e=>e.actions.length>0)}var $Oe=(e,t)=>{let n=e.toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return t;let r=e=>{let t=[e.label,e.description,...Array.isArray(e.keywords)?e.keywords:[e.keywords]].filter(Boolean).join(` `).toLowerCase();return n.every(e=>t.includes(e))},i=[];for(let e of t){if(!cb(e)){r(e)&&i.push(e);continue}let t=e.actions.filter(r);t.length&&i.push({...e,actions:t})}return i};function eke({list:e,act:t,ask:n,open:r,onFleet:i,say:a}){let[o,s]=(0,h.useState)({live:[],ended:[]}),[c,l]=(0,h.useState)(!1),u=(e,t)=>gS(e.results.find(e=>e.id===t)?.frame??{columns:[],rows:[]}),d=()=>H0.run(ZOe).then(e=>{s({live:u(e,`live`),ended:u(e,`ended`)}),l(!1)},()=>l(!0)),f=e=>{let t=String(e.title||`Session ${e.id}`);typeof e.resume!=`string`||!e.resume?n(`Tell me about session ${e.id}, "${t}": what it did and what it left uncommitted.`):navigator.clipboard?.writeText(e.resume).then(()=>a(`Copied the command that resumes ${t}. Paste it in a terminal.`),()=>a(`Couldn't copy. Resume with: ${e.resume}`))},p={group:`Dashboards`,actions:e.map(e=>({id:`dashboard-${e.id}`,label:e.name,leftSection:(0,H.jsx)(Ty,{size:16,"aria-hidden":!0}),onClick:()=>r(e.id)}))},m={group:`Pages`,actions:i?[{id:`page-fleet`,label:`Fleet`,description:`Every machine, project and session, and where the memory goes`,keywords:[`machines`,`sessions`],leftSection:(0,H.jsx)(Dy,{size:16,"aria-hidden":!0}),onClick:i}]:[]};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($c,{className:`search-button`,onClick:sb.open,"aria-keyshortcuts":`Meta+K`,title:`Search sessions and dashboards (⌘K)`,children:(0,H.jsxs)(K,{gap:8,wrap:`nowrap`,children:[(0,H.jsx)(hy,{size:16,"aria-hidden":!0}),(0,H.jsx)(q,{size:`sm`,c:`dimmed`,visibleFrom:`lg`,children:`Search`}),(0,H.jsx)(tl,{hiddenFrom:`lg`,children:`Search`}),(0,H.jsx)(yh,{size:`xs`,visibleFrom:`lg`,"aria-hidden":!0,children:`⌘K`})]})}),(0,H.jsx)(yb,{title:`Search sessions and dashboards`,styles:{actionDescription:{color:`var(--driga-text)`,opacity:1},actionSection:{opacity:1}},shortcut:[`mod + K`],filter:$Oe,onSpotlightOpen:()=>void d(),limit:40,highlightQuery:!0,scrollable:!0,maxHeight:480,actions:[...QOe(o.live,o.ended,Date.now(),t,f),...p.actions.length?[p]:[],...m.actions.length?[m]:[]],nothingFound:c?`Driga can't reach its service, so there is nothing to search.`:`No session or dashboard matches. Sessions that ended more than two weeks ago aren't listed.`,searchProps:{"aria-label":`Search sessions and dashboards`,leftSection:(0,H.jsx)(hy,{size:18,"aria-hidden":!0}),placeholder:`Search sessions by title, project, branch, agent or machine`}})]})}var X9=5e3,Z9=`header`,Q9=`home`,tke={name:`Inbox`,panels:[{id:`inbox`,title:`Inbox`,viz:`inbox`,source:`inbox`}]},$9={at:0,failed:!1};function nke({id:e,vars:t,onError:n,onMissing:r}){let[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)({id:e,navigation:0,fragment:null,fresh:$9}),[f,p]=(0,h.useState)([]),[m,g]=(0,h.useState)([]),[_,v]=(0,h.useState)([]),[y,b]=(0,h.useState)([]),[x,S]=(0,h.useState)(!1),C=(0,h.useRef)({scope:{id:e,vars:t,mutations:0,reconcile:!1,navigation:0},generation:0,refreshing:-1,request:null,editing:!1,headerMutations:0}),w=(0,h.useRef)({onError:n,onMissing:r});w.current={onError:n,onMissing:r};let T=C.current;(T.scope.id!==e||T.scope.vars!==t)&&(T.scope={id:e,vars:t,mutations:0,reconcile:!1,navigation:T.scope.navigation+Number(T.scope.id!==e)},T.generation++);let E=u.navigation===T.scope.navigation?u.fragment:null,D=u.navigation===T.scope.navigation?u.fresh:$9,O=(0,h.useCallback)(async(n=!1)=>{let r=C.current;if(r.scope.id!==e||r.scope.vars!==t||r.scope.mutations>0||r.headerMutations>0||r.editing&&!n||!n&&r.refreshing===r.generation)return;let i=r.scope,o=++r.generation;r.request?.abort();let c=new AbortController;r.request=c,r.refreshing=o;let u=()=>r.generation===o&&r.scope===i,f=(e,t)=>e.then(e=>{u()&&t(e)},()=>void 0),m=async()=>{try{let n=await H0.open(e,t,c.signal);u()&&d({id:e,navigation:i.navigation,fragment:n,fresh:{at:Date.now(),failed:!1}})}catch(t){if(!u())return;d(t=>({id:e,navigation:i.navigation,fragment:t.navigation===i.navigation?t.fragment:null,fresh:{at:t.navigation===i.navigation?t.fresh.at:0,failed:!0}})),w.current.onError(t.message),e!==`home`&&w.current.onMissing()}};try{K0.bursts().then(e=>{u()&&g(e)},()=>void 0),K0.grantHistory().then(e=>{u()&&p(e)},()=>void 0),K0.prompts().then(e=>{u()&&v(e)},()=>void 0),await Promise.all([m(),f(H0.open(Z9,void 0,c.signal),a),f(H0.run(tke,void 0,c.signal),s),f(H0.run(age,void 0,c.signal),l)])}finally{r.request===c&&(r.request=null),r.refreshing===o&&(r.refreshing=-1)}},[e,t]),k=(0,h.useRef)(()=>O(!0));return k.current=()=>O(!0),(0,h.useEffect)(()=>(O(!0),()=>{C.current.generation++,C.current.request?.abort()}),[O]),(0,h.useEffect)(()=>{if(x)return;let e=window.setInterval(()=>{document.visibilityState===`visible`&&O()},X9);return()=>window.clearInterval(e)},[O,x]),(0,h.useEffect)(()=>{let e=!0;return H0.list().then(t=>{e&&b(t.filter(e=>e.id!==Z9))},()=>void 0),()=>{e=!1}},[E?.id,E?.version]),{fragment:E,header:i,inbox:o,fleet:c,prompts:_,bursts:m,grantHistory:f,list:y,fresh:D,editing:x,setEditing:(0,h.useCallback)(e=>{let t=C.current,n=typeof e==`function`?e(t.editing):e;n!==t.editing&&(t.editing=n,t.generation++,S(n))},[]),refresh:()=>O(!0),edit:async(e,t,n,r)=>{let i=C.current,o=i.scope;i.generation++,o.mutations++;try{let s=await H0.edit(e,n,t,e===`header`?void 0:o.vars,r);return i.scope===o?(e===`header`?a(s):e===o.id&&d({id:o.id,navigation:o.navigation,fragment:s,fresh:{at:Date.now(),failed:!1}}),s):void 0}catch(e){i.scope===o&&(w.current.onError(e.message),o.reconcile=!0)}finally{o.mutations--,i.scope===o&&(i.generation++,o.reconcile&&o.mutations===0&&(o.reconcile=!1,O(!0)))}},mutateHeader:async e=>{let t=C.current;if(t.headerMutations>0)return;let n=t.scope;t.headerMutations++,t.generation++;try{let t=await e();return a(t),t}catch(e){let t=e instanceof Error&&`status`in e&&e.status===409;try{a(await H0.open(Z9)),w.current.onError(t?`Header changed elsewhere; reloaded`:e.message)}catch(e){w.current.onError(e.message)}}finally{t.headerMutations--,t.generation++,t.scope!==n&&k.current()}},forgetPrompt:e=>{C.current.generation++,v(t=>t.filter(t=>t.id!==e)),g(t=>t.map(t=>({...t,members:t.members.filter(t=>t.id!==e)})).filter(e=>e.members.length>0))}}}function rke(){return new URLSearchParams(location.search).get(`dashboard`)||`home`}function ike(){return new URLSearchParams(location.search).get(`page`)===`fleet`?`fleet`:`board`}var ake={inbox:`inbox`,stuck:`stuck`,leftover:`orphans`,reclaim:`orphans`,memory:`machine_memory`};function oke(e){let t=document.getElementById(`panel-${e}`),n=t?.closest(`.mantine-Card-root`)??t;n&&(n.scrollIntoView({behavior:`smooth`,block:`nearest`}),n.classList.add(`panel-shown`),window.setTimeout(()=>n.classList.remove(`panel-shown`),1600))}function ske(e){try{return localStorage.getItem(e)}catch{return null}}function cke(e,t){try{localStorage.setItem(e,t)}catch{}}function lke(e){return e instanceof HTMLElement&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName))}function uke(){let[e,t]=(0,h.useState)(rke),[n,r]=(0,h.useState)(ike),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(()=>ske(`driga-chat-open`)!==`false`),[f,p]=(0,h.useState)(null),m=e=>at.show({message:e,autoClose:4e3,closeButtonProps:{"aria-label":`Dismiss`}}),{fragment:g,header:_,inbox:v,fleet:y,prompts:b,bursts:x,grantHistory:S,list:C,fresh:w,editing:T,setEditing:E,refresh:D,edit:O,mutateHeader:k,forgetPrompt:A}=nke({id:e,vars:i,onError:m,onMissing:()=>t(Q9)});(0,h.useEffect)(()=>{cke(`driga-chat-open`,String(u))},[u]);let j=dS(),M=oS({id:`driga-split`,panelIds:[`board`,`chat`],onlySaveAfterUserInteractions:!0});(0,h.useEffect)(()=>{let e=j.current;e&&(u&&e.isCollapsed()&&e.expand(),!u&&!e.isCollapsed()&&e.collapse())},[u,j]),(0,h.useEffect)(()=>{history.replaceState(null,``,n===`fleet`?`/app/?page=fleet`:e===`home`?`/app/`:`/app/?dashboard=${encodeURIComponent(e)}`)},[e,n]);let N=(0,h.useMemo)(()=>y?P0(y,v):null,[y,v]),P=(0,h.useMemo)(()=>i0(_),[_]),F=(0,h.useMemo)(()=>_?xhe(_,N,P):null,[_,N,P]);(0,h.useEffect)(()=>{if(!o||e!==`home`||n!==`board`||g?.id!==`home`)return;let t=()=>document.getElementById(`panel-${o}`)?(oke(o),s(null),!0):!1;if(t())return;let r=new MutationObserver(()=>{t()&&r.disconnect()});return r.observe(document.body,{childList:!0,subtree:!0}),()=>r.disconnect()},[o,e,n,g]);let ee=e=>{E(!1),a({}),t(e),r(`board`)},I=(0,h.useCallback)(()=>{E(!1),r(`fleet`)},[]),te=t=>{(e!==`home`||n!==`board`)&&ee(Q9),s(ake[t])},L=async t=>{try{let r=g?.id===`home`?g:await H0.open(Q9),i=r.dashboard.panels.find(e=>e.source===t.source&&(e.measure??`count`)===(t.measure??`count`));if(!i){let e=t.id;for(let n=2;r.dashboard.panels.some(t=>t.id===e);n++)e=`${t.id}_${n}`;let n={...Object.fromEntries((_?.dashboard.variables??[]).map(e=>[e.name,e.default??``])),..._?.vars},a=t.title;for(let e of Object.keys(n).sort((e,t)=>t.length-e.length))a=a.replaceAll(`$${e}`,n[e]||`all ${e}s`);if(i={...t,id:e,title:a,...t.where?{where:t.where.flatMap(e=>{if(!e.value.startsWith(`$`))return[e];let t=n[e.value.slice(1)];return t?[{...e,value:t}]:[]})}:{}},!await O(`home`,r.version??0,[{op:`add`,panel:i}],`Added a header widget to Home`))return}(e!==`home`||n!==`board`)&&ee(Q9),s(i.id)}catch(e){m(e.message)}},ne=e=>l(t=>t===e?null:e),re=e=>{d(!0),p({text:e,at:Date.now()})},[ie,ae]=(0,h.useState)(!1),oe=(0,h.useRef)(!1),se=async(e,t,n)=>{if(!oe.current){oe.current=!0,ae(!0);try{let r=await k(e);if(!r)return;let i=at.show({autoClose:8e3,closeButtonProps:{"aria-label":`Dismiss`},message:(0,H.jsxs)(K,{gap:`sm`,wrap:`nowrap`,children:[n,(0,H.jsx)(km,{size:`compact-xs`,variant:`subtle`,onClick:()=>{oe.current||(at.hide(i),se(()=>H0.replace(Z9,t,r.version??0,void 0,`Undid a header edit`),structuredClone(r.dashboard),`Header restored`))},children:`Undo`})]})})}finally{oe.current=!1,ae(!1)}}},R=(e,t)=>{_&&se(()=>H0.edit(Z9,e,_.version??0,void 0,t),structuredClone(_.dashboard),t)},ce=()=>{_&&se(()=>H0.reset(Z9,_.version??0),structuredClone(_.dashboard),`Header reset`)},le=async({kind:e,row:t})=>{let n=t.machine_id,r=Number(t.session_id??t.id),i=String(t.title??t.signature??t.project??t.path??t.id??``),a=async(e,t)=>{let n=await uge(e,t);return n||m(`Cancelled`),n};try{switch(e){case`jump`:case`open`:await G0({action:`jump`,session_id:r,machine:n}),m(`Opened the session's pane`);return;case`ack`:{let e=typeof t.ids==`string`&&t.ids?t.ids.split(`,`):[t.id];for(let t of e)await G0({action:`ack_inbox`,id:t,machine:n});m(e.length>1?`Acknowledged ${e.length} turns`:`Acknowledged`);break}case`stop`:if(!await a(`Stop ${i}? Its agent and the processes it started are ended.`,{action:`kill`,session_id:r,machine:n}))return;m(`Stopped ${i}`);break;case`kill`:case`force_kill`:{let r=e===`force_kill`;if(!await a(`${r?`Force kill`:`Kill`} the ${i} process tree? ${r?`Processes get SIGKILL without a chance to clean up.`:`Processes get SIGTERM first.`}`,{action:`kill`,id:t.id,machine:n,force:r}))return;m(`Killed ${i}`);break}case`cleanup`:if(!await a(`Remove ${i}? Driga checks it again before removing it.`,{action:`cleanup`,id:t.id,machine:n}))return;m(`Removed ${i}`);break;case`summarize`:await G0({action:`summarize`,project:t.path,machine:n}),m(`Summarizing ${i}`);return}D()}catch(e){m(e.message)}},z=async(e,t)=>{try{await K0.answer(e.id,t),A(e.id),m(t?`Allowed ${e.tool}`:`Denied ${e.tool}`)}catch(e){m(e.message)}},ue=async(e,t,n)=>{try{await K0.decideBurst(e,t,n),t.forEach(A)}catch(e){throw D(),e}},de=async e=>{try{await K0.answerSimilar(e.id),A(e.id),D()}catch(e){m(e.message)}},fe=async e=>{try{await K0.revokeGrant(e),D()}catch(e){m(e.message)}},pe=async()=>{if(!g?.id)return;let e=g.dashboard.name;if(!await W0(`Delete the ${e} dashboard and its history?`))m(`Cancelled`);else try{await H0.delete(g.id),g.id===`home`?D():ee(Q9),m(g.id===`home`?`Home is back to the default`:`Deleted ${e}`)}catch(e){m(e.message)}},me=y?.results.find(e=>e.id===`sessions`)?.frame,he=gS(me),ge={clearInboxFilter:()=>l(null),stuck:me?{...me,rows:me.rows.filter((e,t)=>he[t].state===`stuck`||he[t].label===`stuck`)}:void 0,act:le,local:(g??_)?.local_machine,prompts:b,bursts:x,decideBurst:ue,answer:z,answerSimilar:de,grantHistory:S,revokeGrant:fe,inboxFilter:c,ask:re};(0,h.useEffect)(()=>{window.drigaCommand=(e,t)=>{e===`reload`?D():e===`back`?history.back():e===`forward`?history.forward():e===`find`?sb.open():e===`view`&&t===`fleet`?I():e===`view`&&t===`inbox`?(l(null),te(`inbox`)):e===`openSession`&&t&&typeof t==`object`&&`session_id`in t&&typeof t.session_id==`number`&&le({kind:`jump`,row:t})}}),(0,h.useEffect)(()=>{let e=-1/0,t=t=>{if(t.metaKey||t.ctrlKey||t.altKey||lke(t.target)||document.querySelector(`[aria-modal="true"]`)){e=-1/0;return}let n=performance.now()-e<800;if(e=-1/0,t.key===`g`){e=performance.now();return}if(t.key===`f`&&n){I();return}let r=Z1[Number(t.key)-1];r&&(t.preventDefault(),l(e=>e===r?null:r))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[I]);let _e=v?.dashboard.panels[0],ve=n===`fleet`?!1:!g||g.dashboard.panels.some(e=>e.viz===`inbox`),B=_e?{panel:_e,result:v.results[0],listed:!!ve}:void 0,ye=g?.dashboard;return(0,H.jsx)(F0.Provider,{value:ge,children:(0,H.jsxs)(Op,{header:{height:56},padding:0,children:[(0,H.jsx)(Op.Header,{px:`md`,style:{background:`color-mix(in srgb, var(--driga-ground) 88%, transparent)`,backdropFilter:`blur(10px)`,borderColor:`var(--driga-border)`},children:(0,H.jsx)(FDe,{data:F,filter:c,chatOpen:u,onFilter:ne,onOpenFleet:I,onSearch:sb.open,onToggleChat:()=>d(e=>!e),onShow:e=>void L(e),busy:ie,onRemove:e=>R([{op:`remove`,id:e}],`Removed a header widget`),onMove:(e,t)=>R([{op:`move`,id:e,...t?{before:t}:{}}],`Reordered header widgets`),editor:_&&(0,H.jsx)(XOe,{panels:_.dashboard.panels,busy:ie,onAdd:e=>R([{op:`add`,panel:e}],`Added a header widget`),onReset:ce,onAsk:re}),onAsk:e=>re(`Tell me about "${e}" right now.`),search:(0,H.jsx)(eke,{list:C,act:le,say:m,open:ee,onFleet:I,ask:re})})}),(0,H.jsx)(Op.Main,{style:{height:`100dvh`,display:`flex`},children:(0,H.jsxs)(rS,{orientation:`horizontal`,id:`driga-split`,defaultLayout:M.defaultLayout,onLayoutChanged:M.onLayoutChanged,style:{flex:1,minWidth:0},children:[(0,H.jsx)(lS,{id:`board`,minSize:360,style:{display:`flex`,flexDirection:`column`,minWidth:0},children:n===`fleet`?(0,H.jsx)(G,{px:`md`,pt:`sm`,pb:`md`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:(0,H.jsx)(cge,{fragment:y,inbox:v,act:le})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{justify:`space-between`,wrap:`nowrap`,gap:`sm`,px:`md`,pt:`sm`,pb:8,children:[(0,H.jsxs)(G,{style:{minWidth:0},children:[(0,H.jsx)(k_,{order:1,fz:28,fw:650,lh:1.2,style:{letterSpacing:`-0.02em`},children:ye?.name??`Loading…`}),w.failed&&w.at>0?(0,H.jsxs)(q,{size:`xs`,c:`warning`,truncate:!0,role:`status`,title:`Not updated since ${new Date(w.at).toLocaleTimeString([],{timeStyle:`medium`})}. Retrying; check driga service status.`,children:[`Not updated since `,new Date(w.at).toLocaleTimeString([],{timeStyle:`medium`}),`. Retrying; check `,(0,H.jsx)(q,{span:!0,size:`xs`,ff:`monospace`,children:`driga service status`}),`.`]}):w.failed?(0,H.jsxs)(q,{size:`xs`,c:`warning`,role:`status`,children:[`Driga can't reach its service. Retrying every `,X9/1e3,`s.`]}):ye?.description&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,truncate:!0,title:ye.description,children:ye.description})]}),(0,H.jsxs)(K,{gap:`xs`,wrap:`nowrap`,children:[ye?.variables?.map(e=>(0,H.jsx)(Jg,{size:`xs`,w:140,"aria-label":e.name,placeholder:`All ${e.name}s`,clearable:!0,data:g?.options?.[e.name]??[],value:i[e.name]||null,onChange:t=>a(n=>({...n,[e.name]:t??``}))},e.name)),C.length>1&&(0,H.jsx)(Jg,{size:`xs`,w:170,"aria-label":`Dashboard`,allowDeselect:!1,data:C.map(e=>({value:e.id,label:e.name})),value:e,onChange:e=>e&&ee(e)}),T&&(0,H.jsx)(km,{variant:`light`,color:`danger`,onClick:()=>void pe(),children:e===`home`?`Reset Home`:`Delete dashboard`}),(0,H.jsx)(km,{variant:T?`filled`:`default`,leftSection:(0,H.jsx)(Wte,{}),"aria-pressed":T,onClick:()=>E(e=>!e),children:T?`Done`:`Edit`})]})]}),T&&(0,H.jsx)(q,{size:`xs`,c:`dimmed`,px:`md`,pb:6,children:`Drag panels by their title, resize from the corner, or ask Chat to change any of it.`}),(0,H.jsx)(G,{px:`md`,pb:`md`,style:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:g?(0,H.jsx)(JOe,{fragment:g,editing:T,act:le,onLayout:e=>{g&&O(g.id,g.version??0,[{op:`layout`,grids:e}],`Moved panels`)},onRemove:e=>{g&&O(g.id,g.version??0,[{op:`remove`,id:e}],`Removed a panel`)}}):(0,H.jsx)(q,{size:`sm`,c:`dimmed`,children:`Loading…`})})]})}),(0,H.jsx)(mS,{className:`split-handle`,"aria-label":`Resize Chat`}),(0,H.jsx)(lS,{id:`chat`,inert:!u,panelRef:j,defaultSize:400,minSize:300,maxSize:`65`,collapsible:!0,collapsedSize:0,onResize:e=>{let t=e.inPixels>0;t!==u&&d(t)},style:{background:`var(--driga-inset)`,borderLeft:`1px solid var(--driga-border)`,minWidth:0},children:(0,H.jsx)(FTe,{inbox:B,act:le,ask:f,onOpen:ee,onClose:()=>d(!1)})})]})})]})})}(0,Wee.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(h.StrictMode,{children:(0,H.jsxs)(fne,{children:[(0,H.jsx)(av,{position:`bottom-center`}),(0,H.jsx)(uke,{})]})})); \ No newline at end of file diff --git a/internal/web/app/index.html b/internal/web/app/index.html index ee609832..22f74853 100644 --- a/internal/web/app/index.html +++ b/internal/web/app/index.html @@ -1,4 +1,4 @@ -Driga +Driga
diff --git a/site/src/content/docs/reference/cli.mdx b/site/src/content/docs/reference/cli.mdx index 4d030f59..e3431599 100644 --- a/site/src/content/docs/reference/cli.mdx +++ b/site/src/content/docs/reference/cli.mdx @@ -44,7 +44,7 @@ confirmation exits `2` when stdin is not a terminal unless `--yes` is passed. | [`driga reclaim`](#driga-reclaim) | Review resource reclaim candidates and local action history. | | [`driga top`](#driga-top) | Open the interactive session viewer. | | [`driga app`](#driga-app) | Open the Driga desktop app, or focus it. | -| [`driga ask`](#driga-ask) | Ask a one-shot Chat question through Claude and driga's read-only tools. | +| [`driga ask`](#driga-ask) | Ask a one-shot Chat question through the selected assistant and driga's read-only tools. | | [`driga mcp`](#driga-mcp) | Serve collected views and editable dashboards over MCP stdio. | | [`driga doctor`](#driga-doctor) | Check setup and collection health. | | [`driga init`](#driga-init) | Guide optional setup. | @@ -534,7 +534,7 @@ driga app [flags] ## driga ask -Ask a one-shot Chat question through Claude and driga's read-only tools. +Ask a one-shot Chat question through the selected assistant and driga's read-only tools. ```sh driga ask ... [flags] @@ -542,7 +542,7 @@ driga ask ... [flags] | Argument | Default | Description | |---|---|---| -| ` ...` | | One-shot Chat question using Claude and driga's read-only tools. | +| ` ...` | | One-shot Chat question using the selected assistant and driga's read-only tools. | | Flag | Default | Description | |---|---|---| diff --git a/site/src/content/docs/reference/settings.mdx b/site/src/content/docs/reference/settings.mdx index 362fc22b..fc0b9d8d 100644 --- a/site/src/content/docs/reference/settings.mdx +++ b/site/src/content/docs/reference/settings.mdx @@ -44,6 +44,7 @@ variable. | [`machine.disk_free_min`](#machinedisk_free_min) | size | `0` | `DRIGA_MACHINE_DISK_FREE_MIN` | | [`summaries.enabled`](#summariesenabled) | bool | `false` | `DRIGA_SUMMARIES_ENABLED` | | [`summaries.model`](#summariesmodel) | string | `haiku` | `DRIGA_SUMMARIES_MODEL` | +| [`assistant.provider`](#assistantprovider) | string | `auto` | `DRIGA_ASSISTANT_PROVIDER` | | [`cleanup.worktree_idle`](#cleanupworktree_idle) | duration | `168h` | `DRIGA_CLEANUP_WORKTREE_IDLE` | | [`cleanup.build_idle`](#cleanupbuild_idle) | duration | `168h` | `DRIGA_CLEANUP_BUILD_IDLE` | | [`cleanup.regenerable`](#cleanupregenerable) | list | empty | file only | @@ -247,6 +248,18 @@ Model selection passed to the Claude CLI. |---|---|---|---| | string | `haiku` | nonempty | `DRIGA_SUMMARIES_MODEL` | +## Answering assistant + +The `[assistant]` table selects the answering CLI independently of monitored agents. + +### assistant.provider + +Answering assistant; auto prefers Claude, Codex, then Copilot independently of session discovery. + +| Type | Default | Allowed | Environment | +|---|---|---|---| +| string | `auto` | auto, claude, codex or copilot | `DRIGA_ASSISTANT_PROVIDER` | + ## Cleanup The `[cleanup]` table. @@ -396,7 +409,7 @@ those processes start cleanly; they are not configuration. | `DRIGA_CHAT_CONVERSATION` | id | Chat conversation of the MCP child's turn. | | `DRIGA_CHAT_TOKEN` | secret | Per-turn token tying the MCP child's approval requests to its turn. | | `DRIGA_CHAT_READ_ONLY` | marker | 1 keeps the Chat MCP child read-only. | -| `DRIGA_INTERNAL` | marker | 1 suppresses recursive hooks from Driga-owned Claude subprocesses. | +| `DRIGA_INTERNAL` | marker | 1 suppresses recursive hooks from Driga-owned assistant subprocesses. | | `DRIGA_FIXTURE_OUTPUT` | path | Fixture generator output directory (tests only). | | `DRIGA_COLLECTOR_HEAP_CHILD` | marker | 1 selects isolated collector heap-test child. | | `DRIGA_FLEET_HEAP_CHILD` | marker | 1 selects isolated fleet heap-test child. | diff --git a/ui/src/host/Chat.stories.tsx b/ui/src/host/Chat.stories.tsx index f4d8f53e..88c5969e 100644 --- a/ui/src/host/Chat.stories.tsx +++ b/ui/src/host/Chat.stories.tsx @@ -75,6 +75,14 @@ export const Answered: Story = { await expect(await canvas.findByText("Memory right now")).toBeVisible(); }, }; +export const CodexProvider: Story = { + parameters: { service: service({ chat: { ...answered, conversation: { ...answered.conversation, agent: "codex" } } }) }, + play: async ({ canvas }) => { await expect(await canvas.findByLabelText("Assistant provider")).toHaveTextContent("Codex"); }, +}; +export const CopilotProvider: Story = { + parameters: { service: service({ chat: { ...answered, conversation: { ...answered.conversation, agent: "copilot" } } }) }, + play: async ({ canvas }) => { await expect(await canvas.findByLabelText("Assistant provider")).toHaveTextContent("GitHub Copilot CLI"); }, +}; export const SavedADashboard: Story = { parameters: { service: service({ chat: saved }) }, play: async ({ canvas }) => { await expect(await canvas.findByText("Saved Memory")).toBeVisible(); } }; export const DraftRejected: Story = { parameters: { service: service({ chat: rejected }) }, play: async ({ canvas }) => { await expect(await canvas.findByText("Draft rejected: Quota")).toBeVisible(); } }; export const AwaitingApproval: Story = { diff --git a/ui/src/host/Chat.tsx b/ui/src/host/Chat.tsx index 78d9a6cd..ba208a7d 100644 --- a/ui/src/host/Chat.tsx +++ b/ui/src/host/Chat.tsx @@ -108,6 +108,8 @@ export function answerLast(messages: ChatMessage[]): ChatMessage[] { return out; } +const assistantNames: Record = { claude: "Claude Code", codex: "Codex", copilot: "GitHub Copilot CLI" }; + export function Chat({ inbox, act, ask, onOpen, onClose }: { inbox?: { panel: Panel; result?: Result; listed: boolean }; act?: Act; /** ask puts a question in the compose box for the user to send. */ @@ -119,6 +121,7 @@ export function Chat({ inbox, act, ask, onOpen, onClose }: { const [messages, setMessages] = useState([]); const [actions, setActions] = useState>(new Map()); const [active, setActive] = useState(false); + const [provider, setProvider] = useState(); const [mode, setMode] = useState(null); const [until, setUntil] = useState(); const [now, setNow] = useState(Date.now); @@ -145,6 +148,7 @@ export function Chat({ inbox, act, ask, onOpen, onClose }: { return () => { mounted = false; }; }, []); useEffect(() => { + setProvider(undefined); if (!id) return; const control = new AbortController(); let cursor = 0; @@ -164,6 +168,7 @@ export function Chat({ inbox, act, ask, onOpen, onClose }: { }; const flush = () => setMessages(order.map(id => byId.get(id)!)); const receive = (s: ChatState) => { + setProvider(s.conversation.agent); setMode(s.mode); setUntil(s.until); setNow(Date.now()); @@ -247,6 +252,7 @@ export function Chat({ inbox, act, ask, onOpen, onClose }: { {onClose && void close()}>} + {provider && {assistantNames[provider] ?? "Assistant"}} {messages.every(dropped) && void send(text)} />} diff --git a/ui/src/host/api.ts b/ui/src/host/api.ts index 90d80365..6bfad88b 100644 --- a/ui/src/host/api.ts +++ b/ui/src/host/api.ts @@ -72,7 +72,7 @@ export type ProcessRow = { pid: number; owner: string; started_at: string; execu export type CommandCard = { requested: { argv?: string[]; script?: string; cwd: string; timeout_seconds: number; network: boolean }; effective: string[][]; cwd: string; class: string; summary: string; boundary: string; error?: string; targets: ProcessRow[]; count: number; memory_bytes: number; force: boolean; stopped?: ProcessRow[]; vanished?: ProcessRow[]; skipped?: ProcessRow[]; survivors?: ProcessRow[] }; export type GrantDecision = { grant_id: string; action_id?: string; prompt_id?: string; conversation?: string; session?: string; time: string; attribution: string; revoked?: boolean }; export type ChatAction = { id: string; tool: string; title: string; input: unknown; directory: string; status: string; decided_by?: string; result?: string; command?: CommandCard; delegated?: Prompt; grant_id?: string; grant_eligible?: boolean; grant_pattern?: string; grant_expires_at?: string }; -export type ChatState = { conversation: { id: string }; messages: ChatMessage[]; events: ChatEvent[]; actions: ChatAction[]; cursor: number; reset: boolean; active?: boolean; mode: ChatMode; until?: string }; +export type ChatState = { conversation: { id: string; agent?: string }; messages: ChatMessage[]; events: ChatEvent[]; actions: ChatAction[]; cursor: number; reset: boolean; active?: boolean; mode: ChatMode; until?: string }; export const chat = { history: () => get<{ id: string }[]>("/chat/api/history"), From 3f8caa7ba0162db3765b313b6d3a3eb906c58dd5 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 10 Nov 2026 04:56:57 -0800 Subject: [PATCH 2/5] fix(chat): honor provider overrides through the running service --- docs/specs/2026-11-10-assistant-providers.md | 9 +- docs/usage.md | 15 +- internal/chat/broker.go | 23 ++- internal/chat/provider.go | 17 +- internal/chat/provider_override_test.go | 200 +++++++++++++++++++ internal/chat/transport.go | 38 +++- internal/chat/transport_test.go | 2 +- internal/cli/ask.go | 2 +- site/src/content/docs/reference/cli.mdx | 2 +- 9 files changed, 295 insertions(+), 13 deletions(-) create mode 100644 internal/chat/provider_override_test.go diff --git a/docs/specs/2026-11-10-assistant-providers.md b/docs/specs/2026-11-10-assistant-providers.md index 899a3cf8..f02963ad 100644 --- a/docs/specs/2026-11-10-assistant-providers.md +++ b/docs/specs/2026-11-10-assistant-providers.md @@ -14,6 +14,11 @@ background probes, installation, login, or model requests are performed. Compatibility probes inspect CLI metadata. Users authenticate with their CLI. Authentication or quota errors do not trigger automatic replay elsewhere. +CLI clients pass their resolved preference when requesting a new conversation, +including through an already-running service. This is a per-conversation choice, +not a mutation of the service's setting. Desktop Chat uses the service preference; +restart the service after changing its configuration. + The selected provider is persisted before the first prompt. Resumption always uses that provider and exact session ID, even if the preferred CLI changes. Missing/incompatible CLIs produce an actionable error and leave monitoring alive. @@ -29,7 +34,9 @@ trust modes and command approvals for every provider. Claude keeps its strict MCP configuration and permission bridge. Codex uses config-free `exec`, retaining authentication in `CODEX_HOME`, ignoring user exec -rules and project configuration through a private working directory. Its native +rules and project configuration through a private working directory. Provider +and model configuration is not loaded; this adapter uses the default OpenAI +connection rather than user-defined model providers. Its native execution environment is disabled with `CODEX_EXEC_SERVER_URL=none`, including runtime filesystem/command backstops. The adapter accepts the audited 0.167.0 release; unknown registries fail closed. Only Driga's read catalog and, for action diff --git a/docs/usage.md b/docs/usage.md index 6511da04..7e6ee4d1 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -822,9 +822,15 @@ monitoring works without an assistant. Conversations stay with their original provider. Authentication, quota and turn failures are never replayed with another provider. Start a new conversation after changing providers. -Codex currently requires the audited 0.167.0 CLI series and supports Driga reads, +CLI preferences apply to new conversations even when the service is already +running. Desktop Chat uses the service's preference; restart the service after +changing its configuration. Existing conversations always keep their provider. + +Codex currently requires the audited 0.167.0 CLI release and supports Driga reads, panels and broker-gated commands; dashboard edits are unavailable through that -adapter. Copilot requires headless SDK protocol 3 and an exact Driga-only tool +adapter. It uses Codex's default OpenAI connection and existing authentication; +custom provider/model settings in `config.toml` are not loaded. Copilot requires +headless SDK protocol 3 and an exact Driga-only tool catalog. Unsupported versions fail with an error rather than loosening approval or configuration controls. No real agent CLI is run by tests. Project summaries retain their Claude-specific model and budget cap regardless of this setting. @@ -862,6 +868,11 @@ Claude additionally retains its permission-gated native read tools and existing action bridge. Copilot exposes a bounded subset of dashboard edits. Vendor-native shell and file editing tools are disabled. Chat never types into a live agent terminal. +Direct MCP cleanup, inbox acknowledgment, terminal jumps, delegated prompt answers +and project-summary actions remain Claude-only. Codex and Copilot use the shared +broker command tool for supported local commands; their action catalogs are +deliberately smaller than Claude's permission-bridged catalog. + Each conversation starts in **Confirm**. Change trust mode with the app's Chat header buttons or **m** in TUI navigate mode: diff --git a/internal/chat/broker.go b/internal/chat/broker.go index 7481fe90..89b60fba 100644 --- a/internal/chat/broker.go +++ b/internal/chat/broker.go @@ -215,8 +215,29 @@ func (b *Broker) dispose(c *conversation) { c.actions, c.messages, c.events, c.queue, c.result = nil, nil, nil, nil, nil } func (b *Broker) Create(ctx context.Context) (store.Conversation, error) { + return b.CreateWithProvider(ctx, "") +} + +// CreateWithProvider overrides selection for this new conversation only. An +// empty preference uses the broker default for clients that send no override. +func (b *Broker) CreateWithProvider(ctx context.Context, preference string) (store.Conversation, error) { provider := "claude" - if selector, ok := b.agent.(interface { + if preference != "" { + if !validProviderPreference(preference) { + return store.Conversation{}, errors.New("assistant provider must be auto, claude, codex or copilot") + } + selector, ok := b.agent.(interface { + SelectProvider(context.Context, string) (string, error) + }) + if !ok { + return store.Conversation{}, errors.New("assistant provider selection is unavailable") + } + var err error + provider, err = selector.SelectProvider(ctx, preference) + if err != nil { + return store.Conversation{}, err + } + } else if selector, ok := b.agent.(interface { Select(context.Context) (string, error) }); ok { var err error diff --git a/internal/chat/provider.go b/internal/chat/provider.go index eab43585..4d179730 100644 --- a/internal/chat/provider.go +++ b/internal/chat/provider.go @@ -68,8 +68,21 @@ func NewProvider(dataDir, preference string) Agent { } func (p *providers) Select(ctx context.Context) (string, error) { - names := []string{p.preference} - if p.preference == "auto" { + return p.SelectProvider(ctx, p.preference) +} + +func validProviderPreference(preference string) bool { + return preference == "auto" || preference == "claude" || preference == "codex" || preference == "copilot" +} + +// SelectProvider resolves a new conversation's explicit preference without +// changing the broker default or any existing conversation's pinned provider. +func (p *providers) SelectProvider(ctx context.Context, preference string) (string, error) { + if !validProviderPreference(preference) { + return "", errors.New("assistant provider must be auto, claude, codex or copilot") + } + names := []string{preference} + if preference == "auto" { names = []string{"claude", "codex", "copilot"} } var failures []error diff --git a/internal/chat/provider_override_test.go b/internal/chat/provider_override_test.go new file mode 100644 index 00000000..573fce1f --- /dev/null +++ b/internal/chat/provider_override_test.go @@ -0,0 +1,200 @@ +package chat + +import ( + "context" + "encoding/json" + "errors" + "net/http" + "net/http/httptest" + "net/url" + "runtime" + "strings" + "testing" + + "github.com/labstack/driga/internal/store" +) + +func TestProviderOverrideDoesNotChangeDefault(t *testing.T) { + var probes []string + p := &providers{preference: "copilot", probe: func(_ context.Context, name string) (Agent, error) { + probes = append(probes, name) + return providerAgentFunc(func(context.Context, Request, func(Delta) error) error { return nil }), nil + }} + if got, err := p.SelectProvider(context.Background(), "auto"); err != nil || got != "claude" { + t.Fatalf("auto override = %q, %v", got, err) + } + if got, err := p.Select(context.Background()); err != nil || got != "copilot" { + t.Fatalf("default after override = %q, %v", got, err) + } + before := len(probes) + if _, err := p.SelectProvider(context.Background(), "unknown"); err == nil || len(probes) != before { + t.Fatalf("invalid preference probed providers: %v err=%v", probes, err) + } +} + +func TestOpenRemoteUsesRequestedProviderForNewConversation(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("native socket fixture; HTTP provider contract is covered separately") + } + p := &providers{preference: "claude", probe: func(_ context.Context, name string) (Agent, error) { + return providerAgentFunc(func(_ context.Context, r Request, emit func(Delta) error) error { + if r.Provider != name { + return errors.New("request provider changed") + } + if r.Resume != "" && r.Resume != name+"-session" { + return errors.New("resume crossed provider") + } + return emit(Delta{Text: "fixture answer", SessionID: name + "-session"}) + }), nil + }} + b, st := providerBroker(t, p) + ctx := context.Background() + dir := t.TempDir() + stop, err := Listen(ctx, dir, b) + if err != nil { + t.Fatal(err) + } + defer stop() + client, ephemeral, closeClient, err := Open(ctx, dir, false, "codex") + if err != nil || ephemeral { + t.Fatalf("remote open: ephemeral=%v err=%v", ephemeral, err) + } + defer closeClient() + c, err := client.Create(ctx) + if err != nil || c.Agent != "codex" { + t.Fatalf("override conversation=%+v err=%v", c, err) + } + if saved, err := st.ChatConversation(c.ID); err != nil || saved.Agent != "codex" { + t.Fatalf("persisted=%+v err=%v", saved, err) + } + if err := client.Send(ctx, c.ID, "first", Context{}); err != nil { + t.Fatal(err) + } + settled(t, b, c.ID) + oldClient, err := Dial(ctx, dir) + if err != nil { + t.Fatal(err) + } + defer oldClient.Close() + defaultConversation, err := oldClient.Create(ctx) + if err != nil || defaultConversation.Agent != "claude" { + t.Fatalf("old client default=%+v err=%v", defaultConversation, err) + } + if err := client.Send(ctx, c.ID, "resume", Context{}); err != nil { + t.Fatal(err) + } + state := settled(t, b, c.ID) + if state.Conversation.Agent != "codex" || state.Conversation.SessionID != "codex-session" { + t.Fatalf("override lost pin: %+v", state.Conversation) + } + for _, message := range state.Messages { + if message.Status == "error" { + t.Fatalf("pinned turn failed: %+v", message) + } + } + client.(*Remote).provider = "unknown" + if _, err := client.Create(ctx); err == nil { + t.Fatal("unknown remote preference accepted") + } + if rows, err := st.ChatConversations(); err != nil || len(rows) != 2 { + t.Fatalf("failed override created row: %+v err=%v", rows, err) + } +} + +func TestConversationProviderRequestContract(t *testing.T) { + p := &providers{preference: "claude", probe: func(_ context.Context, name string) (Agent, error) { + if name == "copilot" { + return nil, errors.New("fixture unavailable") + } + return providerAgentFunc(func(context.Context, Request, func(Delta) error) error { return nil }), nil + }} + b, st := providerBroker(t, p) + b.clientToken = "fixture-token" + for _, tt := range []struct { + body, want string + ok bool + }{ + {"", "claude", true}, + {"{}", "claude", true}, + {`{"provider":"codex"}`, "codex", true}, + {`{"provider":"auto"}`, "claude", true}, + {`{"provider":"unknown"}`, "", false}, + {`{"provider":"copilot"}`, "", false}, + {`{"provider":42}`, "", false}, + {`{"provider":"codex","extra":true}`, "", false}, + {`{"provider":"codex"} {}`, "", false}, + } { + t.Run(tt.body, func(t *testing.T) { + before, err := st.ChatConversations() + if err != nil { + t.Fatal(err) + } + req := httptest.NewRequest(http.MethodPost, "/conversations", strings.NewReader(tt.body)) + req.Header.Set("Authorization", "fixture-token") + response := httptest.NewRecorder() + handler(b).ServeHTTP(response, req) + if (response.Code == http.StatusOK) != tt.ok { + t.Fatalf("status=%d body=%s", response.Code, response.Body) + } + after, err := st.ChatConversations() + if err != nil { + t.Fatal(err) + } + if !tt.ok { + if len(after) != len(before) { + t.Fatal("rejected request persisted a conversation") + } + return + } + var c createConversationResponse + var requested struct { + Provider string `json:"provider"` + } + if tt.body != "" { + _ = json.Unmarshal([]byte(tt.body), &requested) + } + if err := json.Unmarshal(response.Body.Bytes(), &c); err != nil || c.Agent != tt.want || c.ProviderPreference != requested.Provider || len(after) != len(before)+1 { + t.Fatalf("created=%+v err=%v", c, err) + } + }) + } +} + +func TestRemoteProviderOverrideRefusesOlderServiceMismatch(t *testing.T) { + for _, tt := range []struct{ preference, ack string }{{"codex", ""}, {"auto", ""}, {"codex", "codex"}} { + t.Run(tt.preference+"/ack="+tt.ack, func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var in struct { + Provider string `json:"provider"` + } + if err := json.NewDecoder(r.Body).Decode(&in); err != nil || in.Provider != tt.preference { + t.Errorf("remote override=%+v err=%v", in, err) + } + // The previous service ignored the new request body and chose its default. + _ = json.NewEncoder(w).Encode(createConversationResponse{Conversation: store.Conversation{ID: "old-service", Agent: "claude"}, ProviderPreference: tt.ack}) + })) + defer server.Close() + remote := &Remote{provider: tt.preference, http: server.Client()} + // The transport uses a fixed local URL; direct all requests to this fixture. + remote.http.Transport = fixtureProviderTransport{target: server.URL, base: http.DefaultTransport} + if _, err := remote.Create(context.Background()); err == nil || !strings.Contains(err.Error(), "restart the service") { + t.Fatalf("old service mismatch err=%v", err) + } + }) + } +} + +type fixtureProviderTransport struct { + target string + base http.RoundTripper +} + +func (f fixtureProviderTransport) RoundTrip(r *http.Request) (*http.Response, error) { + copy := r.Clone(r.Context()) + url, err := url.Parse(f.target) + if err != nil { + return nil, err + } + copy.URL.Scheme, copy.URL.Host = url.Scheme, url.Host + return f.base.RoundTrip(copy) +} diff --git a/internal/chat/transport.go b/internal/chat/transport.go index 68c8b986..87035b0d 100644 --- a/internal/chat/transport.go +++ b/internal/chat/transport.go @@ -217,7 +217,18 @@ func handler(b *Broker) http.Handler { case r.Method == "GET" && r.URL.Path == "/conversations": out, err = b.List(r.Context()) case r.Method == "POST" && r.URL.Path == "/conversations": - out, err = b.Create(r.Context()) + var in struct { + Provider string `json:"provider"` + } + err = decodeClientJSON(w, r, &in, 4096) + if errors.Is(err, io.EOF) { + err = nil // Older clients send no request body. + } + if err == nil { + var conversation store.Conversation + conversation, err = b.CreateWithProvider(r.Context(), in.Provider) + out = createConversationResponse{Conversation: conversation, ProviderPreference: in.Provider} + } case r.Method == "POST" && r.URL.Path == "/send": var in struct { ID, Text string @@ -263,6 +274,13 @@ func handler(b *Broker) http.Handler { }) } +// The acknowledgement lets a client distinguish provider-aware services from +// older services that accepted this endpoint but ignored its request body. +type createConversationResponse struct { + store.Conversation + ProviderPreference string `json:"provider_preference,omitempty"` +} + type Remote struct { mu sync.Mutex fullAuto map[string]bool @@ -270,6 +288,7 @@ type Remote struct { keyPath string http *http.Client transport *http.Transport + provider string // Optional preference for new conversations from this client. } func Dial(ctx context.Context, dataDir string) (*Remote, error) { @@ -403,9 +422,16 @@ func (c *Remote) callOnce(ctx context.Context, method, path string, in, out any, return json.NewDecoder(reader).Decode(out) } func (c *Remote) Create(ctx context.Context) (store.Conversation, error) { - var out store.Conversation - err := c.call(ctx, "POST", "/conversations", nil, &out) - return out, err + var out createConversationResponse + var in any + if c.provider != "" { + in = map[string]string{"provider": c.provider} + } + err := c.call(ctx, "POST", "/conversations", in, &out) + if err == nil && c.provider != "" && (out.ProviderPreference != c.provider || c.provider != "auto" && out.Agent != c.provider) { + return store.Conversation{}, errors.New("Driga service did not select the requested assistant; restart the service and try again") + } + return out.Conversation, err } func (c *Remote) List(ctx context.Context) ([]store.Conversation, error) { var out []store.Conversation @@ -427,8 +453,12 @@ func (c *Remote) Read(ctx context.Context, id string, after uint64) (State, erro // Open uses the service when available. The fallback is private to the opening // client, with no persistent driga history or competing collector socket. func Open(ctx context.Context, dataDir string, snippets bool, provider string) (Client, bool, func(), error) { + if provider != "" && !validProviderPreference(provider) { + return nil, false, nil, errors.New("assistant provider must be auto, claude, codex or copilot") + } remote, err := Dial(ctx, dataDir) if err == nil { + remote.provider = provider return remote, false, remote.Close, nil } // Permission and invalid-path failures must not silently select another broker. diff --git a/internal/chat/transport_test.go b/internal/chat/transport_test.go index 189a3fad..0e19eedc 100644 --- a/internal/chat/transport_test.go +++ b/internal/chat/transport_test.go @@ -35,7 +35,7 @@ func TestSocketAndFallback(t *testing.T) { if err != nil || info.Mode().Perm() != 0600 { t.Fatal(info, err) } - c, ephemeral, closeClient, err := Open(ctx, dir, true, "auto") + c, ephemeral, closeClient, err := Open(ctx, dir, true, "") if err != nil || ephemeral { t.Fatal(ephemeral, err) } diff --git a/internal/cli/ask.go b/internal/cli/ask.go index 726c82e6..21532052 100644 --- a/internal/cli/ask.go +++ b/internal/cli/ask.go @@ -17,7 +17,7 @@ import ( type AskCmd struct { AskOptions - Question []string `arg:"" required:"" help:"One-shot Chat question using the selected assistant and driga's read-only tools."` + Question []string `arg:"" required:"" help:"One-shot Chat question using driga's read-only tools. Select its assistant with assistant.provider or DRIGA_ASSISTANT_PROVIDER (auto, claude, codex, copilot), including when the service runs."` } func (a AskCmd) Run(g *Globals) error { diff --git a/site/src/content/docs/reference/cli.mdx b/site/src/content/docs/reference/cli.mdx index e3431599..da7ad619 100644 --- a/site/src/content/docs/reference/cli.mdx +++ b/site/src/content/docs/reference/cli.mdx @@ -542,7 +542,7 @@ driga ask ... [flags] | Argument | Default | Description | |---|---|---| -| ` ...` | | One-shot Chat question using the selected assistant and driga's read-only tools. | +| ` ...` | | One-shot Chat question using driga's read-only tools. Select its assistant with assistant.provider or DRIGA_ASSISTANT_PROVIDER (auto, claude, codex, copilot), including when the service runs. | | Flag | Default | Description | |---|---|---| From 03d380aa443e0b2aadfc6d6a7d4786df4e6938d7 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 10 Nov 2026 04:58:14 -0800 Subject: [PATCH 3/5] docs: record independent assistant provider reviews --- docs/specs/2026-11-10-provider-review.md | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 docs/specs/2026-11-10-provider-review.md diff --git a/docs/specs/2026-11-10-provider-review.md b/docs/specs/2026-11-10-provider-review.md new file mode 100644 index 00000000..873b077b --- /dev/null +++ b/docs/specs/2026-11-10-provider-review.md @@ -0,0 +1,74 @@ +# Assistant provider review + +Base: `affa6e64807cb775181af3d4a2d6f4ae3bc35aa5` (released main). +Source candidate: `3f8caa7` (including `2b89669`). +Spec: [Assistant providers](2026-11-10-assistant-providers.md), issue #103. + +## Scope + +Reviewed the entire feature diff: provider routing, Claude/Codex/Copilot +adapters, host MCP forwarding, subprocess environment/lifetimes, config, +provider-qualified store and collector exclusion, hook/spool handling, CLI/service +transport, TUI/UI labels, stories, generated docs and host bundle. No migration, +agent-settings edits, real vendor turns or production cleanup were performed. + +## Standards + +A fresh independent reviewer checked repository standards and the code-review +skill's smell baseline. Initial findings were resolved: + +- Removed the variadic `Open` compatibility signature; callers supply one + preference explicitly. +- Normalize inherited environment keys before filtering, including on Windows. + Hostile mixed-case approval, permissive Copilot and Node settings are covered. + +Final candidate and the service-override follow-up have no remaining standards +blocker. The reviewer performed read-only review; execution evidence is below. + +## Spec + +A separate fresh reviewer checked implementation against the issue and spec. +Missing/null Copilot plugin-hook acknowledgment previously looked like zero; +the adapter now requires a present, non-null zero count before sending a prompt. +Regression fixtures prove missing/null/nonzero responses never receive it. + +Provider choice is stored before dispatch, resumes retain provider/session IDs, +and failures are not replayed elsewhere. The final service override is scoped to +new conversations, validates requests before persistence, and leaves the daemon +default and existing sessions unchanged. Its additive acknowledgment rejects +older services before a prompt is submitted. No remaining spec blocker. + +## Astra and user checks + +Astra audited tool/approval ownership and independently reviewed the transports. +Resolved findings include per-turn Codex tool-name checks, call identity checks, +panel capture/result mapping, and inherited `CODEX_EXEC_SERVER_NOISE_*` settings +that could override a disabled execution environment. The launcher now strips +the entire inherited namespace before explicitly setting `URL=none`. + +Official tag `rust-v0.167.0` resolves to `086ccc833bc9cf01024ad2dd6af7dbd421b6bf9a` +and contains the environment-disable implementation. The adapter accepts only +that exact release; future patches require another audit. + +A separate agent exercised isolated help/config and fake-provider workflows as +a user. It found that the service silently ignored CLI preferences and that help +did not explain selection. Both are fixed and independently re-reviewed. The +user agent reran provider/remote/old-service cases and found no new blocker. + +## Validation and limits + +- Isolated Go suite; affected-package race checks across chat, llm, collector, + config, store and TUI; targeted remote-override normal/race checks. +- Native and Windows vet; Linux build; generated-doc consistency. +- 212 UI unit tests and 1,224 browser-story tests; UI bundles regenerated. +- Gitleaks and diff whitespace checks pass. +- An initial macOS open-file timeout passed when retried and in the subsequent + full suite. The collector heap-budget check passed in that full run. + +Synthetic subprocess and protocol fixtures establish Driga's routing and refusal +behavior, not live vendor-service certification. No real authentication/model +turns were run. Copilot requires protocol 3, safety acknowledgment and an exact +custom-tool catalog. Codex requires 0.167.0 and default OpenAI configuration. +Codex/Copilot expose a smaller action catalog than Claude; direct MCP cleanup, +acknowledgment, jump, delegated prompt and summary actions remain Claude-only. +Project summaries retain their existing Claude model and budget contract. From 50994d4e424b94e1e1bf1ee6fd5f26b1ddade735 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 10 Nov 2026 05:15:44 -0800 Subject: [PATCH 4/5] fix(chat): reject Codex completion with unfinished tool calls --- docs/specs/2026-11-10-provider-review.md | 8 ++++++++ internal/chat/codex.go | 5 +++++ internal/chat/codex_test.go | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/docs/specs/2026-11-10-provider-review.md b/docs/specs/2026-11-10-provider-review.md index 873b077b..a0729b1b 100644 --- a/docs/specs/2026-11-10-provider-review.md +++ b/docs/specs/2026-11-10-provider-review.md @@ -72,3 +72,11 @@ custom-tool catalog. Codex requires 0.167.0 and default OpenAI configuration. Codex/Copilot expose a smaller action catalog than Claude; direct MCP cleanup, acknowledgment, jump, delegated prompt and summary actions remain Claude-only. Project summaries retain their existing Claude model and budget contract. + +## Final merge review + +A second fresh Standards/Spec review of `03d380a` found one additional incomplete +stream case: Codex accepted `turn.completed` while an MCP call lacked its result. +A fake-provider regression reproduced it for read and panel tools. Completion +now rejects unfinished calls, while unresolved panel outcomes remain visible as +unknown. No approval bypass was found. The Standards review found no blockers. diff --git a/internal/chat/codex.go b/internal/chat/codex.go index b027c312..0c1dc7be 100644 --- a/internal/chat/codex.go +++ b/internal/chat/codex.go @@ -291,6 +291,11 @@ func (s *codexStream) line(line []byte) error { if !s.started { return errors.New("Codex completed before session") } + for id := range s.calls { + if !s.finished[id] { + return errors.New("Codex completed with an unfinished tool call") + } + } s.completed = true case "turn.failed", "error": return errors.New("Codex turn failed; check CLI authentication and availability") diff --git a/internal/chat/codex_test.go b/internal/chat/codex_test.go index 97c41b7c..34a9853f 100644 --- a/internal/chat/codex_test.go +++ b/internal/chat/codex_test.go @@ -149,6 +149,28 @@ func TestCodexReadOnlyAndIncomplete(t *testing.T) { } } +func TestCodexCompletedTurnRequiresToolResults(t *testing.T) { + for _, tool := range []string{"get_machine", "show_panels"} { + t.Run(tool, func(t *testing.T) { + events := codexStart + `{"type":"item.started","item":{"id":"unfinished","type":"mcp_tool_call","server":"driga","tool":"` + tool + `","arguments":{}}}` + "\n" + `{"type":"turn.completed"}` + "\n" + a, _ := fakeCodex(t, "/bin/cat <<'EVENTS'\n"+events+"EVENTS") + var panels []string + err := a.Run(context.Background(), Request{ReadOnly: true}, func(d Delta) error { + if len(d.Panel) > 0 { + panels = append(panels, string(d.Panel)) + } + return nil + }) + if err == nil || !strings.Contains(err.Error(), "unfinished tool") { + t.Fatalf("accepted unfinished tool: %v", err) + } + if tool == "show_panels" && (len(panels) != 1 || !strings.Contains(panels[0], `"status":"unknown"`)) { + t.Fatalf("lost unknown panel outcome: %v", panels) + } + }) + } +} + func TestCodexPanelAndToolIdentity(t *testing.T) { _, cancel := context.WithCancel(context.Background()) defer cancel() From ba3da0d56062b81ba6b28eccd9bb9cea4007a17a Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 10 Nov 2026 06:36:27 -0800 Subject: [PATCH 5/5] test(chat): isolate assistant discovery in fallback fixture --- docs/specs/2026-11-10-provider-review.md | 5 +++++ internal/chat/transport_test.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docs/specs/2026-11-10-provider-review.md b/docs/specs/2026-11-10-provider-review.md index a0729b1b..08f42ea9 100644 --- a/docs/specs/2026-11-10-provider-review.md +++ b/docs/specs/2026-11-10-provider-review.md @@ -80,3 +80,8 @@ stream case: Codex accepted `turn.completed` while an MCP call lacked its result A fake-provider regression reproduced it for read and panel tools. Completion now rejects unfinished calls, while unresolved panel outcomes remain visible as unknown. No approval bypass was found. The Standards review found no blockers. + +Linux CI additionally exposed a fallback-transport test that depended on an +installed assistant for its new capability probe. It now uses the existing +synthetic CLI fixture with a private PATH. The failure was reproduced with an +agent-free PATH before fixing it; production behavior was unchanged. diff --git a/internal/chat/transport_test.go b/internal/chat/transport_test.go index 0e19eedc..58735c5a 100644 --- a/internal/chat/transport_test.go +++ b/internal/chat/transport_test.go @@ -23,6 +23,9 @@ func TestSocketAndFallback(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("Unix socket permissions") } + // Fallback creation now probes assistant capabilities. Keep its PATH limited + // to a synthetic CLI, including on developer machines with real agents. + fakeCLI(t, flags, "") b, _, _ := fixture(t, true) dir := t.TempDir() ctx := context.Background()