From 92ca9597d5702da05a4957652d8bc69ccb788107 Mon Sep 17 00:00:00 2001 From: Dmitriy Solodukha Date: Tue, 1 Sep 2026 21:34:18 +0300 Subject: [PATCH 1/2] feat(report): the weekly report, and the discipline to say nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The third paid feature: what moved this week, to a Telegram bot the user owns. Four decisions shape it, and three of them are about restraint. **"Usual" is a baseline, not last week.** The premium page promises "the repository that cost 3× its usual week", and comparing two weeks gives a ratio rather than a finding — $2 to $6 is three times and is nothing. So a repository is named only when it clears both an absolute floor in dollars and twice the median of the four preceding weeks. The median rather than the mean, because one runaway week must not become the baseline that hides the next one. The floor started at $3 and the tests caught it immediately: $2 to $6 clears $3, which is the exact finding the floor exists to suppress. It is $10. Most weeks the answer is that nothing moved, and the message says so. A report that lists nothing reads as broken; a report that cries wolf is one people stop opening. A week the machine was off is reported as such rather than as a collapse in spending — the reader cannot click into a message to check it, which is why this is stricter than the dashboard. **The schedule is a comparison, not a countdown.** A ticker anchored to Monday 09:00 fires for nobody whose laptop is shut at the weekend: macOS does not replay missed ticks. The daemon asks hourly whether the ISO week of the last report is behind the current one, so a machine opened on Wednesday gets Monday's report on Wednesday, labelled with the week it covers. The marker lives in `meta` rather than memory, or a restart would send a second copy of a message somebody already read — the bug cap.Guard.firedOn has, tolerable for a cap and not for a phone. **The bot token is stored, and the Gemini key still is not.** ADR-024 argues the difference: a key attached to a billing account can spend real money, while a bot token drives a bot made for this one purpose. The deciding argument is what the alternative costs — editing a launchd plist to turn on a feature sold as two minutes of setup is a feature nobody finishes. It is the API's first write-only field: accepted by PUT, never returned by GET, which instead reports that one is set. A test fails if the token appears in a settings response. **A send that fails is on the screen.** A weekly message that stops arriving is invisible — an absence looks exactly like a quiet week — so the last outcome is on the panel, in Telegram's own words, because "chat not found" and "bot was blocked by the user" are both things only the user can fix. Claude-Session: https://claude.ai/code/session_01DR8fggA2LRHcjNWUsqtDcF --- .ai/03-contracts.md | 2 + .ai/08-decisions.md | 73 +++++++ CHANGELOG.md | 18 ++ internal/api/api.go | 40 ++++ internal/api/api_test.go | 9 +- ...{index-AgZMyFDM.css => index-1ZVeIGiX.css} | 2 +- .../{index-CkGNaCrc.js => index-DLnWXkEr.js} | 36 ++-- internal/api/dist/index.html | 4 +- internal/api/gemini_test.go | 35 ++++ internal/config/config.go | 11 + internal/daemon/daemon.go | 32 ++- internal/daemon/weekly.go | 162 +++++++++++++++ internal/daemon/weekly_test.go | 61 ++++++ internal/store/store.go | 6 + internal/weekly/telegram.go | 164 +++++++++++++++ internal/weekly/telegram_test.go | 121 +++++++++++ internal/weekly/weekly.go | 196 ++++++++++++++++++ internal/weekly/weekly_test.go | 138 ++++++++++++ ui/src/components/WeeklyReport.test.tsx | 74 +++++++ ui/src/components/WeeklyReport.tsx | 146 +++++++++++++ ui/src/lib/api.ts | 11 + ui/src/screens/History.tsx | 45 +--- 22 files changed, 1316 insertions(+), 70 deletions(-) rename internal/api/dist/assets/{index-AgZMyFDM.css => index-1ZVeIGiX.css} (51%) rename internal/api/dist/assets/{index-CkGNaCrc.js => index-DLnWXkEr.js} (63%) create mode 100644 internal/daemon/weekly.go create mode 100644 internal/daemon/weekly_test.go create mode 100644 internal/weekly/telegram.go create mode 100644 internal/weekly/telegram_test.go create mode 100644 internal/weekly/weekly.go create mode 100644 internal/weekly/weekly_test.go create mode 100644 ui/src/components/WeeklyReport.test.tsx create mode 100644 ui/src/components/WeeklyReport.tsx diff --git a/.ai/03-contracts.md b/.ai/03-contracts.md index 5b7b0b6..37ee2e3 100644 --- a/.ai/03-contracts.md +++ b/.ai/03-contracts.md @@ -130,6 +130,8 @@ Plan-limit windows relayed by `caprock statusline` are **validated before storag What that file holds bounds what may ever be said about it: a timestamp and two window percentages. **No tokens, no cost, no conversation content**, so this can never state what the desktop app cost — only how much of a window it consumed. It is also written only while the app runs (27 samples in a day on one real machine, against ~290 at its five-minute interval), so a reading older than 20 minutes is flagged `stale` and the UI says the app has been closed since. Nothing is stored and nothing is polled. +`PUT /v1/settings` accepts `report_bot_token` and `report_chat_id` for the weekly report. The **token is write-only**: it is stored and never returned by `GET /v1/settings`, which instead carries `report_bot_set` (a bool), `report_last_error` and `report_last_sent_ms`. This is the only write-only field in the API and it exists because the settings response is read on every dashboard render and by `caprock report` — a credential should not ride along on either ([ADR-024](08-decisions.md)). Omitting `report_bot_token` from a PUT leaves the stored one alone, since a UI that reads settings and writes them back always omits it; sending `""` clears it. The chat id is not a credential and round-trips normally. + `GET /v1/gemini` reports whether asking Gemini is possible here: `{available, env_var, licensed, model}`. It performs **no network I/O** and **never returns the key** — `available` says only that one is present. `POST /v1/gemini/ask` takes `{prompt, model?}` and answers `{text, model, usage}`, where `usage` carries the response's own `promptTokenCount` / `candidatesTokenCount` / `cachedContentTokenCount` / `thoughtsTokenCount`. It is the one endpoint in the product that checks the licence **server-side** (402 without an active key) rather than leaving the paywall to the UI, because the call spends the user's Gemini quota and opens an outbound connection — the reasoning and its limits are in [ADR-023](08-decisions.md). With no key set it answers 412 with the variable to set, which is a different problem from 402 and is reported separately so the screen can say which. The key is read from `GEMINI_API_KEY` in the daemon's environment at call time; it is never stored, never accepted by `PUT /v1/settings`, and never present in `GET /v1/settings`. `GET /v1/update` returns `{enabled, current, latest, update_available, command, url, checked_at, error, notes, notes_for}` from cache and **performs no network I/O** — a page load must never cause an outbound call. `POST /v1/update/check` performs one, and returns **403 while `update_checks` is false**: the opt-in is enforced by the server, not merely hidden in the UI, so no page or local script can make Caprock reach the network uninvited. Checks are throttled to once a day unless forced, the request carries no body or credentials, and a failure is reported in `error` rather than as an error status — not knowing about a release must not read as a broken dashboard. `command` is the upgrade command inferred from the running binary's path (Homebrew, Scoop, `go install`); when no package manager owns the binary it is empty and the UI offers `url` instead. `notes` is the published release's own description, taken from the same GitHub response as the tag — reading it costs no second request and no further exposure. It is trimmed to a dialog-sized excerpt (long bodies cut at a line boundary) and paired with `notes_for`, the version it describes, so a cached note can never be shown beside a different version after a failed check. `update_available` is never true for a `dev` or `git describe` build. Caprock does not install the update: replacing the running binary would mean the daemon killing the process executing the command, and running a package manager on the user's behalf from a web page is a surface a local tool should not open. diff --git a/.ai/08-decisions.md b/.ai/08-decisions.md index 7c204fc..78c61ac 100644 --- a/.ai/08-decisions.md +++ b/.ai/08-decisions.md @@ -422,3 +422,76 @@ call; presenting a Caprock-side total as the user's Google bill. reconciled rather than only counted), or if setting an environment variable proves to be the thing that stops people using the feature — in which case the question is a better handoff, not a key Caprock keeps. + +--- + +## ADR-024 — The weekly report holds a bot token, and only reports what a baseline supports + +**Decided 2026-09-01.** *Third paid feature; amends the scope of [ADR-023](#adr-023--gemini-runs-on-a-key-caprock-never-holds-read-from-the-environment).* + +A weekly message saying what moved, sent to the user's own Telegram bot. Three +decisions, and the first one walks back a line drawn yesterday. + +**The bot token is stored, and the Gemini key still is not.** ADR-023 said +Caprock never holds a credential, and that remains true of the thing it was +written about. A Google AI Studio key and a Telegram bot token are not the same +object: the key is attached to a billing account and can spend real money, while +the token drives a bot the user created for this one purpose, which can send +messages to the chats it was invited to and nothing else. Leaking the first +costs money; leaking the second costs a stranger the ability to message you. +That difference is large enough to price differently. + +The deciding argument is what the alternative does to the feature. Putting the +token in the environment means: talk to BotFather, find the chat id, edit a +launchd plist or a systemd unit, reinstall the service, restart the daemon — on +Windows, worse. The premium page promises "about two minutes", and a setup that +long would not be dishonest so much as unused. A feature nobody finishes setting +up is not a feature. + +It is stored the way the licence key already is: `config.json`, mode `0600`, +inside a `0700` data dir. It is **write-only over HTTP** — accepted by +`PUT /v1/settings`, never returned by `GET /v1/settings`, which is a new pattern +in this codebase and exists because the settings response is read by the +dashboard on every render and by `caprock report`. What comes back instead is +whether a token is set, which is all any screen needs to know. + +**A finding needs a baseline and a floor, or it is not reported.** The premium +page says "the repository that cost 3× its usual week". Two weeks compared give +a ratio, not a finding: a repository that cost $2 and then $6 is 3× and means +nothing. "Usual" is therefore the median of the preceding four weeks, not last +week, and no movement is reported at all unless the change also clears an +absolute floor — a few dollars, not a few cents. Below that the message says the +week was ordinary, which is a true and useful thing to say. + +This follows what `assembleWork` already does in `caprock report`: withhold a +breakdown whose linkage is too weak rather than publish a confident wrong +ranking. A weekly message is worse than the dashboard for this, because the +reader cannot click into it to check. + +**It is the first background outbound call, and that is the part to be careful +with.** ADR-023 ruled out "any background or speculative call" for Gemini, and +that stands for Gemini: it spends the user's money per call. This spends +nothing, goes only to Telegram's documented API, and carries figures the user +already sees on their own screen — no prompts, no replies, no tool output, no +file paths, on the same rule as the Gemini context. It sends only when the user +has configured a bot, which is the opt-in; with no token there is no timer and +nothing to disable. + +**Scheduling is a comparison, not a countdown.** A laptop is closed at +weekends, so a ticker anchored to Monday 09:00 fires for nobody. The daemon +instead checks hourly whether the ISO week of the last sent report is behind the +current one, and sends on the first tick after the send time — which means a +machine opened on Wednesday gets Monday's report on Wednesday, labelled with the +week it covers. The marker lives in the `meta` table beside the tool-link +cursor, because an in-memory marker sends a second copy after every restart: +that is exactly the bug `cap.Guard.firedOn` has, tolerable for a cap and not for +a message. + +**Rules out:** a token in the environment; a report that names a mover without a +baseline behind it; a fixed weekly timer; an in-memory sent-marker; sending +anything the dashboard does not already show the user. + +**Revisit if** a user asks for a second channel (a webhook is the same shape with +a different URL), or if the token turns out to be worth more than this decision +assumes — a bot added to a company Slack-style group chat is a wider blast radius +than a personal one, and that would be the signal to move it out of the file. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b32f84..91013b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ polish (plan-limit windows, orchestrator-lifecycle fixes, Homebrew formula, firs ## [Unreleased] +### Added + +- **The weekly report, to your own Telegram bot.** What moved this week against + your usual, sent Monday morning — or the next day you open the lid, because a + timer set for Monday 09:00 fires for nobody whose laptop is shut at weekends. + + A repository is only named when it clears both a real change in dollars and + twice its usual week, where *usual* is the median of the preceding four weeks + rather than last week: $2 to $6 is three times and is nothing, and a claim in + a message is one the reader cannot click into to check. Most weeks it says + nothing moved, which is true and worth saying. A week the machine was off is + reported as such rather than as a collapse in spending. + + The bot token is stored on your machine and is the one thing this API accepts + but never returns. The message carries figures only — no prompts, no replies, + no tool output, no file names — and goes straight to Telegram; nothing passes + our server. + Phase 3 (Delight) has no plan by design. ## [0.41.0] - 2026-09-01 diff --git a/internal/api/api.go b/internal/api/api.go index 4db1d75..ff22fdb 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -113,6 +113,33 @@ type Settings struct { // too old to have the field, and the panel cannot tell "you turned this // off" from "this build cannot do it". CapUSDPerDay float64 `json:"cap_usd_per_day"` + // ReportChatID is where the weekly report goes. Not a credential — a chat + // id identifies a conversation and grants nothing — so it round-trips like + // any other setting. + ReportChatID string `json:"report_chat_id"` + // ReportBotSet reports whether a bot token is stored, WITHOUT the token. + // + // The token is the first write-only field in this API: accepted by PUT, + // never returned by GET. Every other setting round-trips, and the licence + // key is echoed back plainly — but that key unlocks features on this + // machine, while a bot token can send messages as somebody's bot. This + // response is read on every settings render and by `caprock report`, and a + // credential should not ride along on either. What a screen needs is + // whether one is set, which is this. + ReportBotSet bool `json:"report_bot_set"` + // ReportBotToken is never serialised — the `-` tag is the mechanism that + // makes "write-only" true rather than merely intended. It is set by the PUT + // handler and read by the daemon; GET renders ReportBotSet instead. + ReportBotToken string `json:"-"` + // ReportLastError is why the last send failed, empty when it did not. + // + // A weekly message that silently stops arriving is the failure mode this + // feature has: nobody notices an absence. Telegram's own words are kept + // ("chat not found", "bot was blocked by the user") because both are things + // only the user can fix. + ReportLastError string `json:"report_last_error,omitempty"` + // ReportLastSentMs is when a report last went out, 0 for never. + ReportLastSentMs int64 `json:"report_last_sent_ms,omitempty"` // BrowseRoot is the only directory the folder picker may look inside, and // the boundary every path it returns is checked against. Empty means the // user's home directory. @@ -645,6 +672,10 @@ func (s *Server) handlePutSettings(w http.ResponseWriter, r *http.Request) { LicenseKey *string `json:"license_key"` CapUSDPerDay *float64 `json:"cap_usd_per_day"` BrowseRoot *string `json:"browse_root"` + // The bot token goes in and never comes back out. An empty string is a + // deliberate clear, which is why it is a pointer like everything else. + ReportBotToken *string `json:"report_bot_token"` + ReportChatID *string `json:"report_chat_id"` } if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 4<<10)).Decode(&patch); err != nil { s.failCode(w, http.StatusBadRequest, fmt.Errorf("parse body: %w", err)) @@ -671,6 +702,15 @@ func (s *Server) handlePutSettings(w http.ResponseWriter, r *http.Request) { if patch.BrowseRoot != nil { in.BrowseRoot = *patch.BrowseRoot } + // Only touched when the caller named it. GET never returns the token, so a + // UI that reads settings and writes them back always omits it — treating + // absence as "clear it" would delete the token on the next unrelated save. + if patch.ReportBotToken != nil { + in.ReportBotToken = strings.TrimSpace(*patch.ReportBotToken) + } + if patch.ReportChatID != nil { + in.ReportChatID = strings.TrimSpace(*patch.ReportChatID) + } if patch.LicenseKey != nil { in.LicenseKey = *patch.LicenseKey } diff --git a/internal/api/api_test.go b/internal/api/api_test.go index a10a75b..5b8cbc4 100644 --- a/internal/api/api_test.go +++ b/internal/api/api_test.go @@ -428,7 +428,14 @@ func TestPaceForecastHonesty(t *testing.T) { // fakeSettings is an in-memory SettingsController for the endpoint tests. type fakeSettings struct{ cur Settings } -func (f *fakeSettings) Get() Settings { return f.cur } +// Get mirrors what the daemon's adapter does with the write-only token: it +// reports that one is set and does not hand it back. A fake that returned the +// token would let a leak pass its own test. +func (f *fakeSettings) Get() Settings { + out := f.cur + out.ReportBotSet = f.cur.ReportBotToken != "" + return out +} func (f *fakeSettings) Set(s Settings) error { f.cur = s; return nil } // The cap is a number that stops work, so it has to survive a save and it has diff --git a/internal/api/dist/assets/index-AgZMyFDM.css b/internal/api/dist/assets/index-1ZVeIGiX.css similarity index 51% rename from internal/api/dist/assets/index-AgZMyFDM.css rename to internal/api/dist/assets/index-1ZVeIGiX.css index 5ddee8a..a538d69 100644 --- a/internal/api/dist/assets/index-AgZMyFDM.css +++ b/internal/api/dist/assets/index-1ZVeIGiX.css @@ -1 +1 @@ -@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[520px\]{width:520px}.w-\[560px\]{width:560px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/25{background-color:#837f7840}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/25{background-color:color-mix(in oklab, var(--color-fg-faint) 25%, transparent)}}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-panel\/95{background-color:#211f1df2}@supports (color:color-mix(in lab, red, red)){.bg-panel\/95{background-color:color-mix(in oklab, var(--color-panel) 95%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-\[0_2px_12px_var\(--color-bg\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,var(--color-bg));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-premium\/10:hover{background-color:#4d5cf01a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-premium\/10:hover{background-color:color-mix(in oklab, var(--color-premium) 10%, transparent)}}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} +@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[520px\]{width:520px}.w-\[560px\]{width:560px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-panel\/95{background-color:#211f1df2}@supports (color:color-mix(in lab, red, red)){.bg-panel\/95{background-color:color-mix(in oklab, var(--color-panel) 95%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-\[0_2px_12px_var\(--color-bg\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,var(--color-bg));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-premium\/10:hover{background-color:#4d5cf01a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-premium\/10:hover{background-color:color-mix(in oklab, var(--color-premium) 10%, transparent)}}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} diff --git a/internal/api/dist/assets/index-CkGNaCrc.js b/internal/api/dist/assets/index-DLnWXkEr.js similarity index 63% rename from internal/api/dist/assets/index-CkGNaCrc.js rename to internal/api/dist/assets/index-DLnWXkEr.js index a6ffb2f..995c29d 100644 --- a/internal/api/dist/assets/index-CkGNaCrc.js +++ b/internal/api/dist/assets/index-DLnWXkEr.js @@ -1,26 +1,26 @@ -var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function te(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function T(e,t){return te(e.type,t,e.props)}function E(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function ie(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function ae(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function D(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,D(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ie(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),D(o,r,i,``,function(e){return e})):o!=null&&(E(o)&&(o=T(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,ee=-1;function te(){return g?!0:!(e.unstable_now()-eet&&te());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(T)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=T,E=function(){re.postMessage(null)}}else E=function(){_(T,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1N||(e.current=M[N],M[N]=null,N--)}function P(e,t){N++,M[N]=e.current,e.current=t}var le=se(null),ue=se(null),de=se(null),fe=se(null);function pe(e,t){switch(P(de,t),P(ue,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(le),P(le,e)}function me(){ce(le),ce(ue),ce(de)}function he(e){e.memoizedState!==null&&P(fe,e);var t=le.current,n=Hd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function ge(e){ue.current===e&&(ce(le),ce(ue)),fe.current===e&&(ce(fe),Qf._currentValue=oe)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function ee(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function E(e,t){return ee(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function te(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ne=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?te(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function O(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,O(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ne,`$&/`)+`/`),O(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ne,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,ne=te.port2;te.port1.onmessage=E,D=function(){ne.postMessage(null)}}else D=function(){_(E,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1P||(e.current=N[P],N[P]=null,P--)}function F(e,t){P++,N[P]=e.current,e.current=t}var ce=oe(null),le=oe(null),ue=oe(null),de=oe(null);function fe(e,t){switch(F(ue,t),F(le,e),F(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}se(ce),F(ce,e)}function pe(){se(ce),se(le),se(ue)}function me(e){e.memoizedState!==null&&F(de,e);var t=ce.current,n=Hd(t,e.type);t!==n&&(F(le,e),F(ce,n))}function he(e){le.current===e&&(se(ce),se(le)),de.current===e&&(se(de),Qf._currentValue=ae)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function xe(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return F(e.type,!1);case 11:return F(e.type.render,!1);case 1:return F(e.type,!0);case 31:return ye(`Activity`);default:return``}}function I(e){try{var t=``,n=null;do t+=xe(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ve(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return e.child!==t&&t!==null?ve(`Suspense Fallback`):ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 15:return I(e.type,!1);case 11:return I(e.type.render,!1);case 1:return I(e.type,!0);case 31:return ve(`Activity`);default:return``}}function L(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` -`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,Fe=t.unstable_setDisableYieldValue,Ie=null,Le=null;function Re(e){if(typeof Pe==`function`&&Fe(e),Le&&typeof Le.setStrictMode==`function`)try{Le.setStrictMode(Ie,e)}catch{}}var ze=Math.clz32?Math.clz32:He,Be=Math.log,Ve=Math.LN2;function He(e){return e>>>=0,e===0?32:31-(Be(e)/Ve|0)|0}var Ue=256,We=262144,Ge=4194304;function Ke(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function qe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ke(n))):i=Ke(o):i=Ke(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ke(n))):i=Ke(o)):i=Ke(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Je(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ye(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xe(){var e=Ge;return Ge<<=1,!(Ge&62914560)&&(Ge=4194304),e}function Ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $e(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=mn(),pn=fn=dn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=cn&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Ft(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Td(Ar,`onSelect`),0>=o,i-=o,wi=1<<32-ze(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),V&&Ei(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),V&&Ei(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return V&&Ei(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),V&&Ei(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&wa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=di(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ui(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(a,e.mode,c),c.return=e,e=c}return o(e);case E:return a=wa(a),b(e,r,a,c)}if(k(a))return h(e,r,a,c);if(ae(a)){if(l=ae(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,ea(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=fi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tt(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Z&f)===f:(r&f)===f){f!==0&&f===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=A.T,s={};A.T=s,js(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),du(e)):As(e,t,r,du(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ss(e).queue;ys(e,i,t,oe,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:oe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},du())}function ws(){return $i(Qf)}function Ts(){return Oo().memoizedState}function Es(){return Oo().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Ra(n);var r=za(t,e,n);r!==null&&(pu(r,t,n),Ba(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=ei(e,t,n,r),n!==null&&(pu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,du())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return $r(e,t,i,0),Il===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return pu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(s(479))}else t=ei(e,n,r,2),t!==null&&pu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tt(e,n)}}var Fs={readContext:$i,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Fs.useEffectEvent=vo;var Is={readContext:$i,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Re(!0);try{n(t)}finally{Re(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=ys.bind(null,G,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Do();if(V){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Il===null)throw Error(s(349));Z&127||Ro(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,os(Bo.bind(null,r,a,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),n},useId:function(){var e=Do(),t=Il.identifierPrefix;if(V){var n=Ti,r=wi;n=(r&~(1<<32-ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[ct]=t,a[lt]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=de.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ii(t,!0)}else e=Bd(e).createTextNode(r),e[ct]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[ct]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(s(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[ct]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),i=!1}else i=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return me(),e===null&&xd(t.stateNode.containerInfo),Nc(t),null;case 10:return qi(t.type),Nc(t),null;case 19:if(ce(ao),r=t.memoizedState,r===null)return Nc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Mc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Mc(r,!1),e=a.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return P(ao,ao.current&1|2),V&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>$l&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!V)return Nc(t),null}else 2*De()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=ao.current,P(ao,i?n&1|2:n&1),V&&Ei(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ce(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(H),Nc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Fc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(H),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(ao),null;case 4:return me(),null;case 10:return qi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&ce(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(H),null;case 25:return null;default:return null}}function Ic(e,t){switch(ki(t),t.tag){case 3:qi(H),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:ce(ao);break;case 10:qi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&ce(ma);break;case 24:qi(H)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Uu(e,e.return,t)}}}function Bc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[lt]=t}catch(t){Uu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ct]=e,t[lt]=n}catch(t){Uu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Rd=sp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(a,r,n),a[ct]=e,yt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;cg&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,A.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,Y&6)throw Error(s(331));var c=Y;if(Y|=4,jl(a.current),Cl(a,a.current,o,n),Y=c,rd(0,!1),Le&&typeof Le.onPostCommitFiberRoot==`function`)try{Le.onPostCommitFiberRoot(Ie,a)}catch{}return!0}finally{j.p=i,A.T=r,zu(e,t)}}function Hu(e,t,n){t=gi(n,t),t=Js(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Qe(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=gi(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),Qe(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Q=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Z&n)===n&&(Hl===4||Hl===3&&(Z&62914560)===Z&&300>De()-Zl?!(Y&2)&&bu(e,0):Gl|=n,ql===Z&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Xe()),e=ti(e,t),e!==null&&(Qe(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Ce(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Z,a=qe(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Je(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=De(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=vt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);yt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=vt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),yt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=de.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=vt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=vt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=vt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Lt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),yt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Lt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,yt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),yt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,yt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),yt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=new class{state={conn:`connecting`,lastFrameAt:0,tick:0,alerts:[]};listeners=new Set;backoff=500;timer=null;started=!1;frameSubs=new Set;getState=()=>this.state;subscribe=e=>(this.listeners.add(e),this.start(),()=>{this.listeners.delete(e)});onFrame=e=>(this.frameSubs.add(e),()=>{this.frameSubs.delete(e)});set(e){this.state={...this.state,...e};for(let e of this.listeners)e()}start(){this.started||typeof WebSocket>`u`||(this.started=!0,this.connect())}connect(){let e=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/v1/live`;this.set({conn:`connecting`});let t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.onopen=()=>{this.backoff=500,this.set({conn:`open`})},t.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}this.handle(t)},t.onclose=()=>{this.set({conn:`closed`}),this.scheduleReconnect()},t.onerror=()=>{t.close()}}scheduleReconnect(){this.timer===null&&(this.timer=window.setTimeout(()=>{this.timer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,1e4))}handle(e){let t=Date.now();for(let t of this.frameSubs)try{t(e)}catch(e){console.error(`[caprock] live frame subscriber failed`,e)}switch(e.type){case`alert`:this.set({lastFrameAt:t,alerts:[e.data,...this.state.alerts.filter(t=>t.session_id!==e.data.session_id)].slice(0,50),tick:this.state.tick+1});break;case`event`:this.set({lastFrameAt:t,lastEvent:e.data,tick:this.state.tick+1});break;case`session`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;case`task`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;default:this.set({lastFrameAt:t})}}dismissAlert(e){this.set({alerts:this.state.alerts.filter(t=>t.session_id!==e)})}};function f(){return(0,l.useSyncExternalStore)(d.subscribe,d.getState,d.getState)}function p(e=400){let{tick:t}=f(),[n,r]=m(t,e);return(0,l.useEffect)(()=>{r(t)},[t,r]),n}function m(e,t){let[n,r]=(0,l.useState)(e),i=(0,l.useRef)(null),a=(0,l.useRef)(e);return[n,(0,l.useCallback)(e=>{a.current=e,i.current===null&&(i.current=window.setTimeout(()=>{i.current=null,r(a.current)},t))},[t])]}function h(e){let[t,n]=e.replace(/^#\/?/,``).split(`?`),r=(t??``).split(`/`).filter(Boolean),i=new URLSearchParams(n??``),a=i.get(`tab`)??void 0,o=Number(i.get(`at`)),s=Number.isFinite(o)&&o>0?o:void 0;switch(r[0]){case void 0:case``:case`now`:return{name:`now`};case`session`:return r[1]?{name:`session`,id:decodeURIComponent(r[1]),tab:a,at:s}:{name:`now`};case`cost`:return{name:`cost`};case`history`:return{name:`history`};case`tasks`:return{name:`tasks`};case`graph`:return{name:`graph`};case`notes`:return{name:`notes`};case`settings`:return{name:`settings`};default:return{name:`now`}}}function g(e){switch(e.name){case`now`:return`#/`;case`session`:{let t=new URLSearchParams;e.tab&&t.set(`tab`,e.tab),e.at&&t.set(`at`,String(e.at));let n=t.toString();return`#/session/${encodeURIComponent(e.id)}${n?`?${n}`:``}`}case`cost`:return`#/cost`;case`history`:return`#/history`;case`tasks`:return`#/tasks`;case`graph`:return`#/graph`;case`notes`:return`#/notes`;case`settings`:return`#/settings`}}function _(){let[e,t]=(0,l.useState)(()=>h(location.hash));return(0,l.useEffect)(()=>{let e=()=>t(h(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(e){location.hash=g(e)}var y=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:4,maximumFractionDigits:4});function x(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function S(e){return x(e)===null?`—`:(e=e,e!==0&&Math.abs(e)<.01?b.format(e):y.format(e))}function C(e){if(x(e)===null)return`—`;e=e;let t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e4?`${(e/1e3).toFixed(1)}k`:new Intl.NumberFormat(`en-US`).format(e)}function w(e,t=0){if(x(e)===null)return`—`;let n=e;if(t===0){let e=Math.floor(n);return`${Number.isFinite(e)?e:0}%`}let r=Math.min(100,Math.max(0,Math.trunc(x(t)??0)));return`${e.toFixed(r)}%`}function ee(e,t=Date.now()){if(!e)return`—`;let n=typeof e==`number`?e:Date.parse(e);if(Number.isNaN(n))return`—`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<5)return`now`;if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<48?`${a}h ago`:`${Math.floor(a/24)}d ago`}function te(e){if(x(e)===null)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function T(e){return e.length>8?e.slice(0,8):e}function E(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.slice(n+1):t}function ne(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t?`${t[1]}·${t[2]}`:e}function re(e){return e.replace(/-\d{6,}$/,`…`)}function ie(e){let[t,n]=(0,l.useState)(()=>Date.now());return(0,l.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}var ae=`caprock-theme`;function D(){let e=localStorage.getItem(ae);return e===`dark`||e===`light`?e:window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function O(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function k(){let[e,t]=(0,l.useState)(D);return(0,l.useEffect)(()=>{O(e),localStorage.setItem(ae,e)},[e]),[e,()=>t(e=>e===`dark`?`light`:`dark`)]}async function A(e,t,n=`POST`){let r=await fetch(e,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok){let e;try{e=await r.json()}catch{}throw new j(r.status,`${r.status} ${r.statusText}`,e)}return r.status===204?void 0:await r.json()}var j=class extends Error{status;body;constructor(e,t,n){super(t),this.status=e,this.body=n}};function oe(e){if(e instanceof j){let t=e.body,n=t?.error??e.message;return t?.detail?`${n} — ${t.detail}`:n}return e instanceof Error?e.message:String(e)}async function M(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok){let e;try{e=await t.json()}catch{}throw new j(t.status,`${t.status} ${t.statusText}`,e)}return await t.json()}var N={sessions:(e=!1)=>M(`/v1/sessions${e?`?active=true`:``}`),session:e=>M(`/v1/sessions/${encodeURIComponent(e)}`),events:(e,t=0,n=500)=>M(`/v1/sessions/${encodeURIComponent(e)}/events?after=${t}&limit=${n}`),eventsBefore:(e,t,n=200)=>M(`/v1/sessions/${encodeURIComponent(e)}/events?before=${t}&limit=${n}`),recentEvents:(e,t=2e3)=>M(`/v1/sessions/${encodeURIComponent(e)}/events?newest=1&limit=${t}`),diff:e=>M(`/v1/sessions/${encodeURIComponent(e)}/diff`),notes:(e,t=200)=>M(`/v1/sessions/${encodeURIComponent(e)}/notes?limit=${t}`),searchNotes:(e,t=100,n=0)=>M(`/v1/notes?q=${encodeURIComponent(e)}&limit=${t}${n?`&before=${n}`:``}`),settings:()=>M(`/v1/settings`),update:()=>M(`/v1/update`),checkUpdate:()=>A(`/v1/update/check`,{}),saveSettings:e=>A(`/v1/settings`,e,`PUT`),summary:(e=`today`,t)=>M(`/v1/stats/summary?range=${e}${t&&t!==`all`?`&agent=${t}`:``}`),daily:(e=30)=>M(`/v1/stats/daily?days=${e}`),premium:()=>M(`/v1/premium`),gemini:()=>M(`/v1/gemini`),askGemini:(e,t)=>A(`/v1/gemini/ask`,{prompt:e,model:t}),browse:(e=``)=>M(`/v1/browse${e?`?dir=${encodeURIComponent(e)}`:``}`),recentDirs:()=>M(`/v1/recent-dirs`),history:(e=`all`)=>M(`/v1/history?range=${e}`),enableHive:(e,t)=>A(`/v1/hive`,{hive:e??``,repo:t??``}),tasks:()=>M(`/v1/tasks`),task:e=>M(`/v1/tasks/${encodeURIComponent(e)}`),createTask:e=>A(`/v1/tasks`,e),approve:(e,t)=>A(`/v1/tasks/${encodeURIComponent(e)}/${t?`approve`:`reject`}`,{}),startOrchestrator:()=>A(`/v1/orchestrator/start`,{}),stopOrchestrator:()=>A(`/v1/orchestrator/stop`,{}),status:()=>M(`/v1/status`),spawn:e=>A(`/v1/agents`,e),signal:(e,t)=>A(`/v1/agents/${encodeURIComponent(e)}/signal`,{action:t}),paste:(e,t)=>A(`/v1/paste`,{type:e,data:t}),agentInput:(e,t)=>A(`/v1/agents/${encodeURIComponent(e)}/input`,{data:t})},se=[{id:`macos`,label:`macOS`},{id:`linux`,label:`Linux`},{id:`windows`,label:`Windows`}],ce={cmd:`caprock down && caprock up`,note:`The running daemon is the old binary until it restarts. Your database is untouched.`},P={cmd:`caprock status`,note:`Confirms the new version is the one running, and that hooks are still registered.`},le={label:`Homebrew`,steps:[{cmd:`brew update && brew upgrade caprock`,note:`The update is not optional: without it Homebrew reads a cached copy of the tap, refreshed at most once a day, and reports "already installed" for a release that is already out.`},ce,P]},ue={label:`Scoop`,steps:[{cmd:`scoop update caprock`,note:`Scoop refreshes its buckets as part of this, so no separate step.`},ce,P]},de={label:`go install`,steps:[{cmd:`go install github.com/dspv/caprock/cmd/caprock@latest`,note:`Also install the hook shim: same command with cmd/caprock-hook.`},ce,P]},fe={label:`Downloaded binary`,steps:[{cmd:``,note:`Download the archive for your platform from the release page, and replace the caprock and caprock-hook binaries with the ones inside it.`},ce,P]};function pe(e){switch(e){case`macos`:return[le,de,fe];case`linux`:return[le,de,fe];case`windows`:return[ue,de,fe]}}function me(e,t){let n=`${t??``} ${e}`.toLowerCase();return n.includes(`win`)?`windows`:n.includes(`mac`)||n.includes(`darwin`)||n.includes(`iphone`)||n.includes(`ipad`)?`macos`:`linux`}function he(e){if(e&&e.startsWith(`scoop`))return`windows`}function ge(e,t){return e?be(e,pe(t))===void 0:!1}var _e=`caprock-update-platform`;function ve(){try{let e=localStorage.getItem(_e);return se.some(t=>t.id===e)?e:void 0}catch{return}}function ye(e){try{localStorage.setItem(_e,e)}catch{}}function be(e,t){if(!e)return;let n=e.split(/\s+/)[0];if(n)return t.find(e=>e.steps.some(e=>e.cmd.startsWith(n)))}function F(e,t=[],n={}){let{live:r=!0,intervalMs:i=0}=n,a=p(400),[o,s]=(0,l.useState)({data:void 0,error:void 0,loading:!0,refresh:()=>{},loadedAt:0}),c=(0,l.useRef)(0),u=(0,l.useRef)(e);u.current=e;let d=(0,l.useCallback)(()=>{let e=++c.current;u.current().then(t=>{e===c.current&&s(e=>({...e,data:t,error:void 0,loading:!1,loadedAt:Date.now()}))},t=>{e===c.current&&s(e=>({...e,error:t,loading:!1}))})},[]);return(0,l.useEffect)(d,[d,...t]),(0,l.useEffect)(()=>{r&&a>0&&d()},[r,a,d]),(0,l.useEffect)(()=>{if(!i)return;let e=window.setInterval(d,i);return()=>window.clearInterval(e)},[i,d]),{...o,refresh:d}}var xe=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),I=e(((e,t)=>{t.exports=xe()}))(),Se=[{label:`Pro`,kind:`flat`,usd:20,note:`$20/mo`},{label:`Max 5×`,kind:`flat`,usd:100,note:`$100/mo`},{label:`Max 20×`,kind:`flat`,usd:200,note:`$200/mo`},{label:`Team seat`,kind:`flat`,usd:30,note:`$30/seat/mo`},{label:`API / Bedrock`,kind:`metered`,usd:0,note:`billed per token`}],Ce,we=null,Te=new Set;function Ee(){for(let e of Te)e()}function De(){let[,e]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let t=()=>e(e=>e+1);return Te.add(t),!Ce&&!we&&(we=N.settings().then(e=>{Ce=e}).catch(()=>{Ce={update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0}}).finally(()=>{we=null,Ee()})),()=>{Te.delete(t)}},[]),[Ce,e=>{Ce=e,Ee(),N.saveSettings(e).catch(()=>{})}]}function Oe({plan:e,onSave:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let a=e?.plan_kind?e.plan_kind===`metered`?e.plan_label||`API`:`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`set plan`;return(0,I.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,I.jsx)(`button`,{onClick:()=>r(e=>!e),className:`mono text-[11px] px-1.5 py-0.5 rounded-sm border ${e?.plan_kind?`border-border text-fg-muted hover:text-fg`:`border-accent/50 text-accent`}`,title:`How you pay for Claude Code — Caprock cannot detect this, so you tell it`,children:a}),n&&(0,I.jsx)(ke,{plan:e,onSave:e=>{t(e),r(!1)}})]})}function ke({plan:e,onSave:t}){let[n,r]=(0,l.useState)(String(e?.plan_usd_per_month||``)),i=e??{update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0};return(0,I.jsxs)(`div`,{className:`absolute right-0 top-7 z-20 w-[268px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg p-2`,children:[(0,I.jsx)(`div`,{className:`text-[11px] text-fg-muted px-1 pb-1.5`,children:`How do you pay for Claude Code? Caprock can't detect this and never guesses.`}),Se.map(n=>{let r=e?.plan_label===n.label;return(0,I.jsxs)(`button`,{onClick:()=>t({...i,plan_kind:n.kind,plan_label:n.label,plan_usd_per_month:n.usd}),className:`w-full flex items-baseline gap-2 px-1.5 py-1 rounded-sm text-left text-[12px] hover:bg-panel-2 ${r?`text-accent`:`text-fg`}`,children:[(0,I.jsx)(`span`,{children:n.label}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint ml-auto`,children:n.note})]},n.label)}),(0,I.jsxs)(`div`,{className:`border-t border-border mt-1.5 pt-1.5 px-1.5`,children:[(0,I.jsx)(`label`,{className:`text-[11px] text-fg-faint`,children:`Or a different monthly price`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px] text-fg-faint`,children:`$`}),(0,I.jsx)(`input`,{className:`input`,inputMode:`decimal`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. 150`}),(0,I.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-1 rounded-sm hover:border-border-strong`,onClick:()=>{let e=Number(n);!Number.isFinite(e)||e<0||t({...i,plan_kind:`flat`,plan_label:`plan`,plan_usd_per_month:e})},children:`set`})]})]})]})}var Ae=[{id:`bug`,label:`bug`,hint:`What did you see?`,gh:`bug`},{id:`feature`,label:`feature`,hint:`What would you want?`,gh:`enhancement`},{id:`unclear`,label:`unclear`,hint:`What did not make sense?`,gh:`question`},{id:`other`,label:`other`,hint:`Anything else — a sentence is enough.`,gh:`question`}],je=`dspv/caprock`;function Me(e,t){if(!e)return[`Screen: ${t}`];let n=e.hooks,r=n?(n.missing?.length??0)>0?`partly installed`:n.shim_exists?`installed`:`not installed`:`unknown`;return[`Caprock ${e.version}${e.platform?` (${e.platform})`:``}`,`Screen: ${t}`,`${e.events.toLocaleString(`en-US`)} events${e.owned_active?` · ${e.owned_active} owned session(s) running`:``}`,`Hooks: ${r} · Orchestration: ${e.orchestration?`on`:`off`}`]}function Ne(e,t,n){let r=n.trim().split(` -`)[0]?.trim()??``;return`[${e}] ${t}: ${r.length>60?`${r.slice(0,57)}…`:r}`}function Pe(e,t,n){let r=e===`bug`?`What happened`:e===`feature`?`What is missing`:e===`unclear`?`What is unclear`:`Feedback`,i=t.trim(),a=i.length>6e3?`${i.slice(0,Ie)}\n\n_[…truncated — the rest did not fit in the link; paste it below]_`:i;return[`### ${r}`,``,a,``,`### Context`,``,...n.map(e=>`- ${e}`),``,`Filed from the Caprock dashboard. Nothing was sent automatically — this issue was opened in your browser for you to review.`].join(` -`)}function Fe(e,t,n,r){let i=Ae.find(t=>t.id===e)??Ae[0];return`https://github.com/${je}/issues/new?${new URLSearchParams({title:Ne(e,t,n),body:Pe(e,n,r),labels:i.gh}).toString()}`}var Ie=6e3;function Le(e){return e.trim().length>=8}function Re({screen:e}){let[t,n]=(0,l.useState)(!1);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>n(!0),className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,title:`Report a bug, ask for something, or say what was unclear`,children:`feedback`}),t&&(0,I.jsx)(ze,{screen:e,onClose:()=>n(!1)})]})}function ze({screen:e,onClose:t}){let[n,r]=(0,l.useState)(`bug`),[i,a]=(0,l.useState)(``),o=Me(F(()=>N.status(),[],{live:!1,intervalMs:0}).data,e),s=Le(i),c=Ae.find(e=>e.id===n)??Ae[0],u=()=>{s&&(window.open(Fe(n,e,i,o),`_blank`,`noopener`),t())};return(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[12vh] px-4`,onClick:t,children:(0,I.jsxs)(`div`,{className:`w-full max-w-[660px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Tell us what happened`}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,I.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,I.jsx)(`div`,{className:`flex gap-1.5`,children:Ae.map(e=>(0,I.jsx)(`button`,{onClick:()=>r(e.id),className:`text-[13px] px-3.5 py-1.5 rounded-sm border font-mono ${e.id===n?`border-accent/60 bg-accent/10 text-accent`:`border-border text-fg-muted hover:text-fg`}`,children:e.label},e.id))}),(0,I.jsx)(`textarea`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:c.hint,rows:6,className:`input w-full resize-y text-[14px] leading-relaxed`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&u()}}),(0,I.jsxs)(`div`,{className:`border border-border rounded-sm bg-panel-2/50 px-3 py-2`,children:[(0,I.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:`Attached`}),(0,I.jsx)(`ul`,{className:`text-[11px] text-fg-muted num grid gap-0.5`,children:o.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`button`,{onClick:u,disabled:!s,className:`text-[12px] px-3 py-1.5 rounded-sm border ${s?`border-accent/50 bg-accent/10 text-accent hover:bg-accent/20`:`border-border text-fg-faint cursor-not-allowed`}`,children:`Open a GitHub issue →`}),(0,I.jsx)(`span`,{className:`text-[12px] ${s?`text-fg-faint`:`text-fg-muted`}`,children:s?`⌘↵ to open`:`One sentence is enough.`})]}),(0,I.jsx)(`p`,{className:`text-[11px] text-fg-faint leading-relaxed`,children:`Nothing is sent from here — the issue opens prefilled in your browser for you to submit.`})]})]})})}var Be=1200,Ve=630;function He(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}var Ue={command:`running commands`,edit:`writing code`,read:`reading code`,mcp:`MCP tools`,web:`web research`,other:`other tools`,none:`no tool call`};function We(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/^claude-/,``).replace(/-\d{8}$/,``).slice(0,18)}function Ge(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function Ke(e,t){let n=He(`--color-bg`,`#141414`),r=He(`--color-panel`,`#1a1a19`),i=He(`--color-border`,`#2a2a28`),a=He(`--color-fg`,`#e8e6e2`),o=He(`--color-fg-muted`,`#a9a59e`),s=He(`--color-fg-faint`,`#6f6b64`),c=He(`--color-accent`,`#feb157`),l=He(`--color-ok`,`#7fc99a`),u=`"JetBrains Mono", ui-monospace, monospace`,d=`"Hanken Grotesk", ui-sans-serif, system-ui, sans-serif`;e.fillStyle=n,e.fillRect(0,0,Be,Ve);let f=(t,n,r,i,a=12)=>{e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()},p=(t,n,a,o)=>{f(t,n,a,o),e.fillStyle=r,e.fill(),e.strokeStyle=i,e.lineWidth=1,e.stroke()},m=(t,n,r,i,a,o=d,s=400,c=`left`)=>{e.fillStyle=a,e.font=`${s} ${i}px ${o}`,e.textAlign=c,e.fillText(r,t,n)};e.font=`600 32px ${d}`;let h=`My stats on`,g=e.measureText(` `).width,_=e.measureText(h).width;m(64,78,h,32,a,d,600);let v=64+_+g;m(v,78,`caprock.dev`,32,c,d,600);let y=e.measureText(`caprock.dev`).width,b=t.takenAt.toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`});m(v+y+g*2,78,`– ${b}`,26,s,d,600),[[`TODAY`,S(t.today.cost),`${t.today.sessions} sessions`,c],[`THIS WEEK`,S(t.week.cost),`${t.week.sessions} sessions`,a],[`THIS MONTH`,S(t.month.cost),`${Ge(t.month.tokens)} tokens`,a],[`ALL TIME`,S(t.allTime.cost),`${t.allTime.days} active days`,c],[`A DAY`,S(t.allTime.cost/Math.max(1,t.allTime.days)),`on average`,a],[`TOKENS`,Ge(t.allTime.tokens),`all time`,a],[`PER 1M TOKENS`,S(t.allTime.cost/Math.max(1,t.allTime.tokens/1e6)),`what a million costs`,a],[`CACHE HIT`,`${Math.round(t.cacheHitPct)}%`,`input cost cut`,l]].forEach(([e,t,n,r],i)=>{let a=64+i%4*272,c=130+Math.floor(i/4)*114;p(a,c,256,98),m(a+20,c+30,e,13,s,u),m(a+20,c+56,t,28,r,d,600),m(a+20,c+81,n,14,o)});let x=(t,n,r,i)=>{let l=44+r.length*26+12;p(t,n,524,l),m(t+20,n+30,i,13,s,u);let d=Math.max(...r.map(e=>e.cost),1),h=r.reduce((e,t)=>e+t.cost,0),g=t+170;return r.forEach((r,i)=>{let l=n+62+i*26;m(t+20,l,r.label,14,o,u),e.fillStyle=c,e.globalAlpha=.85;let p=Math.max(2,164*(r.cost/d));f(g,l-10,p,10,Math.min(3,p/2)),e.fill(),e.globalAlpha=1,m(t+524-62,l,S(r.cost),14,a,u,400,`right`);let _=h>0?Math.max(1,Math.floor(100*r.cost/h)):0;m(t+524-20,l,`${_}%`,14,s,u,400,`right`)}),l},C=x(64,372,t.models,`WHERE THE MONEY WENT`);x(612,372,t.work,`WHAT IT WENT ON`);let w=372+C+34;m(64,w,`at API list prices — not a bill, and not money saved`,14,s),m(1136,w,`What's yours?`,15,c,d,600,`right`),e.textAlign=`left`}function qe(e=new Date){let t=e=>String(e).padStart(2,`0`);return`caprock-${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}.png`}async function Je(){let[e,t,n,r]=await Promise.all([N.summary(`today`),N.summary(`7d`),N.summary(`30d`),N.history(`all`)]),i=e=>e.tokens_in+e.tokens_out+e.cache_read+e.cache_write;return{takenAt:new Date,today:{cost:e.cost_usd,sessions:e.sessions},week:{cost:t.cost_usd,sessions:t.sessions},month:{cost:n.cost_usd,tokens:i(n)},allTime:{cost:r.totals.cost_usd,days:r.totals.days,tokens:i(r.summary)},cacheHitPct:(n.savings?.hit_rate??0)*100,models:(n.models??[]).slice(0,5).map(e=>({label:We(e.model),cost:e.cost_usd})),work:(n.work??[]).slice(0,5).map(e=>({label:Ue[e.kind]??e.kind,cost:e.cost_usd}))}}async function Ye(e){let t=document.createElement(`canvas`);t.width=Be,t.height=Ve;let n=null;try{n=t.getContext(`2d`)}catch{return null}return n?(Ke(n,e),await new Promise(e=>{if(typeof t.toBlob!=`function`){e(null);return}t.toBlob(t=>e(t),`image/png`)})):null}function Xe(e){let t=`over ${e.days} active days`;return`${S(e.cost_usd)} of Claude Code ${t}, across ${e.sessions.toLocaleString(`en-US`)} sessions — measured on my own machine with Caprock. https://caprock.dev`}function Ze(){let[e,t]=(0,l.useState)(!1);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>t(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2 py-0.5 text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of your figures`,children:`Share`}),e&&(0,I.jsx)(Qe,{onClose:()=>t(!1)})]})}function Qe({onClose:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=async()=>{let[e,t]=await Promise.all([Je(),N.history(`all`)]);return{blob:await Ye(e),text:Xe(t.totals)}},c=async()=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t}=await s();if(!t){o(`Could not draw the card in this browser.`),i(!1);return}let r=new File([t],qe(),{type:`image/png`});n(!1),await navigator.share({files:[r]}),e()}catch(e){e?.name!==`AbortError`&&o(`Sharing was not available — the card was not sent.`),i(!1)}finally{n(!1)}}},u=async e=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t,text:n}=await s();if(!t){o(`Could not draw the card in this browser.`);return}let r=URL.createObjectURL(t),i=document.createElement(`a`);if(i.href=r,i.download=qe(),i.click(),URL.revokeObjectURL(r),e===`download`){o(`Saved to your downloads.`);return}let a=e===`x`?`https://x.com/intent/tweet?text=${encodeURIComponent(n)}`:`https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(n)}`;window.open(a,`_blank`,`noopener`),o(`Card saved and the post opened — drag the image in.`)}finally{n(!1),i(!1)}}},d=typeof navigator<`u`&&typeof navigator.canShare==`function`&&navigator.canShare({files:[new File([],`x.png`,{type:`image/png`})]});return(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[14vh]`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":`Share your figures`,children:(0,I.jsxs)(`div`,{className:`w-[420px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`flex items-center border-b border-border px-4 py-3`,children:[(0,I.jsx)(`h2`,{className:`text-[13px] font-medium text-fg`,children:`Share your figures`}),(0,I.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,I.jsxs)(`div`,{className:`grid gap-2.5`,children:[d&&(0,I.jsxs)(`button`,{onClick:c,disabled:r,className:`rounded-md border border-accent bg-accent/15 px-4 py-3 text-[14px] font-medium text-accent hover:bg-accent/25 disabled:opacity-50`,children:[t?`Drawing the card…`:`Send it somewhere`,(0,I.jsx)(`span`,{className:`mt-0.5 block text-[12px] font-normal text-fg-muted`,children:`Opens your share menu — Messages, Mail, anywhere`})]}),(0,I.jsxs)(`button`,{onClick:()=>u(`download`),disabled:r,className:`rounded-md border border-border bg-transparent px-4 py-3 text-[14px] text-fg transition-colors hover:border-border-strong hover:bg-panel-2 disabled:opacity-50`,children:[t&&!d?`Drawing the card…`:`Save the image`,(0,I.jsx)(`span`,{className:`mt-0.5 block text-[12px] text-fg-muted`,children:`A PNG in your downloads, to post wherever you like`})]})]}),(0,I.jsxs)(`ul`,{className:`mt-4 grid gap-1 text-[13px] text-fg-muted`,children:[(0,I.jsx)(`li`,{children:`Totals only — no names, no paths, nothing Claude wrote.`}),(0,I.jsx)(`li`,{children:`Drawn on your machine. Uploaded nowhere.`})]}),a&&(0,I.jsx)(`p`,{className:`mt-2 text-[12px] text-fg-muted`,children:a})]})]})})}function $e(){let e=F(()=>N.history(`all`),[],{intervalMs:6e4}),[t,n]=(0,l.useState)(!1),r=e.data?.totals;return!r||r.sessions===0?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>n(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1 text-[12px] text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of these figures`,children:`Share these numbers`}),t&&(0,I.jsx)(Qe,{onClose:()=>n(!1)})]})}var et={cap:{title:`A daily cap that pauses sessions`,body:`A number for the day. Cross it and Caprock stops its own sessions.`,points:[`A runaway loop stops at $40 instead of finishing at $400`,`It happens while you are asleep, not in tomorrow’s summary`,`Your own sessions are never touched — only the ones Caprock started`]},gemini:{title:`Ask Gemini, on your own key`,body:`A second model inside Caprock, paid for by you, at Google’s prices.`,points:[`Ask about your own sessions without leaving the dashboard`,`What it costs is counted and shown beside your Claude spend`,`Caprock never stores the key — it reads it from your environment`],setup:`Set GEMINI_API_KEY in the daemon’s environment and restart it. Google bills you directly.`},report:{title:`A weekly report, sent where you are`,body:`Monday morning, before you open a terminal.`,points:[`What moved: the repository that cost 3× its usual week`,`Last week against the one before it, per repository and model`,`Through your own Telegram bot — nothing passes our server`],setup:`Setup: one message to BotFather, about two minutes.`}};function tt({p:e,onClose:t}){return e?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsxs)(`a`,{href:e.yearly.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium/75 px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:bg-premium`,children:[`$`,e.yearly.charged_usd,` / year`]}),(0,I.jsxs)(`a`,{href:e.lifetime?.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium-strong px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:brightness-110`,children:[`$`,e.lifetime?.charged_usd,` once`]})]}),(0,I.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-center text-[11px] leading-snug text-fg-faint`,children:[(0,I.jsx)(`span`,{children:`Every Premium feature, renews yearly`}),(0,I.jsx)(`span`,{children:`Every Premium feature, now and future — no renewal`})]})]}):(0,I.jsx)(`div`,{className:`h-[92px] text-[13px] text-fg-faint`,children:`…`})}function nt({feature:e,onClose:t}){let n=F(()=>N.premium(),[]).data,r=et[e];return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[12vh]`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Caprock Premium`,children:(0,I.jsxs)(`div`,{className:`w-[440px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-premium-strong`,children:`Caprock Premium`}),(0,I.jsx)(`h2`,{className:`mt-1 text-[16px] font-medium leading-snug text-fg`,children:r.title})]}),(0,I.jsx)(`button`,{onClick:t,className:`-mr-1 ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-5 pt-3`,children:[(0,I.jsx)(`p`,{className:`text-[13px] leading-relaxed text-fg-muted`,children:r.body}),(0,I.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:r.points.map(e=>(0,I.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-fg`,children:[(0,I.jsx)(`span`,{"aria-hidden":!0,className:`text-premium-strong`,children:`·`}),(0,I.jsx)(`span`,{children:e})]},e))}),r.setup&&(0,I.jsx)(`p`,{className:`mt-2.5 text-[12px] text-fg-faint`,children:r.setup})]}),(0,I.jsx)(`div`,{className:`mt-4 border-t border-border px-5 py-4`,children:(0,I.jsx)(tt,{p:n,onClose:t})}),(0,I.jsx)(`footer`,{className:`border-t border-border px-5 py-3 text-[12px]`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`a`,{href:n?.info_url??`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`whitespace-nowrap text-fg-muted no-underline hover:text-fg`,children:`Read more`}),(0,I.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:`opens a new tab`}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`Close`})]})}),(0,I.jsx)(`p`,{className:`border-t border-border px-5 py-2.5 text-[11px] leading-relaxed text-fg-faint`,children:`Everything Caprock does now stays free and Apache-2.0 — Premium only ever adds.`})]})})}function rt(){let[e,t]=(0,l.useState)(!1),n=F(()=>N.premium(),[],{live:!1,intervalMs:3e5});if(!n.data?.yearly?.url)return null;if(n.data.license?.active)return(0,I.jsx)(`span`,{className:`text-premium-strong`,children:`premium`});let r=n.data;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`inline-flex items-center overflow-hidden rounded-sm border border-premium/60`,children:[(0,I.jsxs)(`a`,{href:r.yearly.url,target:`_blank`,rel:`noreferrer`,className:`bg-premium px-2 py-0.5 text-white no-underline hover:brightness-110`,children:[`premium $`,r.yearly.charged_usd,`/yr`]}),(0,I.jsx)(`button`,{onClick:()=>t(!0),"aria-label":`What Premium includes`,title:`What Premium includes`,className:`px-1.5 py-0.5 text-premium-strong hover:bg-premium/10`,children:`›`})]}),e&&(0,I.jsx)(nt,{feature:`cap`,onClose:()=>t(!1)})]})}var it=`https://github.com/dspv/caprock`,at=`https://caprock.dev/teams`,ot=`https://caprock.dev/premium`,st=`caprock.footer.starred`;function ct(){let[e,t]=(0,l.useState)(()=>localStorage.getItem(st)===`1`);return(0,I.jsx)(`footer`,{className:`mt-6 border-t border-border`,children:(0,I.jsxs)(`div`,{className:`max-w-[1600px] mx-auto px-3 py-4 flex flex-wrap items-center gap-x-6 gap-y-3 text-[11px] text-fg-faint`,children:[(0,I.jsxs)(`a`,{href:at,target:`_blank`,rel:`noreferrer`,className:`group inline-flex items-center gap-2 no-underline`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted group-hover:text-fg`,children:`Want this for your team?`}),(0,I.jsx)(`span`,{className:`text-accent group-hover:text-accent-strong`,children:`Caprock for Teams →`})]}),(0,I.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-4`,children:[(0,I.jsx)(`a`,{href:ot,target:`_blank`,rel:`noreferrer`,className:`text-fg-muted hover:text-fg no-underline`,title:`A daily spend cap — Caprock pauses its own sessions when the day passes a limit you set`,children:`premium`}),!e&&(0,I.jsx)(`a`,{href:it,target:`_blank`,rel:`noreferrer`,onClick:()=>{localStorage.setItem(st,`1`),t(!0)},className:`text-fg-faint hover:text-fg no-underline`,title:`Opens GitHub in a new tab`,children:`★ star on GitHub`}),(0,I.jsx)(`a`,{href:`https://caprock.dev/blog`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`blog`}),(0,I.jsx)(`a`,{href:`https://caprock.dev/docs`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`docs`})]})]})})}var lt=[{route:{name:`now`},label:`Now`},{route:{name:`cost`},label:`Cost`},{route:{name:`history`},label:`Lifetime`},{route:{name:`notes`},label:`Answers`},{route:{name:`tasks`},label:`Tasks`}];function ut(e){switch(e.name){case`now`:return`Now`;case`session`:return`Session detail`;case`cost`:return`Cost`;case`history`:return`Lifetime`;case`tasks`:return`Tasks`;case`graph`:return`Graph`;case`notes`:return`Answers`;case`settings`:return`Status`}}function dt({route:e,children:t}){let n=f(),[r,i]=De(),a=t=>t.name===e.name||t.name===`now`&&e.name===`session`;return(0,I.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,I.jsxs)(`header`,{className:`h-10 border-b border-border bg-panel flex items-center px-3 gap-4 sticky top-0 z-10`,children:[(0,I.jsxs)(`a`,{href:`#/`,className:`flex items-center gap-2 text-fg no-underline hover:no-underline`,children:[(0,I.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 32 32`,"aria-hidden":!0,children:[(0,I.jsx)(`path`,{d:`M6 22 L16 8 L26 22 Z`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`3`,strokeLinejoin:`round`}),(0,I.jsx)(`rect`,{x:`6`,y:`22`,width:`20`,height:`3`,fill:`var(--color-accent)`})]}),(0,I.jsx)(`span`,{className:`font-medium tracking-wide text-[13px]`,children:`caprock`}),(0,I.jsx)(`span`,{className:`text-fg-faint text-[11px] hidden sm:inline`,children:`mission control`})]}),(0,I.jsx)(`nav`,{className:`inline-flex items-center gap-0.5 ml-2 rounded-md bg-panel-2 p-0.5`,children:lt.map(e=>(0,I.jsxs)(`a`,{href:g(e.route),"aria-current":a(e.route)?`page`:void 0,className:`px-2.5 py-1 rounded-[5px] text-[12px] no-underline hover:no-underline transition-colors ${a(e.route)?`bg-accent text-panel font-medium`:`text-fg hover:text-accent`}`,children:[e.label,e.phase&&(0,I.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wider text-fg-faint`,children:e.phase})]},e.label))}),(0,I.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-fg-muted`,children:[(0,I.jsx)(Ze,{}),(0,I.jsx)(rt,{}),(0,I.jsx)(Re,{screen:ut(e)}),(0,I.jsx)(pt,{state:n.conn,lastFrameAt:n.lastFrameAt}),(0,I.jsx)(Oe,{plan:r,onSave:i}),(0,I.jsx)(ft,{}),(0,I.jsx)(mt,{}),(0,I.jsx)(`a`,{href:`#/settings`,className:`text-fg-muted hover:text-fg no-underline`,children:`status`})]})]}),(0,I.jsx)(`main`,{className:`flex-1 p-3 max-w-[1600px] w-full mx-auto`,children:t}),(0,I.jsx)(ct,{})]})}function ft(){let[e,t]=k(),n=e===`dark`;return(0,I.jsx)(`button`,{type:`button`,onClick:t,title:n?`Switch to light theme`:`Switch to dark theme`,"aria-label":n?`Switch to light theme`:`Switch to dark theme`,className:`text-fg-muted hover:text-fg inline-flex items-center`,children:n?(0,I.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,I.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M19.1 4.9l-1.4 1.4M6.3 17.7l-1.4 1.4`})]}):(0,I.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,I.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})})})}function pt({state:e,lastFrameAt:t}){let n=ie(1e3),r=e===`open`?`bg-ok`:e===`connecting`?`bg-warn`:`bg-danger`,i=e===`open`?`live · ${t?ee(t,n):`connected`}`:e===`connecting`?`connecting…`:`disconnected — reconnecting`;return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:e===`open`?`Connected to the daemon. The time is when it last sent anything — on an idle machine that keeps counting up, which is normal.`:`WebSocket /v1/live`,children:[(0,I.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${r}`}),(0,I.jsx)(`span`,{className:`num`,children:i})]})}function mt(){let e=F(()=>N.status(),[],{live:!1,intervalMs:6e4}),t=F(()=>N.update().catch(()=>void 0),[],{live:!1,intervalMs:6e4}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=e.data?.version;if(!o)return null;let s=/^v?\d+\.\d+\.\d+$/.test(o),c=s&&t.data?.update_available?t.data.latest:void 0;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:c?`mono text-[11px] text-accent hover:text-accent-strong`:`mono text-[11px] text-fg-faint hover:text-fg`,title:c?`${c} is available — you are on ${o}`:`version and updates`,children:c?`${o} → ${c}`:s?o:`dev build`}),t.data?.notes&&(0,I.jsx)(`button`,{onClick:()=>a(!0),className:`text-[11px] text-fg-faint hover:text-accent`,title:`what changed in ${t.data.notes_for??`the latest release`}`,children:`what's new`}),n&&(0,I.jsx)(gt,{onClose:()=>r(!1)}),i&&t.data&&(0,I.jsx)(ht,{u:t.data,onClose:()=>a(!1)})]})}function ht({u:e,onClose:t}){return(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:t,children:(0,I.jsxs)(`div`,{className:`w-full max-w-[620px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`What's new`,children:[(0,I.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-[15px] font-medium`,children:`What's new`}),e.notes_for&&(0,I.jsx)(`span`,{className:`mono text-[12px] text-accent`,children:e.notes_for}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,I.jsx)(`div`,{className:`overflow-y-auto px-4 py-3`,children:(0,I.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[13px] leading-relaxed text-fg-muted`,children:e.notes})}),(0,I.jsx)(`div`,{className:`border-t border-border px-4 py-2.5`,children:(0,I.jsx)(`a`,{href:e.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`the full release on GitHub →`})})]})})}function gt({onClose:e}){let t=F(()=>N.status(),[],{live:!1,intervalMs:0}),n=F(()=>N.update().catch(()=>void 0),[],{live:!1,intervalMs:0}),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(void 0),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(()=>ve()??me(navigator.userAgent,navigator.userAgentData?.platform)),[f,p]=(0,l.useState)(!1),m=a??n.data,h=t.data?.version??``,g=/^v?\d+\.\d+\.\d+$/.test(h),_=!f&&ge(m?.command,u)?he(m?.command)??(u===`windows`?`macos`:u):u,v=pe(_),y=be(m?.command,v),[b,x]=(0,l.useState)(void 0),S=v.find(e=>e.label===b)??y??v[0],C=e=>{d(e),p(!0),ye(e),x(void 0)},w=async()=>{i(!0);try{o(await N.checkUpdate())}catch{}finally{i(!1)}},ee=e=>{navigator.clipboard.writeText(e),c(e),setTimeout(()=>c(``),1600)};return(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:e,children:(0,I.jsxs)(`div`,{className:`w-full max-w-[560px] max-h-[80vh] overflow-y-auto border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Version and updates`,children:[(0,I.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Version`}),(0,I.jsx)(`button`,{onClick:e,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,I.jsxs)(`div`,{className:`p-4 grid gap-3.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[13px]`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`running`}),(0,I.jsx)(`span`,{className:`mono text-fg`,children:g?h:`${h} (local build)`}),m?.update_available&&(0,I.jsxs)(`span`,{className:`mono text-accent`,children:[`→ `,m.latest,` is out`]})]}),m?.enabled===!1?(0,I.jsxs)(`div`,{className:`text-[13px] text-fg-muted`,children:[`Release checks are off, so this copy never asks GitHub what the latest version is. Turn them on in`,` `,(0,I.jsx)(`a`,{href:`#/status`,onClick:e,className:`text-accent no-underline hover:text-accent-strong`,children:`status`}),`.`]}):m?.update_available?null:(0,I.jsx)(`div`,{className:`text-[13px] text-fg-muted`,children:m?.latest?`Up to date — ${m.latest} is the latest release.`:`No newer release found.`}),(0,I.jsxs)(`div`,{className:`grid gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[se.map(e=>(0,I.jsx)(`button`,{onClick:()=>C(e.id),className:`rounded-sm px-2.5 py-1 text-[12px] transition-colors ${_===e.id?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.id)),v.length>1&&(0,I.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:v.map(e=>(0,I.jsxs)(`button`,{onClick:()=>x(e.label),className:`rounded-sm px-2 py-1 text-[11px] transition-colors ${S.label===e.label?`text-accent`:`text-fg-faint hover:text-fg-muted`}`,title:e.label===y?.label?`how this copy appears to be installed`:void 0,children:[e.label,e.label===y?.label?` ·`:``]},e.label))})]}),(0,I.jsx)(`ol`,{className:`grid gap-2.5`,children:S.steps.map((e,t)=>(0,I.jsxs)(`li`,{className:`grid gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:t+1}),e.cmd?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`code`,{className:`mono flex-1 truncate rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-fg`,children:e.cmd}),(0,I.jsx)(`button`,{onClick:()=>ee(e.cmd),className:`shrink-0 rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1.5 text-[12px] text-accent hover:bg-accent/[0.16]`,children:s===e.cmd?`copied`:`copy`})]}):(0,I.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1 rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-accent no-underline hover:text-accent-strong`,children:`Open the release page →`})]}),(0,I.jsx)(`p`,{className:`pl-5 text-[11px] leading-relaxed text-fg-faint`,children:e.note})]},t))})]}),(0,I.jsx)(`div`,{className:`text-[11px] leading-relaxed text-fg-faint border-t border-border pt-3`,children:`Caprock does not update itself: it would have to overwrite its own binary while running, and where a package manager owns that binary, replacing it behind their back breaks the next upgrade.`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`button`,{onClick:w,disabled:r,className:`rounded-md border border-border px-3 py-1.5 text-[13px] text-fg-muted hover:text-fg disabled:opacity-50`,children:r?`checking…`:`check now`}),(0,I.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`release notes →`})]})]})]})})}var _t=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[caprock ui]`,e,t.componentStack)}render(){return this.state.error?(0,I.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 rounded-[var(--radius-panel)] px-3 py-2 text-[12px]`,children:[(0,I.jsxs)(`div`,{className:`text-danger font-medium`,children:[this.props.label??`This view`,` failed to render`]}),(0,I.jsx)(`div`,{className:`mono text-fg-muted mt-1`,children:this.state.error.message}),(0,I.jsx)(`button`,{className:`mt-2 border border-border px-2 py-0.5 rounded-sm text-fg-muted hover:text-fg`,onClick:()=>this.setState({error:null}),children:`retry`})]}):this.props.children}};function L({title:e,center:t,right:n,children:r,className:i=``,onMouseEnter:a,onMouseLeave:o}){return(0,I.jsxs)(`section`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] shadow-[var(--shadow-panel)] min-w-0 ${i}`,onMouseEnter:a,onMouseLeave:o,children:[(e||t||n)&&(0,I.jsxs)(`header`,{className:`relative flex items-center justify-between px-3 py-2 border-b border-border bg-panel-2/60 rounded-t-[var(--radius-panel)]`,children:[(0,I.jsx)(`h2`,{className:`text-[11px] uppercase tracking-[0.12em] text-fg-muted font-medium`,children:e}),t?(0,I.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2`,children:t}):null,(0,I.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:n})]}),(0,I.jsx)(`div`,{children:r})]})}function R({label:e,value:t,sub:n,tone:r,size:i=`default`}){return(0,I.jsxs)(`div`,{className:`flex h-full flex-col px-3 py-2.5 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,I.jsx)(`div`,{className:`num font-semibold tracking-[-0.01em] ${i===`hero`?`text-[34px] leading-[1.05]`:i===`compact`?`text-[17px] leading-tight`:`text-[24px] leading-[1.1]`} ${r===`ok`?`text-ok`:r===`warn`?`text-warn`:r===`danger`?`text-danger`:r===`info`?`text-info`:`text-fg`}`,children:t}),n&&(0,I.jsx)(`div`,{className:`mt-auto pt-1 text-[11px] text-fg-muted num truncate`,children:n})]})}var vt={working:`working`,idle:`idle`,"waiting-on-you":`waiting on you`,looping:`looping?`,error:`error`,ended:`ended`};function yt(e){switch(e){case`working`:return`ok`;case`idle`:return`warn`;case`waiting-on-you`:return`warn`;case`looping`:return`danger`;case`error`:return`danger`;case`ended`:return`muted`}}function bt({health:e}){let t=yt(e);return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 border rounded-sm px-1.5 py-[1px] text-[11px] leading-4 ${t===`ok`?`text-ok border-ok/40 bg-ok/10`:t===`warn`?`text-warn border-warn/40 bg-warn/10`:t===`danger`?`text-danger border-danger/40 bg-danger/10`:`text-fg-muted border-border bg-panel-2`}`,children:[(0,I.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${t===`ok`?`bg-ok`:t===`warn`?`bg-warn`:t===`danger`?`bg-danger`:`bg-fg-faint`} ${e===`working`?`animate-pulse`:``}`}),vt[e]]})}function xt({values:e,width:t=120,height:n=24,tone:r=`info`}){if(e.length<2)return(0,I.jsx)(`svg`,{width:t,height:n,"aria-hidden":!0});let i=Math.max(...e,1e-9),a=Math.min(...e,0),o=i-a||1,s=t/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(n-(e-a)/o*(n-2)-1).toFixed(1)}`).join(` `),l=r===`ok`?`var(--color-ok)`:r===`warn`?`var(--color-warn)`:r===`danger`?`var(--color-danger)`:r===`accent`?`var(--color-accent)`:`var(--color-info)`;return(0,I.jsx)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:`block`,"aria-hidden":!0,children:(0,I.jsx)(`polyline`,{fill:`none`,stroke:l,strokeWidth:`1.25`,points:c,vectorEffect:`non-scaling-stroke`})})}function z({title:e,children:t}){return(0,I.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,I.jsx)(`div`,{className:`text-fg-muted`,children:e}),t&&(0,I.jsx)(`div`,{className:`text-[12px] text-fg-faint mt-1`,children:t})]})}function St({rows:e=3,className:t=``}){return(0,I.jsx)(`div`,{className:`px-3 py-2 grid gap-2 ${t}`,"aria-hidden":!0,children:Array.from({length:e},(e,t)=>(0,I.jsx)(`div`,{className:`h-3 rounded-sm bg-panel-2 skeleton-pulse`,style:{width:`${[92,74,83,61,88][t%5]}%`}},t))})}function Ct({command:e,className:t=``}){let[n,r]=(0,l.useState)(!1);return(0,I.jsx)(`button`,{className:`mono text-[12px] bg-panel-2 border border-border px-2 py-0.5 rounded-sm hover:border-border-strong text-fg text-left ${t}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)})},title:`copy to clipboard — run it in your terminal`,children:n?`copied`:`$ ${e}`})}var wt={edit:{label:`writing code`,title:`Turns that wrote to a file — Edit, Write, NotebookEdit.`},command:{label:`running commands`,title:`Turns that ran a shell command — builds, tests, git, anything through Bash. The command itself is free; what costs is the turn that issued it and read its output.`},read:{label:`reading and searching`,title:`Turns that read or searched the codebase — Read, Grep, Glob. The file contents enter the prompt and are billed, which is why reading is not free.`},web:{label:`web research`,title:`Turns that fetched or searched the web — WebFetch, WebSearch.`},mcp:{label:`MCP tools`,title:`Turns that called one of your own MCP integrations.`},other:{label:`other tools`,title:`Turns that called a tool in none of the categories above — subagents, task and skill control, and any tool Caprock does not yet know by name.`},none:{label:`no tool call`,title:`Turns that called no tool at all. They may have been reasoning, planning, answering a question or writing prose — Caprock records which tools ran, not what a turn was thinking, so it does not claim to know which.`}},Tt=`Each turn counts toward one kind of work, decided by the tools it called: writing a file wins over running a command, which wins over reading or searching, then web, then an MCP tool, then anything else. A turn that called no tool is counted as exactly that. Each turn goes whole to one row, never split, so the rows add up to the total exactly.`;function Et({summary:e}){let t=e,n=t?.work??[],r=t?.work_unlinked_calls??0,i=t?.tool_calls??0,a=r>0&&i>0&&r/i>.01;return(0,I.jsxs)(L,{title:`What it went on`,right:(0,I.jsx)(`span`,{title:Tt,children:`by cost`}),children:[t?n.length===0&&(0,I.jsx)(z,{title:`No priced turns in range`}):(0,I.jsx)(St,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:n.map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,I.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:w(e.cost_pct)})]},e.kind))})}),a&&(0,I.jsxs)(`div`,{className:`mx-3 mb-2.5 text-[11px] text-warn`,children:[r.toLocaleString(),` tool calls in this range could not be matched to the turn that paid for them, so their cost is counted under “no tool call” rather than the work they actually did. Every other row is understated by up to that much.`]})]})}function Dt({summary:e}){let t=e?.work??[],n=e?.work_unlinked_calls??0,r=e?.tool_calls??0;if(t.length===0||r===0||n/r>.2)return null;let i=t.filter(e=>e.cost_pct>=1).slice(0,5);return i.length===0?null:(0,I.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`what it went on`}),(0,I.jsx)(`a`,{href:`#/cost`,className:`text-[10px] text-fg-faint hover:text-accent no-underline`,children:`details →`})]}),(0,I.jsx)(`div`,{className:`mt-2 flex h-1.5 w-full overflow-hidden rounded-full bg-panel-2`,title:Tt,children:i.map((e,t)=>(0,I.jsx)(`span`,{className:`h-full`,style:{width:`${e.cost_pct}%`,background:`var(--color-accent)`,opacity:1-t*.17}},e.kind))}),(0,I.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1`,children:i.map((e,t)=>(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-[2px] translate-y-[1px]`,style:{background:`var(--color-accent)`,opacity:1-t*.17}}),(0,I.jsx)(`span`,{className:`text-fg-muted`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,I.jsx)(`span`,{className:`num text-fg-faint`,children:w(e.cost_pct)})]},e.kind))})]})}var Ot=.62;function kt(e,t){return e?t===`tokens`?e.tokens??[]:e.cost??[]:[]}function At(e,t,n){let r=kt(e,t);if(!e||r.length===0)return[];let i=n>0?n:0;return r.map((t,n)=>{let r=Number.isFinite(t)&&t>0?t:0,a=i>0&&r>0?Math.min(1,r/i)**+Ot:0;return{value:r,at:e.from_ms+n*e.width_ms,height:a,empty:r<=0}})}function jt(e,t){let n=0;for(let r of e)for(let e of kt(r,t))Number.isFinite(e)&&e>n&&(n=e);return n}function Mt(e,t){let n=new Date(e);return t<864e5?n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function Nt(e){return e.split(`/`).filter(Boolean)}function Pt(e,t=3){let n=[],r=new Map,i=[],a=(e,t)=>{let n=r.get(e);if(n)return n;let o=Nt(e),s={path:e,name:o.length===0?`/`:o[o.length-1],depth:t,tokens:0,cost:0,turns:0,tokensPct:0,costPct:0,ownTokens:0,ownCost:0,ownTurns:0,ownTokensPct:0,ownCostPct:0,children:[],rolledUp:0};if(r.set(e,s),t===0)i.push(s);else{let e=t===1?`/`:`/`+o.slice(0,t-1).join(`/`);a(e,t-1).children.push(s)}return s};for(let r of e){if(r.unattributed||r.outside){n.push(r);continue}let e=Nt(r.path),i=e.length,o=Math.min(i,t),s=a(o===0?`/`:`/`+e.slice(0,o).join(`/`),o);s.ownTokens+=r.tokens,s.ownCost+=r.cost_usd,s.ownTurns+=r.turns,s.ownTokensPct+=r.tokens_pct,s.ownCostPct+=r.cost_pct,i>o&&s.rolledUp++;for(let t=0;t<=o;t++){let n=a(t===0?`/`:`/`+e.slice(0,t).join(`/`),t);n.tokens+=r.tokens,n.cost+=r.cost_usd,n.tokensPct+=r.tokens_pct,n.costPct+=r.cost_pct,n.turns+=r.turns}}let o=i[0],s=i;o&&o.path===`/`&&(s=[...o.children],(o.ownTokens>0||o.ownCost>0||o.ownTurns>0||o.rolledUp>0)&&s.push({...o,depth:1,tokens:o.ownTokens,cost:o.ownCost,turns:o.ownTurns,tokensPct:o.ownTokensPct,costPct:o.ownCostPct,children:[],ownTokens:o.ownTokens,ownCost:o.ownCost,ownTurns:o.ownTurns}));let c=e=>{e.sort((e,t)=>t.cost-e.cost);for(let t of e)c(t.children)};return c(s),{roots:s,buckets:n}}function Ft(e){return e.map(e=>{let t=e;for(;t.children.length===1&&t.ownTokens===0&&t.ownCost===0&&t.ownTurns===0&&t.rolledUp===0;)t=t.children[0];return{...t,children:Ft(t.children)}})}var It=[{key:`all`,label:`all`},{key:`claude`,label:`claude`},{key:`opencode`,label:`opencode`}],Lt=[{key:`today`,label:`today`},{key:`7d`,label:`7d`},{key:`30d`,label:`30d`},{key:`all`,label:`all`}],Rt=`tokens`,zt=`A turn counts toward the directory of the most recent file it touched, and keeps counting there until it touches a file somewhere else — so the commands, tests and searches between two edits count toward the directory being worked on. Reading, editing or writing a file counts as touching it; running a command does not. Each turn goes whole to one row, never split between two, so the rows add up to the repository total exactly.`,Bt=`repository-wide work`,Vt=`Turns from the start of a session, before Claude had touched any file — so there is no directory yet for them to count toward. Their cost is counted here whole rather than guessed onto the directory the session reached later.`,Ht=`outside the repository`,Ut=`Turns whose most recent file touch was outside this repository — Claude’s notes on the project, agent scratchpads, test-output directories, or another checkout. This is real work and it counts toward the repository total, but it happened outside the tree, so it is not charged to any directory inside it.`;function Wt({sessions:e,agent:t}){let[n,r]=(0,l.useState)(`7d`),[i,a]=(0,l.useState)(!1),o=F(()=>N.summary(n),[n],{intervalMs:3e4}),s=o.data?.projects??[],c=(0,l.useMemo)(()=>t===`all`?s:s.filter(e=>!e.agent||e.agent===t),[s,t]),[u,d]=(0,l.useState)(null),f=(0,l.useMemo)(()=>{if(!u)return c;let e=new Map(u.map((e,t)=>[e,t]));return[...c].sort((t,n)=>(e.get(t.project)??1/0)-(e.get(n.project)??1/0))},[c,u]),p=i?f:f.slice(0,6),m=c.reduce((e,t)=>e+t.cost_usd,0),h=c.reduce((e,t)=>e+t.tokens,0),g=(0,l.useMemo)(()=>jt(p.map(e=>e.spark),Rt),[p]),_=(0,l.useMemo)(()=>p.reduce((e,t)=>Math.max(e,t.tokens),0),[p]);return(0,I.jsx)(L,{onMouseEnter:()=>d(c.map(e=>e.project)),onMouseLeave:()=>d(null),title:`Projects`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`span`,{className:`num text-[13px]`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:C(h)}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,S(m),` total`]})]}),(0,I.jsx)(`span`,{className:`inline-flex border border-border rounded-sm overflow-hidden`,children:Lt.map(e=>(0,I.jsx)(`button`,{onClick:()=>r(e.key),className:`px-1.5 py-0.5 text-[11px] mono ${n===e.key?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg-muted`}`,children:e.label},e.key))})]}),children:o.data?c.length===0?(0,I.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:`No spend captured in this range yet.`}):(0,I.jsxs)(`div`,{className:`grid`,children:[p.map(t=>(0,I.jsx)(Kt,{p:t,max:_,ceiling:g,live:Gt(e).has(t.project)},t.project||`(unknown)`)),c.length>6&&(0,I.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[11px] text-fg-faint hover:text-fg-muted px-3 py-1.5 text-left border-t border-border`,children:i?`show less`:`show all ${c.length} projects`}),(0,I.jsx)(Dt,{summary:o.data}),(0,I.jsx)(Zt,{count:c.length})]}):(0,I.jsx)(St,{rows:5})})}function Gt(e){return new Set(e.filter(e=>e.status!==`ended`).map(e=>e.project).filter(Boolean))}function Kt({p:e,max:t,ceiling:n,live:r}){let i=e.paths??[],a=i.length>1,[o,s]=(0,l.useState)(!1),c=e.project||`unknown project`,u=t>0?100*e.tokens/t:0,d=(0,l.useMemo)(()=>At(e.spark,Rt,n),[e.spark,n]),f=(0,l.useMemo)(()=>{let e=Pt(i);return{roots:Ft(e.roots),buckets:e.buckets}},[i]),p=(0,l.useMemo)(()=>Math.max(0,...f.roots.map(e=>e.tokens),...f.buckets.map(e=>e.tokens)),[f]),m=(0,I.jsxs)(`div`,{className:`grid grid-cols-[1fr_128px_auto] items-center gap-3 w-full text-left`,children:[(0,I.jsx)(`div`,{className:`min-w-0`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,I.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-ok shrink-0`,title:`a session is live in this project`}),(0,I.jsx)(`span`,{className:`truncate text-[14px]`,children:c}),e.agent===`opencode`&&(0,I.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint num shrink-0`,children:[e.sessions,` `,e.sessions===1?`session`:`sessions`]}),a&&(0,I.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${o?`rotate-90`:``}`,children:`▶`})]})}),d.length>0?(0,I.jsx)(Xt,{bars:d,widthMs:e.spark?.width_ms??0,label:c}):(0,I.jsx)(`div`,{className:`h-1 bg-panel-2 rounded-sm overflow-hidden`,title:`${c}: share of the largest project`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${u}%`}})}),(0,I.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,I.jsx)(`div`,{className:`num text-[17px] font-semibold leading-tight text-accent`,children:C(e.tokens)}),(0,I.jsx)(`div`,{className:`num text-[13px] leading-tight text-fg-muted`,children:S(e.cost_usd)})]})]});return(0,I.jsxs)(`div`,{className:`border-t border-border first:border-t-0`,children:[a?(0,I.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`w-full px-3 py-1.5 hover:bg-panel-2/50`,title:`${c}: show cost by directory`,children:m}):(0,I.jsx)(`div`,{className:`px-3 py-1.5`,children:m}),a&&o&&(0,I.jsxs)(`div`,{className:`pb-1.5 bg-panel-2/30`,children:[(0,I.jsx)(`div`,{className:`pl-7 pr-3 pt-1 pb-0.5 text-[10px] text-fg-faint`,title:zt,children:`by files touched · share of this repository's tokens`}),f.roots.map(e=>(0,I.jsx)(qt,{n:e,max:p},e.path)),f.buckets.length>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`pl-7 pr-3 pt-2 pb-0.5 text-[10px] uppercase tracking-[0.08em] text-fg-faint`,children:`not a directory`}),f.buckets.map(e=>(0,I.jsx)(Jt,{q:e,max:p},e.path))]})]})]})}function qt({n:e,max:t}){let[n,r]=(0,l.useState)(!1),i=t>0?100*e.tokens/t:0,a=e.children.length>0,o=(0,l.useMemo)(()=>Math.max(0,...e.children.map(e=>e.tokens)),[e.children]),s=a&&e.ownCost>0,c=e.children.length,u=(0,I.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 w-full text-left`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted mono`,children:e.path}),e.rolledUp>0&&(0,I.jsxs)(`span`,{className:`text-[10px] text-fg-faint shrink-0`,title:`${e.rolledUp} ${e.rolledUp===1?`directory`:`directories`} below this one ${e.rolledUp===1?`is`:`are`} counted here rather than shown: the breakdown stops at 3 levels.`,children:[`+`,e.rolledUp,` deeper`]}),(0,I.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]}),a&&(0,I.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${n?`rotate-90`:``}`,children:`▶`})]}),s&&(0,I.jsxs)(`div`,{className:`text-[10px] text-fg-faint mt-0.5`,children:[S(e.ownCost),` here · `,S(e.cost-e.ownCost),` in `,c,` `,c===1?`subdirectory`:`subdirectories`]}),(0,I.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent/40`,style:{width:`${i}%`}})})]}),(0,I.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.costPct)} of this repository's cost`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokensPct)]}),(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost)]})]})]}),d={paddingLeft:`${28+(e.depth-1)*14}px`};return(0,I.jsxs)(`div`,{children:[a?(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`w-full pr-3 py-1 hover:bg-panel-2/50`,style:d,title:`${e.path}: show the directories inside it`,children:u}):(0,I.jsx)(`div`,{className:`pr-3 py-1`,style:d,children:u}),a&&n&&e.children.map(e=>(0,I.jsx)(qt,{n:e,max:o},e.path))]})}function Jt({q:e,max:t}){let n=t>0?100*e.tokens/t:0,r=e.unattributed===!0;return(0,I.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 pl-7 pr-3 py-1`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted`,title:r?Vt:Ut,children:r?Bt:Ht}),(0,I.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]})]}),(0,I.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-fg-faint/30`,style:{width:`${n}%`}})})]}),(0,I.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.cost_pct)} of this repository's cost`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokens_pct)]}),(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost_usd)]})]})]})}function Yt(e){return!Number.isFinite(e)||e<=0?`0%`:e<.1?`<0.1%`:w(e)}function Xt({bars:e,widthMs:t,label:n}){let r=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=o.getPropertyValue(`--color-accent`).trim()||`#feb157`,c=o.getPropertyValue(`--color-fg-faint`).trim()||`#837f78`,l=n/e.length;for(let t=0;ti.disconnect()},[e]);let i=e.filter(e=>!e.empty),a=i[0],o=i[i.length-1],s=!a||!o?`no spend in this range`:a===o?`all of it on ${Mt(a.at,t)}`:`${Mt(a.at,t)} → ${Mt(o.at,t)}`;return(0,I.jsx)(`canvas`,{ref:r,className:`w-full h-[14px] block`,role:`img`,"aria-label":`${n}: ${Rt} over time, ${s}`,title:`${n}: when the spend happened — ${s}`})}function Zt({count:e}){return e<10?null:(0,I.jsxs)(`a`,{href:`https://caprock.dev/teams`,target:`_blank`,rel:`noreferrer`,className:`flex items-baseline gap-2 border-t border-border px-3 py-1.5 text-[11px] no-underline hover:no-underline`,children:[(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[e,` repositories on one machine.`]}),(0,I.jsx)(`span`,{className:`text-fg-faint hover:text-accent`,children:`See them across the team →`})]})}function Qt(e){return typeof e==`string`?e:``}function $t(e){let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}function en(e,t){let n=e.replace(/\s+/g,` `).trim(),r=[...n];return r.length>t?r.slice(0,t-1).join(``)+`…`:n}function tn(e){return e.replace(/(\/[\w.@%+-]+){3,}/g,e=>`…/`+e.split(`/`).filter(Boolean).slice(-2).join(`/`))}function nn(e,t){switch(e){case`Edit`:case`NotebookEdit`:return Qt(t.file_path)?{icon:`✎`,text:`editing`,detail:$t(Qt(t.file_path))}:null;case`Write`:return Qt(t.file_path)?{icon:`✎`,text:`writing`,detail:$t(Qt(t.file_path))}:null;case`Read`:return Qt(t.file_path)?{icon:`◇`,text:`reading`,detail:$t(Qt(t.file_path))}:null;case`Bash`:return Qt(t.command)?{icon:`$`,text:`running`,detail:en(tn(Qt(t.command)),46)}:null;case`Grep`:case`Glob`:return{icon:`⌕`,text:`searching`,detail:en(Qt(t.pattern)||Qt(t.query),40)||void 0};case`WebFetch`:case`WebSearch`:return{icon:`⇢`,text:`fetching`,detail:en(Qt(t.url)||Qt(t.query),44)||void 0};case`Agent`:return{icon:`⚑`,text:`spawned a subagent`,detail:Qt(t.subagent_type)||void 0};case`Skill`:return{icon:`⚑`,text:`invoked skill`,detail:Qt(t.skill)||void 0};case`TodoWrite`:return{icon:`☑`,text:`updated its plan`};default:return e?{icon:`·`,text:`used`,detail:e}:null}}function rn(e,t){let n=e.payload??{},r=Date.parse(e.ts),i={id:`${e.id}`,ts:Number.isNaN(r)?Date.now():r,sessionId:e.session_id,project:t};switch(e.kind){case`tool.pre`:{let t=nn(Qt(n.tool_name)||Qt(e.tool),n.tool_input??{});return t?{...i,...t,tone:`normal`}:null}case`tool.post`:return n.is_error?{...i,icon:`✕`,text:`a tool call failed`,tone:`danger`}:null;case`agent.spawn`:return{...i,icon:`▸`,text:`session started`,tone:`ok`};case`agent.stop`:return{...i,icon:`■`,text:`session ended`,tone:`normal`};case`context.compact`:return{...i,icon:`⇱`,text:`compacted its context`,tone:`warn`};case`throttle`:return{...i,icon:`⏳`,text:`rate-limited by the API`,tone:`warn`};case`task.created`:return{...i,icon:`+`,text:`task created`,tone:`normal`};case`task.done`:return{...i,icon:`✓`,text:`task verified — tests passed`,tone:`ok`};case`approval.requested`:return{...i,icon:`!`,text:`needs your approval`,tone:`warn`};default:return null}}function an(e,t,n=60){return e.some(e=>e.id===t.id)?e:[t,...e].slice(0,n)}function on({sessions:e,now:t,emptyHint:n}){let[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(!1),s=(0,l.useRef)(new Map),c=(0,l.useRef)(a);c.current=a;for(let t of e)t.project&&s.current.set(t.session_id,t.project);(0,l.useEffect)(()=>{let t=!1;return(async()=>{let n=[...e].sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,4),r=await Promise.all(n.map(e=>N.events(e.session_id,0,60).catch(()=>[])));if(t)return;let a=r.flat().map(e=>rn(e)).filter(e=>e!==null).sort((e,t)=>t.ts-e.ts).slice(0,40);i(e=>{let t=new Set(n.map(e=>e.session_id)),r=e.filter(e=>!e.sessionId||t.has(e.sessionId)),i=new Set(r.map(e=>e.id));return[...r,...a.filter(e=>!i.has(e.id))].sort((e,t)=>t.ts-e.ts).slice(0,60)})})(),()=>{t=!0}},[e.map(e=>e.session_id).join(`,`)]);let u=(0,l.useRef)(new Set);return u.current=new Set(e.map(e=>e.session_id)),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`||c.current)return;let t=e.data?.session_id;if(t&&s.current.has(t)&&!u.current.has(t))return;let n=rn(e.data);n&&i(e=>an(e,n))}),[]),(0,I.jsx)(L,{title:`Live activity`,right:(0,I.jsx)(`button`,{onClick:()=>o(e=>!e),className:`text-[11px] mono text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,children:a?`resume`:`pause`}),children:r.length===0?(0,I.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:n??(0,I.jsxs)(I.Fragment,{children:[`Nothing yet — start `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal.`]})}):(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(`div`,{className:`max-h-[420px] overflow-y-auto`,children:r.map(e=>(0,I.jsx)(cn,{it:e,now:t,project:s.current.get(e.sessionId)},e.id))}),(0,I.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-panel to-transparent`})]})})}function sn(e){switch(e){case`ok`:return`text-ok`;case`warn`:return`text-warn`;case`danger`:return`text-danger`;default:return`text-fg-faint`}}function cn({it:e,now:t,project:n}){return(0,I.jsxs)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`grid grid-cols-[auto_auto_1fr_auto] items-baseline gap-2 px-3 py-1 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px] w-3 text-center ${sn(e.tone)}`,children:e.icon}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate max-w-[12ch]`,children:n??e.project??T(e.sessionId)}),(0,I.jsxs)(`span`,{className:`text-[12px] truncate`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:e.text}),e.detail&&(0,I.jsx)(`span`,{className:`mono text-fg ml-1.5`,children:e.detail})]}),(0,I.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:ee(e.ts,t)})]})}function ln(e){return e?.plan_kind===`metered`?`at API list price · ≈ your bill`:e?.plan_kind===`flat`?`at API list price · not a bill`:`at API list price`}function un(e){return e?.plan_kind===`metered`?`Priced from your captured tokens at Anthropic list prices. You are billed per token, so this is approximately your actual cost.`:e?.plan_kind===`flat`?`Priced from your captured tokens at Anthropic list prices. You pay ${e.plan_label||`a flat plan`}, so this is what the same work would have cost through the API — not money out of pocket.`:`Priced from your captured tokens at Anthropic list prices. Whether that is your actual bill depends on how you pay — set your plan in the header.`}function dn({plan:e}){let t=F(()=>N.history(`all`),[],{intervalMs:6e4}).data?.totals;if(!t||t.sessions===0)return null;let n=t.days>0?t.sessions/t.days:0;return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 rounded-[var(--radius-panel)] border border-border bg-panel px-3 py-2.5`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`all time`}),(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num font-semibold tracking-[-0.01em] text-[22px] leading-none text-info`,children:S(t.cost_usd)}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,title:un(e),children:ln(e)})]}),(0,I.jsx)(fn,{value:t.sessions.toLocaleString(`en-US`),label:`sessions`}),(0,I.jsx)(fn,{value:t.days.toLocaleString(`en-US`),label:`active days`}),(0,I.jsx)(fn,{value:t.turns.toLocaleString(`en-US`),label:`turns`}),n>=1&&(0,I.jsx)(fn,{value:n.toFixed(1),label:`sessions a day`}),(0,I.jsx)(`span`,{className:`ml-auto inline-flex items-baseline gap-4`,children:(0,I.jsx)(pn,{})})]})}function fn({value:e,label:t}){return(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:`num text-[13px] text-fg`,children:e}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:t})]})}function pn(){let e=F(()=>N.daily(30),[],{intervalMs:3e5}),t=F(()=>N.summary(`today`),[],{intervalMs:3e4}),n=e.data??[];if(n.length===0)return null;let r=new Map;for(let e of n)r.set(e.day,(r.get(e.day)??0)+e.cost_usd);let i=[...r.values()].filter(e=>e>0).sort((e,t)=>e-t);if(i.length<7)return null;let a=i[Math.floor(i.length/2)]??0,o=t.data?.cost_usd??0;return a<=0||o=99?{label:`outstanding`,color:`text-ok`}:e>=95?{label:`good`,color:`text-ok`}:e>=85?{label:`ok`,color:``}:{label:`low`,color:`text-warn`}}function hn({hitRate:e,cutPct:t,measured:n,size:r=`compact`,label:i=`Cache hit`}){let a=n&&e!==void 0?e*100:void 0,o=mn(a);return(0,I.jsx)(R,{label:i,value:(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{children:a===void 0?`—`:w(a)}),o&&(0,I.jsx)(`span`,{className:`text-[11px] font-normal ${o.color||`text-fg-faint`}`,children:o.label})]}),sub:n&&t!==void 0?`${w(t)} input cost cut`:void 0,size:r})}function gn(e,t){let n=Math.round(e.used_percentage),r=(e.resets_at??0)*1e3,i=r>t&&r85?`text-danger`:n>=60?`text-warn`:`text-fg`,resetsAt:i?new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,stale:e.resets_at?!i:!1}}function _n({label:e,w:t,now:n}){let{pct:r,color:i,resetsAt:a,stale:o}=gn(t,n);return(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:e}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-3`,children:[(0,I.jsxs)(`span`,{className:`font-mono tabular-nums ${i}`,children:[r,`%`]}),a&&(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[`resets `,a]}),o&&(0,I.jsx)(`span`,{className:`text-fg-faint`,title:`Claude Code has not refreshed this window recently`,children:`reset time stale`}),t.forecast&&(0,I.jsx)(`span`,{className:`text-warn`,children:t.forecast})]})]})}function vn({limits:e,now:t}){let n=[];if(e?.five_hour&&n.push([`5h`,e.five_hour]),e?.seven_day&&n.push([`7d`,e.seven_day]),n.length===0)return null;let r=n.map(([e,n])=>({label:e,...gn(n,t)})),i=r.filter(e=>!e.stale),a=i.length===0,o=(i.length?i:r).reduce((e,t)=>t.pct>e.pct?t:e),s=r.find(e=>e.label!==o.label);return(0,I.jsx)(R,{label:`Plan limits`,value:(0,I.jsxs)(`span`,{className:a?`text-fg-faint`:o.color,children:[o.pct,`%`]}),sub:a?(0,I.jsx)(`span`,{title:`Claude Code writes these to its status line; they stop updating when no session is running`,children:`last reported a while ago`}):(0,I.jsxs)(`span`,{children:[o.label,` window`,o.resetsAt?` · resets ${o.resetsAt}`:``,s?` · ${s.label} ${s.pct}%`:``]}),tone:a?void 0:o.pct>85?`danger`:o.pct>=60?`warn`:void 0,size:`compact`})}var yn=`caprock-prompts`,bn={"share-week":6048e5,"share-month":2592e6,"premium-hint":2592e6,"premium-banner":2592e6};function xn(){try{let e=localStorage.getItem(yn);return e?JSON.parse(e):{}}catch{return{}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}function Cn(e,t){let n=xn()[e];return!n||t-n>=bn[e]}function wn(e,t){let n={...xn(),[e]:t};e===`share-month`&&(n[`share-week`]=t),Sn(n)}var Tn=`premium-banner`;function En({costUSD:e,days:t,now:n}){let[r]=(0,l.useState)(()=>Cn(Tn,n)),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1);if(!r||i||e<=0||t<=0)return null;let c=e/t;return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[var(--radius-panel)] border border-border bg-panel-2 px-3 py-2 text-[12px]`,children:[(0,I.jsxs)(`span`,{className:`text-fg`,children:[(0,I.jsx)(`span`,{className:`num`,children:S(c)}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[` a day, on average, across `,t,` active `,t===1?`day`:`days`,`.`]})]}),(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Premium pauses sessions when the day crosses a limit you set.`}),(0,I.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>s(!0),className:`rounded-sm border border-accent/50 bg-accent/10 px-2 py-0.5 text-accent hover:bg-accent/20`,children:`what it does`}),(0,I.jsx)(`button`,{onClick:()=>{wn(Tn,n),a(!0)},className:`rounded-sm border border-border px-1.5 py-0.5 text-[11px] text-fg-faint hover:text-fg-muted`,title:`hide this for a month`,children:`not now`})]}),o&&(0,I.jsx)(nt,{feature:`cap`,onClose:()=>s(!1)})]})}var Dn=[1e3,5e3,1e4,25e3,5e4,1e5],On=e=>e>=1e3?`$${Math.round(e).toLocaleString(`en-US`)}`:`$${e.toFixed(2)}`;function kn(e){let t=Dn.filter(t=>e>=t).pop();return t===void 0||e-t>t*.1?null:{kind:`milestone`,line:`You just passed ${On(t)} of Claude Code.`}}function An(e,t){return e<7||e>10?null:{kind:`first-week`,line:`A week of Claude Code: ${On(t)} measured.`}}function jn(e){if(e.length<3)return null;let[t,...n]=e;if(t===void 0)return null;let r=Math.max(...n);return r<=0||tt[0].localeCompare(e[0])),r=[];for(let e=0;ee+t[1],0));return r}function Nn(e,t,n){return e.sessions===0||e.cost_usd<=0?null:kn(e.cost_usd)??An(e.days,n.cost_usd)??jn(Mn(t))}var Pn=`share-week`;function Fn({now:e}){let[t]=(0,l.useState)(()=>Cn(Pn,e)),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=F(()=>N.history(`all`),[],{intervalMs:3e5}),s=F(()=>N.summary(`7d`),[],{intervalMs:3e5});if(!t||n||!o.data||!s.data)return null;let c=Nn(o.data.totals,o.data.daily??[],s.data);if(!c)return null;let u=()=>{wn(Pn,e),r(!0)};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 rounded-lg border border-accent/35 bg-accent/[0.07] py-1.5 pl-3.5 pr-2 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[c.line,` Don’t be shy and share it off —`]}),(0,I.jsx)(`button`,{onClick:()=>{a(!0),u()},className:`rounded-[5px] bg-accent px-3 py-1 font-medium text-panel hover:bg-accent/90`,children:`Share`}),(0,I.jsx)(`button`,{onClick:u,title:`hide this for a week`,className:`px-1 text-fg-faint hover:text-fg-muted`,children:`✕`})]}),i&&(0,I.jsx)(Qe,{onClose:()=>a(!1)})]})}function In(){let e=F(()=>N.history(`all`),[],{intervalMs:6e4}),t=(e.data?.tools??[]).slice(0,6),n=(e.data?.summary?.models??[]).slice(0,5);if(t.length===0&&n.length===0)return null;let r=t[0]?.count??0,i=n[0]?.cost_usd??0,a=(e.data?.tools??[]).reduce((e,t)=>e+t.count,0),o=(e.data?.summary?.models??[]).reduce((e,t)=>e+t.cost_usd,0),s=e.data?.summary,c=s&&(s.tokens_in||s.tokens_out||s.cache_read||s.cache_write)?{in:s.tokens_in,out:s.tokens_out,cacheRead:s.cache_read,cacheWrite:s.cache_write}:null;return(0,I.jsxs)(L,{title:`All time`,right:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,I.jsx)(Fn,{now:Date.now()}),(0,I.jsx)($e,{}),(0,I.jsx)(`a`,{href:`#/history`,className:`text-fg-faint hover:text-accent no-underline`,children:`every tool, model and project →`})]}),children:[(0,I.jsxs)(`div`,{className:`grid gap-x-8 gap-y-5 px-3 py-3 md:grid-cols-2`,children:[(0,I.jsx)(Ln,{title:`Most-used tools`,note:`by calls`,rows:t.map(e=>({key:e.tool,label:ne(e.tool),value:e.count.toLocaleString(`en-US`),share:a>0?100*e.count/a:null,frac:r>0?e.count/r:0}))}),(0,I.jsx)(Ln,{title:`Where the money went`,note:`by cost`,rows:n.map(e=>({key:e.model,label:e.model||`unknown`,value:S(e.cost_usd),sub:C(e.tokens),share:o>0?100*e.cost_usd/o:null,frac:i>0?e.cost_usd/i:0}))})]}),c&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 border-t border-border px-3 py-2 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`Tokens`}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`input `,(0,I.jsx)(`span`,{className:`num text-fg`,children:C(c.in)})]}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`output `,(0,I.jsx)(`span`,{className:`num text-fg`,children:C(c.out)})]}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache read `,(0,I.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheRead)})]}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache write `,(0,I.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheWrite)})]}),(0,I.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:`fresh input is billed at full price`})]})]})}function Ln({title:e,note:t,rows:n}){return n.length===0?null:(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,I.jsx)(`span`,{className:`text-[10px] text-fg-faint`,children:t})]}),(0,I.jsx)(`div`,{className:`grid gap-1.5`,children:n.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`mono w-36 shrink-0 truncate text-fg-muted`,title:e.label,children:e.label}),(0,I.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full bg-panel-2`,children:(0,I.jsx)(`span`,{className:`block h-full rounded-full bg-accent/70`,style:{width:`${Math.max(2,Math.round(e.frac*100))}%`}})}),(0,I.jsx)(`span`,{className:`num w-20 shrink-0 text-right text-fg`,children:e.value}),(0,I.jsx)(`span`,{className:`num w-16 shrink-0 text-right text-fg-faint`,children:e.sub??``}),(0,I.jsx)(`span`,{className:`num w-9 shrink-0 text-right text-fg-faint`,children:e.share===null?``:e.share<1?`<1%`:`${Math.floor(e.share)}%`})]},e.key))})]})}function Rn(e){return e.bars.reduce((e,t)=>e+t.n,0)}function zn(e){return e.bars.reduce((e,t)=>e+t.cost,0)}var Bn=6,Vn=new Set([`description`,`timeout`,`run_in_background`]),Hn=new Set([`true`,`:`,`echo`,`pwd`,`clear`]);function Un(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return``}}function Wn(e){if(e.kind!==`tool.pre`)return null;let t=typeof e.tool==`string`?e.tool:``;if(!t)return null;let n=e.payload,r=n&&typeof n==`object`?n.tool_input:void 0,i=r&&typeof r==`object`?r:{},a=Un(i.command).trim();if(t===`Bash`&&Hn.has(a))return null;let o=[t],s=t;for(let e of Object.keys(i).sort()){if(Vn.has(e))continue;let n=Un(i[e]);(e===`content`||e===`new_string`||e===`old_string`)&&(n=n.slice(0,200)),o.push(`${e}=${n}`),s===t&&(e===`command`||e===`file_path`||e===`pattern`)&&(s=`${t} ${n.slice(0,48)}`)}return{sig:o.join(`|`),label:s}}function Gn(e){let t=Date.parse(e.ts);return Number.isFinite(t)?t:0}function Kn(e,t,n=60){let r=Array.from({length:n},()=>({n:0,turns:0,tools:0,cost:0})),i=t-n*6e4,a=[...e].sort((e,t)=>Gn(e)-Gn(t)),o=[],s=new Map,c=0,l=``;for(let e of a){let a=Gn(e);if(a<=0)continue;if(a>=i&&a<=t){let t=r[Math.min(n-1,Math.floor((a-i)/6e4))];if(t){t.n++,e.kind===`turn.assistant`?t.turns++:(e.kind===`tool.pre`||e.kind===`tool.post`)&&t.tools++;let n=typeof e.cost_usd==`number`&&Number.isFinite(e.cost_usd)?e.cost_usd:0;t.cost+=n}}let u=Wn(e);if(!u)continue;for(o.push({at:a,sig:u.sig,label:u.label});o.length>0;){let e=o[0];if(!e||a-e.at<=Bn*6e4)break;o.shift();let t=(s.get(e.sig)??1)-1;t<=0?s.delete(e.sig):s.set(e.sig,t)}let d=(s.get(u.sig)??0)+1;s.set(u.sig,d),d>c&&(c=d,l=u.label)}return{bars:r,repeats:c,repeatSample:l}}function qn(e,t){if(e.repeats>=8)return{kind:`repeat`,label:`×${e.repeats} same call`};switch(t){case`waiting-on-you`:return{kind:`waiting`,label:`waiting on you`};case`error`:return{kind:`error`,label:`error`};case`looping`:return{kind:`repeat`,label:`looping`};case`ended`:return{kind:`quiet`,label:`ended`};case`idle`:return{kind:`quiet`,label:`idle`};case`working`:return{kind:`working`,label:`working`}}return e.bars.filter(e=>e.n>0).length===0?{kind:`quiet`,label:`quiet`}:{kind:`working`,label:`working`}}function Jn(e,t){return t<=0?`mid`:e>=t*1.8?`high`:e<=t*.5?`low`:`mid`}function Yn(e){let t=e.filter(e=>e.cost>0).map(e=>e.cost).sort((e,t)=>e-t);return t.length===0?0:t[Math.floor(t.length/2)]??0}var Xn=6,Zn=2e3;function Qn({sessions:e,now:t}){let n=(0,l.useMemo)(()=>[...e].filter(e=>e.status!==`ended`).sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,Xn),[e]),r=n.map(e=>e.session_id).join(`,`),[i,a]=(0,l.useState)(new Map);(0,l.useEffect)(()=>{let e=!1;return(async()=>{let t=r?r.split(`,`):[],n=await Promise.all(t.map(e=>N.recentEvents(e,Zn).catch(()=>[])));e||a(new Map(t.map((e,t)=>[e,n[t]??[]])))})(),()=>{e=!0}},[r]),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`)return;let t=e.data;a(e=>{if(!e.has(t.session_id))return e;let n=new Map(e),r=n.get(t.session_id)??[];return n.set(t.session_id,[...r,t].slice(-4e3)),n})}),[]);let o=Math.floor(t/6e4),s=(0,l.useMemo)(()=>n.map(e=>({s:e,pulse:Kn(i.get(e.session_id)??[],o*6e4)})).filter(e=>Rn(e.pulse)>0),[n,i,o]);return n.length===0?null:(0,I.jsxs)(L,{title:`Live pulse`,right:(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`last `,60,` minutes · one bar per minute`]}),children:[(0,I.jsx)(`div`,{children:s.length===0?(0,I.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-fg-faint text-center`,children:[`Nothing ran in the last `,60,` minutes.`]}):s.map(({s:e,pulse:t})=>(0,I.jsx)(er,{s:e,pulse:t,minute:o,showId:s.length>1},e.session_id))}),(0,I.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-4 flex-wrap text-[11px] text-fg-faint border-t border-border`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,title:`They are independent: one call carrying a large context is a short bright bar, twenty greps are a tall dark one.`,children:`bar height = turns and tools · colour = what the minute cost`}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)($n,{tier:nr,className:`h-[2px]`}),`idle`]}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)($n,{tier:tr.low}),`below this session's median`]}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)($n,{tier:tr.mid}),`around it`]}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)($n,{tier:tr.high}),`well above it`]}),(0,I.jsxs)(`span`,{className:`ml-auto`,children:[(0,I.jsx)(`span`,{className:`text-warn`,children:`×N same call`}),` = most-repeated identical tool call in six minutes`]})]})]})}function $n({tier:e,className:t=``}){return(0,I.jsx)(`span`,{"data-token":e.token,className:`inline-block w-3 h-3 rounded-[2px] ${t}`,style:{background:`var(${e.token}, ${e.fallback})`,opacity:e.alpha}})}function er({s:e,pulse:t,minute:n,showId:r}){let i=qn(t,e.activity?.health),a=i.kind===`repeat`||i.kind===`waiting`?`text-warn`:i.kind===`error`?`text-danger`:i.kind===`quiet`?`text-fg-faint`:`text-ok`;return(0,I.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`grid grid-cols-[132px_1fr_92px_104px] items-center gap-3 px-3 py-2 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`text-[13px] font-medium flex items-baseline gap-1.5 min-w-0`,children:[(0,I.jsx)(`span`,{className:`shrink-0`,children:e.project||`unknown project`}),e.git_branch&&(0,I.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-fg-faint mono`,title:e.git_branch,children:e.git_branch}),e.agent===`opencode`&&(0,I.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`})]}),(0,I.jsxs)(`div`,{className:`text-[10px] text-fg-faint mono truncate`,children:[r&&(0,I.jsxs)(`span`,{title:`session ${e.session_id} · started ${ee(e.started_at)} ago`,children:[T(e.session_id),` · `]}),e.activity?.phrase??``]})]}),(0,I.jsx)(ir,{pulse:t,now:n*6e4,sessionID:e.session_id}),(0,I.jsx)(`div`,{className:`num text-[13px] font-semibold text-right`,title:`${S(e.stats?.cost_usd)} for the whole session`,children:S(zn(t))}),(0,I.jsx)(`div`,{className:`text-[11px] text-right ${a}`,title:t.repeatSample,children:i.label})]})}var tr={low:{token:`--color-ok`,fallback:`#4fbf6b`,alpha:.55},mid:{token:`--color-accent`,fallback:`#feb157`,alpha:.85},high:{token:`--color-accent-strong`,fallback:`#ffcb85`,alpha:1}},nr={token:`--color-fg-faint`,fallback:`#837f78`,alpha:.3};function rr(e,t,n){return e.getPropertyValue(t).trim()||n}function ir({pulse:e,now:t,sessionID:n}){let r=(0,l.useRef)(null),[i,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=rr(o,nr.token,nr.fallback),c=e.bars,l=Math.max(...c.map(e=>e.n),1),u=Yn(c),d=n/c.length;for(let e=0;e{i.disconnect(),a.disconnect()}},[e]);let o=t=>{let n=t.currentTarget.getBoundingClientRect();if(n.width===0)return;let r=Math.floor((t.clientX-n.left)/n.width*e.bars.length);a(r>=0&&ra(null),onClick:e=>{i===null||!s||s.n===0||(e.preventDefault(),e.stopPropagation(),v({name:`session`,id:n,at:u}))},"aria-hidden":!0}),s&&(0,I.jsx)(`div`,{className:`absolute -top-1 left-0 right-0 pointer-events-none flex justify-center`,children:(0,I.jsxs)(`span`,{className:`num text-[10px] bg-panel-2 border border-border-strong rounded-sm px-1.5 py-0.5 text-fg-muted whitespace-nowrap`,children:[new Date(u).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),s.n===0?` · nothing happened`:(0,I.jsxs)(I.Fragment,{children:[` · ${s.n} event${s.n===1?``:`s`}`,s.turns>0&&` · ${s.turns} turn${s.turns===1?``:`s`}`,s.cost>0&&` · ${S(s.cost)}`,s.cost>0&&c>0&&(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` (median ${S(c)})`}),(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · click to open`})]})]})})]})}function ar({session:e,now:t,onClose:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)();(0,l.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await N.notes(e.session_id,12);t||i(n)}catch(e){t||o(e instanceof Error?e.message:`could not load`)}})(),()=>{t=!0}},[e.session_id]);let s=r?.find(e=>!e.fragment),c=r?.[0],u=s??c;return(0,I.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:n,children:(0,I.jsxs)(`div`,{className:`w-full max-w-[720px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-[13px] font-medium truncate`,children:e.project||`unknown project`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted truncate`,children:e.activity?.phrase}),(0,I.jsx)(`button`,{onClick:n,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,I.jsxs)(`div`,{className:`overflow-y-auto px-4 py-3 grid gap-3`,children:[!r&&!a&&(0,I.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`loading…`}),a&&(0,I.jsx)(`div`,{className:`text-[12px] text-danger`,children:a}),r&&!u&&(0,I.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`This session has not said anything yet — it may be running without hooks, or still on its first turn.`}),u&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:[`Last thing Claude said · `,ee(u.ts,t),s&&c&&s.event_id!==c.event_id&&(0,I.jsx)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:`(the newest line was mid-thought; this is the last complete one)`})]}),(0,I.jsx)(`div`,{className:`text-[13px] leading-relaxed whitespace-pre-wrap text-fg`,children:u.text})]}),e.activity?.plan&&e.activity.plan.total>0&&(0,I.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,I.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:[`Plan · `,e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,I.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`→ `,e.activity.plan.next]})]})]}),(0,I.jsxs)(`div`,{className:`px-4 py-2 border-t border-border flex items-center gap-3 text-[11px]`,children:[(0,I.jsx)(`a`,{href:g({name:`session`,id:e.session_id}),className:`link text-fg-muted hover:text-fg`,children:`open the session →`}),(0,I.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:e.owned?`answer in its terminal tab`:`reply in the terminal you started it in`})]})]})})}var or=`premium-hint`;function sr({reason:e,now:t}){let[n]=(0,l.useState)(()=>Cn(or,t)),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1);return!n||r?null:(0,I.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,I.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,I.jsx)(`button`,{onClick:()=>o(!0),className:`rounded-sm border border-border px-1.5 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg`,children:`a cap that stops this`}),(0,I.jsx)(`button`,{title:`hide this for a month`,onClick:()=>{wn(or,t),i(!0)},className:`text-fg-faint hover:text-fg-muted`,children:`✕`}),a&&(0,I.jsx)(nt,{feature:`cap`,onClose:()=>o(!1)})]})}function cr({items:e,now:t,onDismiss:n,sessions:r}){return e.length===0?null:(0,I.jsx)(`div`,{className:`grid gap-1.5`,children:e.map(e=>(0,I.jsx)(lr,{it:e,now:t,onDismiss:n,session:r?.find(t=>t.session_id===e.sessionId)},e.id))})}function lr({it:e,now:t,onDismiss:n,session:r}){let[i,a]=(0,l.useState)(!1),o=e.severity===`high`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 ${o?`border-danger/50 bg-danger/10`:`border-warn/50 bg-warn/10`}`,children:[(0,I.jsx)(`span`,{className:`font-medium text-[13px] shrink-0 ${o?`text-danger`:`text-warn`}`,children:e.title}),(0,I.jsxs)(`span`,{className:`text-[12px] text-fg-muted truncate`,children:[e.sessionId&&(0,I.jsx)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`link mono text-fg`,children:e.project||T(e.sessionId)}),(0,I.jsx)(`span`,{className:e.sessionId?`ml-2`:``,children:e.detail})]}),(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 shrink-0`,children:[e.costUSD!==void 0&&e.costUSD>0&&(0,I.jsx)(`span`,{className:`num text-[13px] text-fg`,title:`spent by this session so far`,children:S(e.costUSD)}),e.since!==void 0&&(0,I.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:ee(e.since,t)}),r&&e.id.startsWith(`waiting-`)&&(0,I.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong text-fg-muted hover:text-fg`,onClick:()=>a(!0),children:`what did it ask?`}),(0,I.jsx)(`a`,{href:e.sessionId?g({name:`session`,id:e.sessionId,tab:`timeline`,at:e.at}):`#/cost`,className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong no-underline text-fg-muted hover:text-fg`,children:e.sessionId?`open`:`details`}),(e.id.startsWith(`loop-`)||e.id.startsWith(`spent-`))&&(0,I.jsx)(sr,{reason:`this is what a cap stops`,now:t}),n&&e.id.startsWith(`loop-`)&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>n(e.sessionId),children:`dismiss`})]})]}),i&&r&&(0,I.jsx)(ar,{session:r,now:t,onClose:()=>a(!1)})]})}var ur=9e5,dr=25,fr=300,pr=2,mr=864e5,hr=90,gr=6912e5;function _r(e){return typeof e==`number`?e:e&&Date.parse(e)||0}function vr({sessions:e,alerts:t,now:n,limits:r,waitingMs:i=ur}){let a=[],o=Array.isArray(e)?e.filter(Boolean):[],s=Array.isArray(t)?t.filter(Boolean):[],c=new Map(o.map(e=>[e.session_id,e]));for(let e of s){let t=c.get(e.session_id);a.push({id:`loop-${e.session_id}`,sessionId:e.session_id,project:t?.project??``,severity:`high`,title:`Stuck in a loop`,detail:[`ran ${e.sample||e.tool||`the same call`}`,Number.isFinite(e.count)?`${e.count}×`:`repeatedly`,Number.isFinite(e.window_min)?`in ${e.window_min} min`:``].filter(Boolean).join(` `),costUSD:t?.stats?.cost_usd,since:_r(e.ts)||void 0,at:_r(e.first_ts)||_r(e.ts)||void 0})}for(let e of o)if(e.status!==`ended`&&e.activity){if(e.activity.health===`error`){a.push({id:`error-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`high`,title:`Session hit an error`,detail:e.activity.phrase,costUSD:e.stats?.cost_usd,since:_r(e.activity.at)||e.last_event_at});continue}if(e.activity.health===`waiting-on-you`){let t=_r(e.activity.at)||e.last_event_at;t>0&&n-t>=i&&a.push({id:`waiting-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Waiting on you`,detail:e.activity.phrase,since:t})}}for(let e of o){if(!e.stats||!e.activity)continue;let{cost_usd:t,turns:r,files_touched:i}=e.stats;if(tpr)continue;let o=_r(e.activity.at)||e.last_event_at;o>0&&n-o>mr||a.push({id:`spent-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Lots of turns, few files`,detail:`${r.toLocaleString()} turns, ${i===0?`no files`:i===1?`1 file`:`${i} files`} touched`,costUSD:t,since:_r(e.activity.at)||e.last_event_at})}let l={high:0,medium:1};for(let[e,t]of[[`5-hour`,r?.five_hour],[`7-day`,r?.seven_day]]){if(!t||t.used_percentagen&&r=95?`high`:`medium`,title:`${e} plan window ${i}% used`,detail:`resets at ${o}${t.forecast?` — ${t.forecast}`:``}`})}return a.sort((e,t)=>l[e.severity]-l[t.severity]||(e.since??0)-(t.since??0))}var yr=`caprock.update.dismissed`;function br({plan:e,onSave:t,now:n,owned:r=0}){let[i,a]=(0,l.useState)(),[o,s]=(0,l.useState)(()=>localStorage.getItem(yr)??``);return(0,l.useEffect)(()=>{if(!e?.update_checks){a(void 0);return}let t=!0,n=()=>{N.update().then(e=>{t&&a(e)}).catch(()=>{})};n();let r=window.setInterval(n,6e4);return()=>{t=!1,window.clearInterval(r)}},[e?.update_checks]),e&&!e.update_checks?o===`offer`?null:(0,I.jsxs)(xr,{tone:`muted`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Caprock can check GitHub for new releases. It's the only outbound call it makes, so it's off unless you turn it on — no usage data is sent, and you can turn it off again any time.`}),(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[(0,I.jsx)(`button`,{className:`text-[11px] border border-accent/50 text-accent bg-accent/10 px-2 py-0.5 rounded-sm hover:bg-accent/20`,onClick:()=>t({...e,update_checks:!0}),children:`check for updates`}),(0,I.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,`offer`),s(`offer`)},children:`no thanks`})]})]}):!i?.update_available||!i.latest||o===i.latest?null:(0,I.jsxs)(xr,{tone:`accent`,children:[(0,I.jsxs)(`span`,{className:`text-fg`,children:[(0,I.jsxs)(`span`,{className:`font-medium`,children:[`Caprock `,i.latest]}),` is available — you're on `,(0,I.jsx)(`span`,{className:`mono`,children:i.current}),`.`]}),r>0&&(0,I.jsx)(`span`,{className:`text-[12px] text-warn shrink-0`,children:r===1?`1 session Caprock started will close`:`${r} sessions Caprock started will close`}),i.command?(0,I.jsx)(Ct,{command:i.command}):(0,I.jsx)(`a`,{className:`link text-[12px]`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`download it`}),(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[i.checked_at?(0,I.jsxs)(`span`,{className:`num text-[11px] text-fg-faint`,children:[`checked `,ee(i.checked_at,n)]}):null,(0,I.jsx)(`a`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm no-underline`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`what's new`}),(0,I.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,i.latest),s(i.latest)},children:`not now`})]})]})}function xr({tone:e,children:t}){return(0,I.jsx)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 text-[12px] ${e===`accent`?`border-accent/40 bg-accent/5`:`border-border bg-panel`}`,children:t})}function Sr({u:e,className:t=``}){return!e||e.turns===0?null:(0,I.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] ${t}`,children:[(0,I.jsx)(`span`,{className:`text-warn font-medium`,children:`Cost is incomplete`}),` `,(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[C(e.tokens),` tokens over `,e.turns,` turn`,e.turns===1?``:`s`,` could not be priced, so they are missing from the total above — not free. `,e.models.length===1?`Model`:`Models`,` with no entry in the pricing table:`,` `,e.models.map((e,t)=>(0,I.jsxs)(`span`,{children:[t>0&&`, `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:e||`unknown`})]},e)),`. This happens when a model ships newer than the pricing table, or when a gateway reports ids that do not normalise.`]})]})}function Cr({value:e,onPick:t}){let[n,r]=(0,l.useState)(`recent`),[i,a]=(0,l.useState)(``),o=F(()=>N.recentDirs(),[],{live:!1}),s=F(()=>N.browse(i),[i],{live:!1});return(0,l.useEffect)(()=>{o.data&&o.data.length===0&&r(`browse`)},[o.data]),(0,I.jsxs)(`div`,{className:`rounded-[3px] border border-border-strong bg-panel-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border-strong px-2 py-1.5 text-[12px]`,children:[(0,I.jsx)(wr,{on:n===`recent`,onClick:()=>r(`recent`),children:`Recent`}),(0,I.jsx)(wr,{on:n===`browse`,onClick:()=>r(`browse`),children:`Browse`}),n===`browse`&&s.data&&(0,I.jsx)(`span`,{className:`mono ml-auto min-w-0 truncate pl-2 text-[11px] text-fg-faint`,title:s.data.dir,children:kr(s.data.dir,s.data.root)})]}),(0,I.jsx)(`div`,{className:`h-[168px] overflow-y-auto overflow-x-hidden`,children:n===`recent`?(0,I.jsx)(Tr,{rows:o.data,value:e,onPick:t}):(0,I.jsx)(Er,{data:s.data,value:e,onOpen:a,onPick:t,error:s.error?.message})})]})}function wr({on:e,onClick:t,children:n}){return(0,I.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-sm px-2 py-0.5 ${e?`bg-accent/15 text-accent`:`text-fg-muted hover:text-fg`}`,children:n})}function Tr({rows:e,value:t,onPick:n}){return e?e.length===0?(0,I.jsx)(Or,{children:`No sessions yet — use Browse, or type a path.`}):(0,I.jsx)(`ul`,{children:e.map(e=>(0,I.jsxs)(Dr,{selected:t===e.dir,onClick:()=>n(e.dir),children:[(0,I.jsx)(`span`,{className:`shrink-0 text-fg`,children:e.name}),(0,I.jsx)(`span`,{className:`mono ml-2 min-w-0 flex-1 truncate text-[11px] text-fg-faint`,title:e.dir,children:e.dir}),(0,I.jsx)(`span`,{className:`shrink-0 pl-2 text-[11px] text-fg-faint`,children:ee(e.last_event_at)})]},e.dir))}):(0,I.jsx)(Or,{children:`…`})}function Er({data:e,value:t,onOpen:n,onPick:r,error:i}){return i?(0,I.jsx)(Or,{children:i}):e?(0,I.jsxs)(`ul`,{children:[e.parent&&(0,I.jsx)(Dr,{selected:!1,onClick:()=>n(e.parent),children:(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`↑ up`})}),e.entries.length===0&&(0,I.jsx)(Or,{children:`Nothing here.`}),e.entries.map(e=>(0,I.jsxs)(Dr,{selected:t===e.path,onClick:()=>e.repo?r(e.path):n(e.path),children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate ${e.repo?`text-fg`:`text-fg-muted`}`,children:e.name}),e.repo&&(0,I.jsx)(`span`,{className:`ml-2 shrink-0 text-[10px] uppercase tracking-wide text-accent`,children:`repo`}),(0,I.jsx)(`span`,{className:`flex-1`}),(0,I.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.repo?n(e.path):r(e.path)},className:`shrink-0 px-1 text-[11px] text-fg-faint hover:text-fg`,title:e.repo?`Open this folder`:`Use this folder`,children:e.repo?`›`:`use`})]},e.path))]}):(0,I.jsx)(Or,{children:`…`})}function Dr({selected:e,onClick:t,children:n}){return(0,I.jsx)(`li`,{children:(0,I.jsx)(`button`,{type:`button`,onClick:t,className:`flex w-full min-w-0 items-center px-2.5 py-1 text-left text-[12px] hover:bg-panel ${e?`bg-accent/10`:``}`,children:n})})}function Or({children:e}){return(0,I.jsx)(`p`,{className:`px-2.5 py-3 text-[12px] text-fg-faint`,children:e})}function kr(e,t){return e===t?`~`:e.startsWith(t+`/`)?`~`+e.slice(t.length):e}var Ar=`claude-opus-5`,jr=`acceptEdits`,Mr=[[`claude-opus-5`,`Opus 5 · most capable`],[`claude-sonnet-5`,`Sonnet 5 · faster, cheaper`],[`claude-haiku-4-5`,`Haiku 4.5 · cheapest`]],Nr=[[`acceptEdits`,`Accept edits · asks before commands`],[`plan`,`Plan · reads and plans, changes nothing`],[`bypassPermissions`,`Bypass · never asks`]];function Pr({available:e,onClose:t,initialCwd:n=``}){let[r,i]=(0,l.useState)(n),[a,o]=(0,l.useState)(Ar),[s,c]=(0,l.useState)(jr),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),y=async()=>{if(!r.trim()){_(`Working directory is required.`);return}h(!0),_(``);try{let e={cwd:r.trim()};a&&(e.model=a),s&&(e.permission_mode=s),u.trim()&&(e.worktree=u.trim()),f&&(e.create=!0);let{session_id:n}=await N.spawn(e);t(),v({name:`session`,id:n,tab:`terminal`})}catch(e){_(oe(e))}finally{h(!1)}};return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:t,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[520px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New session`}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),e?(0,I.jsxs)(`div`,{className:`px-4 py-3 grid min-w-0 gap-3 text-[13px]`,children:[(0,I.jsxs)(Fr,{label:`Working directory`,hint:`pick one, or type a path`,children:[(0,I.jsx)(`input`,{autoFocus:!0,className:`input`,placeholder:`/Users/you/dev/project`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&y()}),(0,I.jsx)(`div`,{className:`mt-1.5 min-w-0 max-w-full`,children:(0,I.jsx)(Cr,{value:r,onPick:i})})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,I.jsx)(Fr,{label:`Model`,children:(0,I.jsx)(`select`,{className:`input`,value:a,onChange:e=>o(e.target.value),children:Mr.map(([e,t])=>(0,I.jsx)(`option`,{value:e,children:t},e))})}),(0,I.jsx)(Fr,{label:`Permissions`,children:(0,I.jsx)(`select`,{className:`input`,value:s,onChange:e=>c(e.target.value),children:Nr.map(([e,t])=>(0,I.jsx)(`option`,{value:e,children:t},e))})})]}),(0,I.jsxs)(`details`,{className:`text-[12px] group`,children:[(0,I.jsxs)(`summary`,{className:`cursor-pointer select-none text-fg-muted hover:text-fg list-none marker:content-none`,children:[(0,I.jsx)(`span`,{className:`inline-block transition-transform group-open:rotate-90 text-fg-faint`,children:`▶`}),` Advanced`]}),(0,I.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,I.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none text-fg-muted`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:f,onChange:e=>p(e.target.checked)}),`create the directory if it does not exist`]}),(0,I.jsx)(Fr,{label:`Git worktree`,hint:`creates .caprock-worktrees/ on a new branch`,children:(0,I.jsx)(`input`,{className:`input`,placeholder:`feature-x`,value:u,onChange:e=>d(e.target.value)})})]})]}),g&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:g})]}):(0,I.jsxs)(`div`,{className:`px-4 py-6 text-[13px] text-fg-muted`,children:[`The `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself.`]}),e&&(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:t,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:y,disabled:m,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:m?`starting…`:`Start session`})]})]})})}function Fr({label:e,hint:t,children:n}){return(0,I.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[e,t&&(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,t]})]}),n]})}function Ir(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(`all`),[i,a]=(0,l.useState)(!1),o=F(()=>N.sessions(!e),[e],{intervalMs:5e3}),s=F(()=>N.status(),[],{live:!1,intervalMs:3e4}),c=F(()=>N.summary(`today`,n),[n],{intervalMs:5e3}),u=F(()=>N.history(`all`),[],{intervalMs:6e4}),{alerts:p}=f(),m=ie(1e3),h=o.data??[],g=n===`all`?h:h.filter(e=>(e.agent??`claude`)===n),_=!!s.data?.opencode,v=g.filter(e=>e.activity.health===`working`||e.activity.health===`looping`||e.activity.health===`error`||e.activity.health===`waiting-on-you`),y=g.filter(e=>!v.includes(e)&&e.status!==`ended`),b=g.filter(e=>e.status===`ended`),[x,w]=De(),te=vr({sessions:g,alerts:p,now:m,limits:c.data?.rate_limits}),T=s.data?.hooks&&(s.data.hooks.missing??[]).length>0,E=!!c.data&&c.data.turns>0,ne=s.data?.ingest_error;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[ne&&(0,I.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`text-danger font-medium`,children:`Ingest stopped`}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`No new sessions are being captured. `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:ne}),` — check that`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})]}),T&&(0,I.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`text-warn font-medium`,children:`Hooks not installed`}),(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`Activity is coming from transcripts only (a few seconds late, no tool-level detail for running commands). Run `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:`caprock hooks install`}),` for real-time narration.`]}),(0,I.jsx)(`a`,{href:`#/settings`,className:`link ml-auto text-[11px]`,children:`details`})]}),(0,I.jsx)(br,{plan:x,onSave:w,now:m,owned:g.filter(e=>e.owned&&e.status!==`ended`).length}),(0,I.jsx)(cr,{items:te,now:m,onDismiss:e=>d.dismissAlert(e),sessions:g}),(0,I.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(dn,{plan:x})}),(0,I.jsx)(Lr,{available:s.data?.claude_available}),(0,I.jsx)(Rr,{available:s.data?.claude_available,onClick:()=>a(!0)})]}),E&&u.data?.totals&&(0,I.jsx)(En,{costUSD:u.data.totals.cost_usd,days:u.data.totals.days,now:m}),(0,I.jsxs)(L,{title:`Today`,center:_?(0,I.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-panel-2 p-0.5`,children:It.map(e=>(0,I.jsx)(`button`,{onClick:()=>r(e.key),title:e.key===`all`?`Every agent`:`Only ${e.label}`,className:`px-2.5 py-1 text-[12px] mono rounded-[5px] transition-colors ${n===e.key?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.key))}):null,right:c.data?(0,I.jsxs)(`span`,{className:`num`,children:[`pricing `,c.data.pricing_version,` · at API list price`]}):null,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-[1.4fr_1fr_1fr_1fr_1fr_1fr] divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost today`,value:E?S(c.data?.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:un(x),children:E?ln(x):`nothing measured yet`}),tone:`info`,size:`hero`}),(0,I.jsx)(R,{label:`Burn now`,value:E?`${S(c.data.burn.usd_per_hour)}/h`:`—`,sub:E?`${C(Math.round(c.data.burn.tokens_per_min))} tok/min · last ${c.data.burn.window_min}m`:void 0}),(0,I.jsx)(R,{label:`Sessions`,value:E?c.data.sessions:`—`,sub:E?`${c.data.active_sessions} active`:void 0,size:`compact`}),(0,I.jsx)(R,{label:`Turns`,value:E?c.data.turns:`—`,sub:E?`${c.data.tool_calls} tool calls`:void 0,size:`compact`}),(0,I.jsx)(vn,{limits:c.data?.rate_limits,now:m}),(0,I.jsx)(hn,{hitRate:c.data?.savings.hit_rate,cutPct:c.data?.savings.cut_pct,measured:E})]}),(0,I.jsx)(Sr,{u:c.data?.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsx)(Qn,{sessions:g,now:m}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,I.jsx)(on,{sessions:g,now:m,emptyHint:n===`all`?void 0:(0,I.jsxs)(I.Fragment,{children:[`Nothing from `,n===`opencode`?`OpenCode`:`Claude Code`,` yet.`]})}),(0,I.jsx)(Wt,{sessions:g,agent:n})]}),(0,I.jsx)(In,{}),o.error&&!o.data&&(0,I.jsxs)(z,{title:`Cannot reach the daemon`,children:[o.error.message,` — is `,(0,I.jsx)(`span`,{className:`mono`,children:`caprock up`}),` running?`]}),!o.data&&!o.error&&(0,I.jsx)(St,{rows:4,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),o.data&&g.length===0&&(n===`all`?(0,I.jsxs)(z,{title:`No sessions yet`,children:[`Start `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal — it will show up here within seconds.`]}):(0,I.jsxs)(z,{title:`No ${n===`opencode`?`OpenCode`:`Claude Code`} sessions here`,children:[`Nothing from this agent in the current view. Switch to`,` `,(0,I.jsx)(`button`,{className:`link underline`,onClick:()=>r(`all`),children:`all`}),` `,`to see everything.`]})),(0,I.jsx)(zr,{groups:[{label:`Active`,items:v},{label:`Idle`,items:y,dim:!0},...e?[{label:`Ended`,items:b,dim:!0}]:[]],now:m}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,I.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:e,onChange:e=>t(e.target.checked)}),`show ended sessions`]}),o.loadedAt>0&&(0,I.jsxs)(`span`,{className:`num ml-auto`,children:[`refreshed `,ee(o.loadedAt,m)]})]}),i&&(0,I.jsx)(Pr,{available:s.data?.claude_available??!1,onClose:()=>{a(!1),o.refresh()}})]})}function Lr({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return e===!1?null:(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`button`,{onClick:async()=>{n(!0),i(``);try{let{session_id:e}=await N.spawn({chat:!0});v({name:`session`,id:e,tab:`terminal`})}catch(e){i(oe(e))}finally{n(!1)}},disabled:t,title:`start a session without picking a folder`,className:`relative shrink-0 rounded-[var(--radius-panel)] border border-border-strong px-3 py-2 text-[13px] leading-5 text-fg-muted hover:text-fg hover:border-accent/50 disabled:opacity-50`,children:[t?`starting…`:`Quick chat`,r&&(0,I.jsx)(`span`,{className:`absolute right-0 top-full mt-1 block max-w-[220px] text-right text-[11px] text-danger`,children:r})]})})}function Rr({available:e,onClick:t}){let n=e===!1;return(0,I.jsxs)(`button`,{onClick:t,title:n?`claude was not found on this machine — click for details`:`start a session Caprock owns`,className:`shrink-0 rounded-[var(--radius-panel)] border px-3 py-2 text-[13px] leading-5 font-medium transition-colors ${n?`border-border text-fg-faint hover:text-fg-muted`:`border-accent/60 bg-accent/15 text-accent hover:bg-accent/25`}`,children:[`+ New session`,n?` (claude not found)`:``]})}function zr({groups:e,now:t}){let n=e.flatMap(e=>e.items.map((t,n)=>({s:t,dim:e.dim,label:n===0?`${e.label} · ${e.items.length}`:null})));return n.length===0?null:(0,I.jsx)(`div`,{"data-testid":`session-grid`,className:`mt-3 grid gap-2 gap-y-6`,children:n.map(({s:e,dim:n,label:r})=>(0,I.jsxs)(`div`,{className:`relative ${n?`opacity-80`:``}`,children:[r&&(0,I.jsx)(`div`,{className:`absolute -top-4 left-0.5 text-[11px] uppercase tracking-[0.08em] text-fg-faint`,children:r}),(0,I.jsx)(Br,{s:e,now:t})]},e.session_id))})}function Br({s:e,now:t}){let n=e.context,r=n?n.pct>=85?`danger`:n.pct>=60?`warn`:void 0:void 0,[i,a]=(0,l.useState)(!1),o=e.activity?.health===`waiting-on-you`;return(0,I.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`block border border-border bg-panel rounded-[var(--radius-panel)] hover:border-border-strong no-underline hover:no-underline text-fg`,children:[(0,I.jsxs)(`div`,{className:`px-3 pt-2 pb-1 flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`font-medium truncate text-[15px]`,children:e.project||`unknown project`}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:T(e.session_id)}),e.agent===`opencode`&&(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.08em] text-fg-muted border border-border px-1 py-px rounded-sm`,children:`opencode`}),e.git_branch&&(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate`,children:e.git_branch}),(0,I.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[o&&(0,I.jsx)(`button`,{className:`text-[11px] border border-warn/50 text-warn bg-warn/10 px-1.5 py-0.5 rounded-sm hover:bg-warn/20`,onClick:e=>{e.preventDefault(),a(!0)},children:`what did it ask?`}),(0,I.jsx)(bt,{health:e.activity.health})]})]}),i&&(0,I.jsx)(ar,{session:e,now:t,onClose:()=>a(!1)}),(0,I.jsxs)(`div`,{className:`px-3 pb-2 text-[13px] truncate`,title:e.activity.phrase,children:[(0,I.jsx)(`span`,{className:e.activity.health===`working`?`text-fg`:`text-fg-muted`,children:e.activity.phrase}),(0,I.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:ee(e.activity.at||e.last_event_at,t)})]}),e.activity.plan&&e.activity.plan.total>0&&(0,I.jsxs)(`div`,{className:`px-3 pb-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,I.jsx)(`div`,{className:`h-1 flex-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent`,style:{width:`${Math.min(100,Math.max(0,100*e.activity.plan.done/e.activity.plan.total))}%`}})}),(0,I.jsxs)(`span`,{className:`num`,children:[e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,I.jsxs)(`span`,{className:`truncate max-w-[50%]`,children:[`→ `,e.activity.plan.next]})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 divide-x divide-border border-t border-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:S(e.stats.cost_usd),sub:e.model||`—`,tone:`info`}),(0,I.jsx)(R,{label:`Tokens`,value:C(e.stats.tokens_in+e.stats.tokens_out+e.stats.cache_read+e.stats.cache_write),sub:`${w(e.savings.hit_rate*100)} cache hit`}),(0,I.jsx)(R,{label:`Context`,value:n?w(n.pct):`—`,sub:n?`${C(n.tokens)} / ${C(n.window)}`:`unknown model`,tone:r}),(0,I.jsx)(R,{label:`Activity`,value:e.stats.tool_calls,sub:`${e.stats.turns} turns · ${e.stats.files_touched} files`})]})]})}function Vr({id:e,now:t}){let n=F(()=>N.notes(e),[e],{intervalMs:1e4}),r=n.data??[],[i,a]=(0,l.useState)(!1),o=r.filter(e=>!e.fragment),s=i?r:o;return n.error&&!n.data?(0,I.jsx)(z,{title:`Cannot load notes`,children:n.error.message}):n.data?r.length===0?(0,I.jsx)(z,{title:`Nothing said yet`,children:`Claude's written answers appear here — the reasoning and the “what changed, what I still need from you” that otherwise lives only in your terminal scrollback.`}):(0,I.jsxs)(`div`,{className:`grid gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,I.jsxs)(`span`,{children:[o.length,` `,o.length===1?`answer`:`answers`,r.length>o.length&&` · ${r.length-o.length} short remarks`]}),r.length>o.length&&(0,I.jsx)(`button`,{className:`text-fg-muted hover:text-fg border border-border px-1.5 rounded-sm`,onClick:()=>a(e=>!e),children:i?`hide short remarks`:`show everything`}),(0,I.jsx)(`span`,{className:`ml-auto`,children:`subagent chatter excluded · newest first`})]}),s.map(e=>(0,I.jsx)(Ur,{note:e,now:t},e.event_id))]}):(0,I.jsx)(St,{rows:4})}var Hr=600;function Ur({note:e,now:t,showSession:n=!1}){let[r,i]=(0,l.useState)(!1),a=typeof e.text==`string`?e.text:``,o=[...a],s=o.length>Hr,c=r||!s?a:o.slice(0,Hr).join(``)+`…`;return(0,I.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)]`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-2 text-[11px] text-fg-faint`,children:[n&&(0,I.jsx)(`a`,{href:g({name:`session`,id:e.session_id,at:e.ts}),className:`link`,title:`Open the session at this moment`,children:(0,I.jsx)(`span`,{className:`text-fg-muted`,children:e.project||T(e.session_id)})}),(0,I.jsx)(`span`,{className:`mono`,children:e.model||`assistant`}),e.fragment&&(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`· mid-thought`}),(0,I.jsx)(`span`,{className:`num ml-auto`,children:ee(e.ts,t)})]}),(0,I.jsx)(`div`,{className:`px-3 py-2 text-[13px] leading-[1.55] whitespace-pre-wrap break-words`,children:c}),s&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg px-3 pb-2`,onClick:()=>i(e=>!e),children:r?`show less`:`show all ${o.length.toLocaleString()} characters`})]})}var Wr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Kr=(e,t)=>{for(var n in t)Wr(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gr(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wr(t,n,i),i},B=(e,t)=>(n,r)=>t(n,r,e),Jr=`Terminal input`,Yr={get:()=>Jr,set:e=>Jr=e},Xr=`Too much output to announce, navigate to rows manually to read`,Zr={get:()=>Xr,set:e=>Xr=e};function Qr(e){return e.replace(/\r?\n/g,`\r`)}function $r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ei(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ti(e,t,n,r){e.stopPropagation(),e.clipboardData&&ni(e.clipboardData.getData(`text/plain`),t,n,r)}function ni(e,t,n,r){e=Qr(e),e=$r(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ri(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ii(e,t,n,r,i){ri(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ai(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oi(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var si=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ci=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},li=``,ui=` `,di=class e{constructor(){this.fg=0,this.bg=0,this.extended=new fi}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},fi=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pi=class e extends di{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fi,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ai(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mi=`di$target`,hi=`di$dependencies`,gi=new Map;function _i(e){return e[hi]||[]}function vi(e){if(gi.has(e))return gi.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);yi(t,e,r)};return t._id=e,gi.set(e,t),t}function yi(e,t,n){t[mi]===t?t[hi].push({id:e,index:n}):(t[hi]=[{id:e,index:n}],t[mi]=t)}var bi=vi(`BufferService`),xi=vi(`CoreMouseService`),Si=vi(`CoreService`),Ci=vi(`CharsetService`),wi=vi(`InstantiationService`),Ti=vi(`LogService`),Ei=vi(`OptionsService`),Di=vi(`OscLinkService`),Oi=vi(`UnicodeService`),ki=vi(`DecorationService`),Ai=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new pi,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):ji(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ai=qr([B(0,bi),B(1,Ei),B(2,Di)],Ai);function ji(e,t){if(confirm(`Do you want to navigate to ${t}? +`+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ye(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Xe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ze(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=mn(),pn=fn=dn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=cn&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Ft(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Td(Ar,`onSelect`),0>=o,i-=o,wi=1<<32-Re(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),V&&Ei(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),V&&Ei(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return V&&Ei(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),V&&Ei(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&wa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=di(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ui(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(a,e.mode,c),c.return=e,e=c}return o(e);case D:return a=wa(a),b(e,r,a,c)}if(A(a))return h(e,r,a,c);if(ie(a)){if(l=ie(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,ea(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=fi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,et(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Z&f)===f:(r&f)===f){f!==0&&f===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=j.T,s={};j.T=s,js(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),du(e)):As(e,t,r,du(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ss(e).queue;ys(e,i,t,ae,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},du())}function ws(){return $i(Qf)}function Ts(){return Oo().memoizedState}function Es(){return Oo().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Ra(n);var r=za(t,e,n);r!==null&&(pu(r,t,n),Ba(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=ei(e,t,n,r),n!==null&&(pu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,du())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return $r(e,t,i,0),Il===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return pu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(s(479))}else t=ei(e,n,r,2),t!==null&&pu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,et(e,n)}}var Fs={readContext:$i,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Fs.useEffectEvent=vo;var Is={readContext:$i,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=ys.bind(null,G,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Do();if(V){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Il===null)throw Error(s(349));Z&127||Ro(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,os(Bo.bind(null,r,a,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),n},useId:function(){var e=Do(),t=Il.identifierPrefix;if(V){var n=Ti,r=wi;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[st]=t,a[ct]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ue.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[st]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ii(t,!0)}else e=Bd(e).createTextNode(r),e[st]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[st]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(s(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[st]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),i=!1}else i=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return pe(),e===null&&xd(t.stateNode.containerInfo),Nc(t),null;case 10:return qi(t.type),Nc(t),null;case 19:if(se(ao),r=t.memoizedState,r===null)return Nc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Mc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Mc(r,!1),e=a.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return F(ao,ao.current&1|2),V&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>$l&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!V)return Nc(t),null}else 2*Ee()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=ao.current,F(ao,i?n&1|2:n&1),V&&Ei(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(H),Nc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Fc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(H),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(ao),null;case 4:return pe(),null;case 10:return qi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&se(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(H),null;case 25:return null;default:return null}}function Ic(e,t){switch(ki(t),t.tag){case 3:qi(H),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:se(ao);break;case 10:qi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&se(ma);break;case 24:qi(H)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Uu(e,e.return,t)}}}function Bc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ct]=t}catch(t){Uu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[st]=e,t[ct]=n}catch(t){Uu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Rd=sp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(a,r,n),a[st]=e,vt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;cg&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,j.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,Y&6)throw Error(s(331));var c=Y;if(Y|=4,jl(a.current),Cl(a,a.current,o,n),Y=c,rd(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,a)}catch{}return!0}finally{M.p=i,j.T=r,zu(e,t)}}function Hu(e,t,n){t=gi(n,t),t=Js(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ze(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=gi(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),Ze(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Q=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Z&n)===n&&(Hl===4||Hl===3&&(Z&62914560)===Z&&300>Ee()-Zl?!(Y&2)&&bu(e,0):Gl|=n,ql===Z&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ye()),e=ti(e,t),e!==null&&(Ze(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Se(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Z,a=Ke(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Ee(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=_t(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);vt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ue.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=_t(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=_t(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=_t(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Lt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),vt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Lt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,vt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),vt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,vt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),vt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=new class{state={conn:`connecting`,lastFrameAt:0,tick:0,alerts:[]};listeners=new Set;backoff=500;timer=null;started=!1;frameSubs=new Set;getState=()=>this.state;subscribe=e=>(this.listeners.add(e),this.start(),()=>{this.listeners.delete(e)});onFrame=e=>(this.frameSubs.add(e),()=>{this.frameSubs.delete(e)});set(e){this.state={...this.state,...e};for(let e of this.listeners)e()}start(){this.started||typeof WebSocket>`u`||(this.started=!0,this.connect())}connect(){let e=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/v1/live`;this.set({conn:`connecting`});let t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.onopen=()=>{this.backoff=500,this.set({conn:`open`})},t.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}this.handle(t)},t.onclose=()=>{this.set({conn:`closed`}),this.scheduleReconnect()},t.onerror=()=>{t.close()}}scheduleReconnect(){this.timer===null&&(this.timer=window.setTimeout(()=>{this.timer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,1e4))}handle(e){let t=Date.now();for(let t of this.frameSubs)try{t(e)}catch(e){console.error(`[caprock] live frame subscriber failed`,e)}switch(e.type){case`alert`:this.set({lastFrameAt:t,alerts:[e.data,...this.state.alerts.filter(t=>t.session_id!==e.data.session_id)].slice(0,50),tick:this.state.tick+1});break;case`event`:this.set({lastFrameAt:t,lastEvent:e.data,tick:this.state.tick+1});break;case`session`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;case`task`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;default:this.set({lastFrameAt:t})}}dismissAlert(e){this.set({alerts:this.state.alerts.filter(t=>t.session_id!==e)})}};function f(){return(0,l.useSyncExternalStore)(d.subscribe,d.getState,d.getState)}function p(e=400){let{tick:t}=f(),[n,r]=m(t,e);return(0,l.useEffect)(()=>{r(t)},[t,r]),n}function m(e,t){let[n,r]=(0,l.useState)(e),i=(0,l.useRef)(null),a=(0,l.useRef)(e);return[n,(0,l.useCallback)(e=>{a.current=e,i.current===null&&(i.current=window.setTimeout(()=>{i.current=null,r(a.current)},t))},[t])]}function h(e){let[t,n]=e.replace(/^#\/?/,``).split(`?`),r=(t??``).split(`/`).filter(Boolean),i=new URLSearchParams(n??``),a=i.get(`tab`)??void 0,o=Number(i.get(`at`)),s=Number.isFinite(o)&&o>0?o:void 0;switch(r[0]){case void 0:case``:case`now`:return{name:`now`};case`session`:return r[1]?{name:`session`,id:decodeURIComponent(r[1]),tab:a,at:s}:{name:`now`};case`cost`:return{name:`cost`};case`history`:return{name:`history`};case`tasks`:return{name:`tasks`};case`graph`:return{name:`graph`};case`notes`:return{name:`notes`};case`settings`:return{name:`settings`};default:return{name:`now`}}}function g(e){switch(e.name){case`now`:return`#/`;case`session`:{let t=new URLSearchParams;e.tab&&t.set(`tab`,e.tab),e.at&&t.set(`at`,String(e.at));let n=t.toString();return`#/session/${encodeURIComponent(e.id)}${n?`?${n}`:``}`}case`cost`:return`#/cost`;case`history`:return`#/history`;case`tasks`:return`#/tasks`;case`graph`:return`#/graph`;case`notes`:return`#/notes`;case`settings`:return`#/settings`}}function _(){let[e,t]=(0,l.useState)(()=>h(location.hash));return(0,l.useEffect)(()=>{let e=()=>t(h(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(e){location.hash=g(e)}var y=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:4,maximumFractionDigits:4});function x(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function S(e){return x(e)===null?`—`:(e=e,e!==0&&Math.abs(e)<.01?b.format(e):y.format(e))}function C(e){if(x(e)===null)return`—`;e=e;let t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e4?`${(e/1e3).toFixed(1)}k`:new Intl.NumberFormat(`en-US`).format(e)}function w(e,t=0){if(x(e)===null)return`—`;let n=e;if(t===0){let e=Math.floor(n);return`${Number.isFinite(e)?e:0}%`}let r=Math.min(100,Math.max(0,Math.trunc(x(t)??0)));return`${e.toFixed(r)}%`}function T(e,t=Date.now()){if(!e)return`—`;let n=typeof e==`number`?e:Date.parse(e);if(Number.isNaN(n))return`—`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<5)return`now`;if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<48?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ee(e){if(x(e)===null)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function E(e){return e.length>8?e.slice(0,8):e}function D(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.slice(n+1):t}function te(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t?`${t[1]}·${t[2]}`:e}function ne(e){return e.replace(/-\d{6,}$/,`…`)}function re(e){let[t,n]=(0,l.useState)(()=>Date.now());return(0,l.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}var ie=`caprock-theme`;function O(){let e=localStorage.getItem(ie);return e===`dark`||e===`light`?e:window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function k(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function A(){let[e,t]=(0,l.useState)(O);return(0,l.useEffect)(()=>{k(e),localStorage.setItem(ie,e)},[e]),[e,()=>t(e=>e===`dark`?`light`:`dark`)]}async function j(e,t,n=`POST`){let r=await fetch(e,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok){let e;try{e=await r.json()}catch{}throw new M(r.status,`${r.status} ${r.statusText}`,e)}return r.status===204?void 0:await r.json()}var M=class extends Error{status;body;constructor(e,t,n){super(t),this.status=e,this.body=n}};function ae(e){if(e instanceof M){let t=e.body,n=t?.error??e.message;return t?.detail?`${n} — ${t.detail}`:n}return e instanceof Error?e.message:String(e)}async function N(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok){let e;try{e=await t.json()}catch{}throw new M(t.status,`${t.status} ${t.statusText}`,e)}return await t.json()}var P={sessions:(e=!1)=>N(`/v1/sessions${e?`?active=true`:``}`),session:e=>N(`/v1/sessions/${encodeURIComponent(e)}`),events:(e,t=0,n=500)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?after=${t}&limit=${n}`),eventsBefore:(e,t,n=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?before=${t}&limit=${n}`),recentEvents:(e,t=2e3)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?newest=1&limit=${t}`),diff:e=>N(`/v1/sessions/${encodeURIComponent(e)}/diff`),notes:(e,t=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/notes?limit=${t}`),searchNotes:(e,t=100,n=0)=>N(`/v1/notes?q=${encodeURIComponent(e)}&limit=${t}${n?`&before=${n}`:``}`),settings:()=>N(`/v1/settings`),update:()=>N(`/v1/update`),checkUpdate:()=>j(`/v1/update/check`,{}),saveSettings:e=>j(`/v1/settings`,e,`PUT`),summary:(e=`today`,t)=>N(`/v1/stats/summary?range=${e}${t&&t!==`all`?`&agent=${t}`:``}`),daily:(e=30)=>N(`/v1/stats/daily?days=${e}`),premium:()=>N(`/v1/premium`),gemini:()=>N(`/v1/gemini`),askGemini:(e,t)=>j(`/v1/gemini/ask`,{prompt:e,model:t}),browse:(e=``)=>N(`/v1/browse${e?`?dir=${encodeURIComponent(e)}`:``}`),recentDirs:()=>N(`/v1/recent-dirs`),history:(e=`all`)=>N(`/v1/history?range=${e}`),enableHive:(e,t)=>j(`/v1/hive`,{hive:e??``,repo:t??``}),tasks:()=>N(`/v1/tasks`),task:e=>N(`/v1/tasks/${encodeURIComponent(e)}`),createTask:e=>j(`/v1/tasks`,e),approve:(e,t)=>j(`/v1/tasks/${encodeURIComponent(e)}/${t?`approve`:`reject`}`,{}),startOrchestrator:()=>j(`/v1/orchestrator/start`,{}),stopOrchestrator:()=>j(`/v1/orchestrator/stop`,{}),status:()=>N(`/v1/status`),spawn:e=>j(`/v1/agents`,e),signal:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/signal`,{action:t}),paste:(e,t)=>j(`/v1/paste`,{type:e,data:t}),agentInput:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/input`,{data:t})},oe=[{id:`macos`,label:`macOS`},{id:`linux`,label:`Linux`},{id:`windows`,label:`Windows`}],se={cmd:`caprock down && caprock up`,note:`The running daemon is the old binary until it restarts. Your database is untouched.`},F={cmd:`caprock status`,note:`Confirms the new version is the one running, and that hooks are still registered.`},ce={label:`Homebrew`,steps:[{cmd:`brew update && brew upgrade caprock`,note:`The update is not optional: without it Homebrew reads a cached copy of the tap, refreshed at most once a day, and reports "already installed" for a release that is already out.`},se,F]},le={label:`Scoop`,steps:[{cmd:`scoop update caprock`,note:`Scoop refreshes its buckets as part of this, so no separate step.`},se,F]},ue={label:`go install`,steps:[{cmd:`go install github.com/dspv/caprock/cmd/caprock@latest`,note:`Also install the hook shim: same command with cmd/caprock-hook.`},se,F]},de={label:`Downloaded binary`,steps:[{cmd:``,note:`Download the archive for your platform from the release page, and replace the caprock and caprock-hook binaries with the ones inside it.`},se,F]};function fe(e){switch(e){case`macos`:return[ce,ue,de];case`linux`:return[ce,ue,de];case`windows`:return[le,ue,de]}}function pe(e,t){let n=`${t??``} ${e}`.toLowerCase();return n.includes(`win`)?`windows`:n.includes(`mac`)||n.includes(`darwin`)||n.includes(`iphone`)||n.includes(`ipad`)?`macos`:`linux`}function me(e){if(e&&e.startsWith(`scoop`))return`windows`}function he(e,t){return e?ye(e,fe(t))===void 0:!1}var ge=`caprock-update-platform`;function _e(){try{let e=localStorage.getItem(ge);return oe.some(t=>t.id===e)?e:void 0}catch{return}}function ve(e){try{localStorage.setItem(ge,e)}catch{}}function ye(e,t){if(!e)return;let n=e.split(/\s+/)[0];if(n)return t.find(e=>e.steps.some(e=>e.cmd.startsWith(n)))}function I(e,t=[],n={}){let{live:r=!0,intervalMs:i=0}=n,a=p(400),[o,s]=(0,l.useState)({data:void 0,error:void 0,loading:!0,refresh:()=>{},loadedAt:0}),c=(0,l.useRef)(0),u=(0,l.useRef)(e);u.current=e;let d=(0,l.useCallback)(()=>{let e=++c.current;u.current().then(t=>{e===c.current&&s(e=>({...e,data:t,error:void 0,loading:!1,loadedAt:Date.now()}))},t=>{e===c.current&&s(e=>({...e,error:t,loading:!1}))})},[]);return(0,l.useEffect)(d,[d,...t]),(0,l.useEffect)(()=>{r&&a>0&&d()},[r,a,d]),(0,l.useEffect)(()=>{if(!i)return;let e=window.setInterval(d,i);return()=>window.clearInterval(e)},[i,d]),{...o,refresh:d}}var be=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=be()}))(),xe=[{label:`Pro`,kind:`flat`,usd:20,note:`$20/mo`},{label:`Max 5×`,kind:`flat`,usd:100,note:`$100/mo`},{label:`Max 20×`,kind:`flat`,usd:200,note:`$200/mo`},{label:`Team seat`,kind:`flat`,usd:30,note:`$30/seat/mo`},{label:`API / Bedrock`,kind:`metered`,usd:0,note:`billed per token`}],Se,Ce=null,we=new Set;function Te(){for(let e of we)e()}function Ee(){let[,e]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let t=()=>e(e=>e+1);return we.add(t),!Se&&!Ce&&(Ce=P.settings().then(e=>{Se=e}).catch(()=>{Se={update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0}}).finally(()=>{Ce=null,Te()})),()=>{we.delete(t)}},[]),[Se,e=>{Se=e,Te(),P.saveSettings(e).catch(()=>{})}]}function De({plan:e,onSave:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let a=e?.plan_kind?e.plan_kind===`metered`?e.plan_label||`API`:`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`set plan`;return(0,L.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,L.jsx)(`button`,{onClick:()=>r(e=>!e),className:`mono text-[11px] px-1.5 py-0.5 rounded-sm border ${e?.plan_kind?`border-border text-fg-muted hover:text-fg`:`border-accent/50 text-accent`}`,title:`How you pay for Claude Code — Caprock cannot detect this, so you tell it`,children:a}),n&&(0,L.jsx)(Oe,{plan:e,onSave:e=>{t(e),r(!1)}})]})}function Oe({plan:e,onSave:t}){let[n,r]=(0,l.useState)(String(e?.plan_usd_per_month||``)),i=e??{update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0};return(0,L.jsxs)(`div`,{className:`absolute right-0 top-7 z-20 w-[268px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg p-2`,children:[(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted px-1 pb-1.5`,children:`How do you pay for Claude Code? Caprock can't detect this and never guesses.`}),xe.map(n=>{let r=e?.plan_label===n.label;return(0,L.jsxs)(`button`,{onClick:()=>t({...i,plan_kind:n.kind,plan_label:n.label,plan_usd_per_month:n.usd}),className:`w-full flex items-baseline gap-2 px-1.5 py-1 rounded-sm text-left text-[12px] hover:bg-panel-2 ${r?`text-accent`:`text-fg`}`,children:[(0,L.jsx)(`span`,{children:n.label}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint ml-auto`,children:n.note})]},n.label)}),(0,L.jsxs)(`div`,{className:`border-t border-border mt-1.5 pt-1.5 px-1.5`,children:[(0,L.jsx)(`label`,{className:`text-[11px] text-fg-faint`,children:`Or a different monthly price`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] text-fg-faint`,children:`$`}),(0,L.jsx)(`input`,{className:`input`,inputMode:`decimal`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. 150`}),(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-1 rounded-sm hover:border-border-strong`,onClick:()=>{let e=Number(n);!Number.isFinite(e)||e<0||t({...i,plan_kind:`flat`,plan_label:`plan`,plan_usd_per_month:e})},children:`set`})]})]})]})}var ke=[{id:`bug`,label:`bug`,hint:`What did you see?`,gh:`bug`},{id:`feature`,label:`feature`,hint:`What would you want?`,gh:`enhancement`},{id:`unclear`,label:`unclear`,hint:`What did not make sense?`,gh:`question`},{id:`other`,label:`other`,hint:`Anything else — a sentence is enough.`,gh:`question`}],Ae=`dspv/caprock`;function je(e,t){if(!e)return[`Screen: ${t}`];let n=e.hooks,r=n?(n.missing?.length??0)>0?`partly installed`:n.shim_exists?`installed`:`not installed`:`unknown`;return[`Caprock ${e.version}${e.platform?` (${e.platform})`:``}`,`Screen: ${t}`,`${e.events.toLocaleString(`en-US`)} events${e.owned_active?` · ${e.owned_active} owned session(s) running`:``}`,`Hooks: ${r} · Orchestration: ${e.orchestration?`on`:`off`}`]}function Me(e,t,n){let r=n.trim().split(` +`)[0]?.trim()??``;return`[${e}] ${t}: ${r.length>60?`${r.slice(0,57)}…`:r}`}function Ne(e,t,n){let r=e===`bug`?`What happened`:e===`feature`?`What is missing`:e===`unclear`?`What is unclear`:`Feedback`,i=t.trim(),a=i.length>6e3?`${i.slice(0,Fe)}\n\n_[…truncated — the rest did not fit in the link; paste it below]_`:i;return[`### ${r}`,``,a,``,`### Context`,``,...n.map(e=>`- ${e}`),``,`Filed from the Caprock dashboard. Nothing was sent automatically — this issue was opened in your browser for you to review.`].join(` +`)}function Pe(e,t,n,r){let i=ke.find(t=>t.id===e)??ke[0];return`https://github.com/${Ae}/issues/new?${new URLSearchParams({title:Me(e,t,n),body:Ne(e,n,r),labels:i.gh}).toString()}`}var Fe=6e3;function Ie(e){return e.trim().length>=8}function Le({screen:e}){let[t,n]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,title:`Report a bug, ask for something, or say what was unclear`,children:`feedback`}),t&&(0,L.jsx)(Re,{screen:e,onClose:()=>n(!1)})]})}function Re({screen:e,onClose:t}){let[n,r]=(0,l.useState)(`bug`),[i,a]=(0,l.useState)(``),o=je(I(()=>P.status(),[],{live:!1,intervalMs:0}).data,e),s=Ie(i),c=ke.find(e=>e.id===n)??ke[0],u=()=>{s&&(window.open(Pe(n,e,i,o),`_blank`,`noopener`),t())};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[12vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[660px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Tell us what happened`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,L.jsx)(`div`,{className:`flex gap-1.5`,children:ke.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.id),className:`text-[13px] px-3.5 py-1.5 rounded-sm border font-mono ${e.id===n?`border-accent/60 bg-accent/10 text-accent`:`border-border text-fg-muted hover:text-fg`}`,children:e.label},e.id))}),(0,L.jsx)(`textarea`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:c.hint,rows:6,className:`input w-full resize-y text-[14px] leading-relaxed`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&u()}}),(0,L.jsxs)(`div`,{className:`border border-border rounded-sm bg-panel-2/50 px-3 py-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:`Attached`}),(0,L.jsx)(`ul`,{className:`text-[11px] text-fg-muted num grid gap-0.5`,children:o.map(e=>(0,L.jsx)(`li`,{children:e},e))})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:u,disabled:!s,className:`text-[12px] px-3 py-1.5 rounded-sm border ${s?`border-accent/50 bg-accent/10 text-accent hover:bg-accent/20`:`border-border text-fg-faint cursor-not-allowed`}`,children:`Open a GitHub issue →`}),(0,L.jsx)(`span`,{className:`text-[12px] ${s?`text-fg-faint`:`text-fg-muted`}`,children:s?`⌘↵ to open`:`One sentence is enough.`})]}),(0,L.jsx)(`p`,{className:`text-[11px] text-fg-faint leading-relaxed`,children:`Nothing is sent from here — the issue opens prefilled in your browser for you to submit.`})]})]})})}var ze=1200,Be=630;function Ve(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}var He={command:`running commands`,edit:`writing code`,read:`reading code`,mcp:`MCP tools`,web:`web research`,other:`other tools`,none:`no tool call`};function Ue(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/^claude-/,``).replace(/-\d{8}$/,``).slice(0,18)}function We(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function Ge(e,t){let n=Ve(`--color-bg`,`#141414`),r=Ve(`--color-panel`,`#1a1a19`),i=Ve(`--color-border`,`#2a2a28`),a=Ve(`--color-fg`,`#e8e6e2`),o=Ve(`--color-fg-muted`,`#a9a59e`),s=Ve(`--color-fg-faint`,`#6f6b64`),c=Ve(`--color-accent`,`#feb157`),l=Ve(`--color-ok`,`#7fc99a`),u=`"JetBrains Mono", ui-monospace, monospace`,d=`"Hanken Grotesk", ui-sans-serif, system-ui, sans-serif`;e.fillStyle=n,e.fillRect(0,0,ze,Be);let f=(t,n,r,i,a=12)=>{e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()},p=(t,n,a,o)=>{f(t,n,a,o),e.fillStyle=r,e.fill(),e.strokeStyle=i,e.lineWidth=1,e.stroke()},m=(t,n,r,i,a,o=d,s=400,c=`left`)=>{e.fillStyle=a,e.font=`${s} ${i}px ${o}`,e.textAlign=c,e.fillText(r,t,n)};e.font=`600 32px ${d}`;let h=`My stats on`,g=e.measureText(` `).width,_=e.measureText(h).width;m(64,78,h,32,a,d,600);let v=64+_+g;m(v,78,`caprock.dev`,32,c,d,600);let y=e.measureText(`caprock.dev`).width,b=t.takenAt.toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`});m(v+y+g*2,78,`– ${b}`,26,s,d,600),[[`TODAY`,S(t.today.cost),`${t.today.sessions} sessions`,c],[`THIS WEEK`,S(t.week.cost),`${t.week.sessions} sessions`,a],[`THIS MONTH`,S(t.month.cost),`${We(t.month.tokens)} tokens`,a],[`ALL TIME`,S(t.allTime.cost),`${t.allTime.days} active days`,c],[`A DAY`,S(t.allTime.cost/Math.max(1,t.allTime.days)),`on average`,a],[`TOKENS`,We(t.allTime.tokens),`all time`,a],[`PER 1M TOKENS`,S(t.allTime.cost/Math.max(1,t.allTime.tokens/1e6)),`what a million costs`,a],[`CACHE HIT`,`${Math.round(t.cacheHitPct)}%`,`input cost cut`,l]].forEach(([e,t,n,r],i)=>{let a=64+i%4*272,c=130+Math.floor(i/4)*114;p(a,c,256,98),m(a+20,c+30,e,13,s,u),m(a+20,c+56,t,28,r,d,600),m(a+20,c+81,n,14,o)});let x=(t,n,r,i)=>{let l=44+r.length*26+12;p(t,n,524,l),m(t+20,n+30,i,13,s,u);let d=Math.max(...r.map(e=>e.cost),1),h=r.reduce((e,t)=>e+t.cost,0),g=t+170;return r.forEach((r,i)=>{let l=n+62+i*26;m(t+20,l,r.label,14,o,u),e.fillStyle=c,e.globalAlpha=.85;let p=Math.max(2,164*(r.cost/d));f(g,l-10,p,10,Math.min(3,p/2)),e.fill(),e.globalAlpha=1,m(t+524-62,l,S(r.cost),14,a,u,400,`right`);let _=h>0?Math.max(1,Math.floor(100*r.cost/h)):0;m(t+524-20,l,`${_}%`,14,s,u,400,`right`)}),l},C=x(64,372,t.models,`WHERE THE MONEY WENT`);x(612,372,t.work,`WHAT IT WENT ON`);let w=372+C+34;m(64,w,`at API list prices — not a bill, and not money saved`,14,s),m(1136,w,`What's yours?`,15,c,d,600,`right`),e.textAlign=`left`}function Ke(e=new Date){let t=e=>String(e).padStart(2,`0`);return`caprock-${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}.png`}async function qe(){let[e,t,n,r]=await Promise.all([P.summary(`today`),P.summary(`7d`),P.summary(`30d`),P.history(`all`)]),i=e=>e.tokens_in+e.tokens_out+e.cache_read+e.cache_write;return{takenAt:new Date,today:{cost:e.cost_usd,sessions:e.sessions},week:{cost:t.cost_usd,sessions:t.sessions},month:{cost:n.cost_usd,tokens:i(n)},allTime:{cost:r.totals.cost_usd,days:r.totals.days,tokens:i(r.summary)},cacheHitPct:(n.savings?.hit_rate??0)*100,models:(n.models??[]).slice(0,5).map(e=>({label:Ue(e.model),cost:e.cost_usd})),work:(n.work??[]).slice(0,5).map(e=>({label:He[e.kind]??e.kind,cost:e.cost_usd}))}}async function Je(e){let t=document.createElement(`canvas`);t.width=ze,t.height=Be;let n=null;try{n=t.getContext(`2d`)}catch{return null}return n?(Ge(n,e),await new Promise(e=>{if(typeof t.toBlob!=`function`){e(null);return}t.toBlob(t=>e(t),`image/png`)})):null}function Ye(e){let t=`over ${e.days} active days`;return`${S(e.cost_usd)} of Claude Code ${t}, across ${e.sessions.toLocaleString(`en-US`)} sessions — measured on my own machine with Caprock. https://caprock.dev`}function Xe(){let[e,t]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>t(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2 py-0.5 text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of your figures`,children:`Share`}),e&&(0,L.jsx)(Ze,{onClose:()=>t(!1)})]})}function Ze({onClose:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=async()=>{let[e,t]=await Promise.all([qe(),P.history(`all`)]);return{blob:await Je(e),text:Ye(t.totals)}},c=async()=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t}=await s();if(!t){o(`Could not draw the card in this browser.`),i(!1);return}let r=new File([t],Ke(),{type:`image/png`});n(!1),await navigator.share({files:[r]}),e()}catch(e){e?.name!==`AbortError`&&o(`Sharing was not available — the card was not sent.`),i(!1)}finally{n(!1)}}},u=async e=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t,text:n}=await s();if(!t){o(`Could not draw the card in this browser.`);return}let r=URL.createObjectURL(t),i=document.createElement(`a`);if(i.href=r,i.download=Ke(),i.click(),URL.revokeObjectURL(r),e===`download`){o(`Saved to your downloads.`);return}let a=e===`x`?`https://x.com/intent/tweet?text=${encodeURIComponent(n)}`:`https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(n)}`;window.open(a,`_blank`,`noopener`),o(`Card saved and the post opened — drag the image in.`)}finally{n(!1),i(!1)}}},d=typeof navigator<`u`&&typeof navigator.canShare==`function`&&navigator.canShare({files:[new File([],`x.png`,{type:`image/png`})]});return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[14vh]`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":`Share your figures`,children:(0,L.jsxs)(`div`,{className:`w-[420px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-center border-b border-border px-4 py-3`,children:[(0,L.jsx)(`h2`,{className:`text-[13px] font-medium text-fg`,children:`Share your figures`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2.5`,children:[d&&(0,L.jsxs)(`button`,{onClick:c,disabled:r,className:`rounded-md border border-accent bg-accent/15 px-4 py-3 text-[14px] font-medium text-accent hover:bg-accent/25 disabled:opacity-50`,children:[t?`Drawing the card…`:`Send it somewhere`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] font-normal text-fg-muted`,children:`Opens your share menu — Messages, Mail, anywhere`})]}),(0,L.jsxs)(`button`,{onClick:()=>u(`download`),disabled:r,className:`rounded-md border border-border bg-transparent px-4 py-3 text-[14px] text-fg transition-colors hover:border-border-strong hover:bg-panel-2 disabled:opacity-50`,children:[t&&!d?`Drawing the card…`:`Save the image`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] text-fg-muted`,children:`A PNG in your downloads, to post wherever you like`})]})]}),(0,L.jsxs)(`ul`,{className:`mt-4 grid gap-1 text-[13px] text-fg-muted`,children:[(0,L.jsx)(`li`,{children:`Totals only — no names, no paths, nothing Claude wrote.`}),(0,L.jsx)(`li`,{children:`Drawn on your machine. Uploaded nowhere.`})]}),a&&(0,L.jsx)(`p`,{className:`mt-2 text-[12px] text-fg-muted`,children:a})]})]})})}function Qe(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),[t,n]=(0,l.useState)(!1),r=e.data?.totals;return!r||r.sessions===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1 text-[12px] text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of these figures`,children:`Share these numbers`}),t&&(0,L.jsx)(Ze,{onClose:()=>n(!1)})]})}var $e={cap:{title:`A daily cap that pauses sessions`,body:`A number for the day. Cross it and Caprock stops its own sessions.`,points:[`A runaway loop stops at $40 instead of finishing at $400`,`It happens while you are asleep, not in tomorrow’s summary`,`Your own sessions are never touched — only the ones Caprock started`]},gemini:{title:`Ask Gemini, on your own key`,body:`A second model inside Caprock, paid for by you, at Google’s prices.`,points:[`Ask about your own sessions without leaving the dashboard`,`What it costs is counted and shown beside your Claude spend`,`Caprock never stores the key — it reads it from your environment`],setup:`Set GEMINI_API_KEY in the daemon’s environment and restart it. Google bills you directly.`},report:{title:`A weekly report, sent where you are`,body:`Monday morning, before you open a terminal.`,points:[`What moved: the repository that cost 3× its usual week`,`Last week against the one before it, per repository and model`,`Through your own Telegram bot — nothing passes our server`],setup:`Setup: one message to BotFather, about two minutes.`}};function et({p:e,onClose:t}){return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsxs)(`a`,{href:e.yearly.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium/75 px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:bg-premium`,children:[`$`,e.yearly.charged_usd,` / year`]}),(0,L.jsxs)(`a`,{href:e.lifetime?.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium-strong px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:brightness-110`,children:[`$`,e.lifetime?.charged_usd,` once`]})]}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-center text-[11px] leading-snug text-fg-faint`,children:[(0,L.jsx)(`span`,{children:`Every Premium feature, renews yearly`}),(0,L.jsx)(`span`,{children:`Every Premium feature, now and future — no renewal`})]})]}):(0,L.jsx)(`div`,{className:`h-[92px] text-[13px] text-fg-faint`,children:`…`})}function tt({feature:e,onClose:t}){let n=I(()=>P.premium(),[]).data,r=$e[e];return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[12vh]`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Caprock Premium`,children:(0,L.jsxs)(`div`,{className:`w-[440px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-premium-strong`,children:`Caprock Premium`}),(0,L.jsx)(`h2`,{className:`mt-1 text-[16px] font-medium leading-snug text-fg`,children:r.title})]}),(0,L.jsx)(`button`,{onClick:t,className:`-mr-1 ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-5 pt-3`,children:[(0,L.jsx)(`p`,{className:`text-[13px] leading-relaxed text-fg-muted`,children:r.body}),(0,L.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:r.points.map(e=>(0,L.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-fg`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-premium-strong`,children:`·`}),(0,L.jsx)(`span`,{children:e})]},e))}),r.setup&&(0,L.jsx)(`p`,{className:`mt-2.5 text-[12px] text-fg-faint`,children:r.setup})]}),(0,L.jsx)(`div`,{className:`mt-4 border-t border-border px-5 py-4`,children:(0,L.jsx)(et,{p:n,onClose:t})}),(0,L.jsx)(`footer`,{className:`border-t border-border px-5 py-3 text-[12px]`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`a`,{href:n?.info_url??`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`whitespace-nowrap text-fg-muted no-underline hover:text-fg`,children:`Read more`}),(0,L.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:`opens a new tab`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`Close`})]})}),(0,L.jsx)(`p`,{className:`border-t border-border px-5 py-2.5 text-[11px] leading-relaxed text-fg-faint`,children:`Everything Caprock does now stays free and Apache-2.0 — Premium only ever adds.`})]})})}function nt(){let[e,t]=(0,l.useState)(!1),n=I(()=>P.premium(),[],{live:!1,intervalMs:3e5});if(!n.data?.yearly?.url)return null;if(n.data.license?.active)return(0,L.jsx)(`span`,{className:`text-premium-strong`,children:`premium`});let r=n.data;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center overflow-hidden rounded-sm border border-premium/60`,children:[(0,L.jsxs)(`a`,{href:r.yearly.url,target:`_blank`,rel:`noreferrer`,className:`bg-premium px-2 py-0.5 text-white no-underline hover:brightness-110`,children:[`premium $`,r.yearly.charged_usd,`/yr`]}),(0,L.jsx)(`button`,{onClick:()=>t(!0),"aria-label":`What Premium includes`,title:`What Premium includes`,className:`px-1.5 py-0.5 text-premium-strong hover:bg-premium/10`,children:`›`})]}),e&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>t(!1)})]})}var rt=`https://github.com/dspv/caprock`,it=`https://caprock.dev/teams`,at=`https://caprock.dev/premium`,ot=`caprock.footer.starred`;function st(){let[e,t]=(0,l.useState)(()=>localStorage.getItem(ot)===`1`);return(0,L.jsx)(`footer`,{className:`mt-6 border-t border-border`,children:(0,L.jsxs)(`div`,{className:`max-w-[1600px] mx-auto px-3 py-4 flex flex-wrap items-center gap-x-6 gap-y-3 text-[11px] text-fg-faint`,children:[(0,L.jsxs)(`a`,{href:it,target:`_blank`,rel:`noreferrer`,className:`group inline-flex items-center gap-2 no-underline`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted group-hover:text-fg`,children:`Want this for your team?`}),(0,L.jsx)(`span`,{className:`text-accent group-hover:text-accent-strong`,children:`Caprock for Teams →`})]}),(0,L.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-4`,children:[(0,L.jsx)(`a`,{href:at,target:`_blank`,rel:`noreferrer`,className:`text-fg-muted hover:text-fg no-underline`,title:`A daily spend cap — Caprock pauses its own sessions when the day passes a limit you set`,children:`premium`}),!e&&(0,L.jsx)(`a`,{href:rt,target:`_blank`,rel:`noreferrer`,onClick:()=>{localStorage.setItem(ot,`1`),t(!0)},className:`text-fg-faint hover:text-fg no-underline`,title:`Opens GitHub in a new tab`,children:`★ star on GitHub`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/blog`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`blog`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/docs`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`docs`})]})]})})}var ct=[{route:{name:`now`},label:`Now`},{route:{name:`cost`},label:`Cost`},{route:{name:`history`},label:`Lifetime`},{route:{name:`notes`},label:`Answers`},{route:{name:`tasks`},label:`Tasks`}];function lt(e){switch(e.name){case`now`:return`Now`;case`session`:return`Session detail`;case`cost`:return`Cost`;case`history`:return`Lifetime`;case`tasks`:return`Tasks`;case`graph`:return`Graph`;case`notes`:return`Answers`;case`settings`:return`Status`}}function ut({route:e,children:t}){let n=f(),[r,i]=Ee(),a=t=>t.name===e.name||t.name===`now`&&e.name===`session`;return(0,L.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,L.jsxs)(`header`,{className:`h-10 border-b border-border bg-panel flex items-center px-3 gap-4 sticky top-0 z-10`,children:[(0,L.jsxs)(`a`,{href:`#/`,className:`flex items-center gap-2 text-fg no-underline hover:no-underline`,children:[(0,L.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 32 32`,"aria-hidden":!0,children:[(0,L.jsx)(`path`,{d:`M6 22 L16 8 L26 22 Z`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`3`,strokeLinejoin:`round`}),(0,L.jsx)(`rect`,{x:`6`,y:`22`,width:`20`,height:`3`,fill:`var(--color-accent)`})]}),(0,L.jsx)(`span`,{className:`font-medium tracking-wide text-[13px]`,children:`caprock`}),(0,L.jsx)(`span`,{className:`text-fg-faint text-[11px] hidden sm:inline`,children:`mission control`})]}),(0,L.jsx)(`nav`,{className:`inline-flex items-center gap-0.5 ml-2 rounded-md bg-panel-2 p-0.5`,children:ct.map(e=>(0,L.jsxs)(`a`,{href:g(e.route),"aria-current":a(e.route)?`page`:void 0,className:`px-2.5 py-1 rounded-[5px] text-[12px] no-underline hover:no-underline transition-colors ${a(e.route)?`bg-accent text-panel font-medium`:`text-fg hover:text-accent`}`,children:[e.label,e.phase&&(0,L.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wider text-fg-faint`,children:e.phase})]},e.label))}),(0,L.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-fg-muted`,children:[(0,L.jsx)(Xe,{}),(0,L.jsx)(nt,{}),(0,L.jsx)(Le,{screen:lt(e)}),(0,L.jsx)(ft,{state:n.conn,lastFrameAt:n.lastFrameAt}),(0,L.jsx)(De,{plan:r,onSave:i}),(0,L.jsx)(dt,{}),(0,L.jsx)(pt,{}),(0,L.jsx)(`a`,{href:`#/settings`,className:`text-fg-muted hover:text-fg no-underline`,children:`status`})]})]}),(0,L.jsx)(`main`,{className:`flex-1 p-3 max-w-[1600px] w-full mx-auto`,children:t}),(0,L.jsx)(st,{})]})}function dt(){let[e,t]=A(),n=e===`dark`;return(0,L.jsx)(`button`,{type:`button`,onClick:t,title:n?`Switch to light theme`:`Switch to dark theme`,"aria-label":n?`Switch to light theme`:`Switch to dark theme`,className:`text-fg-muted hover:text-fg inline-flex items-center`,children:n?(0,L.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M19.1 4.9l-1.4 1.4M6.3 17.7l-1.4 1.4`})]}):(0,L.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,L.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})})})}function ft({state:e,lastFrameAt:t}){let n=re(1e3),r=e===`open`?`bg-ok`:e===`connecting`?`bg-warn`:`bg-danger`,i=e===`open`?`live · ${t?T(t,n):`connected`}`:e===`connecting`?`connecting…`:`disconnected — reconnecting`;return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:e===`open`?`Connected to the daemon. The time is when it last sent anything — on an idle machine that keeps counting up, which is normal.`:`WebSocket /v1/live`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${r}`}),(0,L.jsx)(`span`,{className:`num`,children:i})]})}function pt(){let e=I(()=>P.status(),[],{live:!1,intervalMs:6e4}),t=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:6e4}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=e.data?.version;if(!o)return null;let s=/^v?\d+\.\d+\.\d+$/.test(o),c=s&&t.data?.update_available?t.data.latest:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>r(!0),className:c?`mono text-[11px] text-accent hover:text-accent-strong`:`mono text-[11px] text-fg-faint hover:text-fg`,title:c?`${c} is available — you are on ${o}`:`version and updates`,children:c?`${o} → ${c}`:s?o:`dev build`}),t.data?.notes&&(0,L.jsx)(`button`,{onClick:()=>a(!0),className:`text-[11px] text-fg-faint hover:text-accent`,title:`what changed in ${t.data.notes_for??`the latest release`}`,children:`what's new`}),n&&(0,L.jsx)(ht,{onClose:()=>r(!1)}),i&&t.data&&(0,L.jsx)(mt,{u:t.data,onClose:()=>a(!1)})]})}function mt({u:e,onClose:t}){return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[620px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`What's new`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`What's new`}),e.notes_for&&(0,L.jsx)(`span`,{className:`mono text-[12px] text-accent`,children:e.notes_for}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsx)(`div`,{className:`overflow-y-auto px-4 py-3`,children:(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[13px] leading-relaxed text-fg-muted`,children:e.notes})}),(0,L.jsx)(`div`,{className:`border-t border-border px-4 py-2.5`,children:(0,L.jsx)(`a`,{href:e.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`the full release on GitHub →`})})]})})}function ht({onClose:e}){let t=I(()=>P.status(),[],{live:!1,intervalMs:0}),n=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:0}),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(void 0),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(()=>_e()??pe(navigator.userAgent,navigator.userAgentData?.platform)),[f,p]=(0,l.useState)(!1),m=a??n.data,h=t.data?.version??``,g=/^v?\d+\.\d+\.\d+$/.test(h),_=!f&&he(m?.command,u)?me(m?.command)??(u===`windows`?`macos`:u):u,v=fe(_),y=ye(m?.command,v),[b,x]=(0,l.useState)(void 0),S=v.find(e=>e.label===b)??y??v[0],C=e=>{d(e),p(!0),ve(e),x(void 0)},w=async()=>{i(!0);try{o(await P.checkUpdate())}catch{}finally{i(!1)}},T=e=>{navigator.clipboard.writeText(e),c(e),setTimeout(()=>c(``),1600)};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:e,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[560px] max-h-[80vh] overflow-y-auto border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Version and updates`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Version`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`running`}),(0,L.jsx)(`span`,{className:`mono text-fg`,children:g?h:`${h} (local build)`}),m?.update_available&&(0,L.jsxs)(`span`,{className:`mono text-accent`,children:[`→ `,m.latest,` is out`]})]}),m?.enabled===!1?(0,L.jsxs)(`div`,{className:`text-[13px] text-fg-muted`,children:[`Release checks are off, so this copy never asks GitHub what the latest version is. Turn them on in`,` `,(0,L.jsx)(`a`,{href:`#/status`,onClick:e,className:`text-accent no-underline hover:text-accent-strong`,children:`status`}),`.`]}):m?.update_available?null:(0,L.jsx)(`div`,{className:`text-[13px] text-fg-muted`,children:m?.latest?`Up to date — ${m.latest} is the latest release.`:`No newer release found.`}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[oe.map(e=>(0,L.jsx)(`button`,{onClick:()=>C(e.id),className:`rounded-sm px-2.5 py-1 text-[12px] transition-colors ${_===e.id?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.id)),v.length>1&&(0,L.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:v.map(e=>(0,L.jsxs)(`button`,{onClick:()=>x(e.label),className:`rounded-sm px-2 py-1 text-[11px] transition-colors ${S.label===e.label?`text-accent`:`text-fg-faint hover:text-fg-muted`}`,title:e.label===y?.label?`how this copy appears to be installed`:void 0,children:[e.label,e.label===y?.label?` ·`:``]},e.label))})]}),(0,L.jsx)(`ol`,{className:`grid gap-2.5`,children:S.steps.map((e,t)=>(0,L.jsxs)(`li`,{className:`grid gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:t+1}),e.cmd?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`code`,{className:`mono flex-1 truncate rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-fg`,children:e.cmd}),(0,L.jsx)(`button`,{onClick:()=>T(e.cmd),className:`shrink-0 rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1.5 text-[12px] text-accent hover:bg-accent/[0.16]`,children:s===e.cmd?`copied`:`copy`})]}):(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1 rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-accent no-underline hover:text-accent-strong`,children:`Open the release page →`})]}),(0,L.jsx)(`p`,{className:`pl-5 text-[11px] leading-relaxed text-fg-faint`,children:e.note})]},t))})]}),(0,L.jsx)(`div`,{className:`text-[11px] leading-relaxed text-fg-faint border-t border-border pt-3`,children:`Caprock does not update itself: it would have to overwrite its own binary while running, and where a package manager owns that binary, replacing it behind their back breaks the next upgrade.`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:w,disabled:r,className:`rounded-md border border-border px-3 py-1.5 text-[13px] text-fg-muted hover:text-fg disabled:opacity-50`,children:r?`checking…`:`check now`}),(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`release notes →`})]})]})]})})}var gt=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[caprock ui]`,e,t.componentStack)}render(){return this.state.error?(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 rounded-[var(--radius-panel)] px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`div`,{className:`text-danger font-medium`,children:[this.props.label??`This view`,` failed to render`]}),(0,L.jsx)(`div`,{className:`mono text-fg-muted mt-1`,children:this.state.error.message}),(0,L.jsx)(`button`,{className:`mt-2 border border-border px-2 py-0.5 rounded-sm text-fg-muted hover:text-fg`,onClick:()=>this.setState({error:null}),children:`retry`})]}):this.props.children}};function R({title:e,center:t,right:n,children:r,className:i=``,onMouseEnter:a,onMouseLeave:o}){return(0,L.jsxs)(`section`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] shadow-[var(--shadow-panel)] min-w-0 ${i}`,onMouseEnter:a,onMouseLeave:o,children:[(e||t||n)&&(0,L.jsxs)(`header`,{className:`relative flex items-center justify-between px-3 py-2 border-b border-border bg-panel-2/60 rounded-t-[var(--radius-panel)]`,children:[(0,L.jsx)(`h2`,{className:`text-[11px] uppercase tracking-[0.12em] text-fg-muted font-medium`,children:e}),t?(0,L.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2`,children:t}):null,(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:n})]}),(0,L.jsx)(`div`,{children:r})]})}function z({label:e,value:t,sub:n,tone:r,size:i=`default`}){return(0,L.jsxs)(`div`,{className:`flex h-full flex-col px-3 py-2.5 min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`div`,{className:`num font-semibold tracking-[-0.01em] ${i===`hero`?`text-[34px] leading-[1.05]`:i===`compact`?`text-[17px] leading-tight`:`text-[24px] leading-[1.1]`} ${r===`ok`?`text-ok`:r===`warn`?`text-warn`:r===`danger`?`text-danger`:r===`info`?`text-info`:`text-fg`}`,children:t}),n&&(0,L.jsx)(`div`,{className:`mt-auto pt-1 text-[11px] text-fg-muted num truncate`,children:n})]})}var _t={working:`working`,idle:`idle`,"waiting-on-you":`waiting on you`,looping:`looping?`,error:`error`,ended:`ended`};function vt(e){switch(e){case`working`:return`ok`;case`idle`:return`warn`;case`waiting-on-you`:return`warn`;case`looping`:return`danger`;case`error`:return`danger`;case`ended`:return`muted`}}function yt({health:e}){let t=vt(e);return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 border rounded-sm px-1.5 py-[1px] text-[11px] leading-4 ${t===`ok`?`text-ok border-ok/40 bg-ok/10`:t===`warn`?`text-warn border-warn/40 bg-warn/10`:t===`danger`?`text-danger border-danger/40 bg-danger/10`:`text-fg-muted border-border bg-panel-2`}`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${t===`ok`?`bg-ok`:t===`warn`?`bg-warn`:t===`danger`?`bg-danger`:`bg-fg-faint`} ${e===`working`?`animate-pulse`:``}`}),_t[e]]})}function bt({values:e,width:t=120,height:n=24,tone:r=`info`}){if(e.length<2)return(0,L.jsx)(`svg`,{width:t,height:n,"aria-hidden":!0});let i=Math.max(...e,1e-9),a=Math.min(...e,0),o=i-a||1,s=t/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(n-(e-a)/o*(n-2)-1).toFixed(1)}`).join(` `),l=r===`ok`?`var(--color-ok)`:r===`warn`?`var(--color-warn)`:r===`danger`?`var(--color-danger)`:r===`accent`?`var(--color-accent)`:`var(--color-info)`;return(0,L.jsx)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:`block`,"aria-hidden":!0,children:(0,L.jsx)(`polyline`,{fill:`none`,stroke:l,strokeWidth:`1.25`,points:c,vectorEffect:`non-scaling-stroke`})})}function xt({title:e,children:t}){return(0,L.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,L.jsx)(`div`,{className:`text-fg-muted`,children:e}),t&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-faint mt-1`,children:t})]})}function St({rows:e=3,className:t=``}){return(0,L.jsx)(`div`,{className:`px-3 py-2 grid gap-2 ${t}`,"aria-hidden":!0,children:Array.from({length:e},(e,t)=>(0,L.jsx)(`div`,{className:`h-3 rounded-sm bg-panel-2 skeleton-pulse`,style:{width:`${[92,74,83,61,88][t%5]}%`}},t))})}function Ct({command:e,className:t=``}){let[n,r]=(0,l.useState)(!1);return(0,L.jsx)(`button`,{className:`mono text-[12px] bg-panel-2 border border-border px-2 py-0.5 rounded-sm hover:border-border-strong text-fg text-left ${t}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)})},title:`copy to clipboard — run it in your terminal`,children:n?`copied`:`$ ${e}`})}var wt={edit:{label:`writing code`,title:`Turns that wrote to a file — Edit, Write, NotebookEdit.`},command:{label:`running commands`,title:`Turns that ran a shell command — builds, tests, git, anything through Bash. The command itself is free; what costs is the turn that issued it and read its output.`},read:{label:`reading and searching`,title:`Turns that read or searched the codebase — Read, Grep, Glob. The file contents enter the prompt and are billed, which is why reading is not free.`},web:{label:`web research`,title:`Turns that fetched or searched the web — WebFetch, WebSearch.`},mcp:{label:`MCP tools`,title:`Turns that called one of your own MCP integrations.`},other:{label:`other tools`,title:`Turns that called a tool in none of the categories above — subagents, task and skill control, and any tool Caprock does not yet know by name.`},none:{label:`no tool call`,title:`Turns that called no tool at all. They may have been reasoning, planning, answering a question or writing prose — Caprock records which tools ran, not what a turn was thinking, so it does not claim to know which.`}},Tt=`Each turn counts toward one kind of work, decided by the tools it called: writing a file wins over running a command, which wins over reading or searching, then web, then an MCP tool, then anything else. A turn that called no tool is counted as exactly that. Each turn goes whole to one row, never split, so the rows add up to the total exactly.`;function Et({summary:e}){let t=e,n=t?.work??[],r=t?.work_unlinked_calls??0,i=t?.tool_calls??0,a=r>0&&i>0&&r/i>.01;return(0,L.jsxs)(R,{title:`What it went on`,right:(0,L.jsx)(`span`,{title:Tt,children:`by cost`}),children:[t?n.length===0&&(0,L.jsx)(xt,{title:`No priced turns in range`}):(0,L.jsx)(St,{rows:4}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:n.map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:w(e.cost_pct)})]},e.kind))})}),a&&(0,L.jsxs)(`div`,{className:`mx-3 mb-2.5 text-[11px] text-warn`,children:[r.toLocaleString(),` tool calls in this range could not be matched to the turn that paid for them, so their cost is counted under “no tool call” rather than the work they actually did. Every other row is understated by up to that much.`]})]})}function Dt({summary:e}){let t=e?.work??[],n=e?.work_unlinked_calls??0,r=e?.tool_calls??0;if(t.length===0||r===0||n/r>.2)return null;let i=t.filter(e=>e.cost_pct>=1).slice(0,5);return i.length===0?null:(0,L.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`what it went on`}),(0,L.jsx)(`a`,{href:`#/cost`,className:`text-[10px] text-fg-faint hover:text-accent no-underline`,children:`details →`})]}),(0,L.jsx)(`div`,{className:`mt-2 flex h-1.5 w-full overflow-hidden rounded-full bg-panel-2`,title:Tt,children:i.map((e,t)=>(0,L.jsx)(`span`,{className:`h-full`,style:{width:`${e.cost_pct}%`,background:`var(--color-accent)`,opacity:1-t*.17}},e.kind))}),(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1`,children:i.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-[2px] translate-y-[1px]`,style:{background:`var(--color-accent)`,opacity:1-t*.17}}),(0,L.jsx)(`span`,{className:`text-fg-muted`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsx)(`span`,{className:`num text-fg-faint`,children:w(e.cost_pct)})]},e.kind))})]})}var Ot=.62;function kt(e,t){return e?t===`tokens`?e.tokens??[]:e.cost??[]:[]}function At(e,t,n){let r=kt(e,t);if(!e||r.length===0)return[];let i=n>0?n:0;return r.map((t,n)=>{let r=Number.isFinite(t)&&t>0?t:0,a=i>0&&r>0?Math.min(1,r/i)**+Ot:0;return{value:r,at:e.from_ms+n*e.width_ms,height:a,empty:r<=0}})}function jt(e,t){let n=0;for(let r of e)for(let e of kt(r,t))Number.isFinite(e)&&e>n&&(n=e);return n}function Mt(e,t){let n=new Date(e);return t<864e5?n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function Nt(e){return e.split(`/`).filter(Boolean)}function Pt(e,t=3){let n=[],r=new Map,i=[],a=(e,t)=>{let n=r.get(e);if(n)return n;let o=Nt(e),s={path:e,name:o.length===0?`/`:o[o.length-1],depth:t,tokens:0,cost:0,turns:0,tokensPct:0,costPct:0,ownTokens:0,ownCost:0,ownTurns:0,ownTokensPct:0,ownCostPct:0,children:[],rolledUp:0};if(r.set(e,s),t===0)i.push(s);else{let e=t===1?`/`:`/`+o.slice(0,t-1).join(`/`);a(e,t-1).children.push(s)}return s};for(let r of e){if(r.unattributed||r.outside){n.push(r);continue}let e=Nt(r.path),i=e.length,o=Math.min(i,t),s=a(o===0?`/`:`/`+e.slice(0,o).join(`/`),o);s.ownTokens+=r.tokens,s.ownCost+=r.cost_usd,s.ownTurns+=r.turns,s.ownTokensPct+=r.tokens_pct,s.ownCostPct+=r.cost_pct,i>o&&s.rolledUp++;for(let t=0;t<=o;t++){let n=a(t===0?`/`:`/`+e.slice(0,t).join(`/`),t);n.tokens+=r.tokens,n.cost+=r.cost_usd,n.tokensPct+=r.tokens_pct,n.costPct+=r.cost_pct,n.turns+=r.turns}}let o=i[0],s=i;o&&o.path===`/`&&(s=[...o.children],(o.ownTokens>0||o.ownCost>0||o.ownTurns>0||o.rolledUp>0)&&s.push({...o,depth:1,tokens:o.ownTokens,cost:o.ownCost,turns:o.ownTurns,tokensPct:o.ownTokensPct,costPct:o.ownCostPct,children:[],ownTokens:o.ownTokens,ownCost:o.ownCost,ownTurns:o.ownTurns}));let c=e=>{e.sort((e,t)=>t.cost-e.cost);for(let t of e)c(t.children)};return c(s),{roots:s,buckets:n}}function Ft(e){return e.map(e=>{let t=e;for(;t.children.length===1&&t.ownTokens===0&&t.ownCost===0&&t.ownTurns===0&&t.rolledUp===0;)t=t.children[0];return{...t,children:Ft(t.children)}})}var It=[{key:`all`,label:`all`},{key:`claude`,label:`claude`},{key:`opencode`,label:`opencode`}],Lt=[{key:`today`,label:`today`},{key:`7d`,label:`7d`},{key:`30d`,label:`30d`},{key:`all`,label:`all`}],Rt=`tokens`,zt=`A turn counts toward the directory of the most recent file it touched, and keeps counting there until it touches a file somewhere else — so the commands, tests and searches between two edits count toward the directory being worked on. Reading, editing or writing a file counts as touching it; running a command does not. Each turn goes whole to one row, never split between two, so the rows add up to the repository total exactly.`,Bt=`repository-wide work`,Vt=`Turns from the start of a session, before Claude had touched any file — so there is no directory yet for them to count toward. Their cost is counted here whole rather than guessed onto the directory the session reached later.`,Ht=`outside the repository`,Ut=`Turns whose most recent file touch was outside this repository — Claude’s notes on the project, agent scratchpads, test-output directories, or another checkout. This is real work and it counts toward the repository total, but it happened outside the tree, so it is not charged to any directory inside it.`;function Wt({sessions:e,agent:t}){let[n,r]=(0,l.useState)(`7d`),[i,a]=(0,l.useState)(!1),o=I(()=>P.summary(n),[n],{intervalMs:3e4}),s=o.data?.projects??[],c=(0,l.useMemo)(()=>t===`all`?s:s.filter(e=>!e.agent||e.agent===t),[s,t]),[u,d]=(0,l.useState)(null),f=(0,l.useMemo)(()=>{if(!u)return c;let e=new Map(u.map((e,t)=>[e,t]));return[...c].sort((t,n)=>(e.get(t.project)??1/0)-(e.get(n.project)??1/0))},[c,u]),p=i?f:f.slice(0,6),m=c.reduce((e,t)=>e+t.cost_usd,0),h=c.reduce((e,t)=>e+t.tokens,0),g=(0,l.useMemo)(()=>jt(p.map(e=>e.spark),Rt),[p]),_=(0,l.useMemo)(()=>p.reduce((e,t)=>Math.max(e,t.tokens),0),[p]);return(0,L.jsx)(R,{onMouseEnter:()=>d(c.map(e=>e.project)),onMouseLeave:()=>d(null),title:`Projects`,right:(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`num text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg`,children:C(h)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,S(m),` total`]})]}),(0,L.jsx)(`span`,{className:`inline-flex border border-border rounded-sm overflow-hidden`,children:Lt.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),className:`px-1.5 py-0.5 text-[11px] mono ${n===e.key?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg-muted`}`,children:e.label},e.key))})]}),children:o.data?c.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:`No spend captured in this range yet.`}):(0,L.jsxs)(`div`,{className:`grid`,children:[p.map(t=>(0,L.jsx)(Kt,{p:t,max:_,ceiling:g,live:Gt(e).has(t.project)},t.project||`(unknown)`)),c.length>6&&(0,L.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[11px] text-fg-faint hover:text-fg-muted px-3 py-1.5 text-left border-t border-border`,children:i?`show less`:`show all ${c.length} projects`}),(0,L.jsx)(Dt,{summary:o.data}),(0,L.jsx)(Zt,{count:c.length})]}):(0,L.jsx)(St,{rows:5})})}function Gt(e){return new Set(e.filter(e=>e.status!==`ended`).map(e=>e.project).filter(Boolean))}function Kt({p:e,max:t,ceiling:n,live:r}){let i=e.paths??[],a=i.length>1,[o,s]=(0,l.useState)(!1),c=e.project||`unknown project`,u=t>0?100*e.tokens/t:0,d=(0,l.useMemo)(()=>At(e.spark,Rt,n),[e.spark,n]),f=(0,l.useMemo)(()=>{let e=Pt(i);return{roots:Ft(e.roots),buckets:e.buckets}},[i]),p=(0,l.useMemo)(()=>Math.max(0,...f.roots.map(e=>e.tokens),...f.buckets.map(e=>e.tokens)),[f]),m=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_128px_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsx)(`div`,{className:`min-w-0`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-ok shrink-0`,title:`a session is live in this project`}),(0,L.jsx)(`span`,{className:`truncate text-[14px]`,children:c}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint num shrink-0`,children:[e.sessions,` `,e.sessions===1?`session`:`sessions`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${o?`rotate-90`:``}`,children:`▶`})]})}),d.length>0?(0,L.jsx)(Xt,{bars:d,widthMs:e.spark?.width_ms??0,label:c}):(0,L.jsx)(`div`,{className:`h-1 bg-panel-2 rounded-sm overflow-hidden`,title:`${c}: share of the largest project`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${u}%`}})}),(0,L.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,L.jsx)(`div`,{className:`num text-[17px] font-semibold leading-tight text-accent`,children:C(e.tokens)}),(0,L.jsx)(`div`,{className:`num text-[13px] leading-tight text-fg-muted`,children:S(e.cost_usd)})]})]});return(0,L.jsxs)(`div`,{className:`border-t border-border first:border-t-0`,children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`w-full px-3 py-1.5 hover:bg-panel-2/50`,title:`${c}: show cost by directory`,children:m}):(0,L.jsx)(`div`,{className:`px-3 py-1.5`,children:m}),a&&o&&(0,L.jsxs)(`div`,{className:`pb-1.5 bg-panel-2/30`,children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-1 pb-0.5 text-[10px] text-fg-faint`,title:zt,children:`by files touched · share of this repository's tokens`}),f.roots.map(e=>(0,L.jsx)(qt,{n:e,max:p},e.path)),f.buckets.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-2 pb-0.5 text-[10px] uppercase tracking-[0.08em] text-fg-faint`,children:`not a directory`}),f.buckets.map(e=>(0,L.jsx)(Jt,{q:e,max:p},e.path))]})]})]})}function qt({n:e,max:t}){let[n,r]=(0,l.useState)(!1),i=t>0?100*e.tokens/t:0,a=e.children.length>0,o=(0,l.useMemo)(()=>Math.max(0,...e.children.map(e=>e.tokens)),[e.children]),s=a&&e.ownCost>0,c=e.children.length,u=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted mono`,children:e.path}),e.rolledUp>0&&(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint shrink-0`,title:`${e.rolledUp} ${e.rolledUp===1?`directory`:`directories`} below this one ${e.rolledUp===1?`is`:`are`} counted here rather than shown: the breakdown stops at 3 levels.`,children:[`+`,e.rolledUp,` deeper`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${n?`rotate-90`:``}`,children:`▶`})]}),s&&(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mt-0.5`,children:[S(e.ownCost),` here · `,S(e.cost-e.ownCost),` in `,c,` `,c===1?`subdirectory`:`subdirectories`]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/40`,style:{width:`${i}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.costPct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokensPct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost)]})]})]}),d={paddingLeft:`${28+(e.depth-1)*14}px`};return(0,L.jsxs)(`div`,{children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`w-full pr-3 py-1 hover:bg-panel-2/50`,style:d,title:`${e.path}: show the directories inside it`,children:u}):(0,L.jsx)(`div`,{className:`pr-3 py-1`,style:d,children:u}),a&&n&&e.children.map(e=>(0,L.jsx)(qt,{n:e,max:o},e.path))]})}function Jt({q:e,max:t}){let n=t>0?100*e.tokens/t:0,r=e.unattributed===!0;return(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 pl-7 pr-3 py-1`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted`,title:r?Vt:Ut,children:r?Bt:Ht}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]})]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-fg-faint/30`,style:{width:`${n}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.cost_pct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokens_pct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost_usd)]})]})]})}function Yt(e){return!Number.isFinite(e)||e<=0?`0%`:e<.1?`<0.1%`:w(e)}function Xt({bars:e,widthMs:t,label:n}){let r=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=o.getPropertyValue(`--color-accent`).trim()||`#feb157`,c=o.getPropertyValue(`--color-fg-faint`).trim()||`#837f78`,l=n/e.length;for(let t=0;ti.disconnect()},[e]);let i=e.filter(e=>!e.empty),a=i[0],o=i[i.length-1],s=!a||!o?`no spend in this range`:a===o?`all of it on ${Mt(a.at,t)}`:`${Mt(a.at,t)} → ${Mt(o.at,t)}`;return(0,L.jsx)(`canvas`,{ref:r,className:`w-full h-[14px] block`,role:`img`,"aria-label":`${n}: ${Rt} over time, ${s}`,title:`${n}: when the spend happened — ${s}`})}function Zt({count:e}){return e<10?null:(0,L.jsxs)(`a`,{href:`https://caprock.dev/teams`,target:`_blank`,rel:`noreferrer`,className:`flex items-baseline gap-2 border-t border-border px-3 py-1.5 text-[11px] no-underline hover:no-underline`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[e,` repositories on one machine.`]}),(0,L.jsx)(`span`,{className:`text-fg-faint hover:text-accent`,children:`See them across the team →`})]})}function Qt(e){return typeof e==`string`?e:``}function $t(e){let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}function en(e,t){let n=e.replace(/\s+/g,` `).trim(),r=[...n];return r.length>t?r.slice(0,t-1).join(``)+`…`:n}function tn(e){return e.replace(/(\/[\w.@%+-]+){3,}/g,e=>`…/`+e.split(`/`).filter(Boolean).slice(-2).join(`/`))}function nn(e,t){switch(e){case`Edit`:case`NotebookEdit`:return Qt(t.file_path)?{icon:`✎`,text:`editing`,detail:$t(Qt(t.file_path))}:null;case`Write`:return Qt(t.file_path)?{icon:`✎`,text:`writing`,detail:$t(Qt(t.file_path))}:null;case`Read`:return Qt(t.file_path)?{icon:`◇`,text:`reading`,detail:$t(Qt(t.file_path))}:null;case`Bash`:return Qt(t.command)?{icon:`$`,text:`running`,detail:en(tn(Qt(t.command)),46)}:null;case`Grep`:case`Glob`:return{icon:`⌕`,text:`searching`,detail:en(Qt(t.pattern)||Qt(t.query),40)||void 0};case`WebFetch`:case`WebSearch`:return{icon:`⇢`,text:`fetching`,detail:en(Qt(t.url)||Qt(t.query),44)||void 0};case`Agent`:return{icon:`⚑`,text:`spawned a subagent`,detail:Qt(t.subagent_type)||void 0};case`Skill`:return{icon:`⚑`,text:`invoked skill`,detail:Qt(t.skill)||void 0};case`TodoWrite`:return{icon:`☑`,text:`updated its plan`};default:return e?{icon:`·`,text:`used`,detail:e}:null}}function rn(e,t){let n=e.payload??{},r=Date.parse(e.ts),i={id:`${e.id}`,ts:Number.isNaN(r)?Date.now():r,sessionId:e.session_id,project:t};switch(e.kind){case`tool.pre`:{let t=nn(Qt(n.tool_name)||Qt(e.tool),n.tool_input??{});return t?{...i,...t,tone:`normal`}:null}case`tool.post`:return n.is_error?{...i,icon:`✕`,text:`a tool call failed`,tone:`danger`}:null;case`agent.spawn`:return{...i,icon:`▸`,text:`session started`,tone:`ok`};case`agent.stop`:return{...i,icon:`■`,text:`session ended`,tone:`normal`};case`context.compact`:return{...i,icon:`⇱`,text:`compacted its context`,tone:`warn`};case`throttle`:return{...i,icon:`⏳`,text:`rate-limited by the API`,tone:`warn`};case`task.created`:return{...i,icon:`+`,text:`task created`,tone:`normal`};case`task.done`:return{...i,icon:`✓`,text:`task verified — tests passed`,tone:`ok`};case`approval.requested`:return{...i,icon:`!`,text:`needs your approval`,tone:`warn`};default:return null}}function an(e,t,n=60){return e.some(e=>e.id===t.id)?e:[t,...e].slice(0,n)}function on({sessions:e,now:t,emptyHint:n}){let[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(!1),s=(0,l.useRef)(new Map),c=(0,l.useRef)(a);c.current=a;for(let t of e)t.project&&s.current.set(t.session_id,t.project);(0,l.useEffect)(()=>{let t=!1;return(async()=>{let n=[...e].sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,4),r=await Promise.all(n.map(e=>P.events(e.session_id,0,60).catch(()=>[])));if(t)return;let a=r.flat().map(e=>rn(e)).filter(e=>e!==null).sort((e,t)=>t.ts-e.ts).slice(0,40);i(e=>{let t=new Set(n.map(e=>e.session_id)),r=e.filter(e=>!e.sessionId||t.has(e.sessionId)),i=new Set(r.map(e=>e.id));return[...r,...a.filter(e=>!i.has(e.id))].sort((e,t)=>t.ts-e.ts).slice(0,60)})})(),()=>{t=!0}},[e.map(e=>e.session_id).join(`,`)]);let u=(0,l.useRef)(new Set);return u.current=new Set(e.map(e=>e.session_id)),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`||c.current)return;let t=e.data?.session_id;if(t&&s.current.has(t)&&!u.current.has(t))return;let n=rn(e.data);n&&i(e=>an(e,n))}),[]),(0,L.jsx)(R,{title:`Live activity`,right:(0,L.jsx)(`button`,{onClick:()=>o(e=>!e),className:`text-[11px] mono text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,children:a?`resume`:`pause`}),children:r.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:n??(0,L.jsxs)(L.Fragment,{children:[`Nothing yet — start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal.`]})}):(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`div`,{className:`max-h-[420px] overflow-y-auto`,children:r.map(e=>(0,L.jsx)(cn,{it:e,now:t,project:s.current.get(e.sessionId)},e.id))}),(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-panel to-transparent`})]})})}function sn(e){switch(e){case`ok`:return`text-ok`;case`warn`:return`text-warn`;case`danger`:return`text-danger`;default:return`text-fg-faint`}}function cn({it:e,now:t,project:n}){return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`grid grid-cols-[auto_auto_1fr_auto] items-baseline gap-2 px-3 py-1 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] w-3 text-center ${sn(e.tone)}`,children:e.icon}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate max-w-[12ch]`,children:n??e.project??E(e.sessionId)}),(0,L.jsxs)(`span`,{className:`text-[12px] truncate`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.text}),e.detail&&(0,L.jsx)(`span`,{className:`mono text-fg ml-1.5`,children:e.detail})]}),(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.ts,t)})]})}function ln(e){return e?.plan_kind===`metered`?`at API list price · ≈ your bill`:e?.plan_kind===`flat`?`at API list price · not a bill`:`at API list price`}function un(e){return e?.plan_kind===`metered`?`Priced from your captured tokens at Anthropic list prices. You are billed per token, so this is approximately your actual cost.`:e?.plan_kind===`flat`?`Priced from your captured tokens at Anthropic list prices. You pay ${e.plan_label||`a flat plan`}, so this is what the same work would have cost through the API — not money out of pocket.`:`Priced from your captured tokens at Anthropic list prices. Whether that is your actual bill depends on how you pay — set your plan in the header.`}function dn({plan:e}){let t=I(()=>P.history(`all`),[],{intervalMs:6e4}).data?.totals;if(!t||t.sessions===0)return null;let n=t.days>0?t.sessions/t.days:0;return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 rounded-[var(--radius-panel)] border border-border bg-panel px-3 py-2.5`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`all time`}),(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num font-semibold tracking-[-0.01em] text-[22px] leading-none text-info`,children:S(t.cost_usd)}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,title:un(e),children:ln(e)})]}),(0,L.jsx)(fn,{value:t.sessions.toLocaleString(`en-US`),label:`sessions`}),(0,L.jsx)(fn,{value:t.days.toLocaleString(`en-US`),label:`active days`}),(0,L.jsx)(fn,{value:t.turns.toLocaleString(`en-US`),label:`turns`}),n>=1&&(0,L.jsx)(fn,{value:n.toFixed(1),label:`sessions a day`}),(0,L.jsx)(`span`,{className:`ml-auto inline-flex items-baseline gap-4`,children:(0,L.jsx)(pn,{})})]})}function fn({value:e,label:t}){return(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,children:e}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:t})]})}function pn(){let e=I(()=>P.daily(30),[],{intervalMs:3e5}),t=I(()=>P.summary(`today`),[],{intervalMs:3e4}),n=e.data??[];if(n.length===0)return null;let r=new Map;for(let e of n)r.set(e.day,(r.get(e.day)??0)+e.cost_usd);let i=[...r.values()].filter(e=>e>0).sort((e,t)=>e-t);if(i.length<7)return null;let a=i[Math.floor(i.length/2)]??0,o=t.data?.cost_usd??0;return a<=0||o=99?{label:`outstanding`,color:`text-ok`}:e>=95?{label:`good`,color:`text-ok`}:e>=85?{label:`ok`,color:``}:{label:`low`,color:`text-warn`}}function hn({hitRate:e,cutPct:t,measured:n,size:r=`compact`,label:i=`Cache hit`}){let a=n&&e!==void 0?e*100:void 0,o=mn(a);return(0,L.jsx)(z,{label:i,value:(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{children:a===void 0?`—`:w(a)}),o&&(0,L.jsx)(`span`,{className:`text-[11px] font-normal ${o.color||`text-fg-faint`}`,children:o.label})]}),sub:n&&t!==void 0?`${w(t)} input cost cut`:void 0,size:r})}function gn(e,t){let n=Math.round(e.used_percentage),r=(e.resets_at??0)*1e3,i=r>t&&r85?`text-danger`:n>=60?`text-warn`:`text-fg`,resetsAt:i?new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,stale:e.resets_at?!i:!1}}function _n({label:e,w:t,now:n}){let{pct:r,color:i,resetsAt:a,stale:o}=gn(t,n);return(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-3`,children:[(0,L.jsxs)(`span`,{className:`font-mono tabular-nums ${i}`,children:[r,`%`]}),a&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[`resets `,a]}),o&&(0,L.jsx)(`span`,{className:`text-fg-faint`,title:`Claude Code has not refreshed this window recently`,children:`reset time stale`}),t.forecast&&(0,L.jsx)(`span`,{className:`text-warn`,children:t.forecast})]})]})}function vn({limits:e,now:t}){let n=[];if(e?.five_hour&&n.push([`5h`,e.five_hour]),e?.seven_day&&n.push([`7d`,e.seven_day]),n.length===0)return null;let r=n.map(([e,n])=>({label:e,...gn(n,t)})),i=r.filter(e=>!e.stale),a=i.length===0,o=(i.length?i:r).reduce((e,t)=>t.pct>e.pct?t:e),s=r.find(e=>e.label!==o.label);return(0,L.jsx)(z,{label:`Plan limits`,value:(0,L.jsxs)(`span`,{className:a?`text-fg-faint`:o.color,children:[o.pct,`%`]}),sub:a?(0,L.jsx)(`span`,{title:`Claude Code writes these to its status line; they stop updating when no session is running`,children:`last reported a while ago`}):(0,L.jsxs)(`span`,{children:[o.label,` window`,o.resetsAt?` · resets ${o.resetsAt}`:``,s?` · ${s.label} ${s.pct}%`:``]}),tone:a?void 0:o.pct>85?`danger`:o.pct>=60?`warn`:void 0,size:`compact`})}var yn=`caprock-prompts`,bn={"share-week":6048e5,"share-month":2592e6,"premium-hint":2592e6,"premium-banner":2592e6};function xn(){try{let e=localStorage.getItem(yn);return e?JSON.parse(e):{}}catch{return{}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}function Cn(e,t){let n=xn()[e];return!n||t-n>=bn[e]}function wn(e,t){let n={...xn(),[e]:t};e===`share-month`&&(n[`share-week`]=t),Sn(n)}var Tn=`premium-banner`;function En({costUSD:e,days:t,now:n}){let[r]=(0,l.useState)(()=>Cn(Tn,n)),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1);if(!r||i||e<=0||t<=0)return null;let c=e/t;return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[var(--radius-panel)] border border-border bg-panel-2 px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsx)(`span`,{className:`num`,children:S(c)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` a day, on average, across `,t,` active `,t===1?`day`:`days`,`.`]})]}),(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Premium pauses sessions when the day crosses a limit you set.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(`button`,{onClick:()=>s(!0),className:`rounded-sm border border-accent/50 bg-accent/10 px-2 py-0.5 text-accent hover:bg-accent/20`,children:`what it does`}),(0,L.jsx)(`button`,{onClick:()=>{wn(Tn,n),a(!0)},className:`rounded-sm border border-border px-1.5 py-0.5 text-[11px] text-fg-faint hover:text-fg-muted`,title:`hide this for a month`,children:`not now`})]}),o&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>s(!1)})]})}var Dn=[1e3,5e3,1e4,25e3,5e4,1e5],On=e=>e>=1e3?`$${Math.round(e).toLocaleString(`en-US`)}`:`$${e.toFixed(2)}`;function kn(e){let t=Dn.filter(t=>e>=t).pop();return t===void 0||e-t>t*.1?null:{kind:`milestone`,line:`You just passed ${On(t)} of Claude Code.`}}function An(e,t){return e<7||e>10?null:{kind:`first-week`,line:`A week of Claude Code: ${On(t)} measured.`}}function jn(e){if(e.length<3)return null;let[t,...n]=e;if(t===void 0)return null;let r=Math.max(...n);return r<=0||tt[0].localeCompare(e[0])),r=[];for(let e=0;ee+t[1],0));return r}function Nn(e,t,n){return e.sessions===0||e.cost_usd<=0?null:kn(e.cost_usd)??An(e.days,n.cost_usd)??jn(Mn(t))}var Pn=`share-week`;function Fn({now:e}){let[t]=(0,l.useState)(()=>Cn(Pn,e)),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=I(()=>P.history(`all`),[],{intervalMs:3e5}),s=I(()=>P.summary(`7d`),[],{intervalMs:3e5});if(!t||n||!o.data||!s.data)return null;let c=Nn(o.data.totals,o.data.daily??[],s.data);if(!c)return null;let u=()=>{wn(Pn,e),r(!0)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 rounded-lg border border-accent/35 bg-accent/[0.07] py-1.5 pl-3.5 pr-2 text-[13px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[c.line,` Don’t be shy and share it off —`]}),(0,L.jsx)(`button`,{onClick:()=>{a(!0),u()},className:`rounded-[5px] bg-accent px-3 py-1 font-medium text-panel hover:bg-accent/90`,children:`Share`}),(0,L.jsx)(`button`,{onClick:u,title:`hide this for a week`,className:`px-1 text-fg-faint hover:text-fg-muted`,children:`✕`})]}),i&&(0,L.jsx)(Ze,{onClose:()=>a(!1)})]})}function In(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),t=(e.data?.tools??[]).slice(0,6),n=(e.data?.summary?.models??[]).slice(0,5);if(t.length===0&&n.length===0)return null;let r=t[0]?.count??0,i=n[0]?.cost_usd??0,a=(e.data?.tools??[]).reduce((e,t)=>e+t.count,0),o=(e.data?.summary?.models??[]).reduce((e,t)=>e+t.cost_usd,0),s=e.data?.summary,c=s&&(s.tokens_in||s.tokens_out||s.cache_read||s.cache_write)?{in:s.tokens_in,out:s.tokens_out,cacheRead:s.cache_read,cacheWrite:s.cache_write}:null;return(0,L.jsxs)(R,{title:`All time`,right:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,L.jsx)(Fn,{now:Date.now()}),(0,L.jsx)(Qe,{}),(0,L.jsx)(`a`,{href:`#/history`,className:`text-fg-faint hover:text-accent no-underline`,children:`every tool, model and project →`})]}),children:[(0,L.jsxs)(`div`,{className:`grid gap-x-8 gap-y-5 px-3 py-3 md:grid-cols-2`,children:[(0,L.jsx)(Ln,{title:`Most-used tools`,note:`by calls`,rows:t.map(e=>({key:e.tool,label:te(e.tool),value:e.count.toLocaleString(`en-US`),share:a>0?100*e.count/a:null,frac:r>0?e.count/r:0}))}),(0,L.jsx)(Ln,{title:`Where the money went`,note:`by cost`,rows:n.map(e=>({key:e.model,label:e.model||`unknown`,value:S(e.cost_usd),sub:C(e.tokens),share:o>0?100*e.cost_usd/o:null,frac:i>0?e.cost_usd/i:0}))})]}),c&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 border-t border-border px-3 py-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`Tokens`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`input `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.in)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`output `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.out)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache read `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheRead)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache write `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheWrite)})]}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:`fresh input is billed at full price`})]})]})}function Ln({title:e,note:t,rows:n}){return n.length===0?null:(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`span`,{className:`text-[10px] text-fg-faint`,children:t})]}),(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:n.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`mono w-36 shrink-0 truncate text-fg-muted`,title:e.label,children:e.label}),(0,L.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full bg-panel-2`,children:(0,L.jsx)(`span`,{className:`block h-full rounded-full bg-accent/70`,style:{width:`${Math.max(2,Math.round(e.frac*100))}%`}})}),(0,L.jsx)(`span`,{className:`num w-20 shrink-0 text-right text-fg`,children:e.value}),(0,L.jsx)(`span`,{className:`num w-16 shrink-0 text-right text-fg-faint`,children:e.sub??``}),(0,L.jsx)(`span`,{className:`num w-9 shrink-0 text-right text-fg-faint`,children:e.share===null?``:e.share<1?`<1%`:`${Math.floor(e.share)}%`})]},e.key))})]})}function Rn(e){return e.bars.reduce((e,t)=>e+t.n,0)}function zn(e){return e.bars.reduce((e,t)=>e+t.cost,0)}var Bn=6,Vn=new Set([`description`,`timeout`,`run_in_background`]),Hn=new Set([`true`,`:`,`echo`,`pwd`,`clear`]);function Un(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return``}}function Wn(e){if(e.kind!==`tool.pre`)return null;let t=typeof e.tool==`string`?e.tool:``;if(!t)return null;let n=e.payload,r=n&&typeof n==`object`?n.tool_input:void 0,i=r&&typeof r==`object`?r:{},a=Un(i.command).trim();if(t===`Bash`&&Hn.has(a))return null;let o=[t],s=t;for(let e of Object.keys(i).sort()){if(Vn.has(e))continue;let n=Un(i[e]);(e===`content`||e===`new_string`||e===`old_string`)&&(n=n.slice(0,200)),o.push(`${e}=${n}`),s===t&&(e===`command`||e===`file_path`||e===`pattern`)&&(s=`${t} ${n.slice(0,48)}`)}return{sig:o.join(`|`),label:s}}function Gn(e){let t=Date.parse(e.ts);return Number.isFinite(t)?t:0}function Kn(e,t,n=60){let r=Array.from({length:n},()=>({n:0,turns:0,tools:0,cost:0})),i=t-n*6e4,a=[...e].sort((e,t)=>Gn(e)-Gn(t)),o=[],s=new Map,c=0,l=``;for(let e of a){let a=Gn(e);if(a<=0)continue;if(a>=i&&a<=t){let t=r[Math.min(n-1,Math.floor((a-i)/6e4))];if(t){t.n++,e.kind===`turn.assistant`?t.turns++:(e.kind===`tool.pre`||e.kind===`tool.post`)&&t.tools++;let n=typeof e.cost_usd==`number`&&Number.isFinite(e.cost_usd)?e.cost_usd:0;t.cost+=n}}let u=Wn(e);if(!u)continue;for(o.push({at:a,sig:u.sig,label:u.label});o.length>0;){let e=o[0];if(!e||a-e.at<=Bn*6e4)break;o.shift();let t=(s.get(e.sig)??1)-1;t<=0?s.delete(e.sig):s.set(e.sig,t)}let d=(s.get(u.sig)??0)+1;s.set(u.sig,d),d>c&&(c=d,l=u.label)}return{bars:r,repeats:c,repeatSample:l}}function qn(e,t){if(e.repeats>=8)return{kind:`repeat`,label:`×${e.repeats} same call`};switch(t){case`waiting-on-you`:return{kind:`waiting`,label:`waiting on you`};case`error`:return{kind:`error`,label:`error`};case`looping`:return{kind:`repeat`,label:`looping`};case`ended`:return{kind:`quiet`,label:`ended`};case`idle`:return{kind:`quiet`,label:`idle`};case`working`:return{kind:`working`,label:`working`}}return e.bars.filter(e=>e.n>0).length===0?{kind:`quiet`,label:`quiet`}:{kind:`working`,label:`working`}}function Jn(e,t){return t<=0?`mid`:e>=t*1.8?`high`:e<=t*.5?`low`:`mid`}function Yn(e){let t=e.filter(e=>e.cost>0).map(e=>e.cost).sort((e,t)=>e-t);return t.length===0?0:t[Math.floor(t.length/2)]??0}var Xn=6,Zn=2e3;function Qn({sessions:e,now:t}){let n=(0,l.useMemo)(()=>[...e].filter(e=>e.status!==`ended`).sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,Xn),[e]),r=n.map(e=>e.session_id).join(`,`),[i,a]=(0,l.useState)(new Map);(0,l.useEffect)(()=>{let e=!1;return(async()=>{let t=r?r.split(`,`):[],n=await Promise.all(t.map(e=>P.recentEvents(e,Zn).catch(()=>[])));e||a(new Map(t.map((e,t)=>[e,n[t]??[]])))})(),()=>{e=!0}},[r]),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`)return;let t=e.data;a(e=>{if(!e.has(t.session_id))return e;let n=new Map(e),r=n.get(t.session_id)??[];return n.set(t.session_id,[...r,t].slice(-4e3)),n})}),[]);let o=Math.floor(t/6e4),s=(0,l.useMemo)(()=>n.map(e=>({s:e,pulse:Kn(i.get(e.session_id)??[],o*6e4)})).filter(e=>Rn(e.pulse)>0),[n,i,o]);return n.length===0?null:(0,L.jsxs)(R,{title:`Live pulse`,right:(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`last `,60,` minutes · one bar per minute`]}),children:[(0,L.jsx)(`div`,{children:s.length===0?(0,L.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-fg-faint text-center`,children:[`Nothing ran in the last `,60,` minutes.`]}):s.map(({s:e,pulse:t})=>(0,L.jsx)(er,{s:e,pulse:t,minute:o,showId:s.length>1},e.session_id))}),(0,L.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-4 flex-wrap text-[11px] text-fg-faint border-t border-border`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,title:`They are independent: one call carrying a large context is a short bright bar, twenty greps are a tall dark one.`,children:`bar height = turns and tools · colour = what the minute cost`}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:nr,className:`h-[2px]`}),`idle`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.low}),`below this session's median`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.mid}),`around it`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.high}),`well above it`]}),(0,L.jsxs)(`span`,{className:`ml-auto`,children:[(0,L.jsx)(`span`,{className:`text-warn`,children:`×N same call`}),` = most-repeated identical tool call in six minutes`]})]})]})}function $n({tier:e,className:t=``}){return(0,L.jsx)(`span`,{"data-token":e.token,className:`inline-block w-3 h-3 rounded-[2px] ${t}`,style:{background:`var(${e.token}, ${e.fallback})`,opacity:e.alpha}})}function er({s:e,pulse:t,minute:n,showId:r}){let i=qn(t,e.activity?.health),a=i.kind===`repeat`||i.kind===`waiting`?`text-warn`:i.kind===`error`?`text-danger`:i.kind===`quiet`?`text-fg-faint`:`text-ok`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`grid grid-cols-[132px_1fr_92px_104px] items-center gap-3 px-3 py-2 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`text-[13px] font-medium flex items-baseline gap-1.5 min-w-0`,children:[(0,L.jsx)(`span`,{className:`shrink-0`,children:e.project||`unknown project`}),e.git_branch&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-fg-faint mono`,title:e.git_branch,children:e.git_branch}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`})]}),(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mono truncate`,children:[r&&(0,L.jsxs)(`span`,{title:`session ${e.session_id} · started ${T(e.started_at)} ago`,children:[E(e.session_id),` · `]}),e.activity?.phrase??``]})]}),(0,L.jsx)(ir,{pulse:t,now:n*6e4,sessionID:e.session_id}),(0,L.jsx)(`div`,{className:`num text-[13px] font-semibold text-right`,title:`${S(e.stats?.cost_usd)} for the whole session`,children:S(zn(t))}),(0,L.jsx)(`div`,{className:`text-[11px] text-right ${a}`,title:t.repeatSample,children:i.label})]})}var tr={low:{token:`--color-ok`,fallback:`#4fbf6b`,alpha:.55},mid:{token:`--color-accent`,fallback:`#feb157`,alpha:.85},high:{token:`--color-accent-strong`,fallback:`#ffcb85`,alpha:1}},nr={token:`--color-fg-faint`,fallback:`#837f78`,alpha:.3};function rr(e,t,n){return e.getPropertyValue(t).trim()||n}function ir({pulse:e,now:t,sessionID:n}){let r=(0,l.useRef)(null),[i,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=rr(o,nr.token,nr.fallback),c=e.bars,l=Math.max(...c.map(e=>e.n),1),u=Yn(c),d=n/c.length;for(let e=0;e{i.disconnect(),a.disconnect()}},[e]);let o=t=>{let n=t.currentTarget.getBoundingClientRect();if(n.width===0)return;let r=Math.floor((t.clientX-n.left)/n.width*e.bars.length);a(r>=0&&ra(null),onClick:e=>{i===null||!s||s.n===0||(e.preventDefault(),e.stopPropagation(),v({name:`session`,id:n,at:u}))},"aria-hidden":!0}),s&&(0,L.jsx)(`div`,{className:`absolute -top-1 left-0 right-0 pointer-events-none flex justify-center`,children:(0,L.jsxs)(`span`,{className:`num text-[10px] bg-panel-2 border border-border-strong rounded-sm px-1.5 py-0.5 text-fg-muted whitespace-nowrap`,children:[new Date(u).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),s.n===0?` · nothing happened`:(0,L.jsxs)(L.Fragment,{children:[` · ${s.n} event${s.n===1?``:`s`}`,s.turns>0&&` · ${s.turns} turn${s.turns===1?``:`s`}`,s.cost>0&&` · ${S(s.cost)}`,s.cost>0&&c>0&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` (median ${S(c)})`}),(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` · click to open`})]})]})})]})}function ar({session:e,now:t,onClose:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)();(0,l.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await P.notes(e.session_id,12);t||i(n)}catch(e){t||o(e instanceof Error?e.message:`could not load`)}})(),()=>{t=!0}},[e.session_id]);let s=r?.find(e=>!e.fragment),c=r?.[0],u=s??c;return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:n,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[720px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-medium truncate`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted truncate`,children:e.activity?.phrase}),(0,L.jsx)(`button`,{onClick:n,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`overflow-y-auto px-4 py-3 grid gap-3`,children:[!r&&!a&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`loading…`}),a&&(0,L.jsx)(`div`,{className:`text-[12px] text-danger`,children:a}),r&&!u&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`This session has not said anything yet — it may be running without hooks, or still on its first turn.`}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:[`Last thing Claude said · `,T(u.ts,t),s&&c&&s.event_id!==c.event_id&&(0,L.jsx)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:`(the newest line was mid-thought; this is the last complete one)`})]}),(0,L.jsx)(`div`,{className:`text-[13px] leading-relaxed whitespace-pre-wrap text-fg`,children:u.text})]}),e.activity?.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:[`Plan · `,e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`→ `,e.activity.plan.next]})]})]}),(0,L.jsxs)(`div`,{className:`px-4 py-2 border-t border-border flex items-center gap-3 text-[11px]`,children:[(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id}),className:`link text-fg-muted hover:text-fg`,children:`open the session →`}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:e.owned?`answer in its terminal tab`:`reply in the terminal you started it in`})]})]})})}var or=`premium-hint`;function sr({reason:e,now:t}){let[n]=(0,l.useState)(()=>Cn(or,t)),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1);return!n||r?null:(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,L.jsx)(`button`,{onClick:()=>o(!0),className:`rounded-sm border border-border px-1.5 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg`,children:`a cap that stops this`}),(0,L.jsx)(`button`,{title:`hide this for a month`,onClick:()=>{wn(or,t),i(!0)},className:`text-fg-faint hover:text-fg-muted`,children:`✕`}),a&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>o(!1)})]})}function cr({items:e,now:t,onDismiss:n,sessions:r}){return e.length===0?null:(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:e.map(e=>(0,L.jsx)(lr,{it:e,now:t,onDismiss:n,session:r?.find(t=>t.session_id===e.sessionId)},e.id))})}function lr({it:e,now:t,onDismiss:n,session:r}){let[i,a]=(0,l.useState)(!1),o=e.severity===`high`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 ${o?`border-danger/50 bg-danger/10`:`border-warn/50 bg-warn/10`}`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[13px] shrink-0 ${o?`text-danger`:`text-warn`}`,children:e.title}),(0,L.jsxs)(`span`,{className:`text-[12px] text-fg-muted truncate`,children:[e.sessionId&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`link mono text-fg`,children:e.project||E(e.sessionId)}),(0,L.jsx)(`span`,{className:e.sessionId?`ml-2`:``,children:e.detail})]}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 shrink-0`,children:[e.costUSD!==void 0&&e.costUSD>0&&(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,title:`spent by this session so far`,children:S(e.costUSD)}),e.since!==void 0&&(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.since,t)}),r&&e.id.startsWith(`waiting-`)&&(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong text-fg-muted hover:text-fg`,onClick:()=>a(!0),children:`what did it ask?`}),(0,L.jsx)(`a`,{href:e.sessionId?g({name:`session`,id:e.sessionId,tab:`timeline`,at:e.at}):`#/cost`,className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong no-underline text-fg-muted hover:text-fg`,children:e.sessionId?`open`:`details`}),(e.id.startsWith(`loop-`)||e.id.startsWith(`spent-`))&&(0,L.jsx)(sr,{reason:`this is what a cap stops`,now:t}),n&&e.id.startsWith(`loop-`)&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>n(e.sessionId),children:`dismiss`})]})]}),i&&r&&(0,L.jsx)(ar,{session:r,now:t,onClose:()=>a(!1)})]})}var ur=9e5,dr=25,fr=300,pr=2,mr=864e5,hr=90,gr=6912e5;function _r(e){return typeof e==`number`?e:e&&Date.parse(e)||0}function vr({sessions:e,alerts:t,now:n,limits:r,waitingMs:i=ur}){let a=[],o=Array.isArray(e)?e.filter(Boolean):[],s=Array.isArray(t)?t.filter(Boolean):[],c=new Map(o.map(e=>[e.session_id,e]));for(let e of s){let t=c.get(e.session_id);a.push({id:`loop-${e.session_id}`,sessionId:e.session_id,project:t?.project??``,severity:`high`,title:`Stuck in a loop`,detail:[`ran ${e.sample||e.tool||`the same call`}`,Number.isFinite(e.count)?`${e.count}×`:`repeatedly`,Number.isFinite(e.window_min)?`in ${e.window_min} min`:``].filter(Boolean).join(` `),costUSD:t?.stats?.cost_usd,since:_r(e.ts)||void 0,at:_r(e.first_ts)||_r(e.ts)||void 0})}for(let e of o)if(e.status!==`ended`&&e.activity){if(e.activity.health===`error`){a.push({id:`error-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`high`,title:`Session hit an error`,detail:e.activity.phrase,costUSD:e.stats?.cost_usd,since:_r(e.activity.at)||e.last_event_at});continue}if(e.activity.health===`waiting-on-you`){let t=_r(e.activity.at)||e.last_event_at;t>0&&n-t>=i&&a.push({id:`waiting-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Waiting on you`,detail:e.activity.phrase,since:t})}}for(let e of o){if(!e.stats||!e.activity)continue;let{cost_usd:t,turns:r,files_touched:i}=e.stats;if(tpr)continue;let o=_r(e.activity.at)||e.last_event_at;o>0&&n-o>mr||a.push({id:`spent-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Lots of turns, few files`,detail:`${r.toLocaleString()} turns, ${i===0?`no files`:i===1?`1 file`:`${i} files`} touched`,costUSD:t,since:_r(e.activity.at)||e.last_event_at})}let l={high:0,medium:1};for(let[e,t]of[[`5-hour`,r?.five_hour],[`7-day`,r?.seven_day]]){if(!t||t.used_percentagen&&r=95?`high`:`medium`,title:`${e} plan window ${i}% used`,detail:`resets at ${o}${t.forecast?` — ${t.forecast}`:``}`})}return a.sort((e,t)=>l[e.severity]-l[t.severity]||(e.since??0)-(t.since??0))}var yr=`caprock.update.dismissed`;function br({plan:e,onSave:t,now:n,owned:r=0}){let[i,a]=(0,l.useState)(),[o,s]=(0,l.useState)(()=>localStorage.getItem(yr)??``);return(0,l.useEffect)(()=>{if(!e?.update_checks){a(void 0);return}let t=!0,n=()=>{P.update().then(e=>{t&&a(e)}).catch(()=>{})};n();let r=window.setInterval(n,6e4);return()=>{t=!1,window.clearInterval(r)}},[e?.update_checks]),e&&!e.update_checks?o===`offer`?null:(0,L.jsxs)(xr,{tone:`muted`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Caprock can check GitHub for new releases. It's the only outbound call it makes, so it's off unless you turn it on — no usage data is sent, and you can turn it off again any time.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[(0,L.jsx)(`button`,{className:`text-[11px] border border-accent/50 text-accent bg-accent/10 px-2 py-0.5 rounded-sm hover:bg-accent/20`,onClick:()=>t({...e,update_checks:!0}),children:`check for updates`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,`offer`),s(`offer`)},children:`no thanks`})]})]}):!i?.update_available||!i.latest||o===i.latest?null:(0,L.jsxs)(xr,{tone:`accent`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[`Caprock `,i.latest]}),` is available — you're on `,(0,L.jsx)(`span`,{className:`mono`,children:i.current}),`.`]}),r>0&&(0,L.jsx)(`span`,{className:`text-[12px] text-warn shrink-0`,children:r===1?`1 session Caprock started will close`:`${r} sessions Caprock started will close`}),i.command?(0,L.jsx)(Ct,{command:i.command}):(0,L.jsx)(`a`,{className:`link text-[12px]`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`download it`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[i.checked_at?(0,L.jsxs)(`span`,{className:`num text-[11px] text-fg-faint`,children:[`checked `,T(i.checked_at,n)]}):null,(0,L.jsx)(`a`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm no-underline`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`what's new`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,i.latest),s(i.latest)},children:`not now`})]})]})}function xr({tone:e,children:t}){return(0,L.jsx)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 text-[12px] ${e===`accent`?`border-accent/40 bg-accent/5`:`border-border bg-panel`}`,children:t})}function Sr({u:e,className:t=``}){return!e||e.turns===0?null:(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] ${t}`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Cost is incomplete`}),` `,(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[C(e.tokens),` tokens over `,e.turns,` turn`,e.turns===1?``:`s`,` could not be priced, so they are missing from the total above — not free. `,e.models.length===1?`Model`:`Models`,` with no entry in the pricing table:`,` `,e.models.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0&&`, `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:e||`unknown`})]},e)),`. This happens when a model ships newer than the pricing table, or when a gateway reports ids that do not normalise.`]})]})}function Cr({value:e,onPick:t}){let[n,r]=(0,l.useState)(`recent`),[i,a]=(0,l.useState)(``),o=I(()=>P.recentDirs(),[],{live:!1}),s=I(()=>P.browse(i),[i],{live:!1});return(0,l.useEffect)(()=>{o.data&&o.data.length===0&&r(`browse`)},[o.data]),(0,L.jsxs)(`div`,{className:`rounded-[3px] border border-border-strong bg-panel-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border-strong px-2 py-1.5 text-[12px]`,children:[(0,L.jsx)(wr,{on:n===`recent`,onClick:()=>r(`recent`),children:`Recent`}),(0,L.jsx)(wr,{on:n===`browse`,onClick:()=>r(`browse`),children:`Browse`}),n===`browse`&&s.data&&(0,L.jsx)(`span`,{className:`mono ml-auto min-w-0 truncate pl-2 text-[11px] text-fg-faint`,title:s.data.dir,children:kr(s.data.dir,s.data.root)})]}),(0,L.jsx)(`div`,{className:`h-[168px] overflow-y-auto overflow-x-hidden`,children:n===`recent`?(0,L.jsx)(Tr,{rows:o.data,value:e,onPick:t}):(0,L.jsx)(Er,{data:s.data,value:e,onOpen:a,onPick:t,error:s.error?.message})})]})}function wr({on:e,onClick:t,children:n}){return(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-sm px-2 py-0.5 ${e?`bg-accent/15 text-accent`:`text-fg-muted hover:text-fg`}`,children:n})}function Tr({rows:e,value:t,onPick:n}){return e?e.length===0?(0,L.jsx)(Or,{children:`No sessions yet — use Browse, or type a path.`}):(0,L.jsx)(`ul`,{children:e.map(e=>(0,L.jsxs)(Dr,{selected:t===e.dir,onClick:()=>n(e.dir),children:[(0,L.jsx)(`span`,{className:`shrink-0 text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`mono ml-2 min-w-0 flex-1 truncate text-[11px] text-fg-faint`,title:e.dir,children:e.dir}),(0,L.jsx)(`span`,{className:`shrink-0 pl-2 text-[11px] text-fg-faint`,children:T(e.last_event_at)})]},e.dir))}):(0,L.jsx)(Or,{children:`…`})}function Er({data:e,value:t,onOpen:n,onPick:r,error:i}){return i?(0,L.jsx)(Or,{children:i}):e?(0,L.jsxs)(`ul`,{children:[e.parent&&(0,L.jsx)(Dr,{selected:!1,onClick:()=>n(e.parent),children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`↑ up`})}),e.entries.length===0&&(0,L.jsx)(Or,{children:`Nothing here.`}),e.entries.map(e=>(0,L.jsxs)(Dr,{selected:t===e.path,onClick:()=>e.repo?r(e.path):n(e.path),children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate ${e.repo?`text-fg`:`text-fg-muted`}`,children:e.name}),e.repo&&(0,L.jsx)(`span`,{className:`ml-2 shrink-0 text-[10px] uppercase tracking-wide text-accent`,children:`repo`}),(0,L.jsx)(`span`,{className:`flex-1`}),(0,L.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.repo?n(e.path):r(e.path)},className:`shrink-0 px-1 text-[11px] text-fg-faint hover:text-fg`,title:e.repo?`Open this folder`:`Use this folder`,children:e.repo?`›`:`use`})]},e.path))]}):(0,L.jsx)(Or,{children:`…`})}function Dr({selected:e,onClick:t,children:n}){return(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`flex w-full min-w-0 items-center px-2.5 py-1 text-left text-[12px] hover:bg-panel ${e?`bg-accent/10`:``}`,children:n})})}function Or({children:e}){return(0,L.jsx)(`p`,{className:`px-2.5 py-3 text-[12px] text-fg-faint`,children:e})}function kr(e,t){return e===t?`~`:e.startsWith(t+`/`)?`~`+e.slice(t.length):e}var Ar=`claude-opus-5`,jr=`acceptEdits`,Mr=[[`claude-opus-5`,`Opus 5 · most capable`],[`claude-sonnet-5`,`Sonnet 5 · faster, cheaper`],[`claude-haiku-4-5`,`Haiku 4.5 · cheapest`]],Nr=[[`acceptEdits`,`Accept edits · asks before commands`],[`plan`,`Plan · reads and plans, changes nothing`],[`bypassPermissions`,`Bypass · never asks`]];function Pr({available:e,onClose:t,initialCwd:n=``}){let[r,i]=(0,l.useState)(n),[a,o]=(0,l.useState)(Ar),[s,c]=(0,l.useState)(jr),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),y=async()=>{if(!r.trim()){_(`Working directory is required.`);return}h(!0),_(``);try{let e={cwd:r.trim()};a&&(e.model=a),s&&(e.permission_mode=s),u.trim()&&(e.worktree=u.trim()),f&&(e.create=!0);let{session_id:n}=await P.spawn(e);t(),v({name:`session`,id:n,tab:`terminal`})}catch(e){_(ae(e))}finally{h(!1)}};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:t,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[520px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New session`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),e?(0,L.jsxs)(`div`,{className:`px-4 py-3 grid min-w-0 gap-3 text-[13px]`,children:[(0,L.jsxs)(Fr,{label:`Working directory`,hint:`pick one, or type a path`,children:[(0,L.jsx)(`input`,{autoFocus:!0,className:`input`,placeholder:`/Users/you/dev/project`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&y()}),(0,L.jsx)(`div`,{className:`mt-1.5 min-w-0 max-w-full`,children:(0,L.jsx)(Cr,{value:r,onPick:i})})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsx)(Fr,{label:`Model`,children:(0,L.jsx)(`select`,{className:`input`,value:a,onChange:e=>o(e.target.value),children:Mr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})}),(0,L.jsx)(Fr,{label:`Permissions`,children:(0,L.jsx)(`select`,{className:`input`,value:s,onChange:e=>c(e.target.value),children:Nr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})})]}),(0,L.jsxs)(`details`,{className:`text-[12px] group`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer select-none text-fg-muted hover:text-fg list-none marker:content-none`,children:[(0,L.jsx)(`span`,{className:`inline-block transition-transform group-open:rotate-90 text-fg-faint`,children:`▶`}),` Advanced`]}),(0,L.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none text-fg-muted`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:f,onChange:e=>p(e.target.checked)}),`create the directory if it does not exist`]}),(0,L.jsx)(Fr,{label:`Git worktree`,hint:`creates .caprock-worktrees/ on a new branch`,children:(0,L.jsx)(`input`,{className:`input`,placeholder:`feature-x`,value:u,onChange:e=>d(e.target.value)})})]})]}),g&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:g})]}):(0,L.jsxs)(`div`,{className:`px-4 py-6 text-[13px] text-fg-muted`,children:[`The `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself.`]}),e&&(0,L.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,L.jsx)(`button`,{onClick:t,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,L.jsx)(`button`,{onClick:y,disabled:m,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:m?`starting…`:`Start session`})]})]})})}function Fr({label:e,hint:t,children:n}){return(0,L.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[e,t&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,t]})]}),n]})}function Ir(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(`all`),[i,a]=(0,l.useState)(!1),o=I(()=>P.sessions(!e),[e],{intervalMs:5e3}),s=I(()=>P.status(),[],{live:!1,intervalMs:3e4}),c=I(()=>P.summary(`today`,n),[n],{intervalMs:5e3}),u=I(()=>P.history(`all`),[],{intervalMs:6e4}),{alerts:p}=f(),m=re(1e3),h=o.data??[],g=n===`all`?h:h.filter(e=>(e.agent??`claude`)===n),_=!!s.data?.opencode,v=g.filter(e=>e.activity.health===`working`||e.activity.health===`looping`||e.activity.health===`error`||e.activity.health===`waiting-on-you`),y=g.filter(e=>!v.includes(e)&&e.status!==`ended`),b=g.filter(e=>e.status===`ended`),[x,w]=Ee(),ee=vr({sessions:g,alerts:p,now:m,limits:c.data?.rate_limits}),E=s.data?.hooks&&(s.data.hooks.missing??[]).length>0,D=!!c.data&&c.data.turns>0,te=s.data?.ingest_error;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[te&&(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-danger font-medium`,children:`Ingest stopped`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`No new sessions are being captured. `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:te}),` — check that`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})]}),E&&(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Hooks not installed`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`Activity is coming from transcripts only (a few seconds late, no tool-level detail for running commands). Run `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:`caprock hooks install`}),` for real-time narration.`]}),(0,L.jsx)(`a`,{href:`#/settings`,className:`link ml-auto text-[11px]`,children:`details`})]}),(0,L.jsx)(br,{plan:x,onSave:w,now:m,owned:g.filter(e=>e.owned&&e.status!==`ended`).length}),(0,L.jsx)(cr,{items:ee,now:m,onDismiss:e=>d.dismissAlert(e),sessions:g}),(0,L.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(dn,{plan:x})}),(0,L.jsx)(Lr,{available:s.data?.claude_available}),(0,L.jsx)(Rr,{available:s.data?.claude_available,onClick:()=>a(!0)})]}),D&&u.data?.totals&&(0,L.jsx)(En,{costUSD:u.data.totals.cost_usd,days:u.data.totals.days,now:m}),(0,L.jsxs)(R,{title:`Today`,center:_?(0,L.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-panel-2 p-0.5`,children:It.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),title:e.key===`all`?`Every agent`:`Only ${e.label}`,className:`px-2.5 py-1 text-[12px] mono rounded-[5px] transition-colors ${n===e.key?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.key))}):null,right:c.data?(0,L.jsxs)(`span`,{className:`num`,children:[`pricing `,c.data.pricing_version,` · at API list price`]}):null,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-[1.4fr_1fr_1fr_1fr_1fr_1fr] divide-x divide-border`,children:[(0,L.jsx)(z,{label:`Cost today`,value:D?S(c.data?.cost_usd):`—`,sub:(0,L.jsx)(`span`,{title:un(x),children:D?ln(x):`nothing measured yet`}),tone:`info`,size:`hero`}),(0,L.jsx)(z,{label:`Burn now`,value:D?`${S(c.data.burn.usd_per_hour)}/h`:`—`,sub:D?`${C(Math.round(c.data.burn.tokens_per_min))} tok/min · last ${c.data.burn.window_min}m`:void 0}),(0,L.jsx)(z,{label:`Sessions`,value:D?c.data.sessions:`—`,sub:D?`${c.data.active_sessions} active`:void 0,size:`compact`}),(0,L.jsx)(z,{label:`Turns`,value:D?c.data.turns:`—`,sub:D?`${c.data.tool_calls} tool calls`:void 0,size:`compact`}),(0,L.jsx)(vn,{limits:c.data?.rate_limits,now:m}),(0,L.jsx)(hn,{hitRate:c.data?.savings.hit_rate,cutPct:c.data?.savings.cut_pct,measured:D})]}),(0,L.jsx)(Sr,{u:c.data?.unpriced,className:`mx-3 mb-2.5`})]}),(0,L.jsx)(Qn,{sessions:g,now:m}),(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,L.jsx)(on,{sessions:g,now:m,emptyHint:n===`all`?void 0:(0,L.jsxs)(L.Fragment,{children:[`Nothing from `,n===`opencode`?`OpenCode`:`Claude Code`,` yet.`]})}),(0,L.jsx)(Wt,{sessions:g,agent:n})]}),(0,L.jsx)(In,{}),o.error&&!o.data&&(0,L.jsxs)(xt,{title:`Cannot reach the daemon`,children:[o.error.message,` — is `,(0,L.jsx)(`span`,{className:`mono`,children:`caprock up`}),` running?`]}),!o.data&&!o.error&&(0,L.jsx)(St,{rows:4,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),o.data&&g.length===0&&(n===`all`?(0,L.jsxs)(xt,{title:`No sessions yet`,children:[`Start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal — it will show up here within seconds.`]}):(0,L.jsxs)(xt,{title:`No ${n===`opencode`?`OpenCode`:`Claude Code`} sessions here`,children:[`Nothing from this agent in the current view. Switch to`,` `,(0,L.jsx)(`button`,{className:`link underline`,onClick:()=>r(`all`),children:`all`}),` `,`to see everything.`]})),(0,L.jsx)(zr,{groups:[{label:`Active`,items:v},{label:`Idle`,items:y,dim:!0},...e?[{label:`Ended`,items:b,dim:!0}]:[]],now:m}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:e,onChange:e=>t(e.target.checked)}),`show ended sessions`]}),o.loadedAt>0&&(0,L.jsxs)(`span`,{className:`num ml-auto`,children:[`refreshed `,T(o.loadedAt,m)]})]}),i&&(0,L.jsx)(Pr,{available:s.data?.claude_available??!1,onClose:()=>{a(!1),o.refresh()}})]})}function Lr({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return e===!1?null:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`button`,{onClick:async()=>{n(!0),i(``);try{let{session_id:e}=await P.spawn({chat:!0});v({name:`session`,id:e,tab:`terminal`})}catch(e){i(ae(e))}finally{n(!1)}},disabled:t,title:`start a session without picking a folder`,className:`relative shrink-0 rounded-[var(--radius-panel)] border border-border-strong px-3 py-2 text-[13px] leading-5 text-fg-muted hover:text-fg hover:border-accent/50 disabled:opacity-50`,children:[t?`starting…`:`Quick chat`,r&&(0,L.jsx)(`span`,{className:`absolute right-0 top-full mt-1 block max-w-[220px] text-right text-[11px] text-danger`,children:r})]})})}function Rr({available:e,onClick:t}){let n=e===!1;return(0,L.jsxs)(`button`,{onClick:t,title:n?`claude was not found on this machine — click for details`:`start a session Caprock owns`,className:`shrink-0 rounded-[var(--radius-panel)] border px-3 py-2 text-[13px] leading-5 font-medium transition-colors ${n?`border-border text-fg-faint hover:text-fg-muted`:`border-accent/60 bg-accent/15 text-accent hover:bg-accent/25`}`,children:[`+ New session`,n?` (claude not found)`:``]})}function zr({groups:e,now:t}){let n=e.flatMap(e=>e.items.map((t,n)=>({s:t,dim:e.dim,label:n===0?`${e.label} · ${e.items.length}`:null})));return n.length===0?null:(0,L.jsx)(`div`,{"data-testid":`session-grid`,className:`mt-3 grid gap-2 gap-y-6`,children:n.map(({s:e,dim:n,label:r})=>(0,L.jsxs)(`div`,{className:`relative ${n?`opacity-80`:``}`,children:[r&&(0,L.jsx)(`div`,{className:`absolute -top-4 left-0.5 text-[11px] uppercase tracking-[0.08em] text-fg-faint`,children:r}),(0,L.jsx)(Br,{s:e,now:t})]},e.session_id))})}function Br({s:e,now:t}){let n=e.context,r=n?n.pct>=85?`danger`:n.pct>=60?`warn`:void 0:void 0,[i,a]=(0,l.useState)(!1),o=e.activity?.health===`waiting-on-you`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`block border border-border bg-panel rounded-[var(--radius-panel)] hover:border-border-strong no-underline hover:no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`px-3 pt-2 pb-1 flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium truncate text-[15px]`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:E(e.session_id)}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.08em] text-fg-muted border border-border px-1 py-px rounded-sm`,children:`opencode`}),e.git_branch&&(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate`,children:e.git_branch}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[o&&(0,L.jsx)(`button`,{className:`text-[11px] border border-warn/50 text-warn bg-warn/10 px-1.5 py-0.5 rounded-sm hover:bg-warn/20`,onClick:e=>{e.preventDefault(),a(!0)},children:`what did it ask?`}),(0,L.jsx)(yt,{health:e.activity.health})]})]}),i&&(0,L.jsx)(ar,{session:e,now:t,onClose:()=>a(!1)}),(0,L.jsxs)(`div`,{className:`px-3 pb-2 text-[13px] truncate`,title:e.activity.phrase,children:[(0,L.jsx)(`span`,{className:e.activity.health===`working`?`text-fg`:`text-fg-muted`,children:e.activity.phrase}),(0,L.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(e.activity.at||e.last_event_at,t)})]}),e.activity.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`px-3 pb-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,L.jsx)(`div`,{className:`h-1 flex-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent`,style:{width:`${Math.min(100,Math.max(0,100*e.activity.plan.done/e.activity.plan.total))}%`}})}),(0,L.jsxs)(`span`,{className:`num`,children:[e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`span`,{className:`truncate max-w-[50%]`,children:[`→ `,e.activity.plan.next]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 divide-x divide-border border-t border-border`,children:[(0,L.jsx)(z,{label:`Cost`,value:S(e.stats.cost_usd),sub:e.model||`—`,tone:`info`}),(0,L.jsx)(z,{label:`Tokens`,value:C(e.stats.tokens_in+e.stats.tokens_out+e.stats.cache_read+e.stats.cache_write),sub:`${w(e.savings.hit_rate*100)} cache hit`}),(0,L.jsx)(z,{label:`Context`,value:n?w(n.pct):`—`,sub:n?`${C(n.tokens)} / ${C(n.window)}`:`unknown model`,tone:r}),(0,L.jsx)(z,{label:`Activity`,value:e.stats.tool_calls,sub:`${e.stats.turns} turns · ${e.stats.files_touched} files`})]})]})}function Vr({id:e,now:t}){let n=I(()=>P.notes(e),[e],{intervalMs:1e4}),r=n.data??[],[i,a]=(0,l.useState)(!1),o=r.filter(e=>!e.fragment),s=i?r:o;return n.error&&!n.data?(0,L.jsx)(xt,{title:`Cannot load notes`,children:n.error.message}):n.data?r.length===0?(0,L.jsx)(xt,{title:`Nothing said yet`,children:`Claude's written answers appear here — the reasoning and the “what changed, what I still need from you” that otherwise lives only in your terminal scrollback.`}):(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`span`,{children:[o.length,` `,o.length===1?`answer`:`answers`,r.length>o.length&&` · ${r.length-o.length} short remarks`]}),r.length>o.length&&(0,L.jsx)(`button`,{className:`text-fg-muted hover:text-fg border border-border px-1.5 rounded-sm`,onClick:()=>a(e=>!e),children:i?`hide short remarks`:`show everything`}),(0,L.jsx)(`span`,{className:`ml-auto`,children:`subagent chatter excluded · newest first`})]}),s.map(e=>(0,L.jsx)(Ur,{note:e,now:t},e.event_id))]}):(0,L.jsx)(St,{rows:4})}var Hr=600;function Ur({note:e,now:t,showSession:n=!1}){let[r,i]=(0,l.useState)(!1),a=typeof e.text==`string`?e.text:``,o=[...a],s=o.length>Hr,c=r||!s?a:o.slice(0,Hr).join(``)+`…`;return(0,L.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-2 text-[11px] text-fg-faint`,children:[n&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id,at:e.ts}),className:`link`,title:`Open the session at this moment`,children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.project||E(e.session_id)})}),(0,L.jsx)(`span`,{className:`mono`,children:e.model||`assistant`}),e.fragment&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:`· mid-thought`}),(0,L.jsx)(`span`,{className:`num ml-auto`,children:T(e.ts,t)})]}),(0,L.jsx)(`div`,{className:`px-3 py-2 text-[13px] leading-[1.55] whitespace-pre-wrap break-words`,children:c}),s&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg px-3 pb-2`,onClick:()=>i(e=>!e),children:r?`show less`:`show all ${o.length.toLocaleString()} characters`})]})}var Wr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Kr=(e,t)=>{for(var n in t)Wr(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gr(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wr(t,n,i),i},B=(e,t)=>(n,r)=>t(n,r,e),Jr=`Terminal input`,Yr={get:()=>Jr,set:e=>Jr=e},Xr=`Too much output to announce, navigate to rows manually to read`,Zr={get:()=>Xr,set:e=>Xr=e};function Qr(e){return e.replace(/\r?\n/g,`\r`)}function $r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ei(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ti(e,t,n,r){e.stopPropagation(),e.clipboardData&&ni(e.clipboardData.getData(`text/plain`),t,n,r)}function ni(e,t,n,r){e=Qr(e),e=$r(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ri(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ii(e,t,n,r,i){ri(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ai(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oi(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var si=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ci=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},li=``,ui=` `,di=class e{constructor(){this.fg=0,this.bg=0,this.extended=new fi}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},fi=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pi=class e extends di{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fi,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ai(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mi=`di$target`,hi=`di$dependencies`,gi=new Map;function _i(e){return e[hi]||[]}function vi(e){if(gi.has(e))return gi.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);yi(t,e,r)};return t._id=e,gi.set(e,t),t}function yi(e,t,n){t[mi]===t?t[hi].push({id:e,index:n}):(t[hi]=[{id:e,index:n}],t[mi]=t)}var bi=vi(`BufferService`),xi=vi(`CoreMouseService`),Si=vi(`CoreService`),Ci=vi(`CharsetService`),wi=vi(`InstantiationService`),Ti=vi(`LogService`),Ei=vi(`OptionsService`),Di=vi(`OscLinkService`),Oi=vi(`UnicodeService`),ki=vi(`DecorationService`),Ai=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new pi,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):ji(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ai=qr([B(0,bi),B(1,Ei),B(2,Di)],Ai);function ji(e,t){if(confirm(`Do you want to navigate to ${t}? WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Mi=vi(`CharSizeService`),V=vi(`CoreBrowserService`),Ni=vi(`MouseService`),Pi=vi(`RenderService`),Fi=vi(`SelectionService`),Ii=vi(`CharacterJoinerService`),Li=vi(`ThemeService`),Ri=vi(`LinkProviderService`),zi=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Gi.isErrorNoTelemetry(e)?new Gi(e.message+` `+e.stack):Error(e.message+` -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Bi(e){Hi(e)||zi.onUnexpectedError(e)}var Vi=`Canceled`;function Hi(e){return e instanceof Ui||e instanceof Error&&e.name===Vi&&e.message===Vi}var Ui=class extends Error{constructor(){super(Vi),this.name=this.message}};function Wi(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var Gi=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Ki=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function qi(e,t=0){return e[e.length-(1+t)]}var Ji;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ji||={});var Yi=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ji.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Yi.empty=new Yi(e=>{});function Xi(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Zi;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ia(...e){return H(()=>ra(e))}function H(e){let t=$i({dispose:Xi(()=>{ea(t),e()})});return t}var aa=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,$i(this)}dispose(){this._isDisposed||(ea(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ra(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return ta(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),ta(e,null))}};aa.DISABLE_DISPOSED_WARNING=!1;var oa=aa,U=class{constructor(){this._store=new oa,$i(this),ta(this._store,this)}dispose(){ea(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};U.None=Object.freeze({dispose(){}});var sa=class{constructor(){this._isDisposed=!1,$i(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ta(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ea(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ta(e,null),e}},ca=typeof window==`object`?window:globalThis,la=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};la.Undefined=new la(void 0);var ua=la,da=class{constructor(){this._first=ua.Undefined,this._last=ua.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ua.Undefined}clear(){let e=this._first;for(;e!==ua.Undefined;){let t=e.next;e.prev=ua.Undefined,e.next=ua.Undefined,e=t}this._first=ua.Undefined,this._last=ua.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ua(e);if(this._first===ua.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==ua.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ua.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ua.Undefined&&e.next!==ua.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ua.Undefined&&e.next===ua.Undefined?(this._first=ua.Undefined,this._last=ua.Undefined):e.next===ua.Undefined?(this._last=this._last.prev,this._last.next=ua.Undefined):e.prev===ua.Undefined&&(this._first=this._first.next,this._first.prev=ua.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==ua.Undefined;)yield e.element,e=e.next}},fa=globalThis.performance&&typeof globalThis.performance.now==`function`,pa=class e{static create(t){return new e(t)}constructor(e){this._now=fa&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},ma;(e=>{e.None=()=>U.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(ia(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new W({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new W({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new W({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new W;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class ee{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new W(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(e,t){return new ee(e,t).emitter.event}e.fromObservable=te;function T(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof oa?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=T})(ma||={});var ha=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new pa,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ha.all=new Set,ha._idPool=0;var ga=ha,_a=-1,va=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Bi(e){Hi(e)||zi.onUnexpectedError(e)}var Vi=`Canceled`;function Hi(e){return e instanceof Ui||e instanceof Error&&e.name===Vi&&e.message===Vi}var Ui=class extends Error{constructor(){super(Vi),this.name=this.message}};function Wi(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var Gi=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Ki=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function qi(e,t=0){return e[e.length-(1+t)]}var Ji;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ji||={});var Yi=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ji.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Yi.empty=new Yi(e=>{});function Xi(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Zi;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ia(...e){return H(()=>ra(e))}function H(e){let t=$i({dispose:Xi(()=>{ea(t),e()})});return t}var aa=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,$i(this)}dispose(){this._isDisposed||(ea(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ra(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return ta(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),ta(e,null))}};aa.DISABLE_DISPOSED_WARNING=!1;var oa=aa,U=class{constructor(){this._store=new oa,$i(this),ta(this._store,this)}dispose(){ea(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};U.None=Object.freeze({dispose(){}});var sa=class{constructor(){this._isDisposed=!1,$i(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ta(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ea(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ta(e,null),e}},ca=typeof window==`object`?window:globalThis,la=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};la.Undefined=new la(void 0);var ua=la,da=class{constructor(){this._first=ua.Undefined,this._last=ua.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ua.Undefined}clear(){let e=this._first;for(;e!==ua.Undefined;){let t=e.next;e.prev=ua.Undefined,e.next=ua.Undefined,e=t}this._first=ua.Undefined,this._last=ua.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ua(e);if(this._first===ua.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==ua.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ua.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ua.Undefined&&e.next!==ua.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ua.Undefined&&e.next===ua.Undefined?(this._first=ua.Undefined,this._last=ua.Undefined):e.next===ua.Undefined?(this._last=this._last.prev,this._last.next=ua.Undefined):e.prev===ua.Undefined&&(this._first=this._first.next,this._first.prev=ua.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==ua.Undefined;)yield e.element,e=e.next}},fa=globalThis.performance&&typeof globalThis.performance.now==`function`,pa=class e{static create(t){return new e(t)}constructor(e){this._now=fa&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},ma;(e=>{e.None=()=>U.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(ia(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new W({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new W({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new W({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new W;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new W(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ee(e,t){return new T(e,t).emitter.event}e.fromObservable=ee;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof oa?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(ma||={});var ha=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new pa,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ha.all=new Set,ha._idPool=0;var ga=ha,_a=-1,va=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t0||this._options?.leakWarningThreshold?new ya(e?.onListenerError??Bi,this._options?.leakWarningThreshold??_a):void 0,this._perfMon=this._options?._profName?new ga(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Sa(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Bi)(n),U.None}if(this._disposed)return U.None;t&&(e=e.bind(t));let r=new wa(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=ba.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof wa?(this._deliveryQueue??=new Da,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=H(()=>{Ea?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof oa?n.add(a):Array.isArray(n)&&n.push(a),Ea){let e=Error().stack.split(` `).slice(2,3).join(` `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Ea.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Ta<=t.length){let e=0;for(let n=0;n0}},Da=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Oa=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new W,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new W,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Oa.INSTANCE=new Oa;var ka=Oa;function Aa(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}ka.INSTANCE.onDidChangeZoomLevel;function ja(e){return ka.INSTANCE.getZoomFactor(e)}ka.INSTANCE.onDidChangeFullscreen;var Ma=typeof navigator==`object`?navigator.userAgent:``,Na=Ma.indexOf(`Firefox`)>=0,Pa=Ma.indexOf(`AppleWebKit`)>=0,Fa=Ma.indexOf(`Chrome`)>=0,Ia=!Fa&&Ma.indexOf(`Safari`)>=0;Ma.indexOf(`Electron/`),Ma.indexOf(`Android`);var La=!1;if(typeof ca.matchMedia==`function`){let e=ca.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=ca.matchMedia(`(display-mode: fullscreen)`);La=e.matches,Aa(ca,e,({matches:e})=>{La&&t.matches||(La=e)})}function Ra(){return La}var za=`en`,Ba=!1,Va=!1,Ha=!1,Ua=!1,Wa=!1,Ga=za,Ka,qa=globalThis,Ja;typeof qa.vscode<`u`&&typeof qa.vscode.process<`u`?Ja=qa.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Ja=process);var Ya=typeof Ja?.versions?.electron==`string`&&Ja?.type===`renderer`;if(typeof Ja==`object`){Ba=Ja.platform===`win32`,Va=Ja.platform===`darwin`,Ha=Ja.platform===`linux`,Ha&&Ja.env.SNAP&&Ja.env.SNAP_REVISION,Ja.env.CI||Ja.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ga=za;let e=Ja.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Ga=t.resolvedLanguage||za,t.languagePack?.translationsConfigFile}catch{}Ua=!0}else typeof navigator==`object`&&!Ya?(Ka=navigator.userAgent,Ba=Ka.indexOf(`Windows`)>=0,Va=Ka.indexOf(`Macintosh`)>=0,(Ka.indexOf(`Macintosh`)>=0||Ka.indexOf(`iPad`)>=0||Ka.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Ha=Ka.indexOf(`Linux`)>=0,Ka?.indexOf(`Mobi`),Wa=!0,Ga=globalThis._VSCODE_NLS_LANGUAGE||za,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Xa=Ba,Za=Va,Qa=Ha,$a=Ua;Wa&&typeof qa.importScripts==`function`&&qa.origin;var eo=Ka,to=Ga,no;(e=>{function t(){return to}e.value=t;function n(){return to.length===2?to===`en`:to.length>=3&&to[0]===`e`&&to[1]===`n`&&to[2]===`-`}e.isDefaultVariant=n;function r(){return to===`en`}e.isDefault=r})(no||={});var ro=typeof qa.postMessage==`function`&&!qa.importScripts;(()=>{if(ro){let e=[];qa.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),qa.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var io=!!(eo&&eo.indexOf(`Chrome`)>=0);eo&&eo.indexOf(`Firefox`),!io&&eo&&eo.indexOf(`Safari`),eo&&eo.indexOf(`Edg/`),eo&&eo.indexOf(`Android`);var ao=typeof navigator==`object`?navigator:{};$a||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||ao&&ao.clipboard&&ao.clipboard.writeText,$a||ao&&ao.clipboard&&ao.clipboard.readText,$a||Ra()||ao.keyboard,`ontouchstart`in ca||ao.maxTouchPoints,ca.PointerEvent&&(`ontouchstart`in ca||navigator.maxTouchPoints);var oo=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},so=new oo,G=new oo,co=new oo,lo=Array(230),uo;(e=>{function t(e){return so.keyCodeToStr(e)}e.toString=t;function n(e){return so.strToKeyCode(e)}e.fromString=n;function r(e){return G.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return co.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return G.strToKeyCode(e)||co.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return so.keyCodeToStr(e)}e.toElectronAccelerator=o})(uo||={});var fo=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new po([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},po=class{constructor(e){if(e.length===0)throw Wi(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t{function t(t){return t===e.None||t===e.Cancelled||t instanceof Do?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ma.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:To})})(Eo||={});var Do=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?To:(this._emitter||=new W,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Oo=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Ki(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ki(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},ko=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Ki(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=H(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Ao;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Ao||={});var jo=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new W,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};jo.EMPTY=jo.fromArray([]);function Mo(e){return No(e,0)}function No(e,t){switch(typeof e){case`object`:return e===null?Po(349,t):Array.isArray(e)?Lo(e,t):Ro(e,t);case`string`:return Io(e,t);case`boolean`:return Fo(e,t);case`number`:return Po(e,t);case`undefined`:return Po(937,t);default:return Po(617,t)}}function Po(e,t){return(t<<5)-t+e|0}function Fo(e,t){return Po(e?433:863,t)}function Io(e,t){t=Po(149417,t);for(let n=0,r=e.length;nNo(t,e),t)}function Ro(e,t){return t=Po(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Io(n,t),No(e[n],t)),t)}var{registerWindow:zo,getWindow:Bo,getDocument:Vo,getWindows:Ho,getWindowsCount:Uo,getWindowId:Wo,getWindowById:Go,hasWindow:Ko,onDidRegisterWindow:qo,onWillUnregisterWindow:Jo,onDidUnregisterWindow:Yo}=function(){let e=new Map,t={window:ca,disposables:new oa};e.set(ca.vscodeWindowId,t);let n=new W,r=new W,i=new W;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return U.None;let a=new oa,o={window:t,disposables:a.add(new oa)};return e.set(t.vscodeWindowId,o),a.add(H(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(K(t,as.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:ca},getDocument(e){return Bo(e).document}}}(),Xo=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function K(e,t,n,r){return new Xo(e,t,n,r)}function Zo(e,t){return function(n){return t(new Co(e,n))}}function Qo(e){return function(t){return e(new yo(t))}}var $o=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Zo(Bo(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=Qo(n)),K(e,t,i,r)},es,ts=class extends ko{constructor(e){super(),this.defaultTarget=e&&Bo(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},ns=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Bi(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(ns.sort),a.shift().execute();r.set(i,!1)};es=(t,r,a=0)=>{let o=Wo(t),s=new ns(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var rs=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};rs.None=new rs(0,0);function is(e){let t=e.getBoundingClientRect(),n=Bo(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Mo(n),a=r.get(i);if(a)a.users+=1;else{let o=new W,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(H(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var as={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Pa?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Pa?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Pa?`webkitAnimationIteration`:`animationiteration`},os=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=ss(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ss(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ss(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ss(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ss(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ss(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ss(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ss(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ss(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ss(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ss(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=ss(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=ss(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ss(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ss(e){return typeof e==`number`?`${e}px`:e}function cs(e){return new os(e)}var ls=class{constructor(){this._hooks=new oa,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(H(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Bo(e)}this._hooks.add(K(a,as.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(K(a,as.POINTER_UP,e=>this.stopMonitoring(!0)))}};function us(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var ds;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(ds||={});var fs=class e extends U{constructor(){super(),this.dispatched=!1,this.targets=new da,this.ignoreTargets=new da,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ma.runAndSubscribe(qo,({window:e,disposables:t})=>{t.add(K(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(K(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(K(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:ca,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=na(new e),H(e.INSTANCE.targets.push(t))):U.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=na(new e),H(e.INSTANCE.ignoreTargets.push(t))):U.None}static isTouchDevice(){return`ontouchstart`in ca||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n=e.HOLD_DELAY&&Math.abs(s.initialPageX-qi(s.rollingPageX))<30&&Math.abs(s.initialPageY-qi(s.rollingPageY))<30){let e=this.newGestureEvent(ds.Contextmenu,s.initialTarget);e.pageX=qi(s.rollingPageX),e.pageY=qi(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=qi(s.rollingPageX),n=qi(s.rollingPageY),i=qi(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(ds.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===ds.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===ds.Change||t.type===ds.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=es(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(ds.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};fs.SCROLL_FRICTION=-.005,fs.HOLD_DELAY=700,fs.CLEAR_TAP_COUNT_TIME=400,qr([us],fs,`isTouchDevice`,1);var ps=fs,ms=class extends U{onclick(e,t){this._register(K(e,as.CLICK,n=>t(new Co(Bo(e),n))))}onmousedown(e,t){this._register(K(e,as.MOUSE_DOWN,n=>t(new Co(Bo(e),n))))}onmouseover(e,t){this._register(K(e,as.MOUSE_OVER,n=>t(new Co(Bo(e),n))))}onmouseleave(e,t){this._register(K(e,as.MOUSE_LEAVE,n=>t(new Co(Bo(e),n))))}onkeydown(e,t){this._register(K(e,as.KEY_DOWN,e=>t(new yo(e))))}onkeyup(e,t){this._register(K(e,as.KEY_UP,e=>t(new yo(e))))}oninput(e,t){this._register(K(e,as.INPUT,t))}onblur(e,t){this._register(K(e,as.BLUR,t))}onfocus(e,t){this._register(K(e,as.FOCUS,t))}onchange(e,t){this._register(K(e,as.CHANGE,t))}ignoreGesture(e){return ps.ignoreTarget(e)}},hs=11,gs=class extends ms{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=hs+`px`,this.domNode.style.height=hs+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new ls),this._register($o(this.bgDomNode,as.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($o(this.domNode,as.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new ts),this._pointerdownScheduleRepeatTimer=this._register(new Oo)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Bo(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},_s=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},vs=class extends U{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _s(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Ss(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Ss.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},ys=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function bs(e,t){let n=t-e;return function(t){return e+n*ws(t)}}function xs(e,t,n){return function(r){return r2.5*n){let r,i;return e{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Es=140,Ds=class extends ms{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Ts(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ls),this._shouldRender=!0,this.domNode=cs(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(K(this.domNode.domNode,as.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new gs(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=cs(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(K(this.slider.domNode,as.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=is(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Xa&&a>Es){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Os=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Fs.INSTANCE=new Fs;var Is=Fs,Ls=class extends ms{constructor(e,t,n){super(),this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new W),this.onWillScroll=this._onWillScroll.event,this._options=zs(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new As(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new ks(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=cs(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=cs(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=cs(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Oo),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ra(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Za&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new wo(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ra(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(K(this._listenOnDomNode,as.MOUSE_WHEEL,e=>{this._onMouseWheel(new wo(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Is.INSTANCE;Ns&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Za&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Ms*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Ms*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Ns&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),js)}},Rs=class extends Ls{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function zs(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Za&&(t.className+=` mac`),t}var Bs=class extends U{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new vs({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>es(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Rs(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ma.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(H(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(H(()=>this._styleElement.remove())),this._register(ma.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(` `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Bs=qr([B(2,bi),B(3,V),B(4,xi),B(5,Li),B(6,Ei),B(7,Pi)],Bs);var Vs=class extends U{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(H(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Vs=qr([B(1,bi),B(2,V),B(3,ki),B(4,Pi)],Vs);var Hs=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Us={full:0,left:0,center:0,right:0},Ws={full:0,left:0,center:0,right:0},Gs={full:0,left:0,center:0,right:0},Ks=class extends U{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Hs,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(H(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ws.full=this._canvas.width,Ws.left=e,Ws.center=t,Ws.right=e,this._refreshDrawHeightConstants(),Gs.full=1,Gs.left=1,Gs.center=1+Ws.left,Gs.right=1+Ws.left+Ws.center}_refreshDrawHeightConstants(){Us.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Us.left=t,Us.center=t,Us.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Gs[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Us[e.position||`full`]/2),Ws[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Us[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ks=qr([B(2,bi),B(3,ki),B(4,Pi),B(5,Ei),B(6,Li),B(7,V)],Ks);var q;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` -`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(q||={});var qs;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(qs||={});var Js;(e=>e.ST=`${q.ESC}\\`)(Js||={});var Ys=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};Ys=qr([B(2,bi),B(3,Ei),B(4,Si),B(5,Pi)],Ys);var Xs=0,Zs=0,Qs=0,J=0,$s={css:`#00000000`,rgba:0},ec;(e=>{function t(e,t,n,r){return r===void 0?`#${ac(e)}${ac(t)}${ac(n)}`:`#${ac(e)}${ac(t)}${ac(n)}${ac(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(ec||={});var tc;(e=>{function t(e,t){if(J=(t.rgba&255)/255,J===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Xs=a+Math.round((n-a)*J),Zs=o+Math.round((r-o)*J),Qs=s+Math.round((i-s)*J),{css:ec.toCss(Xs,Zs,Qs),rgba:ec.toRgba(Xs,Zs,Qs)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=ic.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return ec.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Xs,Zs,Qs]=ic.toChannels(t),{css:ec.toCss(Xs,Zs,Qs),rgba:t}}e.opaque=i;function a(e,t){return J=Math.round(t*255),[Xs,Zs,Qs]=ic.toChannels(e.rgba),{css:ec.toCss(Xs,Zs,Qs,J),rgba:ec.toRgba(Xs,Zs,Qs,J)}}e.opacity=a;function o(e,t){return J=e.rgba&255,a(e,J*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(tc||={});var nc;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Xs=parseInt(e.slice(1,2).repeat(2),16),Zs=parseInt(e.slice(2,3).repeat(2),16),Qs=parseInt(e.slice(3,4).repeat(2),16),ec.toColor(Xs,Zs,Qs);case 5:return Xs=parseInt(e.slice(1,2).repeat(2),16),Zs=parseInt(e.slice(2,3).repeat(2),16),Qs=parseInt(e.slice(3,4).repeat(2),16),J=parseInt(e.slice(4,5).repeat(2),16),ec.toColor(Xs,Zs,Qs,J);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Xs=parseInt(r[1]),Zs=parseInt(r[2]),Qs=parseInt(r[3]),J=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),ec.toColor(Xs,Zs,Qs,J);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Xs,Zs,Qs,J]=t.getImageData(0,0,1,1).data,J!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:ec.toRgba(Xs,Zs,Qs,J),css:e}}e.toColor=r})(nc||={});var rc;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(rc||={});var ic;(e=>{function t(e,t){if(J=(t&255)/255,J===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Xs=a+Math.round((n-a)*J),Zs=o+Math.round((r-o)*J),Qs=s+Math.round((i-s)*J),ec.toRgba(Xs,Zs,Qs)}e.blend=t;function n(e,t,n){let a=rc.relativeLuminance(e>>8),o=rc.relativeLuminance(t>>8);if(oc(a,o)>8));if(soc(a,rc.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=oc(a,rc.relativeLuminance(s>>8));if(coc(a,rc.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(ic||={});function ac(e){let t=e.toString(16);return t.length<2?`0`+t:t}function oc(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=te,ae=ne,D=this._workCell;if(f.length>0&&ne===f[0][0]&&ie){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],ie?(re=!0,D=new sc(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),ae=r[1]-1,m=D.getWidth()):te=r[1]}let O=this._isCellInSelection(ne,t),k=n&&ne===a,A=E&&ne>=l&&ne<=u,j=!1;this._decorationService.forEachDecorationAtCell(ne,t,void 0,e=>{j=!0});let oe=D.getChars()||ui;if(oe===` `&&(D.isUnderline()||D.isOverline())&&(oe=`\xA0`),ee=m*s-c.get(oe,D.isBold(),D.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(O&&w||!O&&!w&&D.bg===y)&&(O&&w&&p.selectionForeground||D.fg===b)&&D.extended.ext===x&&A===S&&ee===C&&!k&&!re&&!j&&ie){D.isInvisible()?_+=ui:_+=oe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=D.bg,b=D.fg,x=D.extended.ext,S=A,C=ee,w=O,re&&a>=ne&&a<=ae&&(a=ne),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(T.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&T.push(`xterm-cursor-blink`),T.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:T.push(`xterm-cursor-outline`);break;case`block`:T.push(`xterm-cursor-block`);break;case`bar`:T.push(`xterm-cursor-bar`);break;case`underline`:T.push(`xterm-cursor-underline`);break;default:break}}if(D.isBold()&&T.push(`xterm-bold`),D.isItalic()&&T.push(`xterm-italic`),D.isDim()&&T.push(`xterm-dim`),_=D.isInvisible()?ui:D.getChars()||ui,D.isUnderline()&&(T.push(`xterm-underline-${D.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!D.isUnderlineColorDefault())){if(D.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${di.toColorRGB(D.getUnderlineColor()).join(`,`)})`;else{let e=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}D.isOverline()&&(T.push(`xterm-overline`),_===` `&&(_=`\xA0`)),D.isStrikethrough()&&T.push(`xterm-strikethrough`),A&&(h.style.textDecoration=`underline`);let M=D.getFgColor(),N=D.getFgColorMode(),se=D.getBgColor(),ce=D.getBgColorMode(),P=!!D.isInverse();if(P){let e=M;M=se,se=e;let t=N;N=ce,ce=t}let le,ue,de=!1;this._decorationService.forEachDecorationAtCell(ne,t,void 0,e=>{e.options.layer!==`top`&&de||(e.backgroundColorRGB&&(ce=50331648,se=e.backgroundColorRGB.rgba>>8&16777215,le=e.backgroundColorRGB),e.foregroundColorRGB&&(N=50331648,M=e.foregroundColorRGB.rgba>>8&16777215,ue=e.foregroundColorRGB),de=e.options.layer===`top`)}),!de&&O&&(le=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,se=le.rgba>>8&16777215,ce=50331648,de=!0,p.selectionForeground&&(N=50331648,M=p.selectionForeground.rgba>>8&16777215,ue=p.selectionForeground)),de&&T.push(`xterm-decoration-top`);let fe;switch(ce){case 16777216:case 33554432:fe=p.ansi[se],T.push(`xterm-bg-${se}`);break;case 50331648:fe=ec.toColor(se>>16,se>>8&255,se&255),this._addStyle(h,`background-color:#${hc((se>>>0).toString(16),`0`,6)}`);break;default:P?(fe=p.foreground,T.push(`xterm-bg-257`)):fe=p.background}switch(le||D.isDim()&&(le=tc.multiplyOpacity(fe,.5)),N){case 16777216:case 33554432:D.isBold()&&M<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(M+=8),this._applyMinimumContrast(h,fe,p.ansi[M],D,le,void 0)||T.push(`xterm-fg-${M}`);break;case 50331648:let e=ec.toColor(M>>16&255,M>>8&255,M&255);this._applyMinimumContrast(h,fe,e,D,le,ue)||this._addStyle(h,`color:#${hc(M.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,fe,p.foreground,D,le,ue)||P&&T.push(`xterm-fg-257`)}T.length&&=(h.className=T.join(` `),0),!k&&!re&&!j&&ie?g++:h.textContent=_,ee!==this.defaultSpacing&&(h.style.letterSpacing=`${ee}px`),d.push(h),ne=ae}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||dc(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=tc.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};mc=qr([B(1,Ii),B(2,Ei),B(3,V),B(4,Si),B(5,ki),B(6,Li)],mc);function hc(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},_c=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function vc(){return new _c}var yc=`xterm-dom-renderer-owner-`,bc=`xterm-rows`,xc=`xterm-fg-`,Sc=`xterm-bg-`,Cc=`xterm-focus`,wc=`xterm-selection`,Tc=1,Ec=class extends U{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Tc++,this._rowElements=[],this._selectionRenderModel=vc(),this.onRequestRedraw=this._register(new W).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(bc),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(wc),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=fc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(mc,document),this._element.classList.add(yc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(H(()=>{this._element.classList.remove(yc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new gc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${bc} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${bc} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${bc} .xterm-dim { color: ${tc.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${wc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${wc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${wc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${xc}${n} { color: ${r.css}; }${this._terminalSelector} .${xc}${n}.xterm-dim { color: ${tc.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Sc}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${xc}257 { color: ${tc.opaque(e.background).css}; }${this._terminalSelector} .${xc}257.xterm-dim { color: ${tc.multiplyOpacity(tc.opaque(e.background),.5).css}; }${this._terminalSelector} .${Sc}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Cc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Cc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${yc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Ec=qr([B(7,wi),B(8,Mi),B(9,Ei),B(10,bi),B(11,Si),B(12,V),B(13,Li)],Ec);var Dc=class extends U{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new W),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ac(this._optionsService))}catch{this._measureStrategy=this._register(new kc(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Dc=qr([B(2,Ei)],Dc);var Oc=class extends U{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},kc=class extends Oc{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Ac=class extends Oc{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},jc=class extends U{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Mc(this._window)),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new W),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(ma.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(K(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(K(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Mc=class extends U{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new sa),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(H(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=K(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Nc=class extends U{constructor(){super(),this.linkProviders=[],this._register(H(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Pc(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Fc(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Pc(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Ic=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Fc(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Pc(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ic=qr([B(0,Pi),B(1,Mi)],Ic);var Lc=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Rc={};Kr(Rc,{getSafariVersion:()=>Gc,isChromeOS:()=>Zc,isFirefox:()=>Hc,isIpad:()=>qc,isIphone:()=>Jc,isLegacyEdge:()=>Uc,isLinux:()=>Xc,isMac:()=>Kc,isNode:()=>zc,isSafari:()=>Wc,isWindows:()=>Yc});var zc=typeof process<`u`&&`title`in process,Bc=zc?`node`:navigator.userAgent,Vc=zc?`node`:navigator.platform,Hc=Bc.includes(`Firefox`),Uc=Bc.includes(`Edge`),Wc=/^((?!chrome|android).)*safari/i.test(Bc);function Gc(){if(!Wc)return 0;let e=Bc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Kc=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Vc),qc=Vc===`iPad`,Jc=Vc===`iPhone`,Yc=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Vc),Xc=Vc.indexOf(`Linux`)>=0,Zc=/\bCrOS\b/.test(Bc),Qc=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},$c=class extends Qc{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},el=class extends Qc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},tl=!zc&&`requestIdleCallback`in window?el:$c,nl=class{constructor(){this._queue=new tl}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rl=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new sa),this._pausedResizeTask=new nl,this._observerDisposable=this._register(new sa),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new W),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new W),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new W),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Lc((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new il(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(H(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=H(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rl=qr([B(2,Ei),B(3,Mi),B(4,Si),B(5,ki),B(6,bi),B(7,V),B(8,Li)],rl);var il=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function al(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return cl(i,a,e,t,n,r)+ll(a,t,n,r)+ul(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,_l(Math.abs(i-e),gl(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return _l(sl(a>t?e:i,n)+(s-1)*n.cols+1+ol(a>t?i:e,n),gl(o,r))}function ol(e,t){return e-1}function sl(e,t){return t.cols-e}function cl(e,t,n,r,i,a){return ll(t,r,i,a).length===0?``:_l(hl(e,t,e,t-fl(t,i),!1,i).length,gl(`D`,a))}function ll(e,t,n,r){let i=e-fl(e,n),a=t-fl(t,n);return _l(Math.abs(i-a)-dl(e,t,n),gl(ml(e,t),r))}function ul(e,t,n,r,i,a){let o;o=ll(t,r,i,a).length>0?r-fl(r,i):t;let s=r,c=pl(e,t,n,r,i,a);return _l(hl(e,o,n,s,c===`C`,i).length,gl(c,a))}function dl(e,t,n){let r=0,i=e-fl(e,n),a=t-fl(t,n);for(let o=0;o=0&&e0?r-fl(r,i):t,e=n&&ot?`A`:`B`}function hl(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function gl(e,t){let n=t?`O`:`[`;return q.ESC+n+e}function _l(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function yl(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var bl=50,xl=15,Sl=50,Cl=500,wl=RegExp(`\xA0`,`g`),Tl=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new pi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new W),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new W),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new vl(this._bufferService),this._activeSelectionMode=0,this._register(H(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(wl,` `)).join(Yc?`\r +`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(q||={});var qs;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(qs||={});var Js;(e=>e.ST=`${q.ESC}\\`)(Js||={});var Ys=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};Ys=qr([B(2,bi),B(3,Ei),B(4,Si),B(5,Pi)],Ys);var Xs=0,Zs=0,Qs=0,J=0,$s={css:`#00000000`,rgba:0},ec;(e=>{function t(e,t,n,r){return r===void 0?`#${ac(e)}${ac(t)}${ac(n)}`:`#${ac(e)}${ac(t)}${ac(n)}${ac(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(ec||={});var tc;(e=>{function t(e,t){if(J=(t.rgba&255)/255,J===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Xs=a+Math.round((n-a)*J),Zs=o+Math.round((r-o)*J),Qs=s+Math.round((i-s)*J),{css:ec.toCss(Xs,Zs,Qs),rgba:ec.toRgba(Xs,Zs,Qs)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=ic.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return ec.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Xs,Zs,Qs]=ic.toChannels(t),{css:ec.toCss(Xs,Zs,Qs),rgba:t}}e.opaque=i;function a(e,t){return J=Math.round(t*255),[Xs,Zs,Qs]=ic.toChannels(e.rgba),{css:ec.toCss(Xs,Zs,Qs,J),rgba:ec.toRgba(Xs,Zs,Qs,J)}}e.opacity=a;function o(e,t){return J=e.rgba&255,a(e,J*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(tc||={});var nc;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Xs=parseInt(e.slice(1,2).repeat(2),16),Zs=parseInt(e.slice(2,3).repeat(2),16),Qs=parseInt(e.slice(3,4).repeat(2),16),ec.toColor(Xs,Zs,Qs);case 5:return Xs=parseInt(e.slice(1,2).repeat(2),16),Zs=parseInt(e.slice(2,3).repeat(2),16),Qs=parseInt(e.slice(3,4).repeat(2),16),J=parseInt(e.slice(4,5).repeat(2),16),ec.toColor(Xs,Zs,Qs,J);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Xs=parseInt(r[1]),Zs=parseInt(r[2]),Qs=parseInt(r[3]),J=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),ec.toColor(Xs,Zs,Qs,J);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Xs,Zs,Qs,J]=t.getImageData(0,0,1,1).data,J!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:ec.toRgba(Xs,Zs,Qs,J),css:e}}e.toColor=r})(nc||={});var rc;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(rc||={});var ic;(e=>{function t(e,t){if(J=(t&255)/255,J===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Xs=a+Math.round((n-a)*J),Zs=o+Math.round((r-o)*J),Qs=s+Math.round((i-s)*J),ec.toRgba(Xs,Zs,Qs)}e.blend=t;function n(e,t,n){let a=rc.relativeLuminance(e>>8),o=rc.relativeLuminance(t>>8);if(oc(a,o)>8));if(soc(a,rc.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=oc(a,rc.relativeLuminance(s>>8));if(coc(a,rc.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=oc(rc.relativeLuminance2(o,s,c),rc.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(ic||={});function ac(e){let t=e.toString(16);return t.length<2?`0`+t:t}function oc(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=ee,ie=te,O=this._workCell;if(f.length>0&&te===f[0][0]&&re){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],re?(ne=!0,O=new sc(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),ie=r[1]-1,m=O.getWidth()):ee=r[1]}let k=this._isCellInSelection(te,t),A=n&&te===a,j=D&&te>=l&&te<=u,M=!1;this._decorationService.forEachDecorationAtCell(te,t,void 0,e=>{M=!0});let ae=O.getChars()||ui;if(ae===` `&&(O.isUnderline()||O.isOverline())&&(ae=`\xA0`),T=m*s-c.get(ae,O.isBold(),O.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(k&&w||!k&&!w&&O.bg===y)&&(k&&w&&p.selectionForeground||O.fg===b)&&O.extended.ext===x&&j===S&&T===C&&!A&&!ne&&!M&&re){O.isInvisible()?_+=ui:_+=ae,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=O.bg,b=O.fg,x=O.extended.ext,S=j,C=T,w=k,ne&&a>=te&&a<=ie&&(a=te),!this._coreService.isCursorHidden&&A&&this._coreService.isCursorInitialized){if(E.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&E.push(`xterm-cursor-blink`),E.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:E.push(`xterm-cursor-outline`);break;case`block`:E.push(`xterm-cursor-block`);break;case`bar`:E.push(`xterm-cursor-bar`);break;case`underline`:E.push(`xterm-cursor-underline`);break;default:break}}if(O.isBold()&&E.push(`xterm-bold`),O.isItalic()&&E.push(`xterm-italic`),O.isDim()&&E.push(`xterm-dim`),_=O.isInvisible()?ui:O.getChars()||ui,O.isUnderline()&&(E.push(`xterm-underline-${O.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!O.isUnderlineColorDefault())){if(O.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${di.toColorRGB(O.getUnderlineColor()).join(`,`)})`;else{let e=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}O.isOverline()&&(E.push(`xterm-overline`),_===` `&&(_=`\xA0`)),O.isStrikethrough()&&E.push(`xterm-strikethrough`),j&&(h.style.textDecoration=`underline`);let N=O.getFgColor(),P=O.getFgColorMode(),oe=O.getBgColor(),se=O.getBgColorMode(),F=!!O.isInverse();if(F){let e=N;N=oe,oe=e;let t=P;P=se,se=t}let ce,le,ue=!1;this._decorationService.forEachDecorationAtCell(te,t,void 0,e=>{e.options.layer!==`top`&&ue||(e.backgroundColorRGB&&(se=50331648,oe=e.backgroundColorRGB.rgba>>8&16777215,ce=e.backgroundColorRGB),e.foregroundColorRGB&&(P=50331648,N=e.foregroundColorRGB.rgba>>8&16777215,le=e.foregroundColorRGB),ue=e.options.layer===`top`)}),!ue&&k&&(ce=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,oe=ce.rgba>>8&16777215,se=50331648,ue=!0,p.selectionForeground&&(P=50331648,N=p.selectionForeground.rgba>>8&16777215,le=p.selectionForeground)),ue&&E.push(`xterm-decoration-top`);let de;switch(se){case 16777216:case 33554432:de=p.ansi[oe],E.push(`xterm-bg-${oe}`);break;case 50331648:de=ec.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(h,`background-color:#${hc((oe>>>0).toString(16),`0`,6)}`);break;default:F?(de=p.foreground,E.push(`xterm-bg-257`)):de=p.background}switch(ce||O.isDim()&&(ce=tc.multiplyOpacity(de,.5)),P){case 16777216:case 33554432:O.isBold()&&N<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(N+=8),this._applyMinimumContrast(h,de,p.ansi[N],O,ce,void 0)||E.push(`xterm-fg-${N}`);break;case 50331648:let e=ec.toColor(N>>16&255,N>>8&255,N&255);this._applyMinimumContrast(h,de,e,O,ce,le)||this._addStyle(h,`color:#${hc(N.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,de,p.foreground,O,ce,le)||F&&E.push(`xterm-fg-257`)}E.length&&=(h.className=E.join(` `),0),!A&&!ne&&!M&&re?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),te=ie}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||dc(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=tc.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};mc=qr([B(1,Ii),B(2,Ei),B(3,V),B(4,Si),B(5,ki),B(6,Li)],mc);function hc(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},_c=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function vc(){return new _c}var yc=`xterm-dom-renderer-owner-`,bc=`xterm-rows`,xc=`xterm-fg-`,Sc=`xterm-bg-`,Cc=`xterm-focus`,wc=`xterm-selection`,Tc=1,Ec=class extends U{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Tc++,this._rowElements=[],this._selectionRenderModel=vc(),this.onRequestRedraw=this._register(new W).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(bc),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(wc),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=fc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(mc,document),this._element.classList.add(yc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(H(()=>{this._element.classList.remove(yc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new gc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${bc} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${bc} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${bc} .xterm-dim { color: ${tc.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${bc}.${Cc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${bc} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${wc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${wc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${wc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${xc}${n} { color: ${r.css}; }${this._terminalSelector} .${xc}${n}.xterm-dim { color: ${tc.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Sc}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${xc}257 { color: ${tc.opaque(e.background).css}; }${this._terminalSelector} .${xc}257.xterm-dim { color: ${tc.multiplyOpacity(tc.opaque(e.background),.5).css}; }${this._terminalSelector} .${Sc}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Cc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Cc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${yc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Ec=qr([B(7,wi),B(8,Mi),B(9,Ei),B(10,bi),B(11,Si),B(12,V),B(13,Li)],Ec);var Dc=class extends U{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new W),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ac(this._optionsService))}catch{this._measureStrategy=this._register(new kc(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Dc=qr([B(2,Ei)],Dc);var Oc=class extends U{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},kc=class extends Oc{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Ac=class extends Oc{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},jc=class extends U{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Mc(this._window)),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new W),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(ma.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(K(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(K(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Mc=class extends U{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new sa),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(H(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=K(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Nc=class extends U{constructor(){super(),this.linkProviders=[],this._register(H(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Pc(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Fc(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Pc(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Ic=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Fc(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Pc(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ic=qr([B(0,Pi),B(1,Mi)],Ic);var Lc=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Rc={};Kr(Rc,{getSafariVersion:()=>Gc,isChromeOS:()=>Zc,isFirefox:()=>Hc,isIpad:()=>qc,isIphone:()=>Jc,isLegacyEdge:()=>Uc,isLinux:()=>Xc,isMac:()=>Kc,isNode:()=>zc,isSafari:()=>Wc,isWindows:()=>Yc});var zc=typeof process<`u`&&`title`in process,Bc=zc?`node`:navigator.userAgent,Vc=zc?`node`:navigator.platform,Hc=Bc.includes(`Firefox`),Uc=Bc.includes(`Edge`),Wc=/^((?!chrome|android).)*safari/i.test(Bc);function Gc(){if(!Wc)return 0;let e=Bc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Kc=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Vc),qc=Vc===`iPad`,Jc=Vc===`iPhone`,Yc=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Vc),Xc=Vc.indexOf(`Linux`)>=0,Zc=/\bCrOS\b/.test(Bc),Qc=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},$c=class extends Qc{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},el=class extends Qc{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},tl=!zc&&`requestIdleCallback`in window?el:$c,nl=class{constructor(){this._queue=new tl}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rl=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new sa),this._pausedResizeTask=new nl,this._observerDisposable=this._register(new sa),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new W),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new W),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new W),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Lc((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new il(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(H(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=H(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rl=qr([B(2,Ei),B(3,Mi),B(4,Si),B(5,ki),B(6,bi),B(7,V),B(8,Li)],rl);var il=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function al(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return cl(i,a,e,t,n,r)+ll(a,t,n,r)+ul(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,_l(Math.abs(i-e),gl(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return _l(sl(a>t?e:i,n)+(s-1)*n.cols+1+ol(a>t?i:e,n),gl(o,r))}function ol(e,t){return e-1}function sl(e,t){return t.cols-e}function cl(e,t,n,r,i,a){return ll(t,r,i,a).length===0?``:_l(hl(e,t,e,t-fl(t,i),!1,i).length,gl(`D`,a))}function ll(e,t,n,r){let i=e-fl(e,n),a=t-fl(t,n);return _l(Math.abs(i-a)-dl(e,t,n),gl(ml(e,t),r))}function ul(e,t,n,r,i,a){let o;o=ll(t,r,i,a).length>0?r-fl(r,i):t;let s=r,c=pl(e,t,n,r,i,a);return _l(hl(e,o,n,s,c===`C`,i).length,gl(c,a))}function dl(e,t,n){let r=0,i=e-fl(e,n),a=t-fl(t,n);for(let o=0;o=0&&e0?r-fl(r,i):t,e=n&&ot?`A`:`B`}function hl(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function gl(e,t){let n=t?`O`:`[`;return q.ESC+n+e}function _l(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function yl(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var bl=50,xl=15,Sl=50,Cl=500,wl=RegExp(`\xA0`,`g`),Tl=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new pi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new W),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new W),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new vl(this._bufferService),this._activeSelectionMode=0,this._register(H(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(wl,` `)).join(Yc?`\r `:` `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Xc&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=yl(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Pc(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-bl),bl),t/=bl,t/Math.abs(t)+Math.round(t*(xl-1)))}shouldForceSelection(e){return Kc?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Sl)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Kc&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=yl(n,this._bufferService.cols)}};Tl=qr([B(3,bi),B(4,Si),B(5,Ni),B(6,Ei),B(7,Pi),B(8,V)],Tl);var El=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Dl=class{constructor(){this._color=new El,this._css=new El}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ol=Object.freeze((()=>{let e=[nc.toColor(`#2e3436`),nc.toColor(`#cc0000`),nc.toColor(`#4e9a06`),nc.toColor(`#c4a000`),nc.toColor(`#3465a4`),nc.toColor(`#75507b`),nc.toColor(`#06989a`),nc.toColor(`#d3d7cf`),nc.toColor(`#555753`),nc.toColor(`#ef2929`),nc.toColor(`#8ae234`),nc.toColor(`#fce94f`),nc.toColor(`#729fcf`),nc.toColor(`#ad7fa8`),nc.toColor(`#34e2e2`),nc.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:ec.toCss(r,i,a),rgba:ec.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:ec.toCss(n,n,n),rgba:ec.toRgba(n,n,n)})}return e})()),kl=nc.toColor(`#ffffff`),Al=nc.toColor(`#000000`),jl=nc.toColor(`#ffffff`),Ml=Al,Nl={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Pl=kl,Fl=class extends U{constructor(e){super(),this._optionsService=e,this._contrastCache=new Dl,this._halfContrastCache=new Dl,this._onChangeColors=this._register(new W),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:kl,background:Al,cursor:jl,cursorAccent:Ml,selectionForeground:void 0,selectionBackgroundTransparent:Nl,selectionBackgroundOpaque:tc.blend(Al,Nl),selectionInactiveBackgroundTransparent:Nl,selectionInactiveBackgroundOpaque:tc.blend(Al,Nl),scrollbarSliderBackground:tc.opacity(kl,.2),scrollbarSliderHoverBackground:tc.opacity(kl,.4),scrollbarSliderActiveBackground:tc.opacity(kl,.5),overviewRulerBorder:kl,ansi:Ol.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Y(e.foreground,kl),t.background=Y(e.background,Al),t.cursor=tc.blend(t.background,Y(e.cursor,jl)),t.cursorAccent=tc.blend(t.background,Y(e.cursorAccent,Ml)),t.selectionBackgroundTransparent=Y(e.selectionBackground,Nl),t.selectionBackgroundOpaque=tc.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Y(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=tc.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Y(e.selectionForeground,$s):void 0,t.selectionForeground===$s&&(t.selectionForeground=void 0),tc.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=tc.opacity(t.selectionBackgroundTransparent,.3)),tc.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=tc.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Y(e.scrollbarSliderBackground,tc.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Y(e.scrollbarSliderHoverBackground,tc.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Y(e.scrollbarSliderActiveBackground,tc.opacity(t.foreground,.5)),t.overviewRulerBorder=Y(e.overviewRulerBorder,Pl),t.ansi=Ol.slice(),t.ansi[0]=Y(e.black,Ol[0]),t.ansi[1]=Y(e.red,Ol[1]),t.ansi[2]=Y(e.green,Ol[2]),t.ansi[3]=Y(e.yellow,Ol[3]),t.ansi[4]=Y(e.blue,Ol[4]),t.ansi[5]=Y(e.magenta,Ol[5]),t.ansi[6]=Y(e.cyan,Ol[6]),t.ansi[7]=Y(e.white,Ol[7]),t.ansi[8]=Y(e.brightBlack,Ol[8]),t.ansi[9]=Y(e.brightRed,Ol[9]),t.ansi[10]=Y(e.brightGreen,Ol[10]),t.ansi[11]=Y(e.brightYellow,Ol[11]),t.ansi[12]=Y(e.brightBlue,Ol[12]),t.ansi[13]=Y(e.brightMagenta,Ol[13]),t.ansi[14]=Y(e.brightCyan,Ol[14]),t.ansi[15]=Y(e.brightWhite,Ol[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;re.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Z={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ll=`xterm.js: `,Rl=class extends U{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),zl=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Z[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Q+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Q+0]=e|2097152|t[2]<<22):this._data[e*Q+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Q+0]>>22}hasWidth(e){return this._data[e*Q+0]&12582912}getFg(e){return this._data[e*Q+1]}getBg(e){return this._data[e*Q+2]}hasContent(e){return this._data[e*Q+0]&4194303}getCodePoint(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Q+0]&2097152}getString(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e]:t&2097151?ai(t&2097151):``}isProtected(e){return this._data[e*Q+2]&536870912}loadCell(e,t){return Hl=e*Q,t.content=this._data[Hl+0],t.fg=this._data[Hl+1],t.bg=this._data[Hl+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*Q+0]=t.content,this._data[e*Q+1]=t.fg,this._data[e*Q+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Q+0]=t|n<<22,this._data[e*Q+1]=r.fg,this._data[e*Q+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Q+0];r&2097152?this._combined[e]+=ai(t):r&2097151?(this._combined[e]=ai(r&2097151)+ai(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Q+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*Ul=0;--e)if(this._data[e*Q+0]&4194303)return e+(this._data[e*Q+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Q+0]&4194303||this._data[e*Q+2]&50331648)return e+(this._data[e*Q+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}};function Gl(e,t,n,r,i,a){let o=[];for(let s=0;s=s&&r0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function Kl(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;oYl(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;sc&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function Yl(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Xl=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new W),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ra(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Xl._nextId=1;var Zl=Xl,Ql={},$l=Ql.B;Ql[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},Ql.A={"#":`£`},Ql.B=void 0,Ql[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},Ql.C=Ql[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},Ql.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},Ql.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},Ql.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},Ql.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},Ql.E=Ql[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},Ql.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},Ql.H=Ql[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},Ql[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var eu=4294967295,tu=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Vl.clone(),this.savedCharset=$l,this.markers=[],this._nullCell=pi.fromCharData([0,li,1,0]),this._whitespaceCell=pi.fromCharData([0,ui,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new tl,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Bl(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new fi),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new fi),this._whitespaceCell}getBlankLine(e,t){return new Wl(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eeu?eu:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Vl);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Bl(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Vl),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Wl(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=Gl(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Vl),n);if(r.length>0){let n=Kl(this.lines,r);ql(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Vl),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=Yl(c,Math.max(g,0),this._cols))}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},nu=class extends U{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new W),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new tu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new tu(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ru=2,iu=1,au=class extends U{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ru),this.rows=Math.max(e.rawOptions.rows||0,iu),this.buffers=this._register(new nu(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};au=qr([B(0,Ei)],au);var ou={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Kc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},su=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],cu=class extends U{constructor(e){super(),this._onOptionChange=this._register(new W),this.onOptionChange=this._onOptionChange.event;let t={...ou};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(H(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in ou))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in ou))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=ou[e],!lu(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=ou[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=su.includes(t)?t:ou[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function lu(e){return e===`block`||e===`underline`||e===`bar`}function uu(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&uu(e[r],t-1);return n}var du=Object.freeze({insertMode:!1}),fu=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),pu=class extends U{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new W),this.onData=this._onData.event,this._onUserInput=this._register(new W),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new W),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=uu(du),this.decPrivateModes=uu(fu)}reset(){this.modes=uu(du),this.decPrivateModes=uu(fu)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};pu=qr([B(0,bi),B(1,Ti),B(2,Ei)],pu);var mu={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function hu(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var gu=String.fromCharCode,_u={DEFAULT:e=>{let t=[hu(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${gu(t[0])}${gu(t[1])}${gu(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${hu(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${hu(e,!0)};${e.x};${e.y}${t}`}},vu=class extends U{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new W),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(mu))this.addProtocol(e,mu[e]);for(let e of Object.keys(_u))this.addEncoding(e,_u[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};vu=qr([B(0,bi),B(1,Si),B(2,Ei)],vu);var yu=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],bu=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],xu;function Su(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=wu.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return wu.createPropertyValue(0,n,r)}},wu=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new W,this.onChange=this._onChange.event;let e=new Cu;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Tu=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Eu(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Du=2147483647,Ou=256,ku=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Ou)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Du?Du:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Du?Du:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Du):e}},Au=[],ju=class{constructor(){this._state=0,this._active=Au,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Au}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Au,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Au,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,oi(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=Au,this._id=-1,this._state=0}}},Mu=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=oi(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},Nu=[],Pu=class{constructor(){this._handlers=Object.create(null),this._active=Nu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Nu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Nu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Nu,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,oi(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Nu,this._ident=0}},Fu=new ku;Fu.addParam(0);var Iu=class{constructor(e){this._handler=e,this._data=``,this._params=Fu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Fu,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=oi(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=Fu,this._data=``,this._hitLimit=!1,e));return this._params=Fu,this._data=``,this._hitLimit=!1,t}},Lu=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ru,0,2,0),e.add(Ru,8,5,8),e.add(Ru,6,0,6),e.add(Ru,11,0,11),e.add(Ru,13,13,13),e}(),Bu=class extends U{constructor(e=zu){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new ku,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(H(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new ju),this._dcsParser=this._register(new Pu),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r=t||(r=e[i])<32||r>127&&r>4:i>>8}return n}}function Wu(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function Gu(e,t=16){let[n,r,i]=e;return`rgb:${Wu(n,t)}/${Wu(r,t)}/${Wu(i,t)}`}var Ku={"(":0,")":1,"*":2,"+":3,"-":1,".":2},qu=131072,Ju=10;function Yu(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Xu=5e3,Zu=0,Qu=class extends U{constructor(e,t,n,r,i,a,o,s,c=new Bu){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new si,this._utf8Decoder=new ci,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Vl.clone(),this._eraseAttrDataInternal=Vl.clone(),this._onRequestBell=this._register(new W),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new W),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new W),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new W),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new W),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new W),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new W),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new W),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new W),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new $u(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(q.BEL,()=>this.bell()),this._parser.setExecuteHandler(q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(q.BS,()=>this.backspace()),this._parser.setExecuteHandler(q.HT,()=>this.tab()),this._parser.setExecuteHandler(q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(qs.IND,()=>this.index()),this._parser.setExecuteHandler(qs.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(qs.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Mu(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Mu(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Mu(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Mu(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Mu(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Mu(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Mu(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Mu(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Mu(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Mu(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Mu(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Mu(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in Ql)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new Iu((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),Xu))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${Xu} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>qu&&(a=this._parseStack.position+qu)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthqu)for(let t=a;t0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;ps){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof Wl&&d.copyCellsFrom(e,t,0,m,!1);t=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!Yu(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Iu(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Mu(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(q.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=di.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Vl.fg,e.bg=Vl.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Vl.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Vl.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Vl.fg&16777215,r.bg&=-67108864,r.bg|=Vl.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Vl.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Yu(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ju&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ju&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(ed(n)){if(r===`?`)t.push({type:0,index:n});else{let e=Uu(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Uu(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Vl.clone(),this._eraseAttrDataInternal=Vl.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new pi;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${q.ESC}${e}${q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},$u=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Zu=e,e=t,t=Zu),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};$u=qr([B(0,bi)],$u);function ed(e){return 0<=e&&e<256}var td=5e7,nd=12,rd=50,id=class extends U{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new W),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>td)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=nd?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=nd)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rd&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ad=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ad=qr([B(0,bi)],ad);var od=!1,sd=class extends U{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new sa),this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onData=this._register(new W),this.onData=this._onData.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new W),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new W),this._instantiationService=new X,this.optionsService=this._register(new cu(e)),this._instantiationService.setService(Ei,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(au)),this._instantiationService.setService(bi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Rl)),this._instantiationService.setService(Ti,this._logService),this.coreService=this._register(this._instantiationService.createInstance(pu)),this._instantiationService.setService(Si,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(vu)),this._instantiationService.setService(xi,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(wu)),this._instantiationService.setService(Oi,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Tu),this._instantiationService.setService(Ci,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ad),this._instantiationService.setService(Di,this._oscLinkService),this._inputHandler=this._register(new Qu(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ma.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ma.forward(this._bufferService.onResize,this._onResize)),this._register(ma.forward(this.coreService.onData,this._onData)),this._register(ma.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new id((e,t)=>this._inputHandler.parse(e,t))),this._register(ma.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new W),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!od&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),od=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,ru),t=Math.max(t,iu),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Eu.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Eu(this._bufferService),!1))),this._windowsWrappingHeuristics.value=H(()=>{for(let t of e)t.dispose()})}}},cd={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function ld(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?q.ESC+`OA`:q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?q.ESC+`OD`:q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?q.ESC+`OC`:q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?q.ESC+`OB`:q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:q.DEL,e.altKey&&(i.key=q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=q.ESC+`[Z`;break}i.key=q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?q.ESC+q.CR:q.CR,i.cancel=!0;break;case 27:i.key=q.ESC,e.altKey&&(i.key=q.ESC+q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?q.ESC+`[1;`+(a+1)+`D`:t?q.ESC+`OD`:q.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?q.ESC+`[1;`+(a+1)+`C`:t?q.ESC+`OC`:q.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?q.ESC+`[1;`+(a+1)+`A`:t?q.ESC+`OA`:q.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?q.ESC+`[1;`+(a+1)+`B`:t?q.ESC+`OB`:q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=q.ESC+`[2~`);break;case 46:i.key=a?q.ESC+`[3;`+(a+1)+`~`:q.ESC+`[3~`;break;case 36:i.key=a?q.ESC+`[1;`+(a+1)+`H`:t?q.ESC+`OH`:q.ESC+`[H`;break;case 35:i.key=a?q.ESC+`[1;`+(a+1)+`F`:t?q.ESC+`OF`:q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?q.ESC+`[5;`+(a+1)+`~`:q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?q.ESC+`[6;`+(a+1)+`~`:q.ESC+`[6~`;break;case 112:i.key=a?q.ESC+`[1;`+(a+1)+`P`:q.ESC+`OP`;break;case 113:i.key=a?q.ESC+`[1;`+(a+1)+`Q`:q.ESC+`OQ`;break;case 114:i.key=a?q.ESC+`[1;`+(a+1)+`R`:q.ESC+`OR`;break;case 115:i.key=a?q.ESC+`[1;`+(a+1)+`S`:q.ESC+`OS`;break;case 116:i.key=a?q.ESC+`[15;`+(a+1)+`~`:q.ESC+`[15~`;break;case 117:i.key=a?q.ESC+`[17;`+(a+1)+`~`:q.ESC+`[17~`;break;case 118:i.key=a?q.ESC+`[18;`+(a+1)+`~`:q.ESC+`[18~`;break;case 119:i.key=a?q.ESC+`[19;`+(a+1)+`~`:q.ESC+`[19~`;break;case 120:i.key=a?q.ESC+`[20;`+(a+1)+`~`:q.ESC+`[20~`;break;case 121:i.key=a?q.ESC+`[21;`+(a+1)+`~`:q.ESC+`[21~`;break;case 122:i.key=a?q.ESC+`[23;`+(a+1)+`~`:q.ESC+`[23~`;break;case 123:i.key=a?q.ESC+`[24;`+(a+1)+`~`:q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=q.DEL:e.keyCode===219?i.key=q.ESC:e.keyCode===220?i.key=q.FS:e.keyCode===221&&(i.key=q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=cd[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=q.ESC+n}else if(e.keyCode===32)i.key=q.ESC+(e.ctrlKey?q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=q.US),e.key===`@`&&(i.key=q.NUL))}return i}var ud=0,dd=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new tl,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new tl,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(ud=this._search(t),ud===-1)||this._getKey(this._array[ud])!==t)return!1;do if(this._array[ud]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ud),!0;while(++ude-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ud=this._search(e),!(ud<0||ud>=this._array.length)&&this._getKey(this._array[ud])===e))do yield this._array[ud];while(++ud=this._array.length)&&this._getKey(this._array[ud])===e))do t(this._array[ud]);while(++ud=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},fd=0,pd=0,md=class extends U{constructor(){super(),this._decorations=new dd(e=>e?.marker.line),this._onDecorationRegistered=this._register(new W),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new W),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(H(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new hd(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{fd=t.options.x??0,pd=fd+(t.options.width??1),e>=fd&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},vd=20,$=class extends U{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new _d(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(K(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(H(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` @@ -29,11 +29,11 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t `+e.stack):Error(e.message+` -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Bd(e){Hd(e)||zd.onUnexpectedError(e)}var Vd=`Canceled`;function Hd(e){return e instanceof Ud||e instanceof Error&&e.name===Vd&&e.message===Vd}var Ud=class extends Error{constructor(){super(Vd),this.name=this.message}},Wd=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Gd;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Gd||={});var Kd=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Gd.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Kd.empty=new Kd(e=>{});function qd(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Jd;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ef(...e){return tf(()=>$d(e))}function tf(e){let t=Xd({dispose:qd(()=>{Zd(t),e()})});return t}var nf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Xd(this)}dispose(){this._isDisposed||(Zd(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{$d(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Qd(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Qd(e,null))}};nf.DISABLE_DISPOSED_WARNING=!1;var rf=nf,af=class{constructor(){this._store=new rf,Xd(this),Qd(this._store,this)}dispose(){Zd(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};af.None=Object.freeze({dispose(){}});var of=class{constructor(){this._isDisposed=!1,Xd(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Qd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Zd(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Qd(e,null),e}},sf=typeof process<`u`&&`title`in process,cf=sf?`node`:navigator.userAgent,lf=sf?`node`:navigator.platform,uf=cf.includes(`Firefox`),df=cf.includes(`Edge`),ff=/^((?!chrome|android).)*safari/i.test(cf);function pf(){if(!ff)return 0;let e=cf.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(lf),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(lf),lf.indexOf(`Linux`),/\bCrOS\b/.test(cf);var mf=``,hf=0,gf=0,_f=0,vf=0,yf={css:`#00000000`,rgba:0},bf;(e=>{function t(e,t,n,r){return r===void 0?`#${Tf(e)}${Tf(t)}${Tf(n)}`:`#${Tf(e)}${Tf(t)}${Tf(n)}${Tf(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(bf||={});var xf;(e=>{function t(e,t){if(vf=(t.rgba&255)/255,vf===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return hf=a+Math.round((n-a)*vf),gf=o+Math.round((r-o)*vf),_f=s+Math.round((i-s)*vf),{css:bf.toCss(hf,gf,_f),rgba:bf.toRgba(hf,gf,_f)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=wf.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return bf.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[hf,gf,_f]=wf.toChannels(t),{css:bf.toCss(hf,gf,_f),rgba:t}}e.opaque=i;function a(e,t){return vf=Math.round(t*255),[hf,gf,_f]=wf.toChannels(e.rgba),{css:bf.toCss(hf,gf,_f,vf),rgba:bf.toRgba(hf,gf,_f,vf)}}e.opacity=a;function o(e,t){return vf=e.rgba&255,a(e,vf*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(xf||={});var Sf;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return hf=parseInt(e.slice(1,2).repeat(2),16),gf=parseInt(e.slice(2,3).repeat(2),16),_f=parseInt(e.slice(3,4).repeat(2),16),bf.toColor(hf,gf,_f);case 5:return hf=parseInt(e.slice(1,2).repeat(2),16),gf=parseInt(e.slice(2,3).repeat(2),16),_f=parseInt(e.slice(3,4).repeat(2),16),vf=parseInt(e.slice(4,5).repeat(2),16),bf.toColor(hf,gf,_f,vf);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return hf=parseInt(r[1]),gf=parseInt(r[2]),_f=parseInt(r[3]),vf=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),bf.toColor(hf,gf,_f,vf);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[hf,gf,_f,vf]=t.getImageData(0,0,1,1).data,vf!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:bf.toRgba(hf,gf,_f,vf),css:e}}e.toColor=r})(Sf||={});var Cf;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Cf||={});var wf;(e=>{function t(e,t){if(vf=(t&255)/255,vf===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return hf=a+Math.round((n-a)*vf),gf=o+Math.round((r-o)*vf),_f=s+Math.round((i-s)*vf),bf.toRgba(hf,gf,_f)}e.blend=t;function n(e,t,n){let a=Cf.relativeLuminance(e>>8),o=Cf.relativeLuminance(t>>8);if(Ef(a,o)>8));if(sEf(a,Cf.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Ef(a,Cf.relativeLuminance(s>>8));if(cEf(a,Cf.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(wf||={});function Tf(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Ef(e,t){return e=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Nf(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Mf(e)&&!Of(e)&&!Af(e)}function Pf(e){return Of(e)||jf(e)}function Ff(){return{css:{canvas:If(),cell:If()},device:{canvas:If(),cell:If(),char:{width:0,height:0,left:0,top:0}}}}function If(){return{width:0,height:0}}function Lf(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var Rf=0,zf=0,Bf=!1,Vf=!1,Hf=!1,Uf,Wf=0,Gf=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,zf=0,Rf=0,Vf=!1,Bf=!1,Hf=!1,Uf=this._themeService.colors,Wf=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Wf=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(zf=e.backgroundColorRGB.rgba>>8&16777215,Vf=!0),e.foregroundColorRGB&&(Rf=e.foregroundColorRGB.rgba>>8&16777215,Bf=!0)}),Hf=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Hf){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:zf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:zf=(this.result.fg&16777215)<<8|255;break;case 0:default:zf=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:zf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:zf=(this.result.bg&16777215)<<8|255;break}zf=wf.blend(zf,(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else zf=(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Vf=!0,Uf.selectionForeground&&(Rf=Uf.selectionForeground.rgba>>8&16777215,Bf=!0),Pf(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))Rf=(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Rf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Rf=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Rf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Rf=(this.result.fg&16777215)<<8|255;break;case 0:default:Rf=this._themeService.colors.foreground.rgba}Rf=wf.blend(Rf,(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Bf=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(zf=e.backgroundColorRGB.rgba>>8&16777215,Vf=!0),e.foregroundColorRGB&&(Rf=e.foregroundColorRGB.rgba>>8&16777215,Bf=!0)}),Vf&&(zf=Hf?e.bg&-150994944|zf|50331648:e.bg&-16777216|zf|50331648),Bf&&(Rf=e.fg&-83886080|Rf|50331648),this.result.fg&67108864&&(Vf&&!Bf&&(Rf=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|Uf.background.rgba>>8&16777215|50331648,Bf=!0),!Vf&&Bf&&(zf=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|Uf.foreground.rgba>>8&16777215|50331648,Vf=!0)),Uf=void 0,this.result.bg=Vf?zf:this.result.bg,this.result.fg=Bf?Rf:this.result.fg,this.result.ext&=536870911,this.result.ext|=Wf<<29&3758096384}},Kf=.5,qf=uf||df?`bottom`:`ideographic`,Jf={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Yf={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Xf={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Zf={"":{d:`M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655`,type:0},"":{d:`M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5`,type:0},"":{d:`M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82`,type:0},"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}};Zf[``]=Zf[``],Zf[``]=Zf[``];function Qf(e,t,n,r,i,a,o,s){let c=Jf[t];if(c)return $f(e,c,n,r,i,a),!0;let l=Yf[t];if(l)return tp(e,l,n,r,i,a),!0;let u=Xf[t];if(u)return np(e,u,n,r,i,a,s),!0;let d=Zf[t];return d?(rp(e,d,n,r,i,a,o,s),!0):!1}function $f(e,t,n,r,i,a){for(let o=0;o7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;ee.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function op(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;ei){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},up=class extends lp{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},dp=class extends lp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fp=!sf&&`requestIdleCallback`in window?dp:up,pp=class e{constructor(){this.fg=0,this.bg=0,this.extended=new mp}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},mp=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hp=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};hp.Undefined=new hp(void 0);var gp=globalThis.performance&&typeof globalThis.performance.now==`function`,_p=class e{static create(t){return new e(t)}constructor(e){this._now=gp&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},vp;(e=>{e.None=()=>af.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(ef(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new jp({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new jp({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new jp({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new jp({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new jp({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new jp;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class ee{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new jp(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(e,t){return new ee(e,t).emitter.event}e.fromObservable=te;function T(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof rf?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=T})(vp||={});var yp=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new _p,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yp.all=new Set,yp._idPool=0;var bp=yp,xp=-1,Sp=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Bd(e){Hd(e)||zd.onUnexpectedError(e)}var Vd=`Canceled`;function Hd(e){return e instanceof Ud||e instanceof Error&&e.name===Vd&&e.message===Vd}var Ud=class extends Error{constructor(){super(Vd),this.name=this.message}},Wd=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Gd;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Gd||={});var Kd=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Gd.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Kd.empty=new Kd(e=>{});function qd(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Jd;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ef(...e){return tf(()=>$d(e))}function tf(e){let t=Xd({dispose:qd(()=>{Zd(t),e()})});return t}var nf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Xd(this)}dispose(){this._isDisposed||(Zd(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{$d(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Qd(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Qd(e,null))}};nf.DISABLE_DISPOSED_WARNING=!1;var rf=nf,af=class{constructor(){this._store=new rf,Xd(this),Qd(this._store,this)}dispose(){Zd(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};af.None=Object.freeze({dispose(){}});var of=class{constructor(){this._isDisposed=!1,Xd(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Qd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Zd(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Qd(e,null),e}},sf=typeof process<`u`&&`title`in process,cf=sf?`node`:navigator.userAgent,lf=sf?`node`:navigator.platform,uf=cf.includes(`Firefox`),df=cf.includes(`Edge`),ff=/^((?!chrome|android).)*safari/i.test(cf);function pf(){if(!ff)return 0;let e=cf.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(lf),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(lf),lf.indexOf(`Linux`),/\bCrOS\b/.test(cf);var mf=``,hf=0,gf=0,_f=0,vf=0,yf={css:`#00000000`,rgba:0},bf;(e=>{function t(e,t,n,r){return r===void 0?`#${Tf(e)}${Tf(t)}${Tf(n)}`:`#${Tf(e)}${Tf(t)}${Tf(n)}${Tf(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(bf||={});var xf;(e=>{function t(e,t){if(vf=(t.rgba&255)/255,vf===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return hf=a+Math.round((n-a)*vf),gf=o+Math.round((r-o)*vf),_f=s+Math.round((i-s)*vf),{css:bf.toCss(hf,gf,_f),rgba:bf.toRgba(hf,gf,_f)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=wf.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return bf.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[hf,gf,_f]=wf.toChannels(t),{css:bf.toCss(hf,gf,_f),rgba:t}}e.opaque=i;function a(e,t){return vf=Math.round(t*255),[hf,gf,_f]=wf.toChannels(e.rgba),{css:bf.toCss(hf,gf,_f,vf),rgba:bf.toRgba(hf,gf,_f,vf)}}e.opacity=a;function o(e,t){return vf=e.rgba&255,a(e,vf*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(xf||={});var Sf;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return hf=parseInt(e.slice(1,2).repeat(2),16),gf=parseInt(e.slice(2,3).repeat(2),16),_f=parseInt(e.slice(3,4).repeat(2),16),bf.toColor(hf,gf,_f);case 5:return hf=parseInt(e.slice(1,2).repeat(2),16),gf=parseInt(e.slice(2,3).repeat(2),16),_f=parseInt(e.slice(3,4).repeat(2),16),vf=parseInt(e.slice(4,5).repeat(2),16),bf.toColor(hf,gf,_f,vf);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return hf=parseInt(r[1]),gf=parseInt(r[2]),_f=parseInt(r[3]),vf=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),bf.toColor(hf,gf,_f,vf);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[hf,gf,_f,vf]=t.getImageData(0,0,1,1).data,vf!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:bf.toRgba(hf,gf,_f,vf),css:e}}e.toColor=r})(Sf||={});var Cf;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Cf||={});var wf;(e=>{function t(e,t){if(vf=(t&255)/255,vf===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return hf=a+Math.round((n-a)*vf),gf=o+Math.round((r-o)*vf),_f=s+Math.round((i-s)*vf),bf.toRgba(hf,gf,_f)}e.blend=t;function n(e,t,n){let a=Cf.relativeLuminance(e>>8),o=Cf.relativeLuminance(t>>8);if(Ef(a,o)>8));if(sEf(a,Cf.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Ef(a,Cf.relativeLuminance(s>>8));if(cEf(a,Cf.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ef(Cf.relativeLuminance2(o,s,c),Cf.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(wf||={});function Tf(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Ef(e,t){return e=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Nf(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Mf(e)&&!Of(e)&&!Af(e)}function Pf(e){return Of(e)||jf(e)}function Ff(){return{css:{canvas:If(),cell:If()},device:{canvas:If(),cell:If(),char:{width:0,height:0,left:0,top:0}}}}function If(){return{width:0,height:0}}function Lf(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var Rf=0,zf=0,Bf=!1,Vf=!1,Hf=!1,Uf,Wf=0,Gf=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,zf=0,Rf=0,Vf=!1,Bf=!1,Hf=!1,Uf=this._themeService.colors,Wf=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Wf=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(zf=e.backgroundColorRGB.rgba>>8&16777215,Vf=!0),e.foregroundColorRGB&&(Rf=e.foregroundColorRGB.rgba>>8&16777215,Bf=!0)}),Hf=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Hf){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:zf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:zf=(this.result.fg&16777215)<<8|255;break;case 0:default:zf=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:zf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:zf=(this.result.bg&16777215)<<8|255;break}zf=wf.blend(zf,(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else zf=(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Vf=!0,Uf.selectionForeground&&(Rf=Uf.selectionForeground.rgba>>8&16777215,Bf=!0),Pf(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))Rf=(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Rf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Rf=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Rf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Rf=(this.result.fg&16777215)<<8|255;break;case 0:default:Rf=this._themeService.colors.foreground.rgba}Rf=wf.blend(Rf,(this._coreBrowserService.isFocused?Uf.selectionBackgroundOpaque:Uf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Bf=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(zf=e.backgroundColorRGB.rgba>>8&16777215,Vf=!0),e.foregroundColorRGB&&(Rf=e.foregroundColorRGB.rgba>>8&16777215,Bf=!0)}),Vf&&(zf=Hf?e.bg&-150994944|zf|50331648:e.bg&-16777216|zf|50331648),Bf&&(Rf=e.fg&-83886080|Rf|50331648),this.result.fg&67108864&&(Vf&&!Bf&&(Rf=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|Uf.background.rgba>>8&16777215|50331648,Bf=!0),!Vf&&Bf&&(zf=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|Uf.foreground.rgba>>8&16777215|50331648,Vf=!0)),Uf=void 0,this.result.bg=Vf?zf:this.result.bg,this.result.fg=Bf?Rf:this.result.fg,this.result.ext&=536870911,this.result.ext|=Wf<<29&3758096384}},Kf=.5,qf=uf||df?`bottom`:`ideographic`,Jf={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Yf={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Xf={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Zf={"":{d:`M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655`,type:0},"":{d:`M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5`,type:0},"":{d:`M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82`,type:0},"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}};Zf[``]=Zf[``],Zf[``]=Zf[``];function Qf(e,t,n,r,i,a,o,s){let c=Jf[t];if(c)return $f(e,c,n,r,i,a),!0;let l=Yf[t];if(l)return tp(e,l,n,r,i,a),!0;let u=Xf[t];if(u)return np(e,u,n,r,i,a,s),!0;let d=Zf[t];return d?(rp(e,d,n,r,i,a,o,s),!0):!1}function $f(e,t,n,r,i,a){for(let o=0;o7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;ee.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function op(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;ei){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},up=class extends lp{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},dp=class extends lp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fp=!sf&&`requestIdleCallback`in window?dp:up,pp=class e{constructor(){this.fg=0,this.bg=0,this.extended=new mp}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},mp=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hp=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};hp.Undefined=new hp(void 0);var gp=globalThis.performance&&typeof globalThis.performance.now==`function`,_p=class e{static create(t){return new e(t)}constructor(e){this._now=gp&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},vp;(e=>{e.None=()=>af.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(ef(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new jp({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new jp({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new jp({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new jp({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new jp({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new jp;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new jp(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ee(e,t){return new T(e,t).emitter.event}e.fromObservable=ee;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof rf?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(vp||={});var yp=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new _p,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yp.all=new Set,yp._idPool=0;var bp=yp,xp=-1,Sp=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t0||this._options?.leakWarningThreshold?new Cp(e?.onListenerError??Bd,this._options?.leakWarningThreshold??xp):void 0,this._perfMon=this._options?._profName?new bp(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Ep(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Bd)(n),af.None}if(this._disposed)return af.None;t&&(e=e.bind(t));let r=new Op(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=wp.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Op?(this._deliveryQueue??=new Mp,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=tf(()=>{Ap?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof rf?n.add(a):Array.isArray(n)&&n.push(a),Ap){let e=Error().stack.split(` `).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Ap.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*kp<=t.length){let e=0;for(let n=0;n0}},Mp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Np={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Pp=2,Fp,Ip=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new cp,this._cacheMapCombined=new cp,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new pp,this._textureSize=512,this._onAddTextureAtlasCanvas=new jp,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new jp,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Bp(e,this._config.deviceCellWidth*4+Pp*2,this._config.deviceCellHeight+Pp*2),this._tmpCtx=Df(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new fp;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;ee.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new Lp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new Lp(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return yf;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=pp.toColorRGB(t);i=bf.toColor(e[0],e[1],e[2]);break;default:i=n?xf.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(i=xf.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=pp.toColorRGB(a);d=bf.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=xf.opaque(d)),s&&(d=xf.multiplyOpacity(d,Kf)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=wf.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=bf.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+Pp*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=Lf(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!E&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*re,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,T,T+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*re,T+t),this._tmpCtx.stroke()}if(E||this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=Rp(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),x,te,ne);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight-t),e=Rp(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),x,te,ne),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*re,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let ie=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),ae;if(ae=this._config.allowTransparency?zp(ie):Rp(ie,x,te,ne),ae)return Np;let D=this._findGlyphBoundingBox(ie,this._workBoundingBox,c,ee,E,T),O,k;for(;;){if(this._activePages.length===0){let e=this._createNewPage();O=e,k=e.currentRow,k.height=D.size.y;break}O=this._activePages[this._activePages.length-1],k=O.currentRow;for(let e of this._activePages)D.size.y<=e.currentRow.height&&(O=e,k=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=k.height&&D.size.y<=t.height&&(O=this._activePages[e],k=t);if(D.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Lp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),O=this._overflowSizePage,k=this._overflowSizePage.currentRow,k.x+D.size.x>=O.canvas.width&&(k.x=0,k.y+=k.height,k.height=0);break}if(k.y+D.size.y>=O.canvas.height||k.height>D.size.y+2){let t=!1;if(O.currentRow.y+O.currentRow.height+D.size.y>=O.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+D.size.y=e.maxAtlasPages&&k.y+D.size.y<=O.canvas.height&&k.height>=D.size.y&&k.x+D.size.x<=O.canvas.width)t=!0;else{let e=this._createNewPage();O=e,k=e.currentRow,k.height=D.size.y,t=!0}}t||(O.currentRow.height>0&&O.fixedRows.push(O.currentRow),k={x:0,y:O.currentRow.y+O.currentRow.height,height:D.size.y},O.fixedRows.push(k),O.currentRow={x:0,y:k.y+k.height,height:0})}if(k.x+D.size.x<=O.canvas.width)break;k===O.currentRow?(k.x=0,k.y+=k.height,k.height=0):O.fixedRows.splice(O.fixedRows.indexOf(k),1)}return D.texturePage=this._pages.indexOf(O),D.texturePosition.x=k.x,D.texturePosition.y=k.y,D.texturePositionClipSpace.x=k.x/O.canvas.width,D.texturePositionClipSpace.y=k.y/O.canvas.height,D.sizeClipSpace.x/=O.canvas.width,D.sizeClipSpace.y/=O.canvas.height,k.height=Math.max(k.height,D.size.y),k.x+=D.size.x,O.ctx.putImageData(ie,D.texturePosition.x-this._workBoundingBox.left,D.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,D.size.x,D.size.y),O.addGlyph(D),O.version++,D}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n=a;n--){for(let r=0;r=0;n--){for(let r=0;r>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t0)return!1;return!0}function Bp(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function Vp(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:yf,cursorAccent:yf,selectionForeground:yf,selectionBackgroundTransparent:yf,selectionBackgroundOpaque:yf,selectionInactiveBackgroundTransparent:yf,selectionInactiveBackgroundOpaque:yf,overviewRulerBorder:yf,scrollbarSliderBackground:yf,scrollbarSliderHoverBackground:yf,scrollbarSliderActiveBackground:yf,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function Hp(e,t){for(let n=0;n=0){if(Hp(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),Wp.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=qp){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=qp-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=qp-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},qp)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Yp(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return tf(()=>r?.disconnect())}function Xp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Zp=class e extends pp{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mp,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Xp(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Qp=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function $p(e,t,n){let r=Df(e.createProgram());if(e.attachShader(r,Df(em(e,e.VERTEX_SHADER,t))),e.attachShader(r,Df(em(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function em(e,t,n){let r=Df(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function tm(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;t0}},Mp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Np={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Pp=2,Fp,Ip=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new cp,this._cacheMapCombined=new cp,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new pp,this._textureSize=512,this._onAddTextureAtlasCanvas=new jp,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new jp,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Bp(e,this._config.deviceCellWidth*4+Pp*2,this._config.deviceCellHeight+Pp*2),this._tmpCtx=Df(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new fp;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;ee.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new Lp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new Lp(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return yf;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=pp.toColorRGB(t);i=bf.toColor(e[0],e[1],e[2]);break;default:i=n?xf.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(i=xf.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=pp.toColorRGB(a);d=bf.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=xf.opaque(d)),s&&(d=xf.multiplyOpacity(d,Kf)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=wf.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=bf.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+Pp*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=Lf(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!D&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*ne,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,E,E+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(E,E+t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*ne,E+t),this._tmpCtx.stroke()}if(D||this._tmpCtx.fillText(s,E,E+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=Rp(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),x,ee,te);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,E,E+this._config.deviceCharHeight-t),e=Rp(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),x,ee,te),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(E,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*ne,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),ie;if(ie=this._config.allowTransparency?zp(re):Rp(re,x,ee,te),ie)return Np;let O=this._findGlyphBoundingBox(re,this._workBoundingBox,c,T,D,E),k,A;for(;;){if(this._activePages.length===0){let e=this._createNewPage();k=e,A=e.currentRow,A.height=O.size.y;break}k=this._activePages[this._activePages.length-1],A=k.currentRow;for(let e of this._activePages)O.size.y<=e.currentRow.height&&(k=e,A=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=A.height&&O.size.y<=t.height&&(k=this._activePages[e],A=t);if(O.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Lp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),k=this._overflowSizePage,A=this._overflowSizePage.currentRow,A.x+O.size.x>=k.canvas.width&&(A.x=0,A.y+=A.height,A.height=0);break}if(A.y+O.size.y>=k.canvas.height||A.height>O.size.y+2){let t=!1;if(k.currentRow.y+k.currentRow.height+O.size.y>=k.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+O.size.y=e.maxAtlasPages&&A.y+O.size.y<=k.canvas.height&&A.height>=O.size.y&&A.x+O.size.x<=k.canvas.width)t=!0;else{let e=this._createNewPage();k=e,A=e.currentRow,A.height=O.size.y,t=!0}}t||(k.currentRow.height>0&&k.fixedRows.push(k.currentRow),A={x:0,y:k.currentRow.y+k.currentRow.height,height:O.size.y},k.fixedRows.push(A),k.currentRow={x:0,y:A.y+A.height,height:0})}if(A.x+O.size.x<=k.canvas.width)break;A===k.currentRow?(A.x=0,A.y+=A.height,A.height=0):k.fixedRows.splice(k.fixedRows.indexOf(A),1)}return O.texturePage=this._pages.indexOf(k),O.texturePosition.x=A.x,O.texturePosition.y=A.y,O.texturePositionClipSpace.x=A.x/k.canvas.width,O.texturePositionClipSpace.y=A.y/k.canvas.height,O.sizeClipSpace.x/=k.canvas.width,O.sizeClipSpace.y/=k.canvas.height,A.height=Math.max(A.height,O.size.y),A.x+=O.size.x,k.ctx.putImageData(re,O.texturePosition.x-this._workBoundingBox.left,O.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,O.size.x,O.size.y),k.addGlyph(O),k.version++,O}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n=a;n--){for(let r=0;r=0;n--){for(let r=0;r>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t0)return!1;return!0}function Bp(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function Vp(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:yf,cursorAccent:yf,selectionForeground:yf,selectionBackgroundTransparent:yf,selectionBackgroundOpaque:yf,selectionInactiveBackgroundTransparent:yf,selectionInactiveBackgroundOpaque:yf,overviewRulerBorder:yf,scrollbarSliderBackground:yf,scrollbarSliderHoverBackground:yf,scrollbarSliderActiveBackground:yf,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function Hp(e,t){for(let n=0;n=0){if(Hp(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),Wp.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=qp){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=qp-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=qp-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},qp)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Yp(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return tf(()=>r?.disconnect())}function Xp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Zp=class e extends pp{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mp,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Xp(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Qp=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function $p(e,t,n){let r=Df(e.createProgram());if(e.attachShader(r,Df(em(e,e.VERTEX_SHADER,t))),e.attachShader(r,Df(em(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function em(e,t,n){let r=Df(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function tm(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;ti.deleteProgram(this._program))),this._projectionLocation=Df(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(tf(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(tf(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Df(i.createBuffer()),this._register(tf(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,wm,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,wm,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,wm,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Qp),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,jm=(Dm>>16&255)/255,Mm=(Dm>>8&255)/255,Nm=1,this._addRectangle(e.attributes,t,Om,km,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Am,jm,Mm,Nm)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Fm=class extends af{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(tf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Df(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Gp(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=qf,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Im=class extends Fm{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Up(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(Vm.indexOf(`Chrome`)>=0)&&Vm.indexOf(`Safari`),Vm.indexOf(`Electron/`),Vm.indexOf(`Android`);var Um=!1;if(typeof Lm.matchMedia==`function`){let e=Lm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Lm.matchMedia(`(display-mode: fullscreen)`);Um=e.matches,Bm(Lm,e,({matches:e})=>{Um&&t.matches||(Um=e)})}function Wm(){return Um}var Gm=`en`,Km=!1,qm=!1,Jm=!1,Ym=Gm,Xm,Zm=globalThis,Qm;typeof Zm.vscode<`u`&&typeof Zm.vscode.process<`u`?Qm=Zm.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Qm=process);var $m=typeof Qm?.versions?.electron==`string`&&Qm?.type===`renderer`;if(typeof Qm==`object`){Qm.platform,Qm.platform,Km=Qm.platform===`linux`,Km&&Qm.env.SNAP&&Qm.env.SNAP_REVISION,Qm.env.CI||Qm.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ym=Gm;let e=Qm.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Ym=t.resolvedLanguage||Gm,t.languagePack?.translationsConfigFile}catch{}qm=!0}else typeof navigator==`object`&&!$m?(Xm=navigator.userAgent,Xm.indexOf(`Windows`),Xm.indexOf(`Macintosh`),(Xm.indexOf(`Macintosh`)>=0||Xm.indexOf(`iPad`)>=0||Xm.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Km=Xm.indexOf(`Linux`)>=0,Xm?.indexOf(`Mobi`),Jm=!0,Ym=globalThis._VSCODE_NLS_LANGUAGE||Gm,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var eh=qm;Jm&&typeof Zm.importScripts==`function`&&Zm.origin;var th=Xm,nh=Ym,rh;(e=>{function t(){return nh}e.value=t;function n(){return nh.length===2?nh===`en`:nh.length>=3&&nh[0]===`e`&&nh[1]===`n`&&nh[2]===`-`}e.isDefaultVariant=n;function r(){return nh===`en`}e.isDefault=r})(rh||={});var ih=typeof Zm.postMessage==`function`&&!Zm.importScripts;(()=>{if(ih){let e=[];Zm.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),Zm.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var ah=!!(th&&th.indexOf(`Chrome`)>=0);th&&th.indexOf(`Firefox`),!ah&&th&&th.indexOf(`Safari`),th&&th.indexOf(`Edg/`),th&&th.indexOf(`Android`);var oh=typeof navigator==`object`?navigator:{};eh||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||oh&&oh.clipboard&&oh.clipboard.writeText,eh||oh&&oh.clipboard&&oh.clipboard.readText,eh||Wm()||oh.keyboard,`ontouchstart`in Lm||oh.maxTouchPoints,Lm.PointerEvent&&(`ontouchstart`in Lm||navigator.maxTouchPoints);var sh=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ch=new sh,lh=new sh,uh=new sh;Array(230);var dh;(e=>{function t(e){return ch.keyCodeToStr(e)}e.toString=t;function n(e){return ch.strToKeyCode(e)}e.fromString=n;function r(e){return lh.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return uh.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return lh.strToKeyCode(e)||uh.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return ch.keyCodeToStr(e)}e.toElectronAccelerator=o})(dh||={});var fh=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ph;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof mh?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vp.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fh})})(ph||={});var mh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?fh:(this._emitter||=new jp,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var hh;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(hh||={});var gh=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new jp,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};gh.EMPTY=gh.fromArray([]);function _h(e){return vh(e,0)}function vh(e,t){switch(typeof e){case`object`:return e===null?yh(349,t):Array.isArray(e)?Sh(e,t):Ch(e,t);case`string`:return xh(e,t);case`boolean`:return bh(e,t);case`number`:return yh(e,t);case`undefined`:return yh(937,t);default:return yh(617,t)}}function yh(e,t){return(t<<5)-t+e|0}function bh(e,t){return yh(e?433:863,t)}function xh(e,t){t=yh(149417,t);for(let n=0,r=e.length;nvh(t,e),t)}function Ch(e,t){return t=yh(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=xh(n,t),vh(e[n],t)),t)}var{registerWindow:wh,getWindow:Th,getDocument:Eh,getWindows:Dh,getWindowsCount:Oh,getWindowId:kh,getWindowById:Ah,hasWindow:jh,onDidRegisterWindow:Mh,onWillUnregisterWindow:Nh,onDidUnregisterWindow:Ph}=function(){let e=new Map,t={window:Lm,disposables:new rf};e.set(Lm.vscodeWindowId,t);let n=new jp,r=new jp,i=new jp;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return af.None;let a=new rf,o={window:t,disposables:a.add(new rf)};return e.set(t.vscodeWindowId,o),a.add(tf(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Ih(t,Rh.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Lm},getDocument(e){return Th(e).document}}}(),Fh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Ih(e,t,n,r){return new Fh(e,t,n,r)}var Lh=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Lh.None=new Lh(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=_h(n),a=r.get(i);if(a)a.users+=1;else{let o=new jp,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(tf(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Rh={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Hm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Hm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Hm?`webkitAnimationIteration`:`animationiteration`},zh=class extends af{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new of,this._charAtlasDisposable=this._register(new of),this._observerDisposable=this._register(new of),this._model=new bm,this._workCell=new Zp,this._workCell2=new Zp,this._rectangleRenderer=this._register(new of),this._glyphRenderer=this._register(new of),this._onChangeTextureAtlas=this._register(new jp),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new jp),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new jp),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new jp),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new jp),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Gf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Im(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Ff(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ih(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Ih(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Kp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Yp(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=Yp(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(tf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),Kp(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Pm(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new fm(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Gp(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ef(vp.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),vp.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Jp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=Vh(e,n.rows-1,0),t=Vh(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),ee=-1,te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new Bh(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*hm,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),te&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},ee=w+r.getWidth()-1),y>=w&&y<=ee&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+gm]!==this._cellColorResolver.result.bg||this._model.cells[v+_m]!==this._cellColorResolver.result.fg||this._model.cells[v+vm]!==this._cellColorResolver.result.ext)&&(T=!0,h.length>1&&(g|=ym),this._model.cells[v]=g,this._model.cells[v+gm]=this._cellColorResolver.result.bg,this._model.cells[v+_m]=this._cellColorResolver.result.fg,this._model.cells[v+vm]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*hm,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,mf,0,0),this._model.cells[b]=0,this._model.cells[b+gm]=this._cellColorResolver.result.bg,this._model.cells[b+_m]=this._cellColorResolver.result.fg,this._model.cells[b+vm]=this._cellColorResolver.result.ext;y--}}T&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Bh=class extends pp{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Vh(e,t,n=0){return Math.max(Math.min(e,t),n)}var Hh=`di$target`,Uh=`di$dependencies`,Wh=new Map;function Gh(e){if(Wh.has(e))return Wh.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Kh(t,e,r)};return t._id=e,Wh.set(e,t),t}function Kh(e,t,n){t[Hh]===t?t[Uh].push({id:e,index:n}):(t[Uh]=[{id:e,index:n}],t[Hh]=t)}Gh(`BufferService`),Gh(`CoreMouseService`),Gh(`CoreService`),Gh(`CharsetService`),Gh(`InstantiationService`),Gh(`LogService`);var qh=Gh(`OptionsService`);Gh(`OscLinkService`),Gh(`UnicodeService`),Gh(`DecorationService`);var Jh={trace:0,debug:1,info:2,warn:3,error:4,off:5},Yh=`xterm.js: `,Xh=class extends af{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Zh=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Jh[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new zh(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(vp.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(vp.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(vp.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(vp.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(tf(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function $h({sessionId:e,owned:t,cwd:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!a.current||!t)return;let n=getComputedStyle(document.documentElement),r=(e,t)=>n.getPropertyValue(e).trim()||t,i=new jd({convertEol:!1,cursorBlink:!0,fontFamily:r(`--font-mono`,`monospace`),fontSize:12,theme:{background:r(`--color-bg`,`#0b0e14`),foreground:r(`--color-fg`,`#d3dae3`),cursor:r(`--color-accent`,`#5ea1ff`),selectionBackground:r(`--color-border-strong`,`#2b3646`)},scrollback:1e4}),o=new Pd;i.loadAddon(o),i.open(a.current);try{let e=new Qh;e.onContextLoss(()=>{e.dispose()}),i.loadAddon(e)}catch{}try{o.fit()}catch{}for(let e of[`A`,`ā`,`Ы`,`Ѣ`,`Ω`,`ế`])document.fonts?.load(`12px "JetBrains Mono Variable"`,e).catch(()=>{});document.fonts?.ready.then(()=>{try{o.fit()}catch{}});let s=location.protocol===`https:`?`wss`:`ws`,c=new WebSocket(`${s}://${location.host}/v1/agents/${encodeURIComponent(e)}/term`);c.binaryType=`arraybuffer`,c.onmessage=e=>{i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data))},c.onclose=()=>i.write(`\r +}`,Cm=8,wm=Cm*Float32Array.BYTES_PER_ELEMENT,Tm=20*Cm,Em=class{constructor(){this.attributes=new Float32Array(Tm),this.count=0}},Dm=0,Om=0,km=0,Am=0,jm=0,Mm=0,Nm=0,Pm=class extends af{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Em,this._verticesCursor=new Em;let i=this._gl;this._program=Df($p(i,xm,Sm)),this._register(tf(()=>i.deleteProgram(this._program))),this._projectionLocation=Df(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(tf(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(tf(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Df(i.createBuffer()),this._register(tf(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,wm,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,wm,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,wm,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Qp),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,jm=(Dm>>16&255)/255,Mm=(Dm>>8&255)/255,Nm=1,this._addRectangle(e.attributes,t,Om,km,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Am,jm,Mm,Nm)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Fm=class extends af{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(tf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Df(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Gp(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=qf,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Im=class extends Fm{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&Up(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(Vm.indexOf(`Chrome`)>=0)&&Vm.indexOf(`Safari`),Vm.indexOf(`Electron/`),Vm.indexOf(`Android`);var Um=!1;if(typeof Lm.matchMedia==`function`){let e=Lm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Lm.matchMedia(`(display-mode: fullscreen)`);Um=e.matches,Bm(Lm,e,({matches:e})=>{Um&&t.matches||(Um=e)})}function Wm(){return Um}var Gm=`en`,Km=!1,qm=!1,Jm=!1,Ym=Gm,Xm,Zm=globalThis,Qm;typeof Zm.vscode<`u`&&typeof Zm.vscode.process<`u`?Qm=Zm.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Qm=process);var $m=typeof Qm?.versions?.electron==`string`&&Qm?.type===`renderer`;if(typeof Qm==`object`){Qm.platform,Qm.platform,Km=Qm.platform===`linux`,Km&&Qm.env.SNAP&&Qm.env.SNAP_REVISION,Qm.env.CI||Qm.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ym=Gm;let e=Qm.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Ym=t.resolvedLanguage||Gm,t.languagePack?.translationsConfigFile}catch{}qm=!0}else typeof navigator==`object`&&!$m?(Xm=navigator.userAgent,Xm.indexOf(`Windows`),Xm.indexOf(`Macintosh`),(Xm.indexOf(`Macintosh`)>=0||Xm.indexOf(`iPad`)>=0||Xm.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Km=Xm.indexOf(`Linux`)>=0,Xm?.indexOf(`Mobi`),Jm=!0,Ym=globalThis._VSCODE_NLS_LANGUAGE||Gm,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var eh=qm;Jm&&typeof Zm.importScripts==`function`&&Zm.origin;var th=Xm,nh=Ym,rh;(e=>{function t(){return nh}e.value=t;function n(){return nh.length===2?nh===`en`:nh.length>=3&&nh[0]===`e`&&nh[1]===`n`&&nh[2]===`-`}e.isDefaultVariant=n;function r(){return nh===`en`}e.isDefault=r})(rh||={});var ih=typeof Zm.postMessage==`function`&&!Zm.importScripts;(()=>{if(ih){let e=[];Zm.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),Zm.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var ah=!!(th&&th.indexOf(`Chrome`)>=0);th&&th.indexOf(`Firefox`),!ah&&th&&th.indexOf(`Safari`),th&&th.indexOf(`Edg/`),th&&th.indexOf(`Android`);var oh=typeof navigator==`object`?navigator:{};eh||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||oh&&oh.clipboard&&oh.clipboard.writeText,eh||oh&&oh.clipboard&&oh.clipboard.readText,eh||Wm()||oh.keyboard,`ontouchstart`in Lm||oh.maxTouchPoints,Lm.PointerEvent&&(`ontouchstart`in Lm||navigator.maxTouchPoints);var sh=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ch=new sh,lh=new sh,uh=new sh;Array(230);var dh;(e=>{function t(e){return ch.keyCodeToStr(e)}e.toString=t;function n(e){return ch.strToKeyCode(e)}e.fromString=n;function r(e){return lh.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return uh.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return lh.strToKeyCode(e)||uh.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return ch.keyCodeToStr(e)}e.toElectronAccelerator=o})(dh||={});var fh=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ph;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof mh?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vp.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fh})})(ph||={});var mh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?fh:(this._emitter||=new jp,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var hh;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(hh||={});var gh=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new jp,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};gh.EMPTY=gh.fromArray([]);function _h(e){return vh(e,0)}function vh(e,t){switch(typeof e){case`object`:return e===null?yh(349,t):Array.isArray(e)?Sh(e,t):Ch(e,t);case`string`:return xh(e,t);case`boolean`:return bh(e,t);case`number`:return yh(e,t);case`undefined`:return yh(937,t);default:return yh(617,t)}}function yh(e,t){return(t<<5)-t+e|0}function bh(e,t){return yh(e?433:863,t)}function xh(e,t){t=yh(149417,t);for(let n=0,r=e.length;nvh(t,e),t)}function Ch(e,t){return t=yh(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=xh(n,t),vh(e[n],t)),t)}var{registerWindow:wh,getWindow:Th,getDocument:Eh,getWindows:Dh,getWindowsCount:Oh,getWindowId:kh,getWindowById:Ah,hasWindow:jh,onDidRegisterWindow:Mh,onWillUnregisterWindow:Nh,onDidUnregisterWindow:Ph}=function(){let e=new Map,t={window:Lm,disposables:new rf};e.set(Lm.vscodeWindowId,t);let n=new jp,r=new jp,i=new jp;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return af.None;let a=new rf,o={window:t,disposables:a.add(new rf)};return e.set(t.vscodeWindowId,o),a.add(tf(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Ih(t,Rh.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Lm},getDocument(e){return Th(e).document}}}(),Fh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Ih(e,t,n,r){return new Fh(e,t,n,r)}var Lh=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Lh.None=new Lh(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=_h(n),a=r.get(i);if(a)a.users+=1;else{let o=new jp,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(tf(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Rh={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Hm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Hm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Hm?`webkitAnimationIteration`:`animationiteration`},zh=class extends af{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new of,this._charAtlasDisposable=this._register(new of),this._observerDisposable=this._register(new of),this._model=new bm,this._workCell=new Zp,this._workCell2=new Zp,this._rectangleRenderer=this._register(new of),this._glyphRenderer=this._register(new of),this._onChangeTextureAtlas=this._register(new jp),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new jp),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new jp),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new jp),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new jp),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Gf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Im(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Ff(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ih(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Ih(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Kp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Yp(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=Yp(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(tf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),Kp(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Pm(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new fm(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Gp(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ef(vp.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),vp.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Jp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=Vh(e,n.rows-1,0),t=Vh(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new Bh(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*hm,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ee&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+r.getWidth()-1),y>=w&&y<=T&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+gm]!==this._cellColorResolver.result.bg||this._model.cells[v+_m]!==this._cellColorResolver.result.fg||this._model.cells[v+vm]!==this._cellColorResolver.result.ext)&&(E=!0,h.length>1&&(g|=ym),this._model.cells[v]=g,this._model.cells[v+gm]=this._cellColorResolver.result.bg,this._model.cells[v+_m]=this._cellColorResolver.result.fg,this._model.cells[v+vm]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*hm,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,mf,0,0),this._model.cells[b]=0,this._model.cells[b+gm]=this._cellColorResolver.result.bg,this._model.cells[b+_m]=this._cellColorResolver.result.fg,this._model.cells[b+vm]=this._cellColorResolver.result.ext;y--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Bh=class extends pp{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Vh(e,t,n=0){return Math.max(Math.min(e,t),n)}var Hh=`di$target`,Uh=`di$dependencies`,Wh=new Map;function Gh(e){if(Wh.has(e))return Wh.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Kh(t,e,r)};return t._id=e,Wh.set(e,t),t}function Kh(e,t,n){t[Hh]===t?t[Uh].push({id:e,index:n}):(t[Uh]=[{id:e,index:n}],t[Hh]=t)}Gh(`BufferService`),Gh(`CoreMouseService`),Gh(`CoreService`),Gh(`CharsetService`),Gh(`InstantiationService`),Gh(`LogService`);var qh=Gh(`OptionsService`);Gh(`OscLinkService`),Gh(`UnicodeService`),Gh(`DecorationService`);var Jh={trace:0,debug:1,info:2,warn:3,error:4,off:5},Yh=`xterm.js: `,Xh=class extends af{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Zh=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Jh[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new zh(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(vp.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(vp.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(vp.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(vp.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(tf(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function $h({sessionId:e,owned:t,cwd:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!a.current||!t)return;let n=getComputedStyle(document.documentElement),r=(e,t)=>n.getPropertyValue(e).trim()||t,i=new jd({convertEol:!1,cursorBlink:!0,fontFamily:r(`--font-mono`,`monospace`),fontSize:12,theme:{background:r(`--color-bg`,`#0b0e14`),foreground:r(`--color-fg`,`#d3dae3`),cursor:r(`--color-accent`,`#5ea1ff`),selectionBackground:r(`--color-border-strong`,`#2b3646`)},scrollback:1e4}),o=new Pd;i.loadAddon(o),i.open(a.current);try{let e=new Qh;e.onContextLoss(()=>{e.dispose()}),i.loadAddon(e)}catch{}try{o.fit()}catch{}for(let e of[`A`,`ā`,`Ы`,`Ѣ`,`Ω`,`ế`])document.fonts?.load(`12px "JetBrains Mono Variable"`,e).catch(()=>{});document.fonts?.ready.then(()=>{try{o.fit()}catch{}});let s=location.protocol===`https:`?`wss`:`ws`,c=new WebSocket(`${s}://${location.host}/v1/agents/${encodeURIComponent(e)}/term`);c.binaryType=`arraybuffer`,c.onmessage=e=>{i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data))},c.onclose=()=>i.write(`\r \x1B[2m[session ended]\x1B[0m\r -`);let l=new TextEncoder,u=e=>{c.readyState===WebSocket.OPEN&&c.send(l.encode(e))},d=i.onData(u),f=(e,t)=>{c.readyState!==WebSocket.OPEN||e<=0||t<=0||c.send(JSON.stringify({resize:{cols:e,rows:t}}))},p=i.onResize(({cols:e,rows:t})=>f(e,t));c.onopen=()=>{try{o.fit()}catch{}f(i.cols,i.rows)};let m=e=>{e.preventDefault(),e.stopPropagation(),u(`\x1B\r`)};i.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;if(h&&e.metaKey&&!e.ctrlKey&&!e.altKey){if(e.key===`c`)return!g();if(e.key===`v`)return _(),!1}if(!h&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey){if(e.key===`C`||e.key===`c`)return g(),!1;if(e.key===`V`||e.key===`v`)return _(),!1}return!h&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.key===`c`||e.key===`C`)?!g()||(i.clearSelection(),!1):e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.key===`j`||e.key===`J`)?(m(e),!1):e.key!==`Enter`||[e.shiftKey,e.altKey,e.ctrlKey,e.metaKey].filter(Boolean).length!==1||e.metaKey?!0:(m(e),!1)});let h=/Mac|iP(hone|ad)/.test(navigator.platform||navigator.userAgent),g=()=>{let e=i.getSelection();return e?(navigator.clipboard?.writeText(e),!0):!1},_=()=>{navigator.clipboard?.readText().then(e=>{e&&i.paste(e)}).catch(()=>{})},v=async e=>{let t=e.type||`application/octet-stream`,n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e{let t=[...e.clipboardData?.items??[]].find(e=>e.kind===`file`)?.getAsFile();t&&(e.preventDefault(),v(t))},b=e=>{let t=e.dataTransfer?.files?.[0];t&&(e.preventDefault(),v(t))},x=e=>{e.preventDefault()},S=a.current;S.addEventListener(`paste`,y),S.addEventListener(`drop`,b),S.addEventListener(`dragover`,x);let C=new ResizeObserver(()=>{try{o.fit()}catch{}});return C.observe(a.current),()=>{S.removeEventListener(`paste`,y),S.removeEventListener(`drop`,b),S.removeEventListener(`dragover`,x),C.disconnect(),d.dispose(),p.dispose(),c.close(),i.dispose()}},[e,t]),t?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{ref:a,className:`h-[70vh] bg-bg`}),(0,I.jsxs)(`div`,{className:`border-t border-border px-3 py-1.5 text-[11px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Shift`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` for a new line —`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Option`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` and`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Ctrl`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`J`}),` do the same.`]})]}):(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,I.jsx)(`p`,{className:`text-[14px] text-fg`,children:`You started this session yourself, so it has no terminal here.`}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-bg hover:brightness-110`,children:`Launch a new Claude Code session here →`}),(0,I.jsxs)(`p`,{className:`max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:[`Runs a second `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` in`,` `,n?(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:n}):`this repository`,` and gives it a terminal you can type in. This session keeps running, untouched.`]}),r&&(0,I.jsx)(Pr,{available:!0,onClose:()=>i(!1),initialCwd:n??``}),(0,I.jsx)(`p`,{className:`mt-1 max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:`Caprock never types into a process it did not start — including this one, which stays visible here and keeps being measured.`})]})}function eg({id:e,tab:t,at:n}){let r=F(()=>N.session(e),[e],{intervalMs:5e3}),i=t===`changes`||t===`diff`||t===`files`?`changes`:t===`terminal`||t===`notes`?t:`timeline`,a=ie(1e3),[o]=De(),s=r.data;if(r.error&&!s)return(0,I.jsx)(z,{title:r.error instanceof j&&r.error.status===404?`Session not found`:`Cannot load session`,children:r.error.message});if(!s)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let c=t=>v({name:`session`,id:e,tab:t}),l=s.stats.tokens_in+s.stats.tokens_out+s.stats.cache_read+s.stats.cache_write;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`a`,{href:g({name:`now`}),className:`link text-fg-muted text-[12px]`,children:`← Now`}),(0,I.jsx)(`h1`,{className:`text-[15px] font-medium`,children:s.project||`unknown project`}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:s.session_id}),s.git_branch&&(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-muted`,children:s.git_branch}),(0,I.jsx)(bt,{health:s.activity.health}),s.owned&&s.status!==`ended`&&(0,I.jsx)(lg,{id:e}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted ml-auto num`,children:s.cwd})]}),(0,I.jsxs)(`div`,{className:`text-[13px]`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:s.activity.phrase}),(0,I.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:ee(s.activity.at||s.last_event_at,a)}),s.loop&&(0,I.jsxs)(`span`,{className:`ml-3 text-danger text-[12px]`,children:[`loop: `,s.loop.sample,` ×`,s.loop.count,` in `,s.loop.window_min,`m`]})]}),(0,I.jsx)(L,{children:(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:S(s.stats.cost_usd),sub:(0,I.jsx)(`span`,{title:un(o),children:s.model||`unknown model`})}),(0,I.jsx)(R,{label:`Tokens`,value:C(l),sub:`in ${C(s.stats.tokens_in)} · out ${C(s.stats.tokens_out)} · cache ${C(s.stats.cache_read+s.stats.cache_write)}`}),(0,I.jsx)(R,{label:`Cache`,value:w(s.savings.hit_rate*100),sub:`read ${C(s.stats.cache_read)} · write ${C(s.stats.cache_write)}`,tone:s.savings.hit_rate>.5?`ok`:void 0}),(0,I.jsx)(R,{label:`Context`,value:s.context?w(s.context.pct):`—`,sub:s.context?`${C(s.context.tokens)} / ${C(s.context.window)}`:`unknown model`,tone:s.context&&s.context.pct>=85?`danger`:s.context&&s.context.pct>=60?`warn`:void 0}),(0,I.jsx)(R,{label:`Turns`,value:s.stats.turns,sub:`${s.stats.tool_calls} tool calls`}),(0,I.jsx)(R,{label:`Files`,value:s.stats.files_touched,sub:`${s.has_hooks?`hooks`:`no hooks`} · ${s.has_transcript?`transcript`:`no transcript`}`})]})}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border`,children:[[`timeline`,`notes`,`changes`,`terminal`].map(e=>(0,I.jsx)(`button`,{onClick:()=>c(e),className:`px-3 py-1.5 text-[12px] border-b-2 -mb-px ${i===e?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,children:e===`timeline`?`Timeline`:e===`notes`?`Answers`:e===`changes`?`Changes`:`Terminal`},e)),!s.owned&&(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint pr-1`,children:`observe-only — terminal is read/write for spawned sessions only`})]}),i===`timeline`&&(0,I.jsx)(ng,{id:e,initial:s.events,now:a,at:n}),i===`notes`&&(0,I.jsx)(Vr,{id:e,now:a}),i===`changes`&&(0,I.jsx)(og,{id:e,s}),i===`terminal`&&(0,I.jsx)(L,{className:`overflow-hidden`,children:(0,I.jsx)($h,{sessionId:e,owned:s.owned&&s.status!==`ended`,cwd:s.cwd})})]})}var tg=200;function ng({id:e,initial:t,now:n,at:r}){let[i,a]=(0,l.useState)(t),[o,s]=(0,l.useState)(`all`),c=(0,l.useRef)(t.length?t[t.length-1].id:0),u=(0,l.useRef)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),g=async()=>{let t=i[0]?.id;if(!(t===void 0||f)){p(!0);try{let n=await N.eventsBefore(e,t,tg);n.length===0?h(!0):a(e=>[...n,...e])}catch{h(!0)}finally{p(!1)}}};(0,l.useEffect)(()=>{a(t),h(!1),c.current=t.length?t[t.length-1].id:0},[t]),(0,l.useEffect)(()=>d.onFrame(t=>{t.type!==`event`||t.data.session_id!==e||t.data.id<=c.current||(c.current=t.data.id,a(e=>[...e,t.data].slice(-5e3)))}),[e]);let _=(0,l.useMemo)(()=>{let e=0;return i.filter(e=>e.kind===`turn.assistant`).map(t=>e+=t.cost_usd??0)},[i]),v=(0,l.useMemo)(()=>{let e=new Map;for(let t of i)if(t.kind===`tool.pre`&&t.tool){let n=t.payload;n?.tool_use_id&&e.set(n.tool_use_id,t.tool)}return e},[i]),y=i.filter(e=>o===`all`||(o===`tools`?e.kind.startsWith(`tool.`):e.kind.startsWith(`turn.`)||e.kind===`agent.stop`)).slice().reverse();return(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,I.jsx)(L,{title:`Events · ${i.length} shown`,className:`min-w-0 overflow-hidden`,right:(0,I.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:[`all`,`tools`,`turns`].map(e=>(0,I.jsx)(`button`,{onClick:()=>s(e),className:`px-1.5 rounded-sm ${o===e?`bg-panel-2 text-fg`:`hover:text-fg`}`,children:e},e))}),children:(0,I.jsxs)(`ol`,{ref:u,className:`max-h-[70vh] overflow-auto`,children:[y.length===0&&(0,I.jsx)(z,{title:`No events yet`}),y.map(e=>(0,I.jsx)(ig,{e,now:n,toolByUse:v,inMinute:r!==void 0&&rg(e.ts,r)},e.id)),!m&&i.length>0&&(0,I.jsx)(`li`,{className:`px-3 py-1.5 border-t border-border/60`,children:(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-0.5 rounded-sm`,onClick:()=>void g(),disabled:f,children:f?`loading…`:`load earlier events`})}),m&&(0,I.jsx)(`li`,{className:`px-3 py-1 text-[11px] text-fg-faint`,children:`start of session`})]})}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Cost, cumulative`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(xt,{values:_.length?_:[0,0],width:230,height:40,tone:`accent`})}),(0,I.jsxs)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted num`,children:[_.length,` priced turns · `,S(_[_.length-1]??0)]})]}),(0,I.jsxs)(L,{title:`Tokens per turn`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(xt,{values:i.filter(e=>e.tokens).map(e=>e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),width:230,height:40})}),(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted`,children:`prompt size (input + cache) per assistant turn`})]})]})]})}function rg(e,t){let n=Date.parse(e);return Number.isFinite(n)&&Math.floor(n/6e4)===Math.floor(t/6e4)}function ig({e,now:t,toolByUse:n,inMinute:r}){let[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`center`})},[r]);let s=e.payload??{},c=e.tool||(e.kind===`tool.post`?n.get(String(s.tool_use_id??``)):void 0),u=ag({...e,tool:c},s),d=e.kind===`turn.assistant`?String(s.text??``):e.kind===`turn.user`?String(s.prompt??``):e.kind===`tool.post`&&typeof s.tool_response==`string`?s.tool_response:``,f=e.kind===`turn.user`?`text-info`:e.kind===`turn.assistant`?`text-fg`:e.kind===`agent.stop`||e.kind===`context.compact`?`text-warn`:`text-fg-muted`;return(0,I.jsxs)(`li`,{ref:o,className:`border-b border-border/60 last:border-0 hover:bg-panel-2 animate-flash ${r?`bg-accent/10 border-l-2 border-l-accent`:``}`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left flex items-baseline gap-2 px-3 py-[3px]`,onClick:()=>a(!i),children:[(0,I.jsx)(`span`,{className:`num text-[10px] text-fg-faint w-14 shrink-0`,children:ee(e.ts,t)}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-24 shrink-0 ${f}`,children:e.kind}),(0,I.jsx)(`span`,{className:`truncate text-[12px] min-w-0`,title:u,children:u}),e.tokens&&(0,I.jsxs)(`span`,{className:`ml-auto num text-[10px] text-fg-faint shrink-0`,children:[C(e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),`→`,C(e.tokens.out),e.cost_usd===void 0?``:` · ${S(e.cost_usd)}`]})]}),i&&(0,I.jsxs)(`div`,{className:`px-3 pb-2`,children:[d?(0,I.jsx)(`div`,{className:`text-[12px] leading-[1.55] whitespace-pre-wrap break-words max-h-96 overflow-auto border-l-2 border-border-strong pl-3 mb-2`,children:d}):null,(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{className:`text-[10px] text-fg-faint cursor-pointer select-none`,children:`raw event`}),(0,I.jsx)(`pre`,{className:`mono text-[10px] leading-[1.4] text-fg-muted pt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all`,children:JSON.stringify({id:e.id,ts:e.ts,source:e.source,key:e.key,agent_id:e.agent_id,model:e.model,tokens:e.tokens,cost_usd:e.cost_usd,payload:e.payload},null,2)})]})]})]})}function ag(e,t){let n=t.tool_input??{};switch(e.kind){case`tool.pre`:{let r=e.tool??String(t.tool_name??`tool`),i=n.command??n.file_path??n.pattern??n.query??n.url??n.prompt??``;return i?`${r} ${String(i).split(` -`)[0]}`:r}case`tool.post`:{let n=e.tool??String(t.tool_name??`tool`),r=t.tool_response,i=t.is_error===!0,a=typeof r==`string`?r:r?JSON.stringify(r):``;return`${n} ${i?`failed`:`done`}${a?` ${a.slice(0,160)}`:``}`}case`turn.user`:return`you: ${String(t.prompt??``).slice(0,200)}`;case`turn.assistant`:{let n=String(t.text??``),r=Array.isArray(t.tools)?t.tools:[];return n?n.slice(0,200):r.length?`→ ${r.join(`, `)}`:`${e.model??`assistant`} turn`}case`agent.stop`:return e.agent_id?`subagent ${e.agent_id} stopped`:`turn ended (${String(t.stop_reason??`stop`)})`;case`agent.spawn`:return`session started (${String(t.source??`startup`)})`;case`context.compact`:return`context compaction (${String(t.trigger??`auto`)})`;default:return e.kind}}function og({id:e,s:t}){let n=F(()=>N.diff(e),[e,t.last_event_at],{live:!1,intervalMs:8e3}),[r,i]=(0,l.useState)(new Set),a=e=>i(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});if(n.error&&!n.data){let e=n.error;if(e instanceof j&&e.status===409){let n=e.body;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(z,{title:`No git repository`,children:[n?.cwd?(0,I.jsx)(`span`,{className:`mono`,children:n.cwd}):null,` `,n?.error]}),(0,I.jsx)(cg,{s:t})]})}return(0,I.jsx)(z,{title:`Cannot load diff`,children:e.message})}let o=n.data;if(!o)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let s=new Set(o.files.map(e=>e.path)),c=t.files.filter(e=>!s.has(e)&&!s.has(e.replace(/^.*?\//,``))),u=o.files.length>0&&o.files.every(e=>r.has(e.path));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(L,{title:`Changes · ${o.branch||`detached`}`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o.base&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:o.base}),o.files.length>0&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>i(u?new Set:new Set(o.files.map(e=>e.path))),children:u?`collapse all`:`expand all`}),(0,I.jsxs)(`span`,{className:`num`,children:[o.files.length,` files`]})]}),children:[o.files.length===0&&(0,I.jsx)(z,{title:`Clean working tree`}),(0,I.jsx)(`ul`,{children:o.files.map(e=>{let t=r.has(e.path);return(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>a(e.path),"aria-expanded":t,children:[(0,I.jsx)(`span`,{className:`text-fg-faint text-[10px] shrink-0 transition-transform ${t?`rotate-90`:``}`,children:`▶`}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),t&&e.patch&&(0,I.jsx)(sg,{patch:e.patch}),t&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path)})})]}),c.length>0&&(0,I.jsx)(cg,{s:t,only:c})]})}function sg({patch:e}){return(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[50vh]`,children:e.split(` -`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})})}function cg({s:e,only:t}){let n=t??e.files,r=e.files.length(0,I.jsxs)(`li`,{className:`px-3 py-1 border-b border-border/60 last:border-0 flex gap-2 items-baseline`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px]`,children:E(e)}),(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint truncate`,children:e})]},e))})]})}function lg({id:e}){let[t,n]=(0,l.useState)(``),r=async t=>{n(t);try{await N.signal(e,t)}catch{}finally{n(``)}};return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-ok border border-ok/40 rounded-sm px-1`,children:`owned`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`pause`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`pause`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`resume`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`resume`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`kill`),className:`text-[11px] border border-danger/40 text-danger px-1.5 rounded-sm hover:bg-danger/10`,children:`kill`})]})}function ug(e){if(!Number.isFinite(e)||e<=0)return[];let t=e/3,n=10**Math.floor(Math.log10(t)),r=[1,2,5,10].map(e=>e*n).find(e=>e>=t)??n*10,i=[];for(let t=r;t<=e*1.0001;t+=r)i.push(t);return i}function dg({bars:e,active:t,onActive:n,height:r=112,showDayLabels:i=!0}){let a=e=>typeof e==`number`&&Number.isFinite(e)?e:0,o=Math.max(...e.map(e=>a(e.cost)),1e-9),s=r-16,c=ug(o);return(0,I.jsxs)(`div`,{className:`relative px-3 py-3 flex items-end gap-[3px]`,style:{height:r},onMouseLeave:()=>n(null),children:[c.map(e=>(0,I.jsx)(`div`,{className:`pointer-events-none absolute left-3 right-3 border-t border-border/60`,style:{bottom:16+Math.round(s*e/o)},"aria-hidden":!0,children:(0,I.jsx)(`span`,{className:`num absolute -top-[7px] right-0 bg-panel pl-1 text-[9px] text-fg-faint`,children:S(e)})},e)),e.map(e=>{let r=t===e.day;return(0,I.jsxs)(`button`,{type:`button`,className:`flex-1 flex flex-col items-center justify-end gap-1 min-w-0 h-full cursor-default focus:outline-none`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(a(e.cost))}`,children:[(0,I.jsx)(`div`,{className:`w-full rounded-t-sm transition-colors ${r?`bg-accent`:`bg-accent/70`}`,style:{height:Math.max(2,Math.round(s*a(e.cost)/o))}}),i&&(0,I.jsx)(`div`,{className:`num text-[9px] ${r?`text-fg`:`text-fg-faint`}`,children:e.day.slice(8)})]},e.day)})]})}function fg({bars:e,active:t,total:n}){let r=t?e.find(e=>e.day===t):void 0;return r?(0,I.jsxs)(`span`,{className:`num flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:r.day}),(0,I.jsx)(`span`,{className:`text-fg`,children:S(r.cost)}),(0,I.jsx)(`span`,{className:`text-fg-faint`,children:C(r.tokens)}),r.sessions!==void 0&&r.sessions>0&&(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[r.sessions,` `,r.sessions===1?`session`:`sessions`]})]}):(0,I.jsx)(`span`,{className:`num`,children:S(n)})}var pg=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function mg(e){return(new Date(`${e}T00:00:00Z`).getUTCDay()+6)%7}function hg(e,t){if(!(e>0))return`bg-border/60`;let n=Math.sqrt(e/Math.max(t,1e-9));return n>.75?`bg-accent`:n>.5?`bg-accent/75`:n>.25?`bg-accent/50`:`bg-accent/25`}function gg({bars:e,active:t,onActive:n,maxCell:r=44}){let i=e=>typeof e==`number`&&Number.isFinite(e)?e:0,a=Math.max(...e.map(e=>i(e.cost)),1e-9),o=e[0],s=o?mg(o.day):0;return(0,I.jsxs)(`div`,{className:`px-3 py-3`,onMouseLeave:()=>n(null),children:[(0,I.jsxs)(`div`,{className:`grid gap-1`,style:{gridTemplateColumns:`repeat(7, minmax(0, 1fr))`,maxWidth:r*7+24},children:[pg.map((e,t)=>(0,I.jsx)(`div`,{className:`text-center text-[9px] text-fg-faint`,"aria-hidden":!0,children:e},t)),Array.from({length:s},(e,t)=>(0,I.jsx)(`div`,{"aria-hidden":!0},`lead-${t}`)),e.map(e=>{let r=i(e.cost),o=t===e.day;return(0,I.jsx)(`button`,{type:`button`,className:`flex aspect-square items-center justify-center focus:outline-none cursor-default`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(r)}`,children:(0,I.jsx)(`span`,{className:`h-full w-full rounded-[3px] transition-colors ${hg(r,a)} ${o?`ring-1 ring-accent ring-offset-1 ring-offset-panel`:``}`})},e.day)})]}),(0,I.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 text-[9px] text-fg-faint`,children:[(0,I.jsx)(`span`,{children:`$0`}),[`bg-border/60`,`bg-accent/25`,`bg-accent/50`,`bg-accent/75`,`bg-accent`].map(e=>(0,I.jsx)(`span`,{className:`h-2 w-2 rounded-[2px] ${e}`,"aria-hidden":!0},e)),(0,I.jsx)(`span`,{className:`num`,children:S(a)})]})]})}var _g=e=>e===1?`day`:`days`;function vg({summary:e,plan:t,days:n}){if(!e)return null;let r=e.cost_usd;if(!t?.plan_kind)return(0,I.jsx)(L,{title:`Plan value`,children:(0,I.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted`,children:`Set your plan in the header and Caprock will show what this usage is worth against what you actually pay. It can't detect your plan, so it won't guess.`})});if(t.plan_kind===`metered`)return(0,I.jsx)(L,{title:`Spend`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label||`API`,` · billed per token`]}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-3xl text-fg`,children:S(r)}),(0,I.jsxs)(`span`,{className:`text-[12px] text-fg-muted`,children:[`over the last `,n,` `,_g(n)]})]}),(0,I.jsxs)(`p`,{className:`text-[11px] text-fg-faint mt-2 max-w-[60ch]`,children:[`You are billed per token, so this is approximately your actual cost — at Anthropic list prices (`,e.pricing_version,`). Not a saving.`]})]})});let i=t.plan_usd_per_month*n/30,a=i>0?r/i:0;return(0,I.jsxs)(L,{title:`Plan value`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label,` · `,S(t.plan_usd_per_month),`/mo`]}),children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 divide-y sm:divide-y-0 sm:divide-x divide-border`,children:[(0,I.jsx)(R,{label:`you pay · ${n}d`,value:S(i),sub:t.plan_label}),(0,I.jsx)(R,{label:`same usage at API list`,value:S(r),sub:`at list prices ${e.pricing_version}`,tone:`ok`}),(0,I.jsx)(R,{label:`which is`,value:a>0?`${a.toFixed(1)}×`:`—`,sub:a>0?`what ${n} ${_g(n)} would cost through the API`:`not enough measured usage yet`,tone:a>0?`ok`:void 0,size:`hero`})]}),(0,I.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] text-fg-faint leading-relaxed`,children:`Not a discount you received, and not money back — without the plan you would not have run this much.`})]})}function yg({feature:e,title:t,children:n}){let[r,i]=(0,l.useState)(!1);return F(()=>N.premium(),[]).data?.license?.active?(0,I.jsx)(I.Fragment,{children:n}):(0,I.jsxs)(`div`,{className:`relative overflow-hidden rounded-[var(--radius-panel)] border border-border`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none select-none opacity-90`,children:n}),(0,I.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2.5 px-4 text-center`,children:[(0,I.jsx)(`span`,{className:`rounded-sm bg-panel/95 px-3 py-1 text-[15px] font-medium text-fg shadow-[0_2px_12px_var(--color-bg)]`,children:t}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-premium px-3.5 py-1.5 text-[13px] font-medium text-white shadow-[0_2px_12px_var(--color-bg)] hover:brightness-110`,children:`Unlock with Premium`})]}),r&&(0,I.jsx)(nt,{feature:e,onClose:()=>i(!1)})]})}function bg({suggestion:e}){let t=F(()=>N.settings(),[],{live:!1}),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),p=t.data?.cap_usd_per_day;(0,l.useEffect)(()=>{d||p===void 0||(r(p?String(p):``),f(!0))},[p,d]);let m=t.data?.cap_usd_per_day??0,h=m>0,g=async e=>{a(!0),s(``),u(!1);try{await N.saveSettings({cap_usd_per_day:e}),r(e?String(e):``),u(!0),t.refresh()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},_=()=>{let e=n.trim().replace(/^\$/,``).replace(/,/g,``),t=Number(e);if(e===``||!Number.isFinite(t)||t<0){s(`A daily cap has to be a positive number of dollars.`);return}g(t)};return(0,I.jsx)(L,{title:`Daily spend cap`,right:(0,I.jsx)(`span`,{className:h?`text-premium-strong`:`text-fg-faint`,children:h?`on`:`off`}),children:(0,I.jsxs)(`div`,{className:`grid gap-2.5 px-3 py-3 text-[13px]`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Stop the day at`}),(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`$`}),(0,I.jsx)(`input`,{className:`input w-28`,inputMode:`decimal`,placeholder:`0`,value:n,onChange:e=>{r(e.target.value),u(!1)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Daily spend cap in dollars`}),(0,I.jsx)(`button`,{onClick:_,disabled:i,className:`rounded-sm bg-premium px-3 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50`,children:i?`Saving…`:`Save`}),h&&(0,I.jsx)(`button`,{onClick:()=>void g(0),disabled:i,className:`text-[12px] text-fg-faint hover:text-fg`,children:`turn off`}),c&&!o&&(0,I.jsx)(`span`,{className:`text-[12px] text-fg-faint`,children:`saved`})]}),!h&&e?(0,I.jsxs)(`p`,{className:`text-[12px] text-fg-faint`,children:[`Your days run about `,S(e/2),`.`,` `,(0,I.jsxs)(`button`,{onClick:()=>void g(e),className:`text-premium-strong hover:underline`,children:[`Use `,S(e)]}),` `,`— twice that, so an ordinary day never trips it.`]}):null,o&&(0,I.jsx)(`p`,{className:`text-[12px] text-danger`,children:o}),(0,I.jsx)(`p`,{className:`border-t border-border pt-2 text-[12px] leading-relaxed text-fg-faint`,children:h?(0,I.jsxs)(I.Fragment,{children:[`When today crosses `,S(m),`, Caprock pauses the sessions it started — paused, not killed, so resuming keeps the conversation. Sessions you started yourself are never touched.`]}):(0,I.jsx)(I.Fragment,{children:`Off. Nothing is paused, whatever the day costs. Sessions you started yourself are never touched either way.`})})]})})}function xg(e){return e>=.01?`$${e.toFixed(2)}`:`${(e*100).toFixed(1)}\u00A2`}function Sg(){let e=F(()=>N.gemini(),[],{live:!1}),[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(``),f=e.data,p=!!f?.available,m=f!==void 0&&!f.available,h=async()=>{let e=t.trim();if(!(!e||s)){c(!0),d(``);try{o(await N.askGemini(e,r||void 0)),n(``)}catch(e){d(oe(e))}finally{c(!1)}}};return(0,I.jsx)(L,{title:`Ask Gemini`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:p?f?.model:`your key, your bill`}),children:m?(0,I.jsxs)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted grid gap-2.5`,children:[(0,I.jsxs)(`p`,{className:`m-0`,children:[`Caprock can ask Google's Gemini on your own key, and it never stores that key — it reads `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:f?.env_var??`GEMINI_API_KEY`}),` from the daemon's environment when you ask. Get a key from`,` `,(0,I.jsx)(`a`,{className:`link`,href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,children:`Google AI Studio`}),`, then put it where the daemon will see it.`]}),(0,I.jsxs)(`div`,{className:`grid gap-1`,children:[(0,I.jsx)(`p`,{className:`m-0 text-fg`,children:`If you start it yourself`}),(0,I.jsxs)(`p`,{className:`m-0 text-fg-faint`,children:[`Put the line in `,(0,I.jsx)(`span`,{className:`mono`,children:`~/.zshrc`}),` (or`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`~/.bashrc`}),`), open a new terminal, then restart the daemon. Exporting it in one window and starting Caprock in another will not work.`]}),(0,I.jsxs)(`code`,{className:`mono text-[11px] bg-panel-2 px-2 py-1.5 rounded-sm text-fg block overflow-x-auto`,children:[`export `,f?.env_var??`GEMINI_API_KEY`,`=AIza…`,` -`,`caprock down && caprock up`]})]}),(0,I.jsxs)(`div`,{className:`grid gap-1`,children:[(0,I.jsx)(`p`,{className:`m-0 text-fg`,children:`If it starts at login`}),(0,I.jsxs)(`p`,{className:`m-0 text-fg-faint`,children:[`A login agent does not read your shell profile, so the variable has to go in the agent itself — on macOS in`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`~/Library/LaunchAgents/dev.caprock.daemon.plist`}),` under`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`EnvironmentVariables`}),`, on Linux as an`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`Environment=`}),` line in the systemd user unit. Then`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`caprock service install`}),` again to reload it.`]})]}),(0,I.jsx)(`p`,{className:`m-0 text-fg-faint`,children:`You pay Google directly. Caprock only counts what it sent, which is not the same as what Google bills.`})]}):(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-2`,children:[(0,I.jsx)(`textarea`,{className:`input min-h-[70px] resize-y`,placeholder:`Ask about your sessions, your spend, anything…`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&h()}}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`button`,{onClick:()=>void h(),disabled:s||!t.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25 disabled:opacity-50`,children:s?`asking…`:`Ask`}),(f?.models?.length??0)>0&&(0,I.jsx)(`select`,{className:`input w-auto text-[12px] py-1`,value:r||f?.model||``,onChange:e=>i(e.target.value),"aria-label":`Model`,children:f.models.map(e=>(0,I.jsxs)(`option`,{value:e.id,children:[e.display,` · ~`,xg(e.typical_usd),` a question`]},e.id))}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`⌘↵ to send`})]}),u&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:u}),(0,I.jsxs)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:[`Using the key in `,(0,I.jsx)(`span`,{className:`mono`,children:f?.env_var}),`. Caprock never stores it — Google bills you directly.`]}),a&&(0,I.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`div`,{className:`text-[13px] whitespace-pre-wrap`,children:a.text}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint num flex gap-3 flex-wrap`,children:[(0,I.jsx)(`span`,{children:a.model}),(0,I.jsxs)(`span`,{children:[`in `,C(a.usage.prompt_tokens)]}),(0,I.jsxs)(`span`,{children:[`out `,C(a.usage.output_tokens)]}),a.usage.thoughts_tokens>0&&(0,I.jsxs)(`span`,{title:`Google bills thinking tokens as output`,children:[`thinking `,C(a.usage.thoughts_tokens)]}),a.usage.cached_tokens>0&&(0,I.jsxs)(`span`,{children:[`cached `,C(a.usage.cached_tokens)]})]})]})]})})}function Cg(){let[e,t]=(0,l.useState)(`30d`),n=Date.now(),r=F(()=>N.summary(e),[e],{intervalMs:5e3}),i=F(()=>N.daily(30),[],{intervalMs:3e4}),[a]=De(),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`calendar`),d=r.data,f=!!d&&d.turns>0,p=wg(i.data??[]),m=Eg(p.map(e=>e.cost));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[un(a),d?` (table ${d.pricing_version})`:``]})]}),r.error&&!d&&(0,I.jsx)(z,{title:`Cannot reach the daemon`,children:r.error.message}),e!==`today`&&d&&(0,I.jsx)(En,{costUSD:p.reduce((e,t)=>e+t.cost,0),days:p.filter(e=>e.cost>0).length,now:n}),(0,I.jsx)(vg,{summary:d,plan:a,days:Tg(e,d?.from_ms)}),(0,I.jsxs)(L,{title:`Totals · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:f?S(d.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:un(a),children:f?ln(a):`nothing measured in this range`}),tone:`info`,size:`hero`}),(0,I.jsx)(R,{label:`Burn now`,value:f?`${S(d.burn.usd_per_hour)}/h`:`—`,sub:f?`${C(Math.round(d.burn.tokens_per_min))} tok/min · ${d.sessions} sessions`:void 0}),(0,I.jsx)(R,{label:`Input`,value:f?C(d.tokens_in):`—`,sub:`fresh, full price`}),(0,I.jsx)(R,{label:`Output`,value:f?C(d.tokens_out):`—`,sub:f?`${d.turns} turns`:void 0}),(0,I.jsx)(R,{label:`Cache read`,value:f?C(d.cache_read):`—`,sub:f?(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,I.jsxs)(`span`,{children:[w(d.savings.hit_rate*100),` hit rate`]}),(()=>{let e=mn(d.savings.hit_rate*100);return e?(0,I.jsx)(`span`,{className:e.color||`text-fg-faint`,children:e.label}):null})()]}):void 0}),(0,I.jsx)(R,{label:`Cache write`,value:f?C(d.cache_write):`—`,sub:f?`${w(d.savings.cut_pct)} input cost cut by cache`:void 0})]}),(0,I.jsx)(Sr,{u:d?.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.models.length===0&&(0,I.jsx)(z,{title:`No priced turns in range`}):(0,I.jsx)(St,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,title:e.model||void 0,children:e.model?re(e.model):`unknown`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:(d?.unpriced?.models??[]).includes(e.model)?(0,I.jsx)(`span`,{className:`text-warn`,title:`this model is not in the pricing table, so its cost is unknown`,children:`unpriced`}):S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0&&!(d.unpriced?.models??[]).includes(e.model)?w(100*e.cost_usd/d.cost_usd):`—`})]},e.model))})})]}),(0,I.jsx)(Et,{summary:d}),(0,I.jsxs)(L,{title:`Per project`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.projects.length===0&&(0,I.jsx)(z,{title:`No priced turns in range`}):(0,I.jsx)(St,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.projects??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0?w(100*e.cost_usd/d.cost_usd):`—`})]},e.project))})})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:[(0,I.jsxs)(L,{className:`lg:col-span-2`,title:`Last 30 days`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(fg,{bars:p,active:o,total:p.reduce((e,t)=>e+t.cost,0)}),(0,I.jsx)(`span`,{className:`flex items-center gap-1`,children:[`calendar`,`bars`].map(e=>(0,I.jsx)(`button`,{onClick:()=>u(e),className:`px-1.5 py-0.5 rounded-sm text-[11px] ${c===e?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg`}`,children:e},e))})]}),children:[i.data?p.length===0&&(0,I.jsx)(z,{title:`No history yet`}):(0,I.jsx)(St,{rows:2}),p.length>0&&(c===`calendar`?(0,I.jsx)(gg,{bars:p,active:o,onActive:s}):(0,I.jsx)(dg,{bars:p,active:o,onActive:s}))]}),(0,I.jsx)(yg,{feature:`cap`,title:`Stop the day at a number you choose`,children:(0,I.jsx)(bg,{suggestion:m})}),(0,I.jsx)(yg,{feature:`gemini`,title:`Ask a second model, on your own key`,children:(0,I.jsx)(Sg,{})}),d&&(0,I.jsxs)(L,{title:`Plan limits`,children:[d.rate_limits?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1`,children:[d.rate_limits.five_hour&&(0,I.jsx)(_n,{label:`5-hour window`,w:d.rate_limits.five_hour,now:n}),d.rate_limits.seven_day&&(0,I.jsx)(_n,{label:`7-day window`,w:d.rate_limits.seven_day,now:n})]}):(0,I.jsxs)(`div`,{className:`px-3 pt-1 text-sm text-fg-muted`,children:[`No window state yet. Caprock reads this from Claude Code's status line, so it appears once a Pro or Max session has run with `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:`caprock statusline`}),` registered —`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock up`}),` offers to do that. API-billed usage has no windows to report.`]}),(0,I.jsx)(`div`,{className:`mt-2 px-3 pb-3 text-[11px] text-fg-faint leading-relaxed`,children:`Live from Claude Code's status line (Pro/Max). The percentage is your usage of the window; a forecast is shown only when your measured pace would reach the limit before the window resets.`})]})]}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[d&&d.throttles>0?`${d.throttles} rate-limit / overloaded event${d.throttles===1?``:`s`} observed in this range (from Claude Code's StopFailure hook).`:`No rate-limit events observed in this range.`,` `,`Everything here is measured — no invented numbers.`]})]})}function wg(e){let t=new Map;for(let n of e){let e=t.get(n.day)??{day:n.day,cost:0,tokens:0,sessions:0};e.cost+=n.cost_usd,e.tokens+=n.tokens_total,e.sessions+=n.sessions,t.set(n.day,e)}return[...t.values()].sort((e,t)=>e.day.localeCompare(t.day))}function Tg(e,t){switch(e){case`today`:return 1;case`7d`:return 7;case`30d`:return 30;default:return t?Math.max(1,Math.ceil((Date.now()-t)/864e5)):30}}function Eg(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length<3)return 0;let n=t[Math.floor(t.length/2)]*2,r=n<10?1:n<100?5:10;return Math.round(n/r)*r}function Dg({plan:e,save:t}){let[n,r]=(0,l.useState)(e.license_key??``),i=F(()=>N.premium(),[e.license_key]).data?.license;(0,l.useEffect)(()=>{r(e.license_key??``)},[e.license_key]);let a=n.trim()!==(e.license_key??``).trim();return(0,I.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`w-28 shrink-0 text-fg-muted`,children:`Licence`}),(0,I.jsx)(`input`,{className:`input flex-1 min-w-0`,placeholder:`CR-…`,spellCheck:!1,value:n,onChange:e=>r(e.target.value),onKeyDown:r=>{r.key===`Enter`&&a&&t({...e,license_key:n.trim()})}}),(0,I.jsx)(`button`,{disabled:!a,onClick:()=>t({...e,license_key:n.trim()}),className:`rounded-sm border border-border px-2 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg disabled:opacity-40`,children:`save`})]}),(0,I.jsxs)(`p`,{className:`mt-1.5 pl-[7.5rem] text-[11px] leading-relaxed`,children:[i?.active&&!i.in_grace&&(0,I.jsxs)(`span`,{className:`text-ok`,children:[`Premium is on`,i.expires_at?` — renews ${i.expires_at.slice(0,10)}`:``,`.`]}),i?.active&&i.in_grace&&(0,I.jsxs)(`span`,{className:`text-warn`,children:[i.reason,`. Update your key or payment method.`]}),i&&!i.active&&(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[e.license_key?i.reason:`No key — the free product is unaffected.`,` `,(0,I.jsx)(`a`,{href:`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`link`,children:`what Premium does`})]}),(0,I.jsx)(`span`,{className:`block text-fg-faint`,children:`Checked on this machine against the date inside the key. Caprock makes no call to us to verify it.`})]})]})}function Og(){let e=F(()=>N.status(),[],{live:!1,intervalMs:5e3}),t=e.data;if(e.error&&!t)return(0,I.jsx)(z,{title:`Cannot reach the daemon`,children:e.error.message});if(!t)return(0,I.jsx)(`div`,{className:`text-fg-muted`,children:`loading…`});let n=[[`version`,t.version],[`url`,t.url],[`pid`,String(t.pid)],[`uptime`,te(t.uptime_s*1e3)],[`data dir`,t.data_dir],[`pricing`,`${t.pricing.version} · ${t.pricing.models} models · fetched ${t.pricing.fetched_at}${t.pricing.user_override?` · user override`:``}`],[`pricing source`,t.pricing.source],[`loop rule`,`≥ ${t.loop_k} same-tool calls in ${t.loop_t_minutes} min · ${t.active_loops} active`],[`events stored`,`${t.events.toLocaleString()}${t.retention_days>0?` · pruned after ${t.retention_days}d`:` · kept forever (set retention_days to cap DB growth)`}`],[`orchestration`,t.orchestration?`on (--hive)`:`off`],[`claude`,t.claude_available?`found on PATH — Caprock can start sessions for you`:`not found on PATH — Caprock cannot start sessions, but still observes every session you start yourself`],[`dashboard`,t.ui_built?`embedded build`:`dev server / placeholder`]];if(t.hooks&&n.push([`hooks`,`${(t.hooks.installed??[]).length}/${(t.hooks.installed??[]).length+(t.hooks.missing??[]).length} events registered in ${t.hooks.settings_path}${t.hooks.shim_exists?``:` (shim missing)`}`]),t.desktop){let e=t.desktop;n.push([`claude desktop`,`${e.five_hour_pct}% of the 5-hour window · ${e.seven_day_pct}% of the 7-day${e.stale?` · last seen `+new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})+`, app closed since`:` · now`}`])}return t.ingest_error&&n.push([`ingest error`,`STOPPED: ${t.ingest_error} — nothing is being captured`]),t.ingest&&n.push([`ingest`,`${t.ingest.files_known} transcripts · ${t.ingest.events_stored} events stored · ${t.ingest.events_deduped} deduped · ${t.ingest.lines_malformed} malformed lines · backfill ${t.ingest.backfill_done?`done`:`running`}`]),(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-3xl`,children:[(0,I.jsx)(kg,{}),(0,I.jsx)(L,{title:`Daemon`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:n.map(([e,t])=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:e}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:t})]},e))})})}),t.ingest_error&&(0,I.jsx)(L,{title:`Ingest stopped`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`No new sessions are being captured: `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:t.ingest_error}),`. Check that`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})}),!t.claude_available&&(0,I.jsx)(L,{title:`claude not found`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`The `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself. Install Claude Code, or make sure`,(0,I.jsx)(`span`,{className:`mono`,children:` claude`}),` is on the PATH the daemon was started with.`]})}),t.hooks&&(t.hooks.missing??[]).length>0&&(0,I.jsx)(L,{title:`Hooks not fully installed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`Missing: `,(0,I.jsx)(`span`,{className:`mono`,children:(t.hooks.missing??[]).join(`, `)}),`. Run `,(0,I.jsx)(`span`,{className:`mono`,children:`caprock hooks install`}),` for real-time activity; transcript tailing keeps working with a few seconds of delay.`]})})]})}function kg(){let[e,t]=De();return e?(0,I.jsx)(L,{title:`Settings`,children:(0,I.jsxs)(`div`,{className:`grid gap-2 px-3 py-2.5 text-[12px]`,children:[(0,I.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)] mt-0.5`,checked:e.update_checks,onChange:n=>t({...e,update_checks:n.target.checked})}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Check GitHub for new releases`}),(0,I.jsx)(`span`,{className:`block text-[11px] text-fg-muted`,children:`The only outbound call Caprock makes. No usage data is sent, and it is checked at most once a day.`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted w-28 shrink-0`,children:`Your plan`}),(0,I.jsx)(`span`,{className:`mono text-fg`,children:e.plan_kind===`metered`?`${e.plan_label||`API`} · billed per token`:e.plan_kind===`flat`?`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`not set`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint ml-auto`,children:`change it in the header`})]}),(0,I.jsx)(Dg,{plan:e,save:t})]})}):null}var Ag=[`your-api`,`your-web`];function jg(){let[e,t]=(0,l.useState)(`all`),[n,r]=(0,l.useState)(null),i=F(()=>N.history(e),[e],{intervalMs:15e3}),[a]=De(),o=i.data,s=!!o&&o.totals.turns>0,c=wg(o?.daily??[]),u=(F(()=>N.summary(`7d`),[],{intervalMs:6e4}).data?.projects??[]).slice(0,4).map(e=>e.project),d=Math.max(...(o?.tools??[]).map(e=>e.count),1);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Everything you ever ran through Caprock. Measured, not estimated.`})]}),s&&o&&(0,I.jsx)(En,{costUSD:o.totals.cost_usd,days:o.totals.days,now:Date.now()}),i.error&&!o&&(0,I.jsx)(z,{title:`Cannot reach the daemon`,children:i.error.message}),(0,I.jsxs)(L,{title:`Lifetime · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 divide-x divide-border`,children:[(0,I.jsx)(R,{size:`compact`,label:`Sessions`,value:s?o.totals.sessions:`—`,sub:s?`${o.totals.owned_sessions} spawned by caprock`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Active days`,value:s?o.totals.days:`—`}),(0,I.jsx)(R,{size:`compact`,label:`Turns`,value:s?C(o.totals.turns):`—`,sub:s?`${C(o.totals.tool_calls)} tool calls`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Files touched`,value:s?C(o.totals.files_touched):`—`,sub:`summed per session`}),(0,I.jsx)(R,{size:`compact`,label:`Avg session span`,value:s?te(Math.round(o.totals.avg_session_sec*1e3)):`—`,sub:`first to last event`}),(0,I.jsx)(hn,{hitRate:o?.savings.hit_rate,cutPct:o?.savings.cut_pct,measured:s}),(0,I.jsx)(R,{label:`Cost`,value:s?S(o.totals.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:un(a),children:s?ln(a):`nothing measured yet`}),tone:`info`,size:`hero`})]}),(0,I.jsx)(Sr,{u:o?.totals.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,I.jsxs)(L,{title:`Tool usage`,right:(0,I.jsx)(`span`,{children:`by calls`}),children:[o?o.tools.length===0&&(0,I.jsx)(z,{title:`No tool calls yet`}):(0,I.jsx)(St,{rows:5}),(0,I.jsx)(`ul`,{className:`py-1`,children:(o?.tools??[]).slice(0,18).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-[3px]`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px] w-44 shrink-0 truncate`,title:e.tool,children:ne(e.tool)}),(0,I.jsx)(`div`,{className:`flex-1 h-2 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${100*e.count/d}%`}})}),(0,I.jsx)(`span`,{className:`num text-[11px] text-fg-muted w-12 text-right`,children:C(e.count)})]},e.tool))})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[o?o.summary.models.length===0&&(0,I.jsx)(z,{title:`No priced turns`}):(0,I.jsx)(St,{rows:3}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,children:e.model||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.model))})})]}),(0,I.jsx)(yg,{feature:`report`,title:`Get this every Monday, without opening the dashboard`,children:(0,I.jsx)(L,{title:`Weekly report`,right:(0,I.jsx)(`span`,{children:`Mondays, 09:00`}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3 text-[13px]`,children:[(0,I.jsxs)(`p`,{className:`text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`To:`}),` your Telegram bot or webhook`]}),(0,I.jsx)(`p`,{className:`mt-2 text-fg`,children:`Last week, by repository:`}),(0,I.jsx)(`div`,{className:`mt-1.5 grid gap-1`,children:(u.length?u:Ag).map(e=>(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,I.jsx)(`span`,{className:`truncate text-fg-muted`,children:e||`unknown`}),(0,I.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-24 shrink-0 rounded-full bg-fg-faint/25`})]},e))}),(0,I.jsx)(`p`,{className:`mt-2.5 border-t border-border pt-2 text-[12px] text-fg-faint`,children:`…and the same by model, in your inbox before you open a terminal.`})]})})}),(0,I.jsx)(L,{title:`Top projects`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.projects??[]).slice(0,8).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.project))})})})]})]}),(0,I.jsxs)(L,{title:`Daily cost`,right:(0,I.jsx)(fg,{bars:c,active:n,total:c.reduce((e,t)=>e+t.cost,0)}),children:[i.data?c.length===0&&(0,I.jsx)(z,{title:`No history yet`}):(0,I.jsx)(St,{rows:2}),c.length>0&&(0,I.jsx)(dg,{bars:c,active:n,onActive:r,height:96,showDayLabels:!1})]})]})}var Mg=[{key:`inbox`,label:`Inbox`},{key:`assigned`,label:`Assigned`},{key:`in_progress`,label:`In progress`},{key:`verifying`,label:`Verifying`},{key:`needs_you`,label:`Needs you`},{key:`done`,label:`Done`}];function Ng(){let e=F(()=>N.status(),[],{live:!1,intervalMs:3e4}),t=F(()=>N.tasks(),[],{intervalMs:4e3}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);if(e.data&&e.data.orchestration===!1)return(0,I.jsx)(Pg,{status:e.data,onEnabled:()=>{e.refresh(),t.refresh()}});let o=e=>(t.data??[]).filter(t=>t.status===e||e===`done`&&t.status===`failed`);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm text-[12px] hover:bg-accent/20`,children:`+ New task`}),(0,I.jsx)(Lg,{available:e.data?.claude_available??!1}),(t.data??[]).some(e=>e.assignee!==``&&e.status!==`done`&&e.status!==`failed`)&&(0,I.jsx)(`a`,{href:`#/graph`,className:`link text-[12px] border border-border px-2 py-1 rounded-sm hover:border-border-strong`,children:`view graph`}),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[`Tasks are files on disk (`,(0,I.jsx)(`span`,{className:`mono`,children:`tasks/.md`}),`); the orchestrator moves them. Nothing reaches Done until its `,(0,I.jsx)(`span`,{className:`mono`,children:`done_criteria`}),` pass.`]})]}),t.error&&!t.data&&(0,I.jsx)(z,{title:`Cannot reach the daemon`,children:t.error.message}),t.data&&t.data.length===0&&(0,I.jsxs)(`div`,{className:`border border-border bg-panel-2/60 rounded-sm px-3 py-2 text-[12px] text-fg-muted`,children:[`Start here: `,(0,I.jsx)(`span`,{className:`text-fg`,children:`+ New task`}),` — a title and the commands that have to pass. Then `,(0,I.jsx)(`span`,{className:`text-fg`,children:`▶ Start orchestrator`}),`, which assigns it to a worker and keeps going until the checks are green.`]}),(0,I.jsx)(`div`,{className:`grid gap-2 grid-cols-2 md:grid-cols-3 xl:grid-cols-6`,children:Mg.map(e=>(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.08em] text-fg-faint mb-1.5 px-0.5 flex justify-between`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`span`,{className:`num`,children:o(e.key).length})]}),(0,I.jsx)(`div`,{className:`grid gap-1.5 content-start min-h-[60px]`,children:o(e.key).map(e=>(0,I.jsx)(Rg,{t:e,onApprove:()=>t.refresh(),onOpen:()=>a(e.id)},e.id))})]},e.key))}),n&&(0,I.jsx)(Ug,{onClose:()=>{r(!1),t.refresh()}}),i&&(0,I.jsx)(zg,{id:i,onClose:()=>{a(null),t.refresh()}})]})}function Pg({status:e,onEnabled:t}){let[n,r]=(0,l.useState)(!1),i=e.suggested_hive??`~/caprock-tasks`,a=e.suggested_repo??``;return(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-[52rem] mx-auto`,children:[(0,I.jsxs)(L,{title:`Task runner`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`off`}),children:[(0,I.jsxs)(`div`,{className:`grid gap-3 px-3 py-3`,children:[(0,I.jsxs)(`ol`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,I.jsx)(Fg,{n:1,title:`You write a task`,children:`A title, a budget, and the commands that have to pass.`}),(0,I.jsxs)(Fg,{n:2,title:`Caprock runs it`,children:[`One Claude session per task, in its `,(0,I.jsx)(`span`,{className:`text-fg`,children:`own git worktree`}),` — your working tree is untouched.`]}),(0,I.jsxs)(Fg,{n:3,title:`Caprock checks it`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Caprock`}),` runs your commands, not the agent. Only green is done.`]})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Best for independent tasks — nothing here merges branches. The queue directory is created for you; your repository is not modified.`})]}),(0,I.jsxs)(`footer`,{className:`px-3 py-2 border-t border-border flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25`,children:`Turn on the task runner`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`No restart. Nothing runs until you start it.`})]})]}),n&&(0,I.jsx)(Ig,{hive:i,repo:a,onClose:()=>r(!1),onDone:t})]})}function Fg({n:e,title:t,children:n}){return(0,I.jsxs)(`li`,{className:`border border-border bg-panel-2/60 rounded-sm px-2.5 py-2 grid gap-1 content-start`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:`num text-[11px] text-accent`,children:e}),(0,I.jsx)(`span`,{className:`text-[12px] font-medium`,children:t})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-muted leading-[1.45]`,children:n})]})}function Ig({hive:e,repo:t,onClose:n,onDone:r}){let[i,a]=(0,l.useState)(e),[o,s]=(0,l.useState)(t),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:n,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Turn on the task runner`}),(0,I.jsx)(`button`,{onClick:n,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`ul`,{className:`grid gap-1 text-[12px] text-fg-muted`,children:[(0,I.jsx)(`li`,{children:`· Creates the queue directory below, with a README and an example task.`}),(0,I.jsxs)(`li`,{children:[`· Lets Caprock spawn Claude sessions `,(0,I.jsx)(`span`,{className:`text-fg`,children:`with permission prompts skipped`}),`, one git worktree each under the repo below.`]}),(0,I.jsx)(`li`,{children:`· Starts nothing yet — you start the orchestrator, and only then does work begin.`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Queue directory`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · created if missing`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:i,onChange:e=>a(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Repository`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · workers branch from here`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:o,onChange:e=>s(e.target.value)})]}),d&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:d})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:n,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{u(!0),f(``);try{await N.enableHive(i.trim(),o.trim()),n(),r()}catch(e){f(oe(e))}finally{u(!1)}},disabled:c,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`turning on…`:`Turn it on`})]})]})})}function Lg({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(`button`,{disabled:t||!e,onClick:async()=>{n(!0),i(``);try{let e=await N.startOrchestrator();i(`orchestrator: `+e.session_id.slice(0,8))}catch(e){i(oe(e))}finally{n(!1)}},title:e?`spawn the orchestrator session`:`claude not found — cannot spawn`,className:`border border-border text-fg-muted px-2 py-1 rounded-sm text-[12px] hover:text-fg disabled:opacity-50`,children:t?`starting…`:`▶ Start orchestrator`}),!e&&(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` was not found on this machine, so Caprock cannot spawn the orchestrator. It still observes every session you start yourself.`]}),r&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint mono`,children:r})]})}function Rg({t:e,onApprove:t,onOpen:n}){let r=e.budget_usd>0&&e.cost_usd>e.budget_usd,i=e.assignee!==``;return(0,I.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] px-2 py-1.5`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left disabled:cursor-default`,disabled:!i,onClick:n,title:i?`show the diff, the checks that ran, and where the branch is`:`nothing to show yet — no worker has picked this up`,children:[(0,I.jsx)(`div`,{className:`text-[12px] font-medium truncate ${i?`hover:text-accent`:``}`,title:e.title,children:e.title||e.id}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[10px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono`,children:T(e.id)}),e.assignee&&(0,I.jsxs)(`span`,{className:`mono text-fg-muted`,children:[`→ `,e.assignee]}),(0,I.jsxs)(`span`,{className:`num ml-auto ${r?`text-danger`:`text-fg-muted`}`,children:[S(e.cost_usd),e.budget_usd>0?` / ${S(e.budget_usd)}`:``]})]})]}),i&&(0,I.jsxs)(`div`,{className:`mt-1 text-[10px] text-fg-faint mono truncate`,children:[`caprock/`,e.assignee]}),e.status===`needs_you`&&(0,I.jsxs)(`div`,{className:`flex gap-1 mt-1.5`,children:[(0,I.jsx)(`button`,{onClick:()=>N.approve(e.id,!0).then(t),className:`flex-1 text-[11px] border border-ok/40 text-ok rounded-sm hover:bg-ok/10`,children:`approve`}),(0,I.jsx)(`button`,{onClick:()=>N.approve(e.id,!1).then(t),className:`flex-1 text-[11px] border border-danger/40 text-danger rounded-sm hover:bg-danger/10`,children:`reject`})]})]})}function zg({id:e,onClose:t}){let n=F(()=>N.task(e),[e],{intervalMs:6e3}),r=n.data,i=r?.work,a=i?.sessions?.[0];return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-16`,onClick:t,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[820px] max-w-[94vw] max-h-[82vh] overflow-auto`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center gap-2 sticky top-0 bg-panel z-10`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Task`}),r&&(0,I.jsx)(`span`,{className:`text-[12px] truncate`,children:r.task.title||r.task.id}),r&&(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint`,children:r.task.status}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),!r&&!n.error&&(0,I.jsx)(St,{rows:5}),n.error&&!r&&(0,I.jsx)(z,{title:`Cannot load the task`,children:n.error.message}),r&&(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-3`,children:[(0,I.jsx)(Bg,{work:i,assignee:r.task.assignee}),(0,I.jsx)(Vg,{criteria:r.done_criteria,runs:i?.verifications,status:r.task.status}),(0,I.jsx)(Hg,{sessionID:a?.session_id,assignee:r.task.assignee}),r.body&&(0,I.jsx)(L,{title:`Brief`,children:(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.45] px-3 py-2 whitespace-pre-wrap`,children:r.body})})]})]})})}function Bg({work:e,assignee:t}){return e?.branch?(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsxs)(`tbody`,{children:[(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`branch`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.branch})]}),e.worktree&&(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`worktree`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.worktree})]}),(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32 align-top`,children:`take it`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 grid gap-1 justify-items-start`,children:[(0,I.jsx)(Ct,{command:`git merge --no-ff ${e.branch}`}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Run it from `,e.repo?(0,I.jsx)(`span`,{className:`mono`,children:e.repo}):`your repo`,`, on the branch you want the work on. Prefer `,(0,I.jsx)(`span`,{className:`mono`,children:`git cherry-pick`}),` if you only want some of it. Worker`,` `,(0,I.jsx)(`span`,{className:`mono`,children:t}),` may still be running — check the diff below first.`]})]})]})]})})}):(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:`No worker has been assigned yet, so there is no branch. One is created the moment the orchestrator assigns this task.`})})}function Vg({criteria:e,runs:t,status:n}){let r=t?.[0],i=r?t.filter(e=>e.round===r.round):[],a=r?`round ${r.round}`:void 0;return(0,I.jsxs)(L,{title:`What has to pass`,right:a,children:[i.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 grid gap-1`,children:[(0,I.jsx)(`div`,{className:`text-[12px] text-fg-faint`,children:n===`done`?`This task was marked done without a recorded check.`:`Not run yet. Caprock runs these itself, in the worker’s worktree, when the worker reports it has finished.`}),(0,I.jsx)(`ul`,{className:`grid gap-0.5`,children:(e??[]).map(e=>(0,I.jsxs)(`li`,{className:`mono text-[11px] text-fg-muted`,children:[`$ `,e]},e))}),(e??[]).length===0&&(0,I.jsx)(`div`,{className:`mono text-[11px] text-danger`,children:`no done_criteria — Caprock cannot verify this task`})]}),i.length>0&&(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0 px-3 py-1.5 flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`text-[10px] w-14 shrink-0 mono ${e.exit_code===0?`text-ok`:`text-danger`}`,children:e.exit_code===0?`passed`:`exit ${e.exit_code}`}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,title:e.command,children:e.command})]},e.command))})]})}function Hg({sessionID:e,assignee:t}){let n=F(()=>e?N.diff(e):Promise.resolve(void 0),[e],{intervalMs:8e3}),[r,i]=(0,l.useState)(null);if(!e)return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`No session has been attributed to this task yet`,t?` (worker ${t})`:``,`, so there is nothing to diff.`]})});if(n.error&&!n.data){let e=n.error;if(e instanceof j&&e.status===409){let t=e.body;return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[t?.error,t?.cwd?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(`span`,{className:`mono`,children:t.cwd})]}):null]})})}return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:e.message})})}let a=n.data;return a?(0,I.jsxs)(L,{title:`What changed`,right:(0,I.jsxs)(`span`,{className:`num`,children:[a.files.length,` files`]}),children:[a.files.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`Nothing uncommitted in `,(0,I.jsx)(`span`,{className:`mono`,children:a.branch||`the worktree`}),`. If the worker committed its work, the branch above holds it.`]}),(0,I.jsx)(`ul`,{children:a.files.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>i(r===e.path?null:e.path),children:[(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),r===e.path&&e.patch&&(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[40vh]`,children:e.patch.split(` -`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})}),r===e.path&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path))})]}):(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(St,{rows:3})})}function Ug({onClose:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`3`),[a,o]=(0,l.useState)(`go test ./... +`);let l=new TextEncoder,u=e=>{c.readyState===WebSocket.OPEN&&c.send(l.encode(e))},d=i.onData(u),f=(e,t)=>{c.readyState!==WebSocket.OPEN||e<=0||t<=0||c.send(JSON.stringify({resize:{cols:e,rows:t}}))},p=i.onResize(({cols:e,rows:t})=>f(e,t));c.onopen=()=>{try{o.fit()}catch{}f(i.cols,i.rows)};let m=e=>{e.preventDefault(),e.stopPropagation(),u(`\x1B\r`)};i.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;if(h&&e.metaKey&&!e.ctrlKey&&!e.altKey){if(e.key===`c`)return!g();if(e.key===`v`)return _(),!1}if(!h&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey){if(e.key===`C`||e.key===`c`)return g(),!1;if(e.key===`V`||e.key===`v`)return _(),!1}return!h&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.key===`c`||e.key===`C`)?!g()||(i.clearSelection(),!1):e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.key===`j`||e.key===`J`)?(m(e),!1):e.key!==`Enter`||[e.shiftKey,e.altKey,e.ctrlKey,e.metaKey].filter(Boolean).length!==1||e.metaKey?!0:(m(e),!1)});let h=/Mac|iP(hone|ad)/.test(navigator.platform||navigator.userAgent),g=()=>{let e=i.getSelection();return e?(navigator.clipboard?.writeText(e),!0):!1},_=()=>{navigator.clipboard?.readText().then(e=>{e&&i.paste(e)}).catch(()=>{})},v=async e=>{let t=e.type||`application/octet-stream`,n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e{let t=[...e.clipboardData?.items??[]].find(e=>e.kind===`file`)?.getAsFile();t&&(e.preventDefault(),v(t))},b=e=>{let t=e.dataTransfer?.files?.[0];t&&(e.preventDefault(),v(t))},x=e=>{e.preventDefault()},S=a.current;S.addEventListener(`paste`,y),S.addEventListener(`drop`,b),S.addEventListener(`dragover`,x);let C=new ResizeObserver(()=>{try{o.fit()}catch{}});return C.observe(a.current),()=>{S.removeEventListener(`paste`,y),S.removeEventListener(`drop`,b),S.removeEventListener(`dragover`,x),C.disconnect(),d.dispose(),p.dispose(),c.close(),i.dispose()}},[e,t]),t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:a,className:`h-[70vh] bg-bg`}),(0,L.jsxs)(`div`,{className:`border-t border-border px-3 py-1.5 text-[11px] text-fg-faint`,children:[(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`Shift`}),`+`,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` for a new line —`,` `,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`Option`}),`+`,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` and`,` `,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`Ctrl`}),`+`,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`J`}),` do the same.`]})]}):(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,L.jsx)(`p`,{className:`text-[14px] text-fg`,children:`You started this session yourself, so it has no terminal here.`}),(0,L.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-bg hover:brightness-110`,children:`Launch a new Claude Code session here →`}),(0,L.jsxs)(`p`,{className:`max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:[`Runs a second `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in`,` `,n?(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:n}):`this repository`,` and gives it a terminal you can type in. This session keeps running, untouched.`]}),r&&(0,L.jsx)(Pr,{available:!0,onClose:()=>i(!1),initialCwd:n??``}),(0,L.jsx)(`p`,{className:`mt-1 max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:`Caprock never types into a process it did not start — including this one, which stays visible here and keeps being measured.`})]})}function eg({id:e,tab:t,at:n}){let r=I(()=>P.session(e),[e],{intervalMs:5e3}),i=t===`changes`||t===`diff`||t===`files`?`changes`:t===`terminal`||t===`notes`?t:`timeline`,a=re(1e3),[o]=Ee(),s=r.data;if(r.error&&!s)return(0,L.jsx)(xt,{title:r.error instanceof M&&r.error.status===404?`Session not found`:`Cannot load session`,children:r.error.message});if(!s)return(0,L.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let c=t=>v({name:`session`,id:e,tab:t}),l=s.stats.tokens_in+s.stats.tokens_out+s.stats.cache_read+s.stats.cache_write;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,L.jsx)(`a`,{href:g({name:`now`}),className:`link text-fg-muted text-[12px]`,children:`← Now`}),(0,L.jsx)(`h1`,{className:`text-[15px] font-medium`,children:s.project||`unknown project`}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:s.session_id}),s.git_branch&&(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted`,children:s.git_branch}),(0,L.jsx)(yt,{health:s.activity.health}),s.owned&&s.status!==`ended`&&(0,L.jsx)(lg,{id:e}),(0,L.jsx)(`span`,{className:`text-[12px] text-fg-muted ml-auto num`,children:s.cwd})]}),(0,L.jsxs)(`div`,{className:`text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg`,children:s.activity.phrase}),(0,L.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(s.activity.at||s.last_event_at,a)}),s.loop&&(0,L.jsxs)(`span`,{className:`ml-3 text-danger text-[12px]`,children:[`loop: `,s.loop.sample,` ×`,s.loop.count,` in `,s.loop.window_min,`m`]})]}),(0,L.jsx)(R,{children:(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,L.jsx)(z,{label:`Cost`,value:S(s.stats.cost_usd),sub:(0,L.jsx)(`span`,{title:un(o),children:s.model||`unknown model`})}),(0,L.jsx)(z,{label:`Tokens`,value:C(l),sub:`in ${C(s.stats.tokens_in)} · out ${C(s.stats.tokens_out)} · cache ${C(s.stats.cache_read+s.stats.cache_write)}`}),(0,L.jsx)(z,{label:`Cache`,value:w(s.savings.hit_rate*100),sub:`read ${C(s.stats.cache_read)} · write ${C(s.stats.cache_write)}`,tone:s.savings.hit_rate>.5?`ok`:void 0}),(0,L.jsx)(z,{label:`Context`,value:s.context?w(s.context.pct):`—`,sub:s.context?`${C(s.context.tokens)} / ${C(s.context.window)}`:`unknown model`,tone:s.context&&s.context.pct>=85?`danger`:s.context&&s.context.pct>=60?`warn`:void 0}),(0,L.jsx)(z,{label:`Turns`,value:s.stats.turns,sub:`${s.stats.tool_calls} tool calls`}),(0,L.jsx)(z,{label:`Files`,value:s.stats.files_touched,sub:`${s.has_hooks?`hooks`:`no hooks`} · ${s.has_transcript?`transcript`:`no transcript`}`})]})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border`,children:[[`timeline`,`notes`,`changes`,`terminal`].map(e=>(0,L.jsx)(`button`,{onClick:()=>c(e),className:`px-3 py-1.5 text-[12px] border-b-2 -mb-px ${i===e?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,children:e===`timeline`?`Timeline`:e===`notes`?`Answers`:e===`changes`?`Changes`:`Terminal`},e)),!s.owned&&(0,L.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint pr-1`,children:`observe-only — terminal is read/write for spawned sessions only`})]}),i===`timeline`&&(0,L.jsx)(ng,{id:e,initial:s.events,now:a,at:n}),i===`notes`&&(0,L.jsx)(Vr,{id:e,now:a}),i===`changes`&&(0,L.jsx)(og,{id:e,s}),i===`terminal`&&(0,L.jsx)(R,{className:`overflow-hidden`,children:(0,L.jsx)($h,{sessionId:e,owned:s.owned&&s.status!==`ended`,cwd:s.cwd})})]})}var tg=200;function ng({id:e,initial:t,now:n,at:r}){let[i,a]=(0,l.useState)(t),[o,s]=(0,l.useState)(`all`),c=(0,l.useRef)(t.length?t[t.length-1].id:0),u=(0,l.useRef)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),g=async()=>{let t=i[0]?.id;if(!(t===void 0||f)){p(!0);try{let n=await P.eventsBefore(e,t,tg);n.length===0?h(!0):a(e=>[...n,...e])}catch{h(!0)}finally{p(!1)}}};(0,l.useEffect)(()=>{a(t),h(!1),c.current=t.length?t[t.length-1].id:0},[t]),(0,l.useEffect)(()=>d.onFrame(t=>{t.type!==`event`||t.data.session_id!==e||t.data.id<=c.current||(c.current=t.data.id,a(e=>[...e,t.data].slice(-5e3)))}),[e]);let _=(0,l.useMemo)(()=>{let e=0;return i.filter(e=>e.kind===`turn.assistant`).map(t=>e+=t.cost_usd??0)},[i]),v=(0,l.useMemo)(()=>{let e=new Map;for(let t of i)if(t.kind===`tool.pre`&&t.tool){let n=t.payload;n?.tool_use_id&&e.set(n.tool_use_id,t.tool)}return e},[i]),y=i.filter(e=>o===`all`||(o===`tools`?e.kind.startsWith(`tool.`):e.kind.startsWith(`turn.`)||e.kind===`agent.stop`)).slice().reverse();return(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,L.jsx)(R,{title:`Events · ${i.length} shown`,className:`min-w-0 overflow-hidden`,right:(0,L.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:[`all`,`tools`,`turns`].map(e=>(0,L.jsx)(`button`,{onClick:()=>s(e),className:`px-1.5 rounded-sm ${o===e?`bg-panel-2 text-fg`:`hover:text-fg`}`,children:e},e))}),children:(0,L.jsxs)(`ol`,{ref:u,className:`max-h-[70vh] overflow-auto`,children:[y.length===0&&(0,L.jsx)(xt,{title:`No events yet`}),y.map(e=>(0,L.jsx)(ig,{e,now:n,toolByUse:v,inMinute:r!==void 0&&rg(e.ts,r)},e.id)),!m&&i.length>0&&(0,L.jsx)(`li`,{className:`px-3 py-1.5 border-t border-border/60`,children:(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-0.5 rounded-sm`,onClick:()=>void g(),disabled:f,children:f?`loading…`:`load earlier events`})}),m&&(0,L.jsx)(`li`,{className:`px-3 py-1 text-[11px] text-fg-faint`,children:`start of session`})]})}),(0,L.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,L.jsxs)(R,{title:`Cost, cumulative`,children:[(0,L.jsx)(`div`,{className:`px-3 py-2`,children:(0,L.jsx)(bt,{values:_.length?_:[0,0],width:230,height:40,tone:`accent`})}),(0,L.jsxs)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted num`,children:[_.length,` priced turns · `,S(_[_.length-1]??0)]})]}),(0,L.jsxs)(R,{title:`Tokens per turn`,children:[(0,L.jsx)(`div`,{className:`px-3 py-2`,children:(0,L.jsx)(bt,{values:i.filter(e=>e.tokens).map(e=>e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),width:230,height:40})}),(0,L.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted`,children:`prompt size (input + cache) per assistant turn`})]})]})]})}function rg(e,t){let n=Date.parse(e);return Number.isFinite(n)&&Math.floor(n/6e4)===Math.floor(t/6e4)}function ig({e,now:t,toolByUse:n,inMinute:r}){let[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`center`})},[r]);let s=e.payload??{},c=e.tool||(e.kind===`tool.post`?n.get(String(s.tool_use_id??``)):void 0),u=ag({...e,tool:c},s),d=e.kind===`turn.assistant`?String(s.text??``):e.kind===`turn.user`?String(s.prompt??``):e.kind===`tool.post`&&typeof s.tool_response==`string`?s.tool_response:``,f=e.kind===`turn.user`?`text-info`:e.kind===`turn.assistant`?`text-fg`:e.kind===`agent.stop`||e.kind===`context.compact`?`text-warn`:`text-fg-muted`;return(0,L.jsxs)(`li`,{ref:o,className:`border-b border-border/60 last:border-0 hover:bg-panel-2 animate-flash ${r?`bg-accent/10 border-l-2 border-l-accent`:``}`,children:[(0,L.jsxs)(`button`,{className:`w-full text-left flex items-baseline gap-2 px-3 py-[3px]`,onClick:()=>a(!i),children:[(0,L.jsx)(`span`,{className:`num text-[10px] text-fg-faint w-14 shrink-0`,children:T(e.ts,t)}),(0,L.jsx)(`span`,{className:`mono text-[10px] w-24 shrink-0 ${f}`,children:e.kind}),(0,L.jsx)(`span`,{className:`truncate text-[12px] min-w-0`,title:u,children:u}),e.tokens&&(0,L.jsxs)(`span`,{className:`ml-auto num text-[10px] text-fg-faint shrink-0`,children:[C(e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),`→`,C(e.tokens.out),e.cost_usd===void 0?``:` · ${S(e.cost_usd)}`]})]}),i&&(0,L.jsxs)(`div`,{className:`px-3 pb-2`,children:[d?(0,L.jsx)(`div`,{className:`text-[12px] leading-[1.55] whitespace-pre-wrap break-words max-h-96 overflow-auto border-l-2 border-border-strong pl-3 mb-2`,children:d}):null,(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`text-[10px] text-fg-faint cursor-pointer select-none`,children:`raw event`}),(0,L.jsx)(`pre`,{className:`mono text-[10px] leading-[1.4] text-fg-muted pt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all`,children:JSON.stringify({id:e.id,ts:e.ts,source:e.source,key:e.key,agent_id:e.agent_id,model:e.model,tokens:e.tokens,cost_usd:e.cost_usd,payload:e.payload},null,2)})]})]})]})}function ag(e,t){let n=t.tool_input??{};switch(e.kind){case`tool.pre`:{let r=e.tool??String(t.tool_name??`tool`),i=n.command??n.file_path??n.pattern??n.query??n.url??n.prompt??``;return i?`${r} ${String(i).split(` +`)[0]}`:r}case`tool.post`:{let n=e.tool??String(t.tool_name??`tool`),r=t.tool_response,i=t.is_error===!0,a=typeof r==`string`?r:r?JSON.stringify(r):``;return`${n} ${i?`failed`:`done`}${a?` ${a.slice(0,160)}`:``}`}case`turn.user`:return`you: ${String(t.prompt??``).slice(0,200)}`;case`turn.assistant`:{let n=String(t.text??``),r=Array.isArray(t.tools)?t.tools:[];return n?n.slice(0,200):r.length?`→ ${r.join(`, `)}`:`${e.model??`assistant`} turn`}case`agent.stop`:return e.agent_id?`subagent ${e.agent_id} stopped`:`turn ended (${String(t.stop_reason??`stop`)})`;case`agent.spawn`:return`session started (${String(t.source??`startup`)})`;case`context.compact`:return`context compaction (${String(t.trigger??`auto`)})`;default:return e.kind}}function og({id:e,s:t}){let n=I(()=>P.diff(e),[e,t.last_event_at],{live:!1,intervalMs:8e3}),[r,i]=(0,l.useState)(new Set),a=e=>i(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let n=e.body;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(xt,{title:`No git repository`,children:[n?.cwd?(0,L.jsx)(`span`,{className:`mono`,children:n.cwd}):null,` `,n?.error]}),(0,L.jsx)(cg,{s:t})]})}return(0,L.jsx)(xt,{title:`Cannot load diff`,children:e.message})}let o=n.data;if(!o)return(0,L.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let s=new Set(o.files.map(e=>e.path)),c=t.files.filter(e=>!s.has(e)&&!s.has(e.replace(/^.*?\//,``))),u=o.files.length>0&&o.files.every(e=>r.has(e.path));return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(R,{title:`Changes · ${o.branch||`detached`}`,right:(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o.base&&(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:o.base}),o.files.length>0&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>i(u?new Set:new Set(o.files.map(e=>e.path))),children:u?`collapse all`:`expand all`}),(0,L.jsxs)(`span`,{className:`num`,children:[o.files.length,` files`]})]}),children:[o.files.length===0&&(0,L.jsx)(xt,{title:`Clean working tree`}),(0,L.jsx)(`ul`,{children:o.files.map(e=>{let t=r.has(e.path);return(0,L.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>a(e.path),"aria-expanded":t,children:[(0,L.jsx)(`span`,{className:`text-fg-faint text-[10px] shrink-0 transition-transform ${t?`rotate-90`:``}`,children:`▶`}),(0,L.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,L.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,L.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,L.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,L.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),t&&e.patch&&(0,L.jsx)(sg,{patch:e.patch}),t&&!e.patch&&(0,L.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path)})})]}),c.length>0&&(0,L.jsx)(cg,{s:t,only:c})]})}function sg({patch:e}){return(0,L.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[50vh]`,children:e.split(` +`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,L.jsx)(`div`,{className:n,children:e||` `},t)})})}function cg({s:e,only:t}){let n=t??e.files,r=e.files.length(0,L.jsxs)(`li`,{className:`px-3 py-1 border-b border-border/60 last:border-0 flex gap-2 items-baseline`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px]`,children:D(e)}),(0,L.jsx)(`span`,{className:`mono text-[10px] text-fg-faint truncate`,children:e})]},e))})]})}function lg({id:e}){let[t,n]=(0,l.useState)(``),r=async t=>{n(t);try{await P.signal(e,t)}catch{}finally{n(``)}};return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-ok border border-ok/40 rounded-sm px-1`,children:`owned`}),(0,L.jsx)(`button`,{disabled:!!t,onClick:()=>r(`pause`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`pause`}),(0,L.jsx)(`button`,{disabled:!!t,onClick:()=>r(`resume`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`resume`}),(0,L.jsx)(`button`,{disabled:!!t,onClick:()=>r(`kill`),className:`text-[11px] border border-danger/40 text-danger px-1.5 rounded-sm hover:bg-danger/10`,children:`kill`})]})}function ug(e){if(!Number.isFinite(e)||e<=0)return[];let t=e/3,n=10**Math.floor(Math.log10(t)),r=[1,2,5,10].map(e=>e*n).find(e=>e>=t)??n*10,i=[];for(let t=r;t<=e*1.0001;t+=r)i.push(t);return i}function dg({bars:e,active:t,onActive:n,height:r=112,showDayLabels:i=!0}){let a=e=>typeof e==`number`&&Number.isFinite(e)?e:0,o=Math.max(...e.map(e=>a(e.cost)),1e-9),s=r-16,c=ug(o);return(0,L.jsxs)(`div`,{className:`relative px-3 py-3 flex items-end gap-[3px]`,style:{height:r},onMouseLeave:()=>n(null),children:[c.map(e=>(0,L.jsx)(`div`,{className:`pointer-events-none absolute left-3 right-3 border-t border-border/60`,style:{bottom:16+Math.round(s*e/o)},"aria-hidden":!0,children:(0,L.jsx)(`span`,{className:`num absolute -top-[7px] right-0 bg-panel pl-1 text-[9px] text-fg-faint`,children:S(e)})},e)),e.map(e=>{let r=t===e.day;return(0,L.jsxs)(`button`,{type:`button`,className:`flex-1 flex flex-col items-center justify-end gap-1 min-w-0 h-full cursor-default focus:outline-none`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(a(e.cost))}`,children:[(0,L.jsx)(`div`,{className:`w-full rounded-t-sm transition-colors ${r?`bg-accent`:`bg-accent/70`}`,style:{height:Math.max(2,Math.round(s*a(e.cost)/o))}}),i&&(0,L.jsx)(`div`,{className:`num text-[9px] ${r?`text-fg`:`text-fg-faint`}`,children:e.day.slice(8)})]},e.day)})]})}function fg({bars:e,active:t,total:n}){let r=t?e.find(e=>e.day===t):void 0;return r?(0,L.jsxs)(`span`,{className:`num flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:r.day}),(0,L.jsx)(`span`,{className:`text-fg`,children:S(r.cost)}),(0,L.jsx)(`span`,{className:`text-fg-faint`,children:C(r.tokens)}),r.sessions!==void 0&&r.sessions>0&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[r.sessions,` `,r.sessions===1?`session`:`sessions`]})]}):(0,L.jsx)(`span`,{className:`num`,children:S(n)})}var pg=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function mg(e){return(new Date(`${e}T00:00:00Z`).getUTCDay()+6)%7}function hg(e,t){if(!(e>0))return`bg-border/60`;let n=Math.sqrt(e/Math.max(t,1e-9));return n>.75?`bg-accent`:n>.5?`bg-accent/75`:n>.25?`bg-accent/50`:`bg-accent/25`}function gg({bars:e,active:t,onActive:n,maxCell:r=44}){let i=e=>typeof e==`number`&&Number.isFinite(e)?e:0,a=Math.max(...e.map(e=>i(e.cost)),1e-9),o=e[0],s=o?mg(o.day):0;return(0,L.jsxs)(`div`,{className:`px-3 py-3`,onMouseLeave:()=>n(null),children:[(0,L.jsxs)(`div`,{className:`grid gap-1`,style:{gridTemplateColumns:`repeat(7, minmax(0, 1fr))`,maxWidth:r*7+24},children:[pg.map((e,t)=>(0,L.jsx)(`div`,{className:`text-center text-[9px] text-fg-faint`,"aria-hidden":!0,children:e},t)),Array.from({length:s},(e,t)=>(0,L.jsx)(`div`,{"aria-hidden":!0},`lead-${t}`)),e.map(e=>{let r=i(e.cost),o=t===e.day;return(0,L.jsx)(`button`,{type:`button`,className:`flex aspect-square items-center justify-center focus:outline-none cursor-default`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(r)}`,children:(0,L.jsx)(`span`,{className:`h-full w-full rounded-[3px] transition-colors ${hg(r,a)} ${o?`ring-1 ring-accent ring-offset-1 ring-offset-panel`:``}`})},e.day)})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 text-[9px] text-fg-faint`,children:[(0,L.jsx)(`span`,{children:`$0`}),[`bg-border/60`,`bg-accent/25`,`bg-accent/50`,`bg-accent/75`,`bg-accent`].map(e=>(0,L.jsx)(`span`,{className:`h-2 w-2 rounded-[2px] ${e}`,"aria-hidden":!0},e)),(0,L.jsx)(`span`,{className:`num`,children:S(a)})]})]})}var _g=e=>e===1?`day`:`days`;function vg({summary:e,plan:t,days:n}){if(!e)return null;let r=e.cost_usd;if(!t?.plan_kind)return(0,L.jsx)(R,{title:`Plan value`,children:(0,L.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted`,children:`Set your plan in the header and Caprock will show what this usage is worth against what you actually pay. It can't detect your plan, so it won't guess.`})});if(t.plan_kind===`metered`)return(0,L.jsx)(R,{title:`Spend`,right:(0,L.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label||`API`,` · billed per token`]}),children:(0,L.jsxs)(`div`,{className:`px-3 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num text-3xl text-fg`,children:S(r)}),(0,L.jsxs)(`span`,{className:`text-[12px] text-fg-muted`,children:[`over the last `,n,` `,_g(n)]})]}),(0,L.jsxs)(`p`,{className:`text-[11px] text-fg-faint mt-2 max-w-[60ch]`,children:[`You are billed per token, so this is approximately your actual cost — at Anthropic list prices (`,e.pricing_version,`). Not a saving.`]})]})});let i=t.plan_usd_per_month*n/30,a=i>0?r/i:0;return(0,L.jsxs)(R,{title:`Plan value`,right:(0,L.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label,` · `,S(t.plan_usd_per_month),`/mo`]}),children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 divide-y sm:divide-y-0 sm:divide-x divide-border`,children:[(0,L.jsx)(z,{label:`you pay · ${n}d`,value:S(i),sub:t.plan_label}),(0,L.jsx)(z,{label:`same usage at API list`,value:S(r),sub:`at list prices ${e.pricing_version}`,tone:`ok`}),(0,L.jsx)(z,{label:`which is`,value:a>0?`${a.toFixed(1)}×`:`—`,sub:a>0?`what ${n} ${_g(n)} would cost through the API`:`not enough measured usage yet`,tone:a>0?`ok`:void 0,size:`hero`})]}),(0,L.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] text-fg-faint leading-relaxed`,children:`Not a discount you received, and not money back — without the plan you would not have run this much.`})]})}function yg({feature:e,title:t,children:n}){let[r,i]=(0,l.useState)(!1);return I(()=>P.premium(),[]).data?.license?.active?(0,L.jsx)(L.Fragment,{children:n}):(0,L.jsxs)(`div`,{className:`relative overflow-hidden rounded-[var(--radius-panel)] border border-border`,children:[(0,L.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none select-none opacity-90`,children:n}),(0,L.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2.5 px-4 text-center`,children:[(0,L.jsx)(`span`,{className:`rounded-sm bg-panel/95 px-3 py-1 text-[15px] font-medium text-fg shadow-[0_2px_12px_var(--color-bg)]`,children:t}),(0,L.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-premium px-3.5 py-1.5 text-[13px] font-medium text-white shadow-[0_2px_12px_var(--color-bg)] hover:brightness-110`,children:`Unlock with Premium`})]}),r&&(0,L.jsx)(tt,{feature:e,onClose:()=>i(!1)})]})}function bg({suggestion:e}){let t=I(()=>P.settings(),[],{live:!1}),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),p=t.data?.cap_usd_per_day;(0,l.useEffect)(()=>{d||p===void 0||(r(p?String(p):``),f(!0))},[p,d]);let m=t.data?.cap_usd_per_day??0,h=m>0,g=async e=>{a(!0),s(``),u(!1);try{await P.saveSettings({cap_usd_per_day:e}),r(e?String(e):``),u(!0),t.refresh()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},_=()=>{let e=n.trim().replace(/^\$/,``).replace(/,/g,``),t=Number(e);if(e===``||!Number.isFinite(t)||t<0){s(`A daily cap has to be a positive number of dollars.`);return}g(t)};return(0,L.jsx)(R,{title:`Daily spend cap`,right:(0,L.jsx)(`span`,{className:h?`text-premium-strong`:`text-fg-faint`,children:h?`on`:`off`}),children:(0,L.jsxs)(`div`,{className:`grid gap-2.5 px-3 py-3 text-[13px]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Stop the day at`}),(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`$`}),(0,L.jsx)(`input`,{className:`input w-28`,inputMode:`decimal`,placeholder:`0`,value:n,onChange:e=>{r(e.target.value),u(!1)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Daily spend cap in dollars`}),(0,L.jsx)(`button`,{onClick:_,disabled:i,className:`rounded-sm bg-premium px-3 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50`,children:i?`Saving…`:`Save`}),h&&(0,L.jsx)(`button`,{onClick:()=>void g(0),disabled:i,className:`text-[12px] text-fg-faint hover:text-fg`,children:`turn off`}),c&&!o&&(0,L.jsx)(`span`,{className:`text-[12px] text-fg-faint`,children:`saved`})]}),!h&&e?(0,L.jsxs)(`p`,{className:`text-[12px] text-fg-faint`,children:[`Your days run about `,S(e/2),`.`,` `,(0,L.jsxs)(`button`,{onClick:()=>void g(e),className:`text-premium-strong hover:underline`,children:[`Use `,S(e)]}),` `,`— twice that, so an ordinary day never trips it.`]}):null,o&&(0,L.jsx)(`p`,{className:`text-[12px] text-danger`,children:o}),(0,L.jsx)(`p`,{className:`border-t border-border pt-2 text-[12px] leading-relaxed text-fg-faint`,children:h?(0,L.jsxs)(L.Fragment,{children:[`When today crosses `,S(m),`, Caprock pauses the sessions it started — paused, not killed, so resuming keeps the conversation. Sessions you started yourself are never touched.`]}):(0,L.jsx)(L.Fragment,{children:`Off. Nothing is paused, whatever the day costs. Sessions you started yourself are never touched either way.`})})]})})}function xg(e){return e>=.01?`$${e.toFixed(2)}`:`${(e*100).toFixed(1)}\u00A2`}function Sg(){let e=I(()=>P.gemini(),[],{live:!1}),[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(``),f=e.data,p=!!f?.available,m=f!==void 0&&!f.available,h=async()=>{let e=t.trim();if(!(!e||s)){c(!0),d(``);try{o(await P.askGemini(e,r||void 0)),n(``)}catch(e){d(ae(e))}finally{c(!1)}}};return(0,L.jsx)(R,{title:`Ask Gemini`,right:(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:p?f?.model:`your key, your bill`}),children:m?(0,L.jsxs)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted grid gap-2.5`,children:[(0,L.jsxs)(`p`,{className:`m-0`,children:[`Caprock can ask Google's Gemini on your own key, and it never stores that key — it reads `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:f?.env_var??`GEMINI_API_KEY`}),` from the daemon's environment when you ask. Get a key from`,` `,(0,L.jsx)(`a`,{className:`link`,href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,children:`Google AI Studio`}),`, then put it where the daemon will see it.`]}),(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`p`,{className:`m-0 text-fg`,children:`If you start it yourself`}),(0,L.jsxs)(`p`,{className:`m-0 text-fg-faint`,children:[`Put the line in `,(0,L.jsx)(`span`,{className:`mono`,children:`~/.zshrc`}),` (or`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`~/.bashrc`}),`), open a new terminal, then restart the daemon. Exporting it in one window and starting Caprock in another will not work.`]}),(0,L.jsxs)(`code`,{className:`mono text-[11px] bg-panel-2 px-2 py-1.5 rounded-sm text-fg block overflow-x-auto`,children:[`export `,f?.env_var??`GEMINI_API_KEY`,`=AIza…`,` +`,`caprock down && caprock up`]})]}),(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`p`,{className:`m-0 text-fg`,children:`If it starts at login`}),(0,L.jsxs)(`p`,{className:`m-0 text-fg-faint`,children:[`A login agent does not read your shell profile, so the variable has to go in the agent itself — on macOS in`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`~/Library/LaunchAgents/dev.caprock.daemon.plist`}),` under`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`EnvironmentVariables`}),`, on Linux as an`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`Environment=`}),` line in the systemd user unit. Then`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`caprock service install`}),` again to reload it.`]})]}),(0,L.jsx)(`p`,{className:`m-0 text-fg-faint`,children:`You pay Google directly. Caprock only counts what it sent, which is not the same as what Google bills.`})]}):(0,L.jsxs)(`div`,{className:`px-3 py-3 grid gap-2`,children:[(0,L.jsx)(`textarea`,{className:`input min-h-[70px] resize-y`,placeholder:`Ask about your sessions, your spend, anything…`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&h()}}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,L.jsx)(`button`,{onClick:()=>void h(),disabled:s||!t.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25 disabled:opacity-50`,children:s?`asking…`:`Ask`}),(f?.models?.length??0)>0&&(0,L.jsx)(`select`,{className:`input w-auto text-[12px] py-1`,value:r||f?.model||``,onChange:e=>i(e.target.value),"aria-label":`Model`,children:f.models.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.display,` · ~`,xg(e.typical_usd),` a question`]},e.id))}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`⌘↵ to send`})]}),u&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:u}),(0,L.jsxs)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:[`Using the key in `,(0,L.jsx)(`span`,{className:`mono`,children:f?.env_var}),`. Caprock never stores it — Google bills you directly.`]}),a&&(0,L.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-2`,children:[(0,L.jsx)(`div`,{className:`text-[13px] whitespace-pre-wrap`,children:a.text}),(0,L.jsxs)(`div`,{className:`text-[11px] text-fg-faint num flex gap-3 flex-wrap`,children:[(0,L.jsx)(`span`,{children:a.model}),(0,L.jsxs)(`span`,{children:[`in `,C(a.usage.prompt_tokens)]}),(0,L.jsxs)(`span`,{children:[`out `,C(a.usage.output_tokens)]}),a.usage.thoughts_tokens>0&&(0,L.jsxs)(`span`,{title:`Google bills thinking tokens as output`,children:[`thinking `,C(a.usage.thoughts_tokens)]}),a.usage.cached_tokens>0&&(0,L.jsxs)(`span`,{children:[`cached `,C(a.usage.cached_tokens)]})]})]})]})})}function Cg(){let[e,t]=(0,l.useState)(`30d`),n=Date.now(),r=I(()=>P.summary(e),[e],{intervalMs:5e3}),i=I(()=>P.daily(30),[],{intervalMs:3e4}),[a]=Ee(),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`calendar`),d=r.data,f=!!d&&d.turns>0,p=wg(i.data??[]),m=Eg(p.map(e=>e.cost));return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,L.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,L.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[un(a),d?` (table ${d.pricing_version})`:``]})]}),r.error&&!d&&(0,L.jsx)(xt,{title:`Cannot reach the daemon`,children:r.error.message}),e!==`today`&&d&&(0,L.jsx)(En,{costUSD:p.reduce((e,t)=>e+t.cost,0),days:p.filter(e=>e.cost>0).length,now:n}),(0,L.jsx)(vg,{summary:d,plan:a,days:Tg(e,d?.from_ms)}),(0,L.jsxs)(R,{title:`Totals · ${e}`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,L.jsx)(z,{label:`Cost`,value:f?S(d.cost_usd):`—`,sub:(0,L.jsx)(`span`,{title:un(a),children:f?ln(a):`nothing measured in this range`}),tone:`info`,size:`hero`}),(0,L.jsx)(z,{label:`Burn now`,value:f?`${S(d.burn.usd_per_hour)}/h`:`—`,sub:f?`${C(Math.round(d.burn.tokens_per_min))} tok/min · ${d.sessions} sessions`:void 0}),(0,L.jsx)(z,{label:`Input`,value:f?C(d.tokens_in):`—`,sub:`fresh, full price`}),(0,L.jsx)(z,{label:`Output`,value:f?C(d.tokens_out):`—`,sub:f?`${d.turns} turns`:void 0}),(0,L.jsx)(z,{label:`Cache read`,value:f?C(d.cache_read):`—`,sub:f?(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,L.jsxs)(`span`,{children:[w(d.savings.hit_rate*100),` hit rate`]}),(()=>{let e=mn(d.savings.hit_rate*100);return e?(0,L.jsx)(`span`,{className:e.color||`text-fg-faint`,children:e.label}):null})()]}):void 0}),(0,L.jsx)(z,{label:`Cache write`,value:f?C(d.cache_write):`—`,sub:f?`${w(d.savings.cut_pct)} input cost cut by cache`:void 0})]}),(0,L.jsx)(Sr,{u:d?.unpriced,className:`mx-3 mb-2.5`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:[(0,L.jsxs)(R,{title:`Model mix`,right:(0,L.jsx)(`span`,{children:`by cost`}),children:[d?d.models.length===0&&(0,L.jsx)(xt,{title:`No priced turns in range`}):(0,L.jsx)(St,{rows:4}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:(d?.models??[]).map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 mono`,title:e.model||void 0,children:e.model?ne(e.model):`unknown`}),(0,L.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:(d?.unpriced?.models??[]).includes(e.model)?(0,L.jsx)(`span`,{className:`text-warn`,title:`this model is not in the pricing table, so its cost is unknown`,children:`unpriced`}):S(e.cost_usd)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0&&!(d.unpriced?.models??[]).includes(e.model)?w(100*e.cost_usd/d.cost_usd):`—`})]},e.model))})})]}),(0,L.jsx)(Et,{summary:d}),(0,L.jsxs)(R,{title:`Per project`,right:(0,L.jsx)(`span`,{children:`by cost`}),children:[d?d.projects.length===0&&(0,L.jsx)(xt,{title:`No priced turns in range`}):(0,L.jsx)(St,{rows:4}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:(d?.projects??[]).map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0?w(100*e.cost_usd/d.cost_usd):`—`})]},e.project))})})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:[(0,L.jsxs)(R,{className:`lg:col-span-2`,title:`Last 30 days`,right:(0,L.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(fg,{bars:p,active:o,total:p.reduce((e,t)=>e+t.cost,0)}),(0,L.jsx)(`span`,{className:`flex items-center gap-1`,children:[`calendar`,`bars`].map(e=>(0,L.jsx)(`button`,{onClick:()=>u(e),className:`px-1.5 py-0.5 rounded-sm text-[11px] ${c===e?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg`}`,children:e},e))})]}),children:[i.data?p.length===0&&(0,L.jsx)(xt,{title:`No history yet`}):(0,L.jsx)(St,{rows:2}),p.length>0&&(c===`calendar`?(0,L.jsx)(gg,{bars:p,active:o,onActive:s}):(0,L.jsx)(dg,{bars:p,active:o,onActive:s}))]}),(0,L.jsx)(yg,{feature:`cap`,title:`Stop the day at a number you choose`,children:(0,L.jsx)(bg,{suggestion:m})}),(0,L.jsx)(yg,{feature:`gemini`,title:`Ask a second model, on your own key`,children:(0,L.jsx)(Sg,{})}),d&&(0,L.jsxs)(R,{title:`Plan limits`,children:[d.rate_limits?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1`,children:[d.rate_limits.five_hour&&(0,L.jsx)(_n,{label:`5-hour window`,w:d.rate_limits.five_hour,now:n}),d.rate_limits.seven_day&&(0,L.jsx)(_n,{label:`7-day window`,w:d.rate_limits.seven_day,now:n})]}):(0,L.jsxs)(`div`,{className:`px-3 pt-1 text-sm text-fg-muted`,children:[`No window state yet. Caprock reads this from Claude Code's status line, so it appears once a Pro or Max session has run with `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:`caprock statusline`}),` registered —`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` caprock up`}),` offers to do that. API-billed usage has no windows to report.`]}),(0,L.jsx)(`div`,{className:`mt-2 px-3 pb-3 text-[11px] text-fg-faint leading-relaxed`,children:`Live from Claude Code's status line (Pro/Max). The percentage is your usage of the window; a forecast is shown only when your measured pace would reach the limit before the window resets.`})]})]}),(0,L.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[d&&d.throttles>0?`${d.throttles} rate-limit / overloaded event${d.throttles===1?``:`s`} observed in this range (from Claude Code's StopFailure hook).`:`No rate-limit events observed in this range.`,` `,`Everything here is measured — no invented numbers.`]})]})}function wg(e){let t=new Map;for(let n of e){let e=t.get(n.day)??{day:n.day,cost:0,tokens:0,sessions:0};e.cost+=n.cost_usd,e.tokens+=n.tokens_total,e.sessions+=n.sessions,t.set(n.day,e)}return[...t.values()].sort((e,t)=>e.day.localeCompare(t.day))}function Tg(e,t){switch(e){case`today`:return 1;case`7d`:return 7;case`30d`:return 30;default:return t?Math.max(1,Math.ceil((Date.now()-t)/864e5)):30}}function Eg(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length<3)return 0;let n=t[Math.floor(t.length/2)]*2,r=n<10?1:n<100?5:10;return Math.round(n/r)*r}function Dg({plan:e,save:t}){let[n,r]=(0,l.useState)(e.license_key??``),i=I(()=>P.premium(),[e.license_key]).data?.license;(0,l.useEffect)(()=>{r(e.license_key??``)},[e.license_key]);let a=n.trim()!==(e.license_key??``).trim();return(0,L.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`w-28 shrink-0 text-fg-muted`,children:`Licence`}),(0,L.jsx)(`input`,{className:`input flex-1 min-w-0`,placeholder:`CR-…`,spellCheck:!1,value:n,onChange:e=>r(e.target.value),onKeyDown:r=>{r.key===`Enter`&&a&&t({...e,license_key:n.trim()})}}),(0,L.jsx)(`button`,{disabled:!a,onClick:()=>t({...e,license_key:n.trim()}),className:`rounded-sm border border-border px-2 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg disabled:opacity-40`,children:`save`})]}),(0,L.jsxs)(`p`,{className:`mt-1.5 pl-[7.5rem] text-[11px] leading-relaxed`,children:[i?.active&&!i.in_grace&&(0,L.jsxs)(`span`,{className:`text-ok`,children:[`Premium is on`,i.expires_at?` — renews ${i.expires_at.slice(0,10)}`:``,`.`]}),i?.active&&i.in_grace&&(0,L.jsxs)(`span`,{className:`text-warn`,children:[i.reason,`. Update your key or payment method.`]}),i&&!i.active&&(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[e.license_key?i.reason:`No key — the free product is unaffected.`,` `,(0,L.jsx)(`a`,{href:`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`link`,children:`what Premium does`})]}),(0,L.jsx)(`span`,{className:`block text-fg-faint`,children:`Checked on this machine against the date inside the key. Caprock makes no call to us to verify it.`})]})]})}function Og(){let e=I(()=>P.status(),[],{live:!1,intervalMs:5e3}),t=e.data;if(e.error&&!t)return(0,L.jsx)(xt,{title:`Cannot reach the daemon`,children:e.error.message});if(!t)return(0,L.jsx)(`div`,{className:`text-fg-muted`,children:`loading…`});let n=[[`version`,t.version],[`url`,t.url],[`pid`,String(t.pid)],[`uptime`,ee(t.uptime_s*1e3)],[`data dir`,t.data_dir],[`pricing`,`${t.pricing.version} · ${t.pricing.models} models · fetched ${t.pricing.fetched_at}${t.pricing.user_override?` · user override`:``}`],[`pricing source`,t.pricing.source],[`loop rule`,`≥ ${t.loop_k} same-tool calls in ${t.loop_t_minutes} min · ${t.active_loops} active`],[`events stored`,`${t.events.toLocaleString()}${t.retention_days>0?` · pruned after ${t.retention_days}d`:` · kept forever (set retention_days to cap DB growth)`}`],[`orchestration`,t.orchestration?`on (--hive)`:`off`],[`claude`,t.claude_available?`found on PATH — Caprock can start sessions for you`:`not found on PATH — Caprock cannot start sessions, but still observes every session you start yourself`],[`dashboard`,t.ui_built?`embedded build`:`dev server / placeholder`]];if(t.hooks&&n.push([`hooks`,`${(t.hooks.installed??[]).length}/${(t.hooks.installed??[]).length+(t.hooks.missing??[]).length} events registered in ${t.hooks.settings_path}${t.hooks.shim_exists?``:` (shim missing)`}`]),t.desktop){let e=t.desktop;n.push([`claude desktop`,`${e.five_hour_pct}% of the 5-hour window · ${e.seven_day_pct}% of the 7-day${e.stale?` · last seen `+new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})+`, app closed since`:` · now`}`])}return t.ingest_error&&n.push([`ingest error`,`STOPPED: ${t.ingest_error} — nothing is being captured`]),t.ingest&&n.push([`ingest`,`${t.ingest.files_known} transcripts · ${t.ingest.events_stored} events stored · ${t.ingest.events_deduped} deduped · ${t.ingest.lines_malformed} malformed lines · backfill ${t.ingest.backfill_done?`done`:`running`}`]),(0,L.jsxs)(`div`,{className:`grid gap-3 max-w-3xl`,children:[(0,L.jsx)(kg,{}),(0,L.jsx)(R,{title:`Daemon`,children:(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:n.map(([e,t])=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:e}),(0,L.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:t})]},e))})})}),t.ingest_error&&(0,L.jsx)(R,{title:`Ingest stopped`,children:(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`No new sessions are being captured: `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:t.ingest_error}),`. Check that`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})}),!t.claude_available&&(0,L.jsx)(R,{title:`claude not found`,children:(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`The `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself. Install Claude Code, or make sure`,(0,L.jsx)(`span`,{className:`mono`,children:` claude`}),` is on the PATH the daemon was started with.`]})}),t.hooks&&(t.hooks.missing??[]).length>0&&(0,L.jsx)(R,{title:`Hooks not fully installed`,children:(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`Missing: `,(0,L.jsx)(`span`,{className:`mono`,children:(t.hooks.missing??[]).join(`, `)}),`. Run `,(0,L.jsx)(`span`,{className:`mono`,children:`caprock hooks install`}),` for real-time activity; transcript tailing keeps working with a few seconds of delay.`]})})]})}function kg(){let[e,t]=Ee();return e?(0,L.jsx)(R,{title:`Settings`,children:(0,L.jsxs)(`div`,{className:`grid gap-2 px-3 py-2.5 text-[12px]`,children:[(0,L.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)] mt-0.5`,checked:e.update_checks,onChange:n=>t({...e,update_checks:n.target.checked})}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`text-fg`,children:`Check GitHub for new releases`}),(0,L.jsx)(`span`,{className:`block text-[11px] text-fg-muted`,children:`The only outbound call Caprock makes. No usage data is sent, and it is checked at most once a day.`})]})]}),(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 border-t border-border pt-2`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted w-28 shrink-0`,children:`Your plan`}),(0,L.jsx)(`span`,{className:`mono text-fg`,children:e.plan_kind===`metered`?`${e.plan_label||`API`} · billed per token`:e.plan_kind===`flat`?`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`not set`}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint ml-auto`,children:`change it in the header`})]}),(0,L.jsx)(Dg,{plan:e,save:t})]})}):null}function Ag(){let e=I(()=>P.settings(),[],{live:!1}),t=re(3e4),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(``),h=e.data;(0,l.useEffect)(()=>{o||h===void 0||(a(h.report_chat_id??``),s(!0))},[h,o]);let g=async()=>{u(!0),m(``);try{await P.saveSettings({report_chat_id:i.trim(),...n.trim()?{report_bot_token:n.trim()}:{}}),r(``),f(!0),e.refresh?.()}catch(e){m(ae(e))}finally{u(!1)}},_=!!h?.report_bot_set&&!!h?.report_chat_id;return(0,L.jsx)(R,{title:`Weekly report`,right:(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:_?`Mondays, or the next day you open the lid`:`not set up`}),children:(0,L.jsxs)(`div`,{className:`px-3 py-3 grid gap-3 text-[12px]`,children:[(0,L.jsx)(`p`,{className:`m-0 text-fg-muted`,children:`What moved this week, against your usual — sent to a Telegram bot you own. Nothing passes our server, and the message carries figures only: no prompts, no replies, no file names.`}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`Bot token`,h?.report_bot_set&&(0,L.jsx)(`span`,{className:`text-ok`,children:` · one is stored`})]}),(0,L.jsx)(`input`,{className:`input`,type:`password`,placeholder:h?.report_bot_set?`leave blank to keep the current one`:`123456:ABC-DEF…`,value:n,onChange:e=>r(e.target.value)}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Message `,(0,L.jsx)(`span`,{className:`mono`,children:`@BotFather`}),` on Telegram, send`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`/newbot`}),`, and paste what it gives you. Caprock stores it on this machine and never sends it back to this page.`]})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Chat id`}),(0,L.jsx)(`input`,{className:`input`,placeholder:`123456789`,value:i,onChange:e=>a(e.target.value)}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Write to your bot once, then open`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`api.telegram.org/bot/getUpdates`}),` and copy`,` `,(0,L.jsx)(`span`,{className:`mono`,children:`chat.id`}),`.`]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,L.jsx)(`button`,{onClick:()=>void g(),disabled:c||!i.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`saving…`:`Save`}),d&&!p&&(0,L.jsx)(`span`,{className:`text-[11px] text-ok`,children:`saved`}),p&&(0,L.jsx)(`span`,{className:`text-[11px] text-danger`,children:p})]}),h?.report_last_error?(0,L.jsxs)(`p`,{className:`m-0 text-[11px] text-danger`,children:[`Last send failed: `,h.report_last_error]}):h?.report_last_sent_ms?(0,L.jsxs)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:[`Last sent `,T(h.report_last_sent_ms,t),` ago.`]}):_?(0,L.jsx)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:`Nothing sent yet — the first one goes out at the start of next week.`}):null]})})}function jg(){let[e,t]=(0,l.useState)(`all`),[n,r]=(0,l.useState)(null),i=I(()=>P.history(e),[e],{intervalMs:15e3}),[a]=Ee(),o=i.data,s=!!o&&o.totals.turns>0,c=wg(o?.daily??[]),u=Math.max(...(o?.tools??[]).map(e=>e.count),1);return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,L.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,L.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Everything you ever ran through Caprock. Measured, not estimated.`})]}),s&&o&&(0,L.jsx)(En,{costUSD:o.totals.cost_usd,days:o.totals.days,now:Date.now()}),i.error&&!o&&(0,L.jsx)(xt,{title:`Cannot reach the daemon`,children:i.error.message}),(0,L.jsxs)(R,{title:`Lifetime · ${e}`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 divide-x divide-border`,children:[(0,L.jsx)(z,{size:`compact`,label:`Sessions`,value:s?o.totals.sessions:`—`,sub:s?`${o.totals.owned_sessions} spawned by caprock`:void 0}),(0,L.jsx)(z,{size:`compact`,label:`Active days`,value:s?o.totals.days:`—`}),(0,L.jsx)(z,{size:`compact`,label:`Turns`,value:s?C(o.totals.turns):`—`,sub:s?`${C(o.totals.tool_calls)} tool calls`:void 0}),(0,L.jsx)(z,{size:`compact`,label:`Files touched`,value:s?C(o.totals.files_touched):`—`,sub:`summed per session`}),(0,L.jsx)(z,{size:`compact`,label:`Avg session span`,value:s?ee(Math.round(o.totals.avg_session_sec*1e3)):`—`,sub:`first to last event`}),(0,L.jsx)(hn,{hitRate:o?.savings.hit_rate,cutPct:o?.savings.cut_pct,measured:s}),(0,L.jsx)(z,{label:`Cost`,value:s?S(o.totals.cost_usd):`—`,sub:(0,L.jsx)(`span`,{title:un(a),children:s?ln(a):`nothing measured yet`}),tone:`info`,size:`hero`})]}),(0,L.jsx)(Sr,{u:o?.totals.unpriced,className:`mx-3 mb-2.5`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,L.jsxs)(R,{title:`Tool usage`,right:(0,L.jsx)(`span`,{children:`by calls`}),children:[o?o.tools.length===0&&(0,L.jsx)(xt,{title:`No tool calls yet`}):(0,L.jsx)(St,{rows:5}),(0,L.jsx)(`ul`,{className:`py-1`,children:(o?.tools??[]).slice(0,18).map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-[3px]`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] w-44 shrink-0 truncate`,title:e.tool,children:te(e.tool)}),(0,L.jsx)(`div`,{className:`flex-1 h-2 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${100*e.count/u}%`}})}),(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-muted w-12 text-right`,children:C(e.count)})]},e.tool))})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,L.jsxs)(R,{title:`Model mix`,right:(0,L.jsx)(`span`,{children:`by cost`}),children:[o?o.summary.models.length===0&&(0,L.jsx)(xt,{title:`No priced turns`}):(0,L.jsx)(St,{rows:3}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:(o?.summary.models??[]).map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 mono`,children:e.model||`unknown`}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.model))})})]}),(0,L.jsx)(yg,{feature:`report`,title:`Get this every Monday, without opening the dashboard`,children:(0,L.jsx)(Ag,{})}),(0,L.jsx)(R,{title:`Top projects`,right:(0,L.jsx)(`span`,{children:`by cost`}),children:(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:(o?.summary.projects??[]).slice(0,8).map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.project))})})})]})]}),(0,L.jsxs)(R,{title:`Daily cost`,right:(0,L.jsx)(fg,{bars:c,active:n,total:c.reduce((e,t)=>e+t.cost,0)}),children:[i.data?c.length===0&&(0,L.jsx)(xt,{title:`No history yet`}):(0,L.jsx)(St,{rows:2}),c.length>0&&(0,L.jsx)(dg,{bars:c,active:n,onActive:r,height:96,showDayLabels:!1})]})]})}var Mg=[{key:`inbox`,label:`Inbox`},{key:`assigned`,label:`Assigned`},{key:`in_progress`,label:`In progress`},{key:`verifying`,label:`Verifying`},{key:`needs_you`,label:`Needs you`},{key:`done`,label:`Done`}];function Ng(){let e=I(()=>P.status(),[],{live:!1,intervalMs:3e4}),t=I(()=>P.tasks(),[],{intervalMs:4e3}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);if(e.data&&e.data.orchestration===!1)return(0,L.jsx)(Pg,{status:e.data,onEnabled:()=>{e.refresh(),t.refresh()}});let o=e=>(t.data??[]).filter(t=>t.status===e||e===`done`&&t.status===`failed`);return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm text-[12px] hover:bg-accent/20`,children:`+ New task`}),(0,L.jsx)(Lg,{available:e.data?.claude_available??!1}),(t.data??[]).some(e=>e.assignee!==``&&e.status!==`done`&&e.status!==`failed`)&&(0,L.jsx)(`a`,{href:`#/graph`,className:`link text-[12px] border border-border px-2 py-1 rounded-sm hover:border-border-strong`,children:`view graph`}),(0,L.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[`Tasks are files on disk (`,(0,L.jsx)(`span`,{className:`mono`,children:`tasks/.md`}),`); the orchestrator moves them. Nothing reaches Done until its `,(0,L.jsx)(`span`,{className:`mono`,children:`done_criteria`}),` pass.`]})]}),t.error&&!t.data&&(0,L.jsx)(xt,{title:`Cannot reach the daemon`,children:t.error.message}),t.data&&t.data.length===0&&(0,L.jsxs)(`div`,{className:`border border-border bg-panel-2/60 rounded-sm px-3 py-2 text-[12px] text-fg-muted`,children:[`Start here: `,(0,L.jsx)(`span`,{className:`text-fg`,children:`+ New task`}),` — a title and the commands that have to pass. Then `,(0,L.jsx)(`span`,{className:`text-fg`,children:`▶ Start orchestrator`}),`, which assigns it to a worker and keeps going until the checks are green.`]}),(0,L.jsx)(`div`,{className:`grid gap-2 grid-cols-2 md:grid-cols-3 xl:grid-cols-6`,children:Mg.map(e=>(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.08em] text-fg-faint mb-1.5 px-0.5 flex justify-between`,children:[(0,L.jsx)(`span`,{children:e.label}),(0,L.jsx)(`span`,{className:`num`,children:o(e.key).length})]}),(0,L.jsx)(`div`,{className:`grid gap-1.5 content-start min-h-[60px]`,children:o(e.key).map(e=>(0,L.jsx)(Rg,{t:e,onApprove:()=>t.refresh(),onOpen:()=>a(e.id)},e.id))})]},e.key))}),n&&(0,L.jsx)(Ug,{onClose:()=>{r(!1),t.refresh()}}),i&&(0,L.jsx)(zg,{id:i,onClose:()=>{a(null),t.refresh()}})]})}function Pg({status:e,onEnabled:t}){let[n,r]=(0,l.useState)(!1),i=e.suggested_hive??`~/caprock-tasks`,a=e.suggested_repo??``;return(0,L.jsxs)(`div`,{className:`grid gap-3 max-w-[52rem] mx-auto`,children:[(0,L.jsxs)(R,{title:`Task runner`,right:(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`off`}),children:[(0,L.jsxs)(`div`,{className:`grid gap-3 px-3 py-3`,children:[(0,L.jsxs)(`ol`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,L.jsx)(Fg,{n:1,title:`You write a task`,children:`A title, a budget, and the commands that have to pass.`}),(0,L.jsxs)(Fg,{n:2,title:`Caprock runs it`,children:[`One Claude session per task, in its `,(0,L.jsx)(`span`,{className:`text-fg`,children:`own git worktree`}),` — your working tree is untouched.`]}),(0,L.jsxs)(Fg,{n:3,title:`Caprock checks it`,children:[(0,L.jsx)(`span`,{className:`text-fg`,children:`Caprock`}),` runs your commands, not the agent. Only green is done.`]})]}),(0,L.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Best for independent tasks — nothing here merges branches. The queue directory is created for you; your repository is not modified.`})]}),(0,L.jsxs)(`footer`,{className:`px-3 py-2 border-t border-border flex items-center gap-2`,children:[(0,L.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25`,children:`Turn on the task runner`}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`No restart. Nothing runs until you start it.`})]})]}),n&&(0,L.jsx)(Ig,{hive:i,repo:a,onClose:()=>r(!1),onDone:t})]})}function Fg({n:e,title:t,children:n}){return(0,L.jsxs)(`li`,{className:`border border-border bg-panel-2/60 rounded-sm px-2.5 py-2 grid gap-1 content-start`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,L.jsx)(`span`,{className:`num text-[11px] text-accent`,children:e}),(0,L.jsx)(`span`,{className:`text-[12px] font-medium`,children:t})]}),(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted leading-[1.45]`,children:n})]})}function Ig({hive:e,repo:t,onClose:n,onDone:r}){let[i,a]=(0,l.useState)(e),[o,s]=(0,l.useState)(t),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``);return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:n,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Turn on the task runner`}),(0,L.jsx)(`button`,{onClick:n,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,L.jsxs)(`ul`,{className:`grid gap-1 text-[12px] text-fg-muted`,children:[(0,L.jsx)(`li`,{children:`· Creates the queue directory below, with a README and an example task.`}),(0,L.jsxs)(`li`,{children:[`· Lets Caprock spawn Claude sessions `,(0,L.jsx)(`span`,{className:`text-fg`,children:`with permission prompts skipped`}),`, one git worktree each under the repo below.`]}),(0,L.jsx)(`li`,{children:`· Starts nothing yet — you start the orchestrator, and only then does work begin.`})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Queue directory`,(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` · created if missing`})]}),(0,L.jsx)(`input`,{className:`input mono`,value:i,onChange:e=>a(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Repository`,(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` · workers branch from here`})]}),(0,L.jsx)(`input`,{className:`input mono`,value:o,onChange:e=>s(e.target.value)})]}),d&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:d})]}),(0,L.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,L.jsx)(`button`,{onClick:n,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,L.jsx)(`button`,{onClick:async()=>{u(!0),f(``);try{await P.enableHive(i.trim(),o.trim()),n(),r()}catch(e){f(ae(e))}finally{u(!1)}},disabled:c,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`turning on…`:`Turn it on`})]})]})})}function Lg({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(`button`,{disabled:t||!e,onClick:async()=>{n(!0),i(``);try{let e=await P.startOrchestrator();i(`orchestrator: `+e.session_id.slice(0,8))}catch(e){i(ae(e))}finally{n(!1)}},title:e?`spawn the orchestrator session`:`claude not found — cannot spawn`,className:`border border-border text-fg-muted px-2 py-1 rounded-sm text-[12px] hover:text-fg disabled:opacity-50`,children:t?`starting…`:`▶ Start orchestrator`}),!e&&(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` was not found on this machine, so Caprock cannot spawn the orchestrator. It still observes every session you start yourself.`]}),r&&(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint mono`,children:r})]})}function Rg({t:e,onApprove:t,onOpen:n}){let r=e.budget_usd>0&&e.cost_usd>e.budget_usd,i=e.assignee!==``;return(0,L.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] px-2 py-1.5`,children:[(0,L.jsxs)(`button`,{className:`w-full text-left disabled:cursor-default`,disabled:!i,onClick:n,title:i?`show the diff, the checks that ran, and where the branch is`:`nothing to show yet — no worker has picked this up`,children:[(0,L.jsx)(`div`,{className:`text-[12px] font-medium truncate ${i?`hover:text-accent`:``}`,title:e.title,children:e.title||e.id}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[10px] text-fg-faint`,children:[(0,L.jsx)(`span`,{className:`mono`,children:E(e.id)}),e.assignee&&(0,L.jsxs)(`span`,{className:`mono text-fg-muted`,children:[`→ `,e.assignee]}),(0,L.jsxs)(`span`,{className:`num ml-auto ${r?`text-danger`:`text-fg-muted`}`,children:[S(e.cost_usd),e.budget_usd>0?` / ${S(e.budget_usd)}`:``]})]})]}),i&&(0,L.jsxs)(`div`,{className:`mt-1 text-[10px] text-fg-faint mono truncate`,children:[`caprock/`,e.assignee]}),e.status===`needs_you`&&(0,L.jsxs)(`div`,{className:`flex gap-1 mt-1.5`,children:[(0,L.jsx)(`button`,{onClick:()=>P.approve(e.id,!0).then(t),className:`flex-1 text-[11px] border border-ok/40 text-ok rounded-sm hover:bg-ok/10`,children:`approve`}),(0,L.jsx)(`button`,{onClick:()=>P.approve(e.id,!1).then(t),className:`flex-1 text-[11px] border border-danger/40 text-danger rounded-sm hover:bg-danger/10`,children:`reject`})]})]})}function zg({id:e,onClose:t}){let n=I(()=>P.task(e),[e],{intervalMs:6e3}),r=n.data,i=r?.work,a=i?.sessions?.[0];return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-16`,onClick:t,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[820px] max-w-[94vw] max-h-[82vh] overflow-auto`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center gap-2 sticky top-0 bg-panel z-10`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Task`}),r&&(0,L.jsx)(`span`,{className:`text-[12px] truncate`,children:r.task.title||r.task.id}),r&&(0,L.jsx)(`span`,{className:`mono text-[10px] text-fg-faint`,children:r.task.status}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),!r&&!n.error&&(0,L.jsx)(St,{rows:5}),n.error&&!r&&(0,L.jsx)(xt,{title:`Cannot load the task`,children:n.error.message}),r&&(0,L.jsxs)(`div`,{className:`px-3 py-3 grid gap-3`,children:[(0,L.jsx)(Bg,{work:i,assignee:r.task.assignee}),(0,L.jsx)(Vg,{criteria:r.done_criteria,runs:i?.verifications,status:r.task.status}),(0,L.jsx)(Hg,{sessionID:a?.session_id,assignee:r.task.assignee}),r.body&&(0,L.jsx)(R,{title:`Brief`,children:(0,L.jsx)(`pre`,{className:`mono text-[11px] leading-[1.45] px-3 py-2 whitespace-pre-wrap`,children:r.body})})]})]})})}function Bg({work:e,assignee:t}){return e?.branch?(0,L.jsx)(R,{title:`Where the work is`,children:(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsxs)(`tbody`,{children:[(0,L.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`branch`}),(0,L.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.branch})]}),e.worktree&&(0,L.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`worktree`}),(0,L.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.worktree})]}),(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32 align-top`,children:`take it`}),(0,L.jsxs)(`td`,{className:`px-3 py-1 grid gap-1 justify-items-start`,children:[(0,L.jsx)(Ct,{command:`git merge --no-ff ${e.branch}`}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Run it from `,e.repo?(0,L.jsx)(`span`,{className:`mono`,children:e.repo}):`your repo`,`, on the branch you want the work on. Prefer `,(0,L.jsx)(`span`,{className:`mono`,children:`git cherry-pick`}),` if you only want some of it. Worker`,` `,(0,L.jsx)(`span`,{className:`mono`,children:t}),` may still be running — check the diff below first.`]})]})]})]})})}):(0,L.jsx)(R,{title:`Where the work is`,children:(0,L.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:`No worker has been assigned yet, so there is no branch. One is created the moment the orchestrator assigns this task.`})})}function Vg({criteria:e,runs:t,status:n}){let r=t?.[0],i=r?t.filter(e=>e.round===r.round):[],a=r?`round ${r.round}`:void 0;return(0,L.jsxs)(R,{title:`What has to pass`,right:a,children:[i.length===0&&(0,L.jsxs)(`div`,{className:`px-3 py-2 grid gap-1`,children:[(0,L.jsx)(`div`,{className:`text-[12px] text-fg-faint`,children:n===`done`?`This task was marked done without a recorded check.`:`Not run yet. Caprock runs these itself, in the worker’s worktree, when the worker reports it has finished.`}),(0,L.jsx)(`ul`,{className:`grid gap-0.5`,children:(e??[]).map(e=>(0,L.jsxs)(`li`,{className:`mono text-[11px] text-fg-muted`,children:[`$ `,e]},e))}),(e??[]).length===0&&(0,L.jsx)(`div`,{className:`mono text-[11px] text-danger`,children:`no done_criteria — Caprock cannot verify this task`})]}),i.length>0&&(0,L.jsx)(`ul`,{children:i.map(e=>(0,L.jsxs)(`li`,{className:`border-b border-border/60 last:border-0 px-3 py-1.5 flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-[10px] w-14 shrink-0 mono ${e.exit_code===0?`text-ok`:`text-danger`}`,children:e.exit_code===0?`passed`:`exit ${e.exit_code}`}),(0,L.jsx)(`span`,{className:`mono text-[12px] truncate`,title:e.command,children:e.command})]},e.command))})]})}function Hg({sessionID:e,assignee:t}){let n=I(()=>e?P.diff(e):Promise.resolve(void 0),[e],{intervalMs:8e3}),[r,i]=(0,l.useState)(null);if(!e)return(0,L.jsx)(R,{title:`What changed`,children:(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`No session has been attributed to this task yet`,t?` (worker ${t})`:``,`, so there is nothing to diff.`]})});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let t=e.body;return(0,L.jsx)(R,{title:`What changed`,children:(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[t?.error,t?.cwd?(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`span`,{className:`mono`,children:t.cwd})]}):null]})})}return(0,L.jsx)(R,{title:`What changed`,children:(0,L.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:e.message})})}let a=n.data;return a?(0,L.jsxs)(R,{title:`What changed`,right:(0,L.jsxs)(`span`,{className:`num`,children:[a.files.length,` files`]}),children:[a.files.length===0&&(0,L.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`Nothing uncommitted in `,(0,L.jsx)(`span`,{className:`mono`,children:a.branch||`the worktree`}),`. If the worker committed its work, the branch above holds it.`]}),(0,L.jsx)(`ul`,{children:a.files.map(e=>(0,L.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>i(r===e.path?null:e.path),children:[(0,L.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,L.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,L.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,L.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,L.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),r===e.path&&e.patch&&(0,L.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[40vh]`,children:e.patch.split(` +`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,L.jsx)(`div`,{className:n,children:e||` `},t)})}),r===e.path&&!e.patch&&(0,L.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path))})]}):(0,L.jsx)(R,{title:`What changed`,children:(0,L.jsx)(St,{rows:3})})}function Ug({onClose:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`3`),[a,o]=(0,l.useState)(`go test ./... go vet ./...`),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),m=a.split(` -`).map(e=>e.trim()).filter(Boolean);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:e,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New task`}),(0,I.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Title`}),(0,I.jsx)(`input`,{autoFocus:!0,className:`input`,value:t,onChange:e=>n(e.target.value),placeholder:`Add /healthz endpoint`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Budget (USD)`}),(0,I.jsx)(`input`,{className:`input`,value:r,onChange:e=>i(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Done criteria · one command per line`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:a,onChange:e=>o(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Description`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:s,onChange:e=>c(e.target.value)})]}),f&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:f})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:e,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{if(!t.trim()){p(`Title is required.`);return}if(m.length===0){p(`At least one done criterion is required — it is what decides when the task is done.`);return}d(!0),p(``);try{await N.createTask({title:t.trim(),budget_usd:parseFloat(r)||0,done_criteria:m,body:s}),e()}catch(e){p(oe(e))}finally{d(!1)}},disabled:u,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:u?`creating…`:`Create task`})]})]})})}var Wg=72,Gg=38,Kg=.62;function qg(e){return{cx:e.width/2,cy:e.height/2,r:Math.max(80,Math.min(e.width,e.height)/2-Wg-Gg),nodeR:Gg,gateT:Kg}}function Jg(e){return Math.max(e,6)}function Yg(e,t){return-Math.PI/2+2*Math.PI*e/t}function Xg(e,t,n){let r=Jg(e.length),i=[];return e.forEach((e,a)=>{if(!t.has(e))return;let o=Yg(a,r);i.push({id:e,angle:o,x:n.cx+n.r*Math.cos(o),y:n.cy+n.r*Math.sin(o)})}),i}function Zg(e,t,n){return{x:t.cx+(e.x-t.cx)*n,y:t.cy+(e.y-t.cy)*n}}var Qg={assigned:.18,in_progress:.45,verifying:Kg,done:.85,needs_you:.5,failed:.5,inbox:.08};function $g(e){return Qg[e]??.3}function e_(e){return e!==``&&e!==`orchestrator`&&e!==`verifier`}function t_(e,t){let n=e.registry.slice(),r=new Set(e.workers);e_(t.assignee)&&!n.includes(t.assignee)&&(n.push(t.assignee),n.sort()),e_(t.assignee)&&r.add(t.assignee);let i=new Map(e.tasks);return i.set(t.id,t),{registry:n,workers:r,tasks:i}}function n_(){return{registry:[],workers:new Set,tasks:new Map}}function r_(e,t=[]){let n={registry:t.slice(),workers:new Set,tasks:new Map};for(let t of e)n=t_(n,{id:t.id,title:t.title,assignee:t.assignee,status:t.status});return n}function i_(e){return{id:e.id,title:e.title,assignee:e.assignee,status:e.status}}function a_(){let e=F(()=>N.tasks(),[],{intervalMs:8e3}),t=(0,l.useRef)([]),[n,r]=(0,l.useState)(n_);return(0,l.useEffect)(()=>{if(!e.data)return;let n=r_(e.data,t.current);t.current=n.registry,r(n)},[e.data]),(0,l.useEffect)(()=>d.onFrame(e=>{e.type===`task`&&r(n=>{let r=t_(n,i_(e.data));return t.current=r.registry,r})}),[]),n}function o_(e){return e.workers.size>0||e.tasks.size>0}function s_(e){let t=new Map;for(let n of e.tasks.values()){if(!e_(n.assignee))continue;let e=t.get(n.assignee)??[];e.push(n),t.set(n.assignee,e)}return t}var c_=260;function l_(e,t,n,r=c_){let i=e+(t-e)*(1-Math.exp(-n/r));return Math.abs(t-i)<.001?t:i}function u_(e){let t=0,n=performance.now(),r=i=>{let a=Math.min(i-n,64);n=i,e(a),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),{stop:()=>cancelAnimationFrame(t)}}var d_=class{cur=new Map;setTarget(e,t){this.cur.has(e)||this.cur.set(e,t),this.targets.set(e,t)}targets=new Map;step(e,t){let n=!1;for(let r of Array.from(this.cur.keys())){if(!t.has(r)){this.cur.delete(r),this.targets.delete(r);continue}let i=this.targets.get(r)??this.cur.get(r),a=l_(this.cur.get(r),i,e);a!==this.cur.get(r)&&(n=!0),this.cur.set(r,a)}return n}get(e){return this.cur.get(e)}};function f_(e){let t=(0,l.useRef)(new d_),[,n]=(0,l.useState)(0),r=new Set(e.tasks.keys());for(let n of e.tasks.values())t.current.setTarget(n.id,$g(n.status));return(0,l.useEffect)(()=>{let e=u_(e=>{t.current.step(e,r)&&n(e=>e+1)});return()=>e.stop()},[]),(e,n)=>t.current.get(e)??$g(n)}function p_(e){switch(e){case`done`:return`var(--color-ok)`;case`needs_you`:return`var(--color-warn)`;case`failed`:return`var(--color-danger)`;case`verifying`:case`in_progress`:case`assigned`:return`var(--color-accent)`;default:return`var(--color-fg-muted)`}}function m_(e){return e.some(e=>e.status!==`done`&&e.status!==`failed`)}function h_({model:e,viewport:t,centerLabel:n=`orchestrator`}){let r=qg(t),i=Xg(e.registry,e.workers,r),a=s_(e),o=f_(e);return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`orchestration graph`,children:[i.map(e=>(0,I.jsx)(v_,{node:e,g:r,gateStatus:__(a.get(e.id)??[])},`spoke-${e.id}`)),i.map(e=>(a.get(e.id)??[]).map((t,n)=>{let i=Zg(e,r,o(t.id,t.status)),s=(n-(a.get(e.id).length-1)/2)*12,c=-(e.y-r.cy),l=e.x-r.cx,u=Math.hypot(c,l)||1;return(0,I.jsx)(g_,{task:t,cx:i.x+c/u*s,cy:i.y+l/u*s},`task-${t.id}`)})),i.map(e=>{let t=a.get(e.id)??[],n=m_(t),i=e.x>=r.cx?1:-1,o=i===1?`start`:`end`,s=i*(r.nodeR+10),c=t.find(e=>e.status!==`done`&&e.status!==`failed`)??t[0];return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:n?`graph-breathe`:void 0,r:r.nodeR,fill:`var(--color-panel)`,stroke:n?`var(--color-accent)`:`var(--color-border-strong)`,strokeWidth:n?2.5:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`13`,fill:`var(--color-fg)`,className:`mono`,children:x_(e.id)}),c&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`text`,{x:s,y:-4,textAnchor:o,fontSize:`12`,fill:`var(--color-fg)`,children:b_(c.title,26)}),(0,I.jsx)(`text`,{x:s,y:12,textAnchor:o,fontSize:`11`,fill:p_(c.status),className:`mono`,children:y_(c.status)})]})]},`node-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${r.cx},${r.cy})`,children:[(0,I.jsx)(`circle`,{r:r.nodeR+6,fill:`var(--color-panel-2)`,stroke:`var(--color-accent)`,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`12`,fill:`var(--color-fg)`,className:`mono`,children:n===`orchestrator`?`orch`:n})]})]})}function g_({task:e,cx:t,cy:n}){let r=(0,l.useRef)(e.status),[i,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(r.current!==`done`&&e.status===`done`){a(!0);let t=setTimeout(()=>a(!1),600);return r.current=e.status,()=>clearTimeout(t)}r.current=e.status},[e.status]),(0,I.jsx)(`circle`,{className:`graph-dot${i?` graph-verified`:``}`,cx:t,cy:n,r:8,fill:p_(e.status),children:(0,I.jsx)(`title`,{children:`${e.title} · ${e.status}`})})}function __(e){return e.some(e=>e.status===`done`)?`done`:e.some(e=>e.status===`verifying`)?`verifying`:`idle`}function v_({node:e,g:t,gateStatus:n}){let r=Zg(e,t,t.gateT),i=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-bg)`,a=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-border-strong)`;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`line`,{x1:t.cx,y1:t.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5}),(0,I.jsx)(`rect`,{className:`graph-gate`,x:r.x-7,y:r.y-7,width:14,height:14,transform:`rotate(45 ${r.x} ${r.y})`,fill:i,stroke:a,strokeWidth:1.5,children:(0,I.jsx)(`title`,{children:`verify gate — a task turns green only after its tests pass`})})]})}function y_(e){switch(e){case`assigned`:return`assigned`;case`in_progress`:return`working…`;case`verifying`:return`running tests…`;case`done`:return`✓ verified`;case`needs_you`:return`needs you`;case`failed`:return`failed`;default:return e}}function b_(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}function x_(e){let t=/^worker-(\d+)$/.exec(e);return t?`w${t[1]}`:e===`verifier`?`vfy`:e.slice(0,4)}function S_(e){switch(e){case`working`:return`var(--color-ok)`;case`waiting-on-you`:return`var(--color-warn)`;case`looping`:case`error`:return`var(--color-danger)`;case`ended`:return`var(--color-fg-faint)`;default:return`var(--color-fg-muted)`}}function C_({sessions:e,viewport:t}){let n=qg(t),r=e.map(e=>e.id).sort(),i=Xg(r,new Set(r),n),a=new Map(e.map(e=>[e.id,e]));return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`session graph`,children:[i.map(e=>(0,I.jsx)(`line`,{x1:n.cx,y1:n.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5},`edge-${e.id}`)),i.map(e=>{let t=a.get(e.id),r=S_(t.health);return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:t.health===`working`?`graph-breathe`:void 0,r:n.nodeR,fill:`var(--color-panel)`,stroke:r,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`9`,fill:`var(--color-fg-muted)`,className:`mono`,children:t.label}),(0,I.jsx)(`title`,{children:`${t.label} · ${t.health}`})]},`sess-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${n.cx},${n.cy})`,children:[(0,I.jsx)(`circle`,{r:n.nodeR+4,fill:`var(--color-panel-2)`,stroke:`var(--color-border-strong)`,strokeWidth:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`10`,fill:`var(--color-fg-muted)`,className:`mono`,children:`caprock`})]})]})}function w_(){let e=a_(),t=F(()=>N.sessions(!0),[],{intervalMs:4e3}),n=(0,l.useRef)(null),[r,i]=(0,l.useState)({width:900,height:560});(0,l.useEffect)(()=>{if(!n.current)return;let e=n.current,t=new ResizeObserver(()=>{i({width:e.clientWidth,height:Math.max(420,e.clientHeight)})});return t.observe(e),i({width:e.clientWidth,height:Math.max(420,e.clientHeight)}),()=>t.disconnect()},[]);let a=o_(e),o=(t.data??[]).filter(e=>e.status!==`ended`).map(e=>({id:e.session_id,label:T(e.session_id),health:e.activity.health})),s=Array.from(e.tasks.values()),c=s.filter(e=>e.status===`done`).length,u=s.filter(e=>[`assigned`,`in_progress`,`verifying`].includes(e.status)).length;return(0,I.jsxs)(`div`,{className:`grid gap-2`,children:[a&&(0,I.jsxs)(`div`,{className:`flex items-baseline gap-6 border border-border bg-panel rounded-[var(--radius-panel)] px-4 py-3`,children:[(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-ok`,children:c}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`verified — tests passed, not just claimed`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-accent`,children:u}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`in flight`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-fg`,children:e.workers.size}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`workers`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-faint px-0.5`,children:[(0,I.jsx)(T_,{orchestration:a}),(0,I.jsx)(`span`,{className:`ml-auto`,children:a?`live · the orchestrator assigns work; a task turns green only after its tests pass`:(0,I.jsxs)(I.Fragment,{children:[`your live sessions — start an orchestrator with `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`caprock up --hive `}),` to see the verified team`]})})]}),(0,I.jsx)(`div`,{ref:n,className:`relative w-full h-[70vh] rounded-[var(--radius-panel)] border border-border bg-panel/40 overflow-hidden`,children:a?(0,I.jsx)(h_,{model:e,viewport:r}):(0,I.jsx)(C_,{sessions:o,viewport:r})})]})}function T_({orchestration:e}){let t=(e,t)=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),t]});return(0,I.jsx)(`span`,{className:`inline-flex items-center gap-3`,children:e?(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-accent)`,`in flight`),t(`var(--color-ok)`,`verified`),t(`var(--color-warn)`,`needs you`),t(`var(--color-danger)`,`failed`)]}):(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-ok)`,`working`),t(`var(--color-warn)`,`waiting on you`),t(`var(--color-danger)`,`loop / error`),t(`var(--color-fg-muted)`,`idle`)]})})}var E_=200;function D_(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),i=ie(3e4),[a,o]=(0,l.useState)(!1),s=F(()=>N.searchNotes(n,E_),[n],{live:!1,intervalMs:0}),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u([]),m(!1)},[n]);let h=[...s.data??[],...c];async function g(){let e=h[h.length-1];if(!(!e||d)){f(!0);try{let t=await N.searchNotes(n,E_,e.event_id);t.length===0?m(!0):u(e=>[...e,...t])}catch{m(!0)}finally{f(!1)}}}let _=a||n?h:h.filter(e=>!e.fragment),v=h.length-_.length;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e.trim())},children:[(0,I.jsx)(`input`,{className:`input max-w-[520px]`,value:e,onChange:e=>t(e.target.value),placeholder:`Search what Claude told you — a name, an error, a decision…`,"aria-label":`Search Claude's answers`}),(0,I.jsx)(`button`,{type:`submit`,className:`text-[12px] border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm hover:bg-accent/20`,children:`search`}),n&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>{t(``),r(``)},children:`clear`}),v>0&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>o(e=>!e),children:a?`hide short remarks`:`+${v} short remarks`}),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Claude's written answers, across every session. Local only.`})]}),s.error&&!s.data&&(0,I.jsx)(z,{title:`Cannot search`,children:s.error.message}),!s.data&&!s.error&&(0,I.jsx)(St,{rows:5,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),s.data&&_.length===0&&(0,I.jsx)(z,{title:n?`Nothing found for "${n}"`:`No answers captured yet`,children:n?`Try a shorter phrase — this matches the words Claude wrote, not what you asked.`:`Run a session and Claude’s written answers will be searchable here.`}),_.length>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint px-0.5`,children:[_.length,` `,_.length===1?`answer`:`answers`,n?` matching "${n}"`:` · most recent`,` · subagent chatter excluded`]}),(0,I.jsx)(`div`,{className:`grid gap-2`,children:_.map(e=>(0,I.jsx)(Ur,{note:e,now:i,showSession:!0},e.event_id))}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-0.5`,children:[!p&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-1 rounded-sm`,onClick:()=>void g(),disabled:d,children:d?`loading…`:`load older answers`}),p&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`that is everything`})]})]})]})}function O_(){let e=_();return(0,I.jsx)(dt,{route:e,children:(0,I.jsxs)(_t,{label:e.name,children:[e.name===`now`&&(0,I.jsx)(Ir,{}),e.name===`session`&&(0,I.jsx)(eg,{id:e.id,tab:e.tab,at:e.at},e.id),e.name===`cost`&&(0,I.jsx)(Cg,{}),e.name===`settings`&&(0,I.jsx)(Og,{}),e.name===`history`&&(0,I.jsx)(jg,{}),e.name===`tasks`&&(0,I.jsx)(Ng,{}),e.name===`graph`&&(0,I.jsx)(w_,{}),e.name===`notes`&&(0,I.jsx)(D_,{})]})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,I.jsx)(l.StrictMode,{children:(0,I.jsx)(O_,{})})); \ No newline at end of file +`).map(e=>e.trim()).filter(Boolean);return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:e,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New task`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Title`}),(0,L.jsx)(`input`,{autoFocus:!0,className:`input`,value:t,onChange:e=>n(e.target.value),placeholder:`Add /healthz endpoint`})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Budget (USD)`}),(0,L.jsx)(`input`,{className:`input`,value:r,onChange:e=>i(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Done criteria · one command per line`}),(0,L.jsx)(`textarea`,{className:`input`,rows:3,value:a,onChange:e=>o(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`grid gap-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Description`}),(0,L.jsx)(`textarea`,{className:`input`,rows:3,value:s,onChange:e=>c(e.target.value)})]}),f&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:f})]}),(0,L.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,L.jsx)(`button`,{onClick:e,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,L.jsx)(`button`,{onClick:async()=>{if(!t.trim()){p(`Title is required.`);return}if(m.length===0){p(`At least one done criterion is required — it is what decides when the task is done.`);return}d(!0),p(``);try{await P.createTask({title:t.trim(),budget_usd:parseFloat(r)||0,done_criteria:m,body:s}),e()}catch(e){p(ae(e))}finally{d(!1)}},disabled:u,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:u?`creating…`:`Create task`})]})]})})}var Wg=72,Gg=38,Kg=.62;function qg(e){return{cx:e.width/2,cy:e.height/2,r:Math.max(80,Math.min(e.width,e.height)/2-Wg-Gg),nodeR:Gg,gateT:Kg}}function Jg(e){return Math.max(e,6)}function Yg(e,t){return-Math.PI/2+2*Math.PI*e/t}function Xg(e,t,n){let r=Jg(e.length),i=[];return e.forEach((e,a)=>{if(!t.has(e))return;let o=Yg(a,r);i.push({id:e,angle:o,x:n.cx+n.r*Math.cos(o),y:n.cy+n.r*Math.sin(o)})}),i}function Zg(e,t,n){return{x:t.cx+(e.x-t.cx)*n,y:t.cy+(e.y-t.cy)*n}}var Qg={assigned:.18,in_progress:.45,verifying:Kg,done:.85,needs_you:.5,failed:.5,inbox:.08};function $g(e){return Qg[e]??.3}function e_(e){return e!==``&&e!==`orchestrator`&&e!==`verifier`}function t_(e,t){let n=e.registry.slice(),r=new Set(e.workers);e_(t.assignee)&&!n.includes(t.assignee)&&(n.push(t.assignee),n.sort()),e_(t.assignee)&&r.add(t.assignee);let i=new Map(e.tasks);return i.set(t.id,t),{registry:n,workers:r,tasks:i}}function n_(){return{registry:[],workers:new Set,tasks:new Map}}function r_(e,t=[]){let n={registry:t.slice(),workers:new Set,tasks:new Map};for(let t of e)n=t_(n,{id:t.id,title:t.title,assignee:t.assignee,status:t.status});return n}function i_(e){return{id:e.id,title:e.title,assignee:e.assignee,status:e.status}}function a_(){let e=I(()=>P.tasks(),[],{intervalMs:8e3}),t=(0,l.useRef)([]),[n,r]=(0,l.useState)(n_);return(0,l.useEffect)(()=>{if(!e.data)return;let n=r_(e.data,t.current);t.current=n.registry,r(n)},[e.data]),(0,l.useEffect)(()=>d.onFrame(e=>{e.type===`task`&&r(n=>{let r=t_(n,i_(e.data));return t.current=r.registry,r})}),[]),n}function o_(e){return e.workers.size>0||e.tasks.size>0}function s_(e){let t=new Map;for(let n of e.tasks.values()){if(!e_(n.assignee))continue;let e=t.get(n.assignee)??[];e.push(n),t.set(n.assignee,e)}return t}var c_=260;function l_(e,t,n,r=c_){let i=e+(t-e)*(1-Math.exp(-n/r));return Math.abs(t-i)<.001?t:i}function u_(e){let t=0,n=performance.now(),r=i=>{let a=Math.min(i-n,64);n=i,e(a),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),{stop:()=>cancelAnimationFrame(t)}}var d_=class{cur=new Map;setTarget(e,t){this.cur.has(e)||this.cur.set(e,t),this.targets.set(e,t)}targets=new Map;step(e,t){let n=!1;for(let r of Array.from(this.cur.keys())){if(!t.has(r)){this.cur.delete(r),this.targets.delete(r);continue}let i=this.targets.get(r)??this.cur.get(r),a=l_(this.cur.get(r),i,e);a!==this.cur.get(r)&&(n=!0),this.cur.set(r,a)}return n}get(e){return this.cur.get(e)}};function f_(e){let t=(0,l.useRef)(new d_),[,n]=(0,l.useState)(0),r=new Set(e.tasks.keys());for(let n of e.tasks.values())t.current.setTarget(n.id,$g(n.status));return(0,l.useEffect)(()=>{let e=u_(e=>{t.current.step(e,r)&&n(e=>e+1)});return()=>e.stop()},[]),(e,n)=>t.current.get(e)??$g(n)}function p_(e){switch(e){case`done`:return`var(--color-ok)`;case`needs_you`:return`var(--color-warn)`;case`failed`:return`var(--color-danger)`;case`verifying`:case`in_progress`:case`assigned`:return`var(--color-accent)`;default:return`var(--color-fg-muted)`}}function m_(e){return e.some(e=>e.status!==`done`&&e.status!==`failed`)}function h_({model:e,viewport:t,centerLabel:n=`orchestrator`}){let r=qg(t),i=Xg(e.registry,e.workers,r),a=s_(e),o=f_(e);return(0,L.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`orchestration graph`,children:[i.map(e=>(0,L.jsx)(v_,{node:e,g:r,gateStatus:__(a.get(e.id)??[])},`spoke-${e.id}`)),i.map(e=>(a.get(e.id)??[]).map((t,n)=>{let i=Zg(e,r,o(t.id,t.status)),s=(n-(a.get(e.id).length-1)/2)*12,c=-(e.y-r.cy),l=e.x-r.cx,u=Math.hypot(c,l)||1;return(0,L.jsx)(g_,{task:t,cx:i.x+c/u*s,cy:i.y+l/u*s},`task-${t.id}`)})),i.map(e=>{let t=a.get(e.id)??[],n=m_(t),i=e.x>=r.cx?1:-1,o=i===1?`start`:`end`,s=i*(r.nodeR+10),c=t.find(e=>e.status!==`done`&&e.status!==`failed`)??t[0];return(0,L.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,L.jsx)(`circle`,{className:n?`graph-breathe`:void 0,r:r.nodeR,fill:`var(--color-panel)`,stroke:n?`var(--color-accent)`:`var(--color-border-strong)`,strokeWidth:n?2.5:1.5}),(0,L.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`13`,fill:`var(--color-fg)`,className:`mono`,children:x_(e.id)}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`text`,{x:s,y:-4,textAnchor:o,fontSize:`12`,fill:`var(--color-fg)`,children:b_(c.title,26)}),(0,L.jsx)(`text`,{x:s,y:12,textAnchor:o,fontSize:`11`,fill:p_(c.status),className:`mono`,children:y_(c.status)})]})]},`node-${e.id}`)}),(0,L.jsxs)(`g`,{transform:`translate(${r.cx},${r.cy})`,children:[(0,L.jsx)(`circle`,{r:r.nodeR+6,fill:`var(--color-panel-2)`,stroke:`var(--color-accent)`,strokeWidth:2}),(0,L.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`12`,fill:`var(--color-fg)`,className:`mono`,children:n===`orchestrator`?`orch`:n})]})]})}function g_({task:e,cx:t,cy:n}){let r=(0,l.useRef)(e.status),[i,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(r.current!==`done`&&e.status===`done`){a(!0);let t=setTimeout(()=>a(!1),600);return r.current=e.status,()=>clearTimeout(t)}r.current=e.status},[e.status]),(0,L.jsx)(`circle`,{className:`graph-dot${i?` graph-verified`:``}`,cx:t,cy:n,r:8,fill:p_(e.status),children:(0,L.jsx)(`title`,{children:`${e.title} · ${e.status}`})})}function __(e){return e.some(e=>e.status===`done`)?`done`:e.some(e=>e.status===`verifying`)?`verifying`:`idle`}function v_({node:e,g:t,gateStatus:n}){let r=Zg(e,t,t.gateT),i=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-bg)`,a=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-border-strong)`;return(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`line`,{x1:t.cx,y1:t.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5}),(0,L.jsx)(`rect`,{className:`graph-gate`,x:r.x-7,y:r.y-7,width:14,height:14,transform:`rotate(45 ${r.x} ${r.y})`,fill:i,stroke:a,strokeWidth:1.5,children:(0,L.jsx)(`title`,{children:`verify gate — a task turns green only after its tests pass`})})]})}function y_(e){switch(e){case`assigned`:return`assigned`;case`in_progress`:return`working…`;case`verifying`:return`running tests…`;case`done`:return`✓ verified`;case`needs_you`:return`needs you`;case`failed`:return`failed`;default:return e}}function b_(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}function x_(e){let t=/^worker-(\d+)$/.exec(e);return t?`w${t[1]}`:e===`verifier`?`vfy`:e.slice(0,4)}function S_(e){switch(e){case`working`:return`var(--color-ok)`;case`waiting-on-you`:return`var(--color-warn)`;case`looping`:case`error`:return`var(--color-danger)`;case`ended`:return`var(--color-fg-faint)`;default:return`var(--color-fg-muted)`}}function C_({sessions:e,viewport:t}){let n=qg(t),r=e.map(e=>e.id).sort(),i=Xg(r,new Set(r),n),a=new Map(e.map(e=>[e.id,e]));return(0,L.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`session graph`,children:[i.map(e=>(0,L.jsx)(`line`,{x1:n.cx,y1:n.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5},`edge-${e.id}`)),i.map(e=>{let t=a.get(e.id),r=S_(t.health);return(0,L.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,L.jsx)(`circle`,{className:t.health===`working`?`graph-breathe`:void 0,r:n.nodeR,fill:`var(--color-panel)`,stroke:r,strokeWidth:2}),(0,L.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`9`,fill:`var(--color-fg-muted)`,className:`mono`,children:t.label}),(0,L.jsx)(`title`,{children:`${t.label} · ${t.health}`})]},`sess-${e.id}`)}),(0,L.jsxs)(`g`,{transform:`translate(${n.cx},${n.cy})`,children:[(0,L.jsx)(`circle`,{r:n.nodeR+4,fill:`var(--color-panel-2)`,stroke:`var(--color-border-strong)`,strokeWidth:1.5}),(0,L.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`10`,fill:`var(--color-fg-muted)`,className:`mono`,children:`caprock`})]})]})}function w_(){let e=a_(),t=I(()=>P.sessions(!0),[],{intervalMs:4e3}),n=(0,l.useRef)(null),[r,i]=(0,l.useState)({width:900,height:560});(0,l.useEffect)(()=>{if(!n.current)return;let e=n.current,t=new ResizeObserver(()=>{i({width:e.clientWidth,height:Math.max(420,e.clientHeight)})});return t.observe(e),i({width:e.clientWidth,height:Math.max(420,e.clientHeight)}),()=>t.disconnect()},[]);let a=o_(e),o=(t.data??[]).filter(e=>e.status!==`ended`).map(e=>({id:e.session_id,label:E(e.session_id),health:e.activity.health})),s=Array.from(e.tasks.values()),c=s.filter(e=>e.status===`done`).length,u=s.filter(e=>[`assigned`,`in_progress`,`verifying`].includes(e.status)).length;return(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[a&&(0,L.jsxs)(`div`,{className:`flex items-baseline gap-6 border border-border bg-panel rounded-[var(--radius-panel)] px-4 py-3`,children:[(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num text-2xl text-ok`,children:c}),(0,L.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`verified — tests passed, not just claimed`})]}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num text-2xl text-accent`,children:u}),(0,L.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`in flight`})]}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num text-2xl text-fg`,children:e.workers.size}),(0,L.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`workers`})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsx)(T_,{orchestration:a}),(0,L.jsx)(`span`,{className:`ml-auto`,children:a?`live · the orchestrator assigns work; a task turns green only after its tests pass`:(0,L.jsxs)(L.Fragment,{children:[`your live sessions — start an orchestrator with `,(0,L.jsx)(`span`,{className:`mono text-fg-muted`,children:`caprock up --hive `}),` to see the verified team`]})})]}),(0,L.jsx)(`div`,{ref:n,className:`relative w-full h-[70vh] rounded-[var(--radius-panel)] border border-border bg-panel/40 overflow-hidden`,children:a?(0,L.jsx)(h_,{model:e,viewport:r}):(0,L.jsx)(C_,{sessions:o,viewport:r})})]})}function T_({orchestration:e}){let t=(e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),t]});return(0,L.jsx)(`span`,{className:`inline-flex items-center gap-3`,children:e?(0,L.jsxs)(L.Fragment,{children:[t(`var(--color-accent)`,`in flight`),t(`var(--color-ok)`,`verified`),t(`var(--color-warn)`,`needs you`),t(`var(--color-danger)`,`failed`)]}):(0,L.jsxs)(L.Fragment,{children:[t(`var(--color-ok)`,`working`),t(`var(--color-warn)`,`waiting on you`),t(`var(--color-danger)`,`loop / error`),t(`var(--color-fg-muted)`,`idle`)]})})}var E_=200;function D_(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),i=re(3e4),[a,o]=(0,l.useState)(!1),s=I(()=>P.searchNotes(n,E_),[n],{live:!1,intervalMs:0}),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u([]),m(!1)},[n]);let h=[...s.data??[],...c];async function g(){let e=h[h.length-1];if(!(!e||d)){f(!0);try{let t=await P.searchNotes(n,E_,e.event_id);t.length===0?m(!0):u(e=>[...e,...t])}catch{m(!0)}finally{f(!1)}}}let _=a||n?h:h.filter(e=>!e.fragment),v=h.length-_.length;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e.trim())},children:[(0,L.jsx)(`input`,{className:`input max-w-[520px]`,value:e,onChange:e=>t(e.target.value),placeholder:`Search what Claude told you — a name, an error, a decision…`,"aria-label":`Search Claude's answers`}),(0,L.jsx)(`button`,{type:`submit`,className:`text-[12px] border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm hover:bg-accent/20`,children:`search`}),n&&(0,L.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>{t(``),r(``)},children:`clear`}),v>0&&(0,L.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>o(e=>!e),children:a?`hide short remarks`:`+${v} short remarks`}),(0,L.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Claude's written answers, across every session. Local only.`})]}),s.error&&!s.data&&(0,L.jsx)(xt,{title:`Cannot search`,children:s.error.message}),!s.data&&!s.error&&(0,L.jsx)(St,{rows:5,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),s.data&&_.length===0&&(0,L.jsx)(xt,{title:n?`Nothing found for "${n}"`:`No answers captured yet`,children:n?`Try a shorter phrase — this matches the words Claude wrote, not what you asked.`:`Run a session and Claude’s written answers will be searchable here.`}),_.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-[11px] text-fg-faint px-0.5`,children:[_.length,` `,_.length===1?`answer`:`answers`,n?` matching "${n}"`:` · most recent`,` · subagent chatter excluded`]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:_.map(e=>(0,L.jsx)(Ur,{note:e,now:i,showSession:!0},e.event_id))}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 px-0.5`,children:[!p&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-1 rounded-sm`,onClick:()=>void g(),disabled:d,children:d?`loading…`:`load older answers`}),p&&(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`that is everything`})]})]})]})}function O_(){let e=_();return(0,L.jsx)(ut,{route:e,children:(0,L.jsxs)(gt,{label:e.name,children:[e.name===`now`&&(0,L.jsx)(Ir,{}),e.name===`session`&&(0,L.jsx)(eg,{id:e.id,tab:e.tab,at:e.at},e.id),e.name===`cost`&&(0,L.jsx)(Cg,{}),e.name===`settings`&&(0,L.jsx)(Og,{}),e.name===`history`&&(0,L.jsx)(jg,{}),e.name===`tasks`&&(0,L.jsx)(Ng,{}),e.name===`graph`&&(0,L.jsx)(w_,{}),e.name===`notes`&&(0,L.jsx)(D_,{})]})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(l.StrictMode,{children:(0,L.jsx)(O_,{})})); \ No newline at end of file diff --git a/internal/api/dist/index.html b/internal/api/dist/index.html index 0feaa44..eaf4091 100644 --- a/internal/api/dist/index.html +++ b/internal/api/dist/index.html @@ -20,8 +20,8 @@ } catch (e) {} })(); - - + +
diff --git a/internal/api/gemini_test.go b/internal/api/gemini_test.go index 5674c87..f6f4e41 100644 --- a/internal/api/gemini_test.go +++ b/internal/api/gemini_test.go @@ -168,3 +168,38 @@ func TestEmptyPromptIsRefusedBeforeTheNetwork(t *testing.T) { t.Error("an empty prompt reached the client") } } + +// The bot token is the first write-only field in this API. GET /v1/settings is +// read on every settings render and by `caprock report`, so a credential must +// not ride along on either — what comes back is whether one is set. +func TestBotTokenIsWriteOnly(t *testing.T) { + e := newGeminiEnv(t) + + cur := e.settings.Get() + cur.ReportBotToken = "123456:SECRET-BOT-TOKEN" + cur.ReportChatID = "-1009999" + if err := e.settings.Set(cur); err != nil { + t.Fatal(err) + } + + res, err := http.Get(e.srv.URL + "/v1/settings") + if err != nil { + t.Fatal(err) + } + defer res.Body.Close() + var raw bytes.Buffer + _, _ = raw.ReadFrom(res.Body) + + if bytes.Contains(raw.Bytes(), []byte("SECRET-BOT-TOKEN")) { + t.Fatalf("GET /v1/settings returned the bot token:\n%s", raw.String()) + } + var out map[string]any + _ = json.Unmarshal(raw.Bytes(), &out) + // What a screen needs instead: that one is set, and where messages go. + if out["report_bot_set"] != true { + t.Errorf("report_bot_set should be true with a token stored: %v", out) + } + if out["report_chat_id"] != "-1009999" { + t.Errorf("the chat id is not a credential and should round-trip: %v", out["report_chat_id"]) + } +} diff --git a/internal/config/config.go b/internal/config/config.go index 798cf2d..bad12da 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -69,6 +69,17 @@ type Config struct { // default: a threshold nobody chose would eventually stop work for a // reason its owner could not explain. See internal/cap. CapUSDPerDay float64 `json:"cap_usd_per_day,omitempty"` + // ReportBotToken and ReportChatID configure the weekly report's delivery to + // the user's own Telegram bot. + // + // The token is stored here, unlike the Gemini key, and ADR-024 is where + // that difference is argued: a bot token drives a bot the user made for + // this, with no billing attached, while an AI Studio key spends money. + // Putting it in the environment instead would mean editing a launchd plist + // to turn on a feature sold as two minutes of setup. The file is 0600 + // inside a 0700 data dir, and the token is never returned over HTTP. + ReportBotToken string `json:"report_bot_token,omitempty"` + ReportChatID string `json:"report_chat_id,omitempty"` // BrowseRoot is where the folder picker may look. Empty means $HOME. BrowseRoot string `json:"browse_root,omitempty"` } diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index b0e6760..4362b64 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -85,15 +85,19 @@ type Daemon struct { bus *bus.Bus table *cost.Table rec *rollup.Recorder - det *loop.Detector - tail *ingest.Tailer - ocIn *opencode.Ingester - mgr *agents.Manager - board *board.Board - orch *orchestrator.Orchestrator - api *api.Server - rt config.Runtime - start time.Time + // report holds the weekly report's last outcome, so a message that never + // arrived can be explained on the settings screen instead of being an + // absence nobody notices. + report reportState + det *loop.Detector + tail *ingest.Tailer + ocIn *opencode.Ingester + mgr *agents.Manager + board *board.Board + orch *orchestrator.Orchestrator + api *api.Server + rt config.Runtime + start time.Time // cap is the daily spend guard. Nil until run() builds it, because it needs // the owned-session manager. @@ -384,6 +388,7 @@ func (d *Daemon) run(ctx context.Context) error { }() } go d.sweep(ctx) + go d.weeklyLoop(ctx) go d.backfillToolLinks(ctx) if d.config().RetentionDays > 0 { go d.pruneLoop(ctx) @@ -863,6 +868,13 @@ func (a *settingsAdapter) Get() api.Settings { LicenseKey: c.LicenseKey, CapUSDPerDay: c.CapUSDPerDay, BrowseRoot: c.BrowseRoot, + ReportChatID: c.ReportChatID, + // The token itself never crosses this boundary — only whether one + // exists, which is what a screen needs to render a state. + ReportBotSet: c.ReportBotToken != "", + ReportBotToken: c.ReportBotToken, + ReportLastError: a.d.reportLastError(), + ReportLastSentMs: a.d.reportLastSent(), } } @@ -882,6 +894,8 @@ func (a *settingsAdapter) Set(in api.Settings) error { capChanged := in.CapUSDPerDay != a.d.opt.Config.CapUSDPerDay a.d.opt.Config.CapUSDPerDay = in.CapUSDPerDay a.d.opt.Config.BrowseRoot = strings.TrimSpace(in.BrowseRoot) + a.d.opt.Config.ReportBotToken = strings.TrimSpace(in.ReportBotToken) + a.d.opt.Config.ReportChatID = strings.TrimSpace(in.ReportChatID) cfg := a.d.opt.Config a.d.cfgMu.Unlock() if capChanged && a.d.cap != nil { diff --git a/internal/daemon/weekly.go b/internal/daemon/weekly.go new file mode 100644 index 0000000..3c0b715 --- /dev/null +++ b/internal/daemon/weekly.go @@ -0,0 +1,162 @@ +package daemon + +import ( + "context" + "fmt" + "strings" + "sync" + "time" + + "github.com/dspv/caprock/internal/license" + "github.com/dspv/caprock/internal/store" + "github.com/dspv/caprock/internal/weekly" +) + +// reportHour is when a week's report is sent, local time. Monday morning, but +// see weeklyLoop: this is a "not before" rather than an appointment. +const reportHour = 9 + +// weeklyCheck is how often the daemon asks whether a report is due. Hourly +// rather than weekly on purpose — see weeklyLoop. +const weeklyCheck = time.Hour + +// reportState is the small bit of mutable state the feature needs: the last +// failure, so a message that never arrived can be explained on screen, and the +// last success, so the panel can say when. +type reportState struct { + mu sync.RWMutex + lastErr string + lastSent int64 +} + +func (d *Daemon) reportLastError() string { + d.report.mu.RLock() + defer d.report.mu.RUnlock() + return d.report.lastErr +} + +func (d *Daemon) reportLastSent() int64 { + d.report.mu.RLock() + defer d.report.mu.RUnlock() + return d.report.lastSent +} + +// weeklyLoop sends the report when a week has gone by, not when a timer fires. +// +// A ticker set for Monday 09:00 sends to nobody: the laptop is closed at the +// weekend, macOS does not fire missed ticks on wake, and the next tick is a +// week later. So this asks a question instead — is the ISO week of the last +// report we sent behind the current one, and is it past the send hour — and +// answers it every hour. A machine opened on Wednesday gets Monday's report on +// Wednesday, labelled with the week it covers, which is the honest outcome. +// +// The marker is in the store rather than in memory, or a restart would send a +// second copy. +func (d *Daemon) weeklyLoop(ctx context.Context) { + t := time.NewTicker(weeklyCheck) + defer t.Stop() + d.weeklyOnce(ctx) + for { + select { + case <-ctx.Done(): + return + case <-t.C: + d.weeklyOnce(ctx) + } + } +} + +func (d *Daemon) weeklyOnce(ctx context.Context) { + cfg := d.config() + // No bot, no feature: this is the opt-in, and with nothing configured + // there is no timer to disable and nothing that could be sent. + if strings.TrimSpace(cfg.ReportBotToken) == "" || strings.TrimSpace(cfg.ReportChatID) == "" { + return + } + // Paid, and checked here rather than only in the UI: this reaches the + // network on a schedule, which is the boundary ADR-023 drew for + // server-side gates. + if !license.Parse(cfg.LicenseKey, time.Now()).Active { + return + } + + now := time.Now() + week := isoWeek(now) + sent, _ := d.store.GetMeta(ctx, store.MetaReportWeek) + if sent == week { + return // already sent for this week + } + // Before the send hour on Monday, there is nothing to report yet: the week + // only just started. After it, or any later day, send. + if now.Weekday() == time.Monday && now.Hour() < reportHour { + return + } + + rep, err := d.buildWeekly(ctx, now) + if err != nil { + d.log.Warn("weekly report: could not build", "component", "report", "err", err) + return + } + + // The marker is written BEFORE the send, so a failing network cannot make + // the daemon retry every hour and eventually deliver five copies. A missed + // week is a smaller harm than a phone buzzing all afternoon, and the error + // is surfaced on the settings screen either way. + if err := d.store.SetMeta(ctx, store.MetaReportWeek, week); err != nil { + d.log.Warn("weekly report: could not record the week", "component", "report", "err", err) + return + } + + msg := weekly.Message(rep, d.reportBasis()) + sender := &weekly.Sender{} + err = sender.Send(ctx, cfg.ReportBotToken, cfg.ReportChatID, msg) + + d.report.mu.Lock() + if err != nil { + d.report.lastErr = err.Error() + d.log.Warn("weekly report: send failed", "component", "report", "err", err) + } else { + d.report.lastErr = "" + d.report.lastSent = time.Now().UnixMilli() + d.log.Info("weekly report sent", "component", "report", "week", week) + } + d.report.mu.Unlock() +} + +// buildWeekly reads the daily rollups the report is computed from. +// +// daily_stats is already keyed (day, project, model), which is exactly the +// grain this needs, and reading it costs a fraction of scanning events — the +// same reason History uses it. +func (d *Daemon) buildWeekly(ctx context.Context, now time.Time) (weekly.Report, error) { + loc := d.location() + end := startOfDay(now, loc) + // Enough history for the week plus its baseline. + from := end.AddDate(0, 0, -7*(weekly.BaselineWeeks+1)) + + rows, err := store.Daily(ctx, d.store.DB(), from.Format("2006-01-02")) + if err != nil { + return weekly.Report{}, err + } + days := make([]weekly.Day, 0, len(rows)) + for _, r := range rows { + days = append(days, weekly.Day{ + Day: r.Day, Project: r.Project, Model: r.Model, + CostUSD: r.CostUSD, Tokens: r.TokensTotal, + }) + } + return weekly.Build(days, end), nil +} + +// reportBasis is the caveat that travels with the figures, in the message +// itself rather than only on a screen the reader is not looking at (rule 6). +func (d *Daemon) reportBasis() string { + return "At API list prices — what your tokens would cost, not a bill." +} + +// isoWeek is the marker's format: "2026-W36". ISO rather than "week of the +// year" because ISO weeks start on Monday, which is when the report is for. +func isoWeek(t time.Time) string { + y, w := t.ISOWeek() + return fmt.Sprintf("%d-W%02d", y, w) +} diff --git a/internal/daemon/weekly_test.go b/internal/daemon/weekly_test.go new file mode 100644 index 0000000..fea2f64 --- /dev/null +++ b/internal/daemon/weekly_test.go @@ -0,0 +1,61 @@ +package daemon + +import ( + "context" + "testing" + "time" + + "github.com/dspv/caprock/internal/store" +) + +// The marker is what stops a restart from sending a second copy of a message +// somebody already got on their phone. cap.Guard keeps its equivalent in +// memory and re-fires after a restart, which is tolerable for a cap and not +// for this. +func TestTheSentWeekIsRemembered(t *testing.T) { + ctx := context.Background() + st := memStore(t) + + week := isoWeek(time.Date(2026, 9, 7, 10, 0, 0, 0, time.UTC)) + if err := st.SetMeta(ctx, store.MetaReportWeek, week); err != nil { + t.Fatal(err) + } + got, err := st.GetMeta(ctx, store.MetaReportWeek) + if err != nil || got != week { + t.Fatalf("marker did not survive: %q %v", got, err) + } +} + +// A laptop closed on Friday and opened on Wednesday must still get the report. +// A ticker anchored to Monday 09:00 fires for nobody in that case, which is +// the ordinary case rather than an edge one. +func TestIsoWeekIdentifiesTheWeekNotTheDay(t *testing.T) { + monday := time.Date(2026, 9, 7, 9, 0, 0, 0, time.UTC) + wednesday := time.Date(2026, 9, 9, 16, 0, 0, 0, time.UTC) + sunday := time.Date(2026, 9, 13, 23, 0, 0, 0, time.UTC) + + if isoWeek(monday) != isoWeek(wednesday) || isoWeek(monday) != isoWeek(sunday) { + t.Errorf("days of one week produced different markers: %s %s %s", + isoWeek(monday), isoWeek(wednesday), isoWeek(sunday)) + } + // And the next week is a different marker, or the report would never send + // again. + if isoWeek(monday) == isoWeek(monday.AddDate(0, 0, 7)) { + t.Error("the following week shares a marker with this one") + } +} + +func TestIsoWeekFormat(t *testing.T) { + got := isoWeek(time.Date(2026, 1, 5, 12, 0, 0, 0, time.UTC)) + if got != "2026-W02" { + t.Errorf("isoWeek = %q, want 2026-W02", got) + } +} + +// With nothing configured there is no timer and nothing to disable: the +// absence of a bot IS the off switch. +func TestNoBotMeansNoWork(t *testing.T) { + d := &Daemon{log: quietLog(), store: memStore(t)} + // Would panic on a nil store read if it got past the configuration check. + d.weeklyOnce(context.Background()) +} diff --git a/internal/store/store.go b/internal/store/store.go index aa8b529..5163891 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -45,6 +45,12 @@ const ( // it would skip exactly the machines the widening is for. Absent ⇒ start at // 0; the sentinel below ⇒ finished. MetaToolLinkCursor = "tool_link_cursor" + // MetaReportWeek is the ISO week of the last weekly report that was sent, + // as "2026-W36". It lives here rather than in memory because an in-memory + // marker sends a second copy of the message after every restart — the bug + // cap.Guard.firedOn has, tolerable for a cap and not for a message someone + // receives on their phone. + MetaReportWeek = "report_week" // ToolLinkDone is the MetaToolLinkCursor value meaning "no rows left". // A cursor alone cannot say so: the pass ends by reading a short batch, and // new unlinked rows never appear behind the cursor. diff --git a/internal/weekly/telegram.go b/internal/weekly/telegram.go new file mode 100644 index 0000000..a8b8ab9 --- /dev/null +++ b/internal/weekly/telegram.go @@ -0,0 +1,164 @@ +package weekly + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" + "time" +) + +// TelegramAPI is the only host this package ever contacts. +const TelegramAPI = "https://api.telegram.org" + +// Sender delivers a finished report. The zero value is usable. +// +// This is the product's first *background* outbound call — the release check +// and Gemini both fire because a person did something in that moment. What +// keeps it inside rule 4 is what it carries and what turns it on: figures the +// user already sees on their own dashboard, never a prompt, a reply, a tool +// result or a file path, and only once they have configured a bot of their own. +// With no token there is no timer and nothing to switch off. +type Sender struct { + HTTP *http.Client + // Base overrides the API host in tests. + Base string +} + +func (s *Sender) client() *http.Client { + if s.HTTP != nil { + return s.HTTP + } + return &http.Client{Timeout: 20 * time.Second} +} + +func (s *Sender) base() string { + if s.Base != "" { + return s.Base + } + return TelegramAPI +} + +// Send posts one message. token and chat are the user's own bot and chat. +func (s *Sender) Send(ctx context.Context, token, chat, text string) error { + if strings.TrimSpace(token) == "" || strings.TrimSpace(chat) == "" { + return fmt.Errorf("telegram: not configured") + } + body, err := json.Marshal(map[string]any{ + "chat_id": chat, + "text": text, + // No parse mode: Markdown would need every repository name escaped, and + // a name with an underscore in it would either break the message or + // silently italicise half of it. Plain text always renders. + "disable_web_page_preview": true, + }) + if err != nil { + return err + } + + url := fmt.Sprintf("%s/bot%s/sendMessage", s.base(), token) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body)) + if err != nil { + return err + } + req.Header.Set("Content-Type", "application/json") + req.Header.Set("User-Agent", "caprock") + + res, err := s.client().Do(req) + if err != nil { + return fmt.Errorf("telegram: %w", err) + } + defer res.Body.Close() + + raw, _ := io.ReadAll(io.LimitReader(res.Body, 1<<20)) + var out struct { + OK bool `json:"ok"` + Description string `json:"description"` + } + _ = json.Unmarshal(raw, &out) + if !out.OK { + // Telegram's own words are more useful than ours: "chat not found" and + // "bot was blocked by the user" are both things only the user can fix, + // and both are worth reading verbatim. + if out.Description != "" { + return fmt.Errorf("telegram: %s", out.Description) + } + return fmt.Errorf("telegram: http %d", res.StatusCode) + } + return nil +} + +// Message renders a report as the text of one Telegram message. +// +// Plain prose, not a table: a phone is narrow, and a column layout that wraps +// is harder to read than a sentence. The first line is the whole claim, so a +// notification preview carries the point without being opened. +func Message(r Report, basis string) string { + var b strings.Builder + span := fmt.Sprintf("%s – %s", + r.WeekStart.Format("2 Jan"), r.WeekEnd.AddDate(0, 0, -1).Format("2 Jan")) + + if r.NoData { + fmt.Fprintf(&b, "Caprock · %s\n\nNothing ran this week.", span) + return b.String() + } + + fmt.Fprintf(&b, "Caprock · %s\n%s", span, money(r.CostUSD)) + if r.PriorUSD > 0 { + switch { + case r.CostUSD > r.PriorUSD*1.15: + fmt.Fprintf(&b, ", up from a usual %s", money(r.PriorUSD)) + case r.CostUSD < r.PriorUSD*0.85: + fmt.Fprintf(&b, ", down from a usual %s", money(r.PriorUSD)) + default: + fmt.Fprintf(&b, ", about usual") + } + } + b.WriteString("\n") + + if r.Quiet { + // Saying the week was ordinary is information. A message that lists + // nothing reads as a broken report. + b.WriteString("\nNothing moved much this week.\n") + } else { + b.WriteString("\nWhat moved:\n") + for i, m := range r.Movers { + if i >= 3 { + break + } + if m.New { + fmt.Fprintf(&b, "• %s — %s, new this week\n", m.Project, money(m.ThisUSD)) + continue + } + fmt.Fprintf(&b, "• %s — %s, %.1f× its usual %s\n", + m.Project, money(m.ThisUSD), m.Multiple, money(m.UsualUSD)) + } + } + + if len(r.Projects) > 0 { + b.WriteString("\nWhere it went:\n") + for i, p := range r.Projects { + if i >= 5 { + break + } + fmt.Fprintf(&b, "• %s — %s\n", p.Project, money(p.CostUSD)) + } + } + + // The basis travels with the figures, in the message rather than only on + // the screen the reader is not looking at (rule 6). + if basis != "" { + fmt.Fprintf(&b, "\n%s", basis) + } + return b.String() +} + +func money(v float64) string { + if v >= 100 { + return fmt.Sprintf("$%.0f", v) + } + return fmt.Sprintf("$%.2f", v) +} diff --git a/internal/weekly/telegram_test.go b/internal/weekly/telegram_test.go new file mode 100644 index 0000000..c0d6f33 --- /dev/null +++ b/internal/weekly/telegram_test.go @@ -0,0 +1,121 @@ +package weekly + +import ( + "context" + "encoding/json" + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" +) + +func TestSendPostsToTheUsersBot(t *testing.T) { + var gotPath string + var body map[string]any + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + gotPath = r.URL.Path + raw, _ := io.ReadAll(r.Body) + _ = json.Unmarshal(raw, &body) + _, _ = w.Write([]byte(`{"ok":true}`)) + })) + defer srv.Close() + + s := &Sender{Base: srv.URL} + if err := s.Send(context.Background(), "123:ABC", "-100999", "hello"); err != nil { + t.Fatal(err) + } + if !strings.Contains(gotPath, "/bot123:ABC/sendMessage") { + t.Errorf("path %q", gotPath) + } + if body["text"] != "hello" || body["chat_id"] != "-100999" { + t.Errorf("body %+v", body) + } + // No parse mode: a repository name with an underscore would break Markdown + // or silently italicise half the message. + if _, ok := body["parse_mode"]; ok { + t.Error("a parse mode was set; plain text always renders") + } +} + +// Telegram answers 200 with ok:false as readily as it uses a status code, and +// its own words are the ones the user can act on. +func TestSendReportsTelegramsOwnWords(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, _ = w.Write([]byte(`{"ok":false,"description":"chat not found"}`)) + })) + defer srv.Close() + + err := (&Sender{Base: srv.URL}).Send(context.Background(), "t", "c", "hi") + if err == nil || !strings.Contains(err.Error(), "chat not found") { + t.Errorf("error should carry Telegram's own words, got: %v", err) + } +} + +func TestSendRefusesWithoutConfiguration(t *testing.T) { + if err := (&Sender{}).Send(context.Background(), "", "c", "hi"); err == nil { + t.Error("sent with no token") + } + if err := (&Sender{}).Send(context.Background(), "t", "", "hi"); err == nil { + t.Error("sent with no chat") + } +} + +var msgEnd = time.Date(2026, 9, 7, 0, 0, 0, 0, time.UTC) + +// A quiet week is a result, not an empty message. "Nothing moved" is worth +// sending; a report that lists nothing reads as broken. +func TestMessageSaysWhenNothingMoved(t *testing.T) { + r := Report{ + WeekStart: msgEnd.AddDate(0, 0, -7), WeekEnd: msgEnd, + CostUSD: 40, PriorUSD: 42, Quiet: true, + Projects: []ProjectWeek{{Project: "caprock", CostUSD: 40}}, + } + got := Message(r, "At API list prices.") + if !strings.Contains(got, "Nothing moved much") { + t.Errorf("quiet week not stated:\n%s", got) + } + if !strings.Contains(got, "about usual") { + t.Errorf("a week within range should read as usual:\n%s", got) + } + // The basis rides in the message, not only on a screen the reader is not + // looking at. + if !strings.Contains(got, "list prices") { + t.Errorf("basis missing:\n%s", got) + } +} + +func TestMessageNamesMovers(t *testing.T) { + r := Report{ + WeekStart: msgEnd.AddDate(0, 0, -7), WeekEnd: msgEnd, + CostUSD: 120, PriorUSD: 40, + Movers: []Move{ + {Project: "hot-repo", ThisUSD: 90, UsualUSD: 12, Multiple: 7.5}, + {Project: "brand-new", ThisUSD: 30, New: true}, + }, + Projects: []ProjectWeek{{Project: "hot-repo", CostUSD: 90}}, + } + got := Message(r, "") + if !strings.Contains(got, "7.5× its usual") { + t.Errorf("multiple not stated:\n%s", got) + } + if !strings.Contains(got, "new this week") { + t.Errorf("a repo with no baseline should read as new, not as a multiple:\n%s", got) + } + if !strings.Contains(got, "up from a usual") { + t.Errorf("the week's own direction is missing:\n%s", got) + } +} + +// A machine that was off did not stop spending; it was off. +func TestMessageForAnEmptyWeek(t *testing.T) { + r := Report{WeekStart: msgEnd.AddDate(0, 0, -7), WeekEnd: msgEnd, NoData: true} + got := Message(r, "basis") + if !strings.Contains(got, "Nothing ran this week") { + t.Errorf("empty week:\n%s", got) + } + if strings.Contains(got, "0%") || strings.Contains(got, "down from") { + t.Errorf("an empty week must not read as a collapse:\n%s", got) + } +} diff --git a/internal/weekly/weekly.go b/internal/weekly/weekly.go new file mode 100644 index 0000000..5473863 --- /dev/null +++ b/internal/weekly/weekly.go @@ -0,0 +1,196 @@ +// Package weekly builds the report that says what moved — and, more often, +// that nothing did. +// +// The premium page promises "the repository that cost 3× its usual week", and +// the whole difficulty is in the word *usual*. Comparing this week with last +// week gives a ratio, not a finding: a repository that cost $2 and then $6 has +// tripled and means nothing. So "usual" here is the median of the four weeks +// before this one, and a mover is only reported when it also clears an absolute +// floor in dollars. Below that the report says the week was ordinary, which is +// true and worth saying (ADR-024). +// +// This matters more than it would on the dashboard. A reader looking at a screen +// can click into a figure that surprises them; a reader holding a message +// cannot. A confident wrong headline in a weekly message is a claim they have no +// way to check, which is the reason `caprock report` already refuses to publish +// a breakdown whose linkage is too weak. +package weekly + +import ( + "sort" + "time" +) + +// MinMoveUSD is the smallest change worth calling a movement. +// +// Ten dollars, and the first draft had it at three — which the tests caught +// immediately. A repository going from $2 to $6 clears a $3 floor and is +// exactly the finding this floor exists to suppress: it is three times its +// usual week and it is nothing. The floor has to be large enough that the +// change is worth a person's attention on its own, before the multiple is even +// considered, because a report that cries wolf is one people stop opening — +// and that costs more than missing a mover. +const MinMoveUSD = 10.0 + +// BaselineWeeks is how many weeks "usual" is measured over. +// +// Four is a compromise: long enough that one unusual week does not become the +// baseline, short enough to follow someone whose work genuinely changed a month +// ago. The median of the four is used rather than the mean, because one runaway +// week would drag a mean up and hide the next one. +const BaselineWeeks = 4 + +// Day is one row of daily_stats: a day, a project, a model, and what it cost. +type Day struct { + Day string // YYYY-MM-DD + Project string + Model string + CostUSD float64 + Tokens int64 +} + +// Move is one repository whose week departed from its usual. +type Move struct { + Project string `json:"project"` + ThisUSD float64 `json:"this_usd"` + // UsualUSD is the median of the baseline weeks, which is what "3× its usual + // week" is measured against — not last week. + UsualUSD float64 `json:"usual_usd"` + // Multiple is ThisUSD / UsualUSD. Zero when the project had no baseline at + // all, which is reported as "new" rather than as an infinite multiple. + Multiple float64 `json:"multiple"` + New bool `json:"new"` +} + +// Report is a week, and what is worth saying about it. +type Report struct { + WeekStart time.Time `json:"week_start"` + WeekEnd time.Time `json:"week_end"` + CostUSD float64 `json:"cost_usd"` + // PriorUSD is the median week of the baseline, for the one line that says + // whether the week as a whole was ordinary. + PriorUSD float64 `json:"prior_usd"` + Tokens int64 `json:"tokens"` + // Movers are ranked by how far they departed, biggest first. Empty is the + // normal case and is not a failure. + Movers []Move `json:"movers"` + // Projects is the week's spend per repository, biggest first — the part + // that is true whether or not anything moved. + Projects []ProjectWeek `json:"projects"` + // Quiet says the week produced no reportable movement, so the message can + // say so plainly instead of listing nothing. + Quiet bool `json:"quiet"` + // NoData means the week has no priced activity at all — the machine was off, + // or the daemon was. Reporting a 100% drop for a week nobody worked would be + // a lie the reader cannot check. + NoData bool `json:"no_data"` +} + +// ProjectWeek is one repository's week. +type ProjectWeek struct { + Project string `json:"project"` + CostUSD float64 `json:"cost_usd"` + Tokens int64 `json:"tokens"` +} + +// Build assembles the report for the week ending at weekEnd (exclusive) from +// daily rows covering that week and the baseline before it. +// +// It takes rows rather than a database so the judgement above can be tested +// without one — the same reason cmd/caprock/report.go keeps its assembly pure. +func Build(rows []Day, weekEnd time.Time) Report { + weekStart := weekEnd.AddDate(0, 0, -7) + rep := Report{WeekStart: weekStart, WeekEnd: weekEnd} + + // This week, per project. + thisWeek := map[string]float64{} + thisTokens := map[string]int64{} + // Each baseline week, per project, so a median can be taken per project + // rather than per machine. + baseline := make([]map[string]float64, BaselineWeeks) + for i := range baseline { + baseline[i] = map[string]float64{} + } + baseTotals := make([]float64, BaselineWeeks) + + for _, r := range rows { + d, err := time.ParseInLocation("2006-01-02", r.Day, weekEnd.Location()) + if err != nil { + continue + } + switch { + case !d.Before(weekStart) && d.Before(weekEnd): + thisWeek[r.Project] += r.CostUSD + thisTokens[r.Project] += r.Tokens + rep.CostUSD += r.CostUSD + rep.Tokens += r.Tokens + case d.Before(weekStart): + // Which baseline week does this day fall in? 0 is the week just + // before this one. + weeksBack := int(weekStart.Sub(d).Hours() / (24 * 7)) // 0 for the first six days back + if weeksBack >= 0 && weeksBack < BaselineWeeks { + baseline[weeksBack][r.Project] += r.CostUSD + baseTotals[weeksBack] += r.CostUSD + } + } + } + + if rep.CostUSD == 0 && len(thisWeek) == 0 { + rep.NoData = true + return rep + } + + rep.PriorUSD = median(baseTotals) + + for p, cost := range thisWeek { + rep.Projects = append(rep.Projects, ProjectWeek{Project: p, CostUSD: cost, Tokens: thisTokens[p]}) + } + sort.Slice(rep.Projects, func(a, b int) bool { return rep.Projects[a].CostUSD > rep.Projects[b].CostUSD }) + + // A mover has to clear both tests: a real change in dollars, and a change + // against its own usual week. Either alone produces noise — the floor alone + // flags every busy repository, the multiple alone flags every cheap one. + for p, cost := range thisWeek { + var weeks []float64 + for i := range baseline { + weeks = append(weeks, baseline[i][p]) + } + usual := median(weeks) + delta := cost - usual + if delta < MinMoveUSD { + continue + } + m := Move{Project: p, ThisUSD: cost, UsualUSD: usual} + if usual <= 0 { + m.New = true + } else { + m.Multiple = cost / usual + // Twice its usual week, on top of clearing the floor. A repository + // that grew by half is not news. + if m.Multiple < 2 { + continue + } + } + rep.Movers = append(rep.Movers, m) + } + sort.Slice(rep.Movers, func(a, b int) bool { + return rep.Movers[a].ThisUSD-rep.Movers[a].UsualUSD > rep.Movers[b].ThisUSD-rep.Movers[b].UsualUSD + }) + rep.Quiet = len(rep.Movers) == 0 + return rep +} + +// median of the values given, zero for none. Used rather than the mean because +// one runaway week must not become the baseline that hides the next one. +func median(v []float64) float64 { + if len(v) == 0 { + return 0 + } + s := append([]float64(nil), v...) + sort.Float64s(s) + n := len(s) + if n%2 == 1 { + return s[n/2] + } + return (s[n/2-1] + s[n/2]) / 2 +} diff --git a/internal/weekly/weekly_test.go b/internal/weekly/weekly_test.go new file mode 100644 index 0000000..8c59b1f --- /dev/null +++ b/internal/weekly/weekly_test.go @@ -0,0 +1,138 @@ +package weekly + +import ( + "testing" + "time" +) + +var end = time.Date(2026, 9, 7, 0, 0, 0, 0, time.UTC) // a Monday + +// days builds rows for one project across a span, `perDay` dollars each day. +func days(project string, from time.Time, n int, perDay float64) []Day { + var out []Day + for i := 0; i < n; i++ { + out = append(out, Day{ + Day: from.AddDate(0, 0, i).Format("2006-01-02"), + Project: project, Model: "claude-opus-5", + CostUSD: perDay, Tokens: 1000, + }) + } + return out +} + +// The headline claim: 3x its USUAL week, where usual is a baseline rather than +// last week. A repo that was quiet for a month and then busy is the finding. +func TestReportsARealMover(t *testing.T) { + var rows []Day + rows = append(rows, days("quiet-repo", end.AddDate(0, 0, -35), 28, 0.50)...) // ~$3.50/wk + rows = append(rows, days("quiet-repo", end.AddDate(0, 0, -7), 7, 4.00)...) // $28 this week + + rep := Build(rows, end) + if len(rep.Movers) != 1 { + t.Fatalf("movers: %+v", rep.Movers) + } + m := rep.Movers[0] + if m.Project != "quiet-repo" { + t.Errorf("project %q", m.Project) + } + if m.Multiple < 7 || m.Multiple > 9 { + t.Errorf("multiple %.1f — want about 8 ($28 against a $3.50 usual)", m.Multiple) + } + if rep.Quiet { + t.Error("a real mover was reported as a quiet week") + } +} + +// The whole reason for the floor. $2 to $6 is 3x and is not a finding; putting +// it in a message the reader cannot click into is worse than saying nothing. +func TestSmallMultiplesAreNotFindings(t *testing.T) { + var rows []Day + rows = append(rows, days("tiny", end.AddDate(0, 0, -35), 28, 2.0/7)...) // $2/wk + rows = append(rows, days("tiny", end.AddDate(0, 0, -7), 7, 6.0/7)...) // $6 this week + + rep := Build(rows, end) + if len(rep.Movers) != 0 { + t.Errorf("a $2 → $6 week was reported as a movement: %+v", rep.Movers) + } + if !rep.Quiet { + t.Error("should have reported a quiet week") + } +} + +// Steady work is not news, however expensive. A repo costing $200 every week +// must not be a mover just because it is the biggest number on the machine. +func TestSteadySpendIsNotAMover(t *testing.T) { + rows := days("busy", end.AddDate(0, 0, -35), 35, 30) + rep := Build(rows, end) + if len(rep.Movers) != 0 { + t.Errorf("steady spend flagged as movement: %+v", rep.Movers) + } + if rep.CostUSD < 200 { + t.Errorf("this week's total looks wrong: %.2f", rep.CostUSD) + } + // It still appears in the week's spend, which is true whether or not + // anything moved. + if len(rep.Projects) != 1 || rep.Projects[0].Project != "busy" { + t.Errorf("projects: %+v", rep.Projects) + } +} + +// One runaway week must not become the baseline that hides the next one — +// which is why the baseline is a median and not a mean. +func TestOneWildWeekDoesNotBecomeTheBaseline(t *testing.T) { + var rows []Day + // Three quiet weeks and one huge one in the baseline. + rows = append(rows, days("repo", end.AddDate(0, 0, -35), 21, 0.20)...) + rows = append(rows, days("repo", end.AddDate(0, 0, -14), 7, 20.0)...) + // This week is busy again. + rows = append(rows, days("repo", end.AddDate(0, 0, -7), 7, 5.0)...) + + rep := Build(rows, end) + // With a mean baseline (~$36/4 = $9) this would not clear 2x. With a median + // (~$1.40) it does, which is the honest reading: three weeks in four were + // quiet. + if len(rep.Movers) != 1 { + t.Errorf("a mean baseline hid a real mover: %+v", rep.Movers) + } +} + +// A machine that was off is not a machine whose spending collapsed. +func TestAnEmptyWeekIsNotADrop(t *testing.T) { + rows := days("repo", end.AddDate(0, 0, -35), 21, 5) // baseline only, nothing this week + rep := Build(rows, end) + if !rep.NoData { + t.Errorf("an empty week should report no data, got %+v", rep) + } + if len(rep.Movers) != 0 { + t.Error("reported movement in a week with no activity") + } +} + +// A repository seen for the first time has no usual week, so it is named as new +// rather than given an infinite multiple. +func TestANewRepositoryIsNamedNew(t *testing.T) { + rows := days("fresh", end.AddDate(0, 0, -7), 7, 3.0) + rep := Build(rows, end) + if len(rep.Movers) != 1 || !rep.Movers[0].New { + t.Fatalf("movers: %+v", rep.Movers) + } + if rep.Movers[0].Multiple != 0 { + t.Errorf("a new repo should carry no multiple, got %.1f", rep.Movers[0].Multiple) + } +} + +func TestMedian(t *testing.T) { + for _, c := range []struct { + in []float64 + want float64 + }{ + {nil, 0}, + {[]float64{5}, 5}, + {[]float64{1, 2, 3}, 2}, + {[]float64{1, 2, 3, 100}, 2.5}, // the outlier does not move it + } { + if got := median(c.in); got != c.want { + t.Errorf("median(%v) = %v, want %v", c.in, got, c.want) + } + } +} diff --git a/ui/src/components/WeeklyReport.test.tsx b/ui/src/components/WeeklyReport.test.tsx new file mode 100644 index 0000000..980b513 --- /dev/null +++ b/ui/src/components/WeeklyReport.test.tsx @@ -0,0 +1,74 @@ +/** + * The panel has one job the others do not: making an absence visible. A weekly + * message that stops arriving looks exactly like a quiet week, so the last + * outcome has to be on the screen. + */ +import { fireEvent, render, screen, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' +import { WeeklyReport } from './WeeklyReport' +import type { Settings } from '@/lib/api' + +const settings = vi.hoisted(() => ({ value: {} as Settings })) +const saved = vi.hoisted(() => ({ calls: [] as Partial[] })) + +vi.mock('@/lib/api', async (orig) => { + const actual = await orig() + return { + ...actual, + api: { + ...actual.api, + settings: async () => settings.value, + saveSettings: async (s: Settings) => { + saved.calls.push(s) + return s + }, + }, + } +}) + +describe('WeeklyReport', () => { + it('says a token is stored without showing it', async () => { + settings.value = { report_bot_set: true, report_chat_id: '123' } as Settings + render() + // The field is empty because GET never returns the token — so the panel + // has to say one exists, or an unchanged setup reads as unsaved. + await waitFor(() => expect(screen.getByText(/one is stored/)).toBeInTheDocument()) + expect(screen.getByPlaceholderText(/leave blank to keep/)).toHaveValue('') + }) + + // The whole reason the status line exists. + it('shows why the last send failed, in Telegram’s own words', async () => { + settings.value = { + report_bot_set: true, report_chat_id: '1', + report_last_error: 'chat not found', + } as Settings + render() + await waitFor(() => expect(screen.getByText(/chat not found/)).toBeInTheDocument()) + }) + + it('says nothing has been sent yet rather than leaving it blank', async () => { + settings.value = { report_bot_set: true, report_chat_id: '1' } as Settings + render() + await waitFor(() => expect(screen.getByText(/Nothing sent yet/)).toBeInTheDocument()) + }) + + it('does not send an empty token, which would clear a working one', async () => { + saved.calls = [] + settings.value = { report_bot_set: true, report_chat_id: '123' } as Settings + render() + // Wait for the chat id to seed from settings, or the button is disabled + // and the click does nothing. + await waitFor(() => expect(screen.getByPlaceholderText('123456789')).toHaveValue('123')) + fireEvent.click(screen.getByRole('button', { name: /save/i })) + await waitFor(() => expect(saved.calls.length).toBe(1)) + expect(saved.calls[0]).not.toHaveProperty('report_bot_token') + }) + + it('states what the message carries and what it does not', async () => { + settings.value = {} as Settings + render() + // Someone deciding whether to hand over a bot token is deciding on this. + await waitFor(() => expect(screen.getByText(/no prompts, no replies, no/i)).toBeInTheDocument()) + expect(screen.getByText(/Nothing passes our server/i)).toBeInTheDocument() + }) +}) diff --git a/ui/src/components/WeeklyReport.tsx b/ui/src/components/WeeklyReport.tsx new file mode 100644 index 0000000..9077f9e --- /dev/null +++ b/ui/src/components/WeeklyReport.tsx @@ -0,0 +1,146 @@ +/** + * The weekly report: where it goes, and whether the last one arrived. + * + * Two fields and a status line, and the status line is the part that matters. + * A weekly message that quietly stops arriving is the failure nobody notices — + * an absence looks exactly like a quiet week — so the last outcome is on the + * panel rather than in a log file. Telegram's own words are kept verbatim + * ("chat not found", "bot was blocked by the user") because both are things + * only the reader can fix. + * + * The token is write-only (ADR-024). It goes in, it is never sent back, and + * this panel shows that one is stored rather than showing it — which means the + * field starts empty on a machine that already has a working bot, and the line + * underneath has to say so or it reads as unsaved. + */ +import { useEffect, useState } from 'react' +import { api, errText, type Settings } from '@/lib/api' +import { useApi } from '@/lib/useApi' +import { Panel } from '@/components/ui' +import { fmtAgo } from '@/lib/format' +import { useNow } from '@/lib/useNow' + +export function WeeklyReport() { + const settings = useApi(() => api.settings(), [], { live: false }) + const now = useNow(30_000) + const [token, setToken] = useState('') + const [chat, setChat] = useState('') + const [seeded, setSeeded] = useState(false) + const [saving, setSaving] = useState(false) + const [saved, setSaved] = useState(false) + const [error, setError] = useState('') + + const s: Settings | undefined = settings.data + + // The chat id is seeded because it comes back; the token is not, because it + // does not. Seeded once, so a poll cannot overwrite what someone is typing. + useEffect(() => { + if (seeded || s === undefined) return + setChat(s.report_chat_id ?? '') + setSeeded(true) + }, [s, seeded]) + + const save = async () => { + setSaving(true) + setError('') + try { + // Only send the token when one was typed: an empty string is a clear, + // and a blank field is the normal state on a machine that already has a + // working bot. + await api.saveSettings({ + report_chat_id: chat.trim(), + ...(token.trim() ? { report_bot_token: token.trim() } : {}), + } as Partial as Settings) + setToken('') + setSaved(true) + settings.refresh?.() + } catch (e) { + setError(errText(e)) + } finally { + setSaving(false) + } + } + + const configured = !!s?.report_bot_set && !!s?.report_chat_id + + return ( + + {configured ? 'Mondays, or the next day you open the lid' : 'not set up'} + + } + > +
+

+ What moved this week, against your usual — sent to a Telegram bot you own. Nothing + passes our server, and the message carries figures only: no prompts, no replies, no + file names. +

+ + + + + +
+ + {saved && !error && saved} + {error && {error}} +
+ + {/* The whole reason this line exists: a message that stopped arriving + * is invisible otherwise, and looks identical to a quiet week. */} + {s?.report_last_error ? ( +

+ Last send failed: {s.report_last_error} +

+ ) : s?.report_last_sent_ms ? ( +

+ Last sent {fmtAgo(s.report_last_sent_ms, now)} ago. +

+ ) : configured ? ( +

+ Nothing sent yet — the first one goes out at the start of next week. +

+ ) : null} +
+
+ ) +} diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index 28edae2..a157baf 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -274,6 +274,17 @@ export interface Settings { browse_root?: string /** The daily spend ceiling in USD; 0 is off. See internal/cap. */ cap_usd_per_day?: number + /** Where the weekly report goes. Not a credential, so it round-trips. */ + report_chat_id?: string + /** Whether a bot token is stored. The token itself is never returned — it is + * the one write-only field in this API (ADR-024). */ + report_bot_set?: boolean + /** Why the last send failed, absent when it did not. A weekly message that + * stops arriving is invisible otherwise. */ + report_last_error?: string + report_last_sent_ms?: number + /** Write-only: accepted by PUT, never present in a GET response. */ + report_bot_token?: string update_checks: boolean plan_kind: '' | 'flat' | 'metered' plan_label: string diff --git a/ui/src/screens/History.tsx b/ui/src/screens/History.tsx index abf8e71..4db7bb0 100644 --- a/ui/src/screens/History.tsx +++ b/ui/src/screens/History.tsx @@ -10,15 +10,11 @@ import { costBasis, costBasisLong } from '@/components/CostBasis' import { usePlan } from '@/components/PlanPicker' import { PremiumBanner } from '@/components/PremiumBanner' import { Locked } from '@/components/Locked' +import { WeeklyReport } from '@/components/WeeklyReport' import { UnpricedNote } from '@/components/Unpriced' type Range = 'today' | '7d' | '30d' | 'all' -// Shown only when this machine has no week to draw on — a brand-new install -// would otherwise preview an empty report, which sells nothing. Named so it can -// never be mistaken on screen for the reader's own repositories. -const PLACEHOLDER_WEEK = ['your-api', 'your-web'] - export function HistoryScreen() { const [range, setRange] = useState('all') const [activeDay, setActiveDay] = useState(null) @@ -36,10 +32,6 @@ export function HistoryScreen() { // this screen, two panels down. Putting them behind glass would take // something away rather than preview something new, which turns the free // tier into a hostage. What is genuinely paid here is the *delivery* — - // Monday morning, in Telegram, without opening this page — so that is what - // the preview sells. - const wk = useApi(() => api.summary('7d'), [], { intervalMs: 60000 }) - const weekProjects = (wk.data?.projects ?? []).slice(0, 4).map((p) => p.project) const maxTool = Math.max(...(d?.tools ?? []).map((t) => t.count), 1) return (
@@ -121,36 +113,11 @@ export function HistoryScreen() { * screen already answers "where did it go", and the paid half is * having that answer arrive without coming here to look. */} - {/* The preview is the report itself, filled with this machine's own - * figures — not a list of its properties. - * - * It used to be three rows reading "Sent: Mondays 09:00 / To: your - * Telegram bot / Contains: the week by repository and model", which - * describes an email without showing one. Behind glass that is a - * blurred settings screen, and nobody buys a settings screen. What - * sells this is seeing the message that would have arrived, with - * real repository names and real dollars in it. */} - Mondays, 09:00}> -
-

- To: your Telegram bot or webhook -

-

Last week, by repository:

-
- {(weekProjects.length ? weekProjects : PLACEHOLDER_WEEK).map((name) => ( -
- {name || 'unknown'} - {/* Deliberately not a figure — see the note above the - * data. The bar is a shape, not a number. */} - -
- ))} -
-

- …and the same by model, in your inbox before you open a terminal. -

-
-
+ {/* Unlocked this is the real control; locked it is the pitch, and + * both are the same component. What sells it is seeing where the + * message goes and that Caprock keeps nothing — a reader deciding + * whether to pay is deciding whether to hand over a bot token. */} +
by cost}> From cf91983d1f55125aaba8a60370f8ec6b85a541ef Mon Sep 17 00:00:00 2001 From: Dmitriy Solodukha Date: Tue, 1 Sep 2026 21:53:46 +0300 Subject: [PATCH 2/2] fix(ui): stop one setting's save from overwriting the others MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Set plan keeps resetting" was not a save that failed. The settings hook PUT the whole Settings object, assembled from a module-level cache, so any control could write back a field it knew nothing about with a value it had read minutes earlier. Two tabs were enough: change the plan in one, click "check for updates" in the other, and the second restated the plan from its own stale copy. The server has always treated PUT as a patch — absent fields are left alone — so the fix is to stop pretending otherwise on the client. usePlan now takes a Partial and sends only what changed. Also fixes the activity feed, which was showing a fortnight of history as what just happened. Two causes, one on each side. The feed seeded with `events(id, 0, 60)`, which pages FORWARD from a session's first event — the same defect the session timeline had. And LastEvents ordered by rowid rather than by time: those agree for a session captured live and diverge for one whose transcript was re-read, because a backfill inserts old events with new rowids. On a session with fifteen thousand events the "newest sixty" were two weeks old, every row equally stale, which is why it also read as "I cannot even scroll". EventsBefore's cursor moves to the timestamp for the same reason: an id cursor under a time ordering skips rows. The spawn dialog goes from 520 to 620 wide and the permission labels get shorter. "Accept edits · asks before com…" cut off the consequence, which is the one thing that label exists to state. And the premium chip is one control instead of two disguised as one. The label went straight to Stripe's checkout while a chevron beside it opened the dialog, in one border, one colour, with no seam — so clicking the word "premium" to find out what premium IS took you to a card form. It now reads "Get premium $30/yr", opens the dialog, and once bought it names the plan (yearly or lifetime) with the expiry on hover, plus a renew flag inside the grace period. Claude-Session: https://claude.ai/code/session_01DR8fggA2LRHcjNWUsqtDcF --- .../{index-DLnWXkEr.js => index-Cr7Ws9HV.js} | 4 +- ...{index-1ZVeIGiX.css => index-JzCSeTjz.css} | 2 +- internal/api/dist/index.html | 4 +- internal/store/queries.go | 13 ++- internal/store/queries_more_test.go | 41 +++++++ ui/src/components/ActivityFeed.test.tsx | 73 +++++++++++++ ui/src/components/ActivityFeed.tsx | 6 +- ui/src/components/PlanPicker.test.tsx | 80 ++++++++------ ui/src/components/PlanPicker.tsx | 28 +++-- ui/src/components/PremiumChip.test.tsx | 100 ++++++++++-------- ui/src/components/PremiumChip.tsx | 71 ++++++++----- ui/src/components/SpawnDialog.tsx | 9 +- ui/src/components/UpdateBanner.tsx | 4 +- 13 files changed, 314 insertions(+), 121 deletions(-) rename internal/api/dist/assets/{index-DLnWXkEr.js => index-Cr7Ws9HV.js} (87%) rename internal/api/dist/assets/{index-1ZVeIGiX.css => index-JzCSeTjz.css} (66%) create mode 100644 ui/src/components/ActivityFeed.test.tsx diff --git a/internal/api/dist/assets/index-DLnWXkEr.js b/internal/api/dist/assets/index-Cr7Ws9HV.js similarity index 87% rename from internal/api/dist/assets/index-DLnWXkEr.js rename to internal/api/dist/assets/index-Cr7Ws9HV.js index 995c29d..4951bf9 100644 --- a/internal/api/dist/assets/index-DLnWXkEr.js +++ b/internal/api/dist/assets/index-Cr7Ws9HV.js @@ -6,9 +6,9 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ve(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return e.child!==t&&t!==null?ve(`Suspense Fallback`):ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 15:return I(e.type,!1);case 11:return I(e.type.render,!1);case 1:return I(e.type,!0);case 31:return ve(`Activity`);default:return``}}function L(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var xe=Object.prototype.hasOwnProperty,Se=t.unstable_scheduleCallback,Ce=t.unstable_cancelCallback,we=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ee=t.unstable_now,De=t.unstable_getCurrentPriorityLevel,Oe=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ye(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Xe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ze(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=mn(),pn=fn=dn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=cn&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Ft(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Td(Ar,`onSelect`),0>=o,i-=o,wi=1<<32-Re(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),V&&Ei(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),V&&Ei(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return V&&Ei(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),V&&Ei(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&wa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=di(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ui(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=mi(a,e.mode,c),c.return=e,e=c}return o(e);case D:return a=wa(a),b(e,r,a,c)}if(A(a))return h(e,r,a,c);if(ie(a)){if(l=ie(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,ea(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=fi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,et(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Z&f)===f:(r&f)===f){f!==0&&f===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=j.T,s={};j.T=s,js(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),du(e)):As(e,t,r,du(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ss(e).queue;ys(e,i,t,ae,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},du())}function ws(){return $i(Qf)}function Ts(){return Oo().memoizedState}function Es(){return Oo().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Ra(n);var r=za(t,e,n);r!==null&&(pu(r,t,n),Ba(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=ei(e,t,n,r),n!==null&&(pu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,du())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return $r(e,t,i,0),Il===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return pu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(s(479))}else t=ei(e,n,r,2),t!==null&&pu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,et(e,n)}}var Fs={readContext:$i,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Fs.useEffectEvent=vo;var Is={readContext:$i,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=ys.bind(null,G,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Do();if(V){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Il===null)throw Error(s(349));Z&127||Ro(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,os(Bo.bind(null,r,a,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),n},useId:function(){var e=Do(),t=Il.identifierPrefix;if(V){var n=Ti,r=wi;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[st]=t,a[ct]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ue.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ji,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[st]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ii(t,!0)}else e=Bd(e).createTextNode(r),e[st]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[st]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(s(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[st]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),i=!1}else i=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return pe(),e===null&&xd(t.stateNode.containerInfo),Nc(t),null;case 10:return qi(t.type),Nc(t),null;case 19:if(se(ao),r=t.memoizedState,r===null)return Nc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Mc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Mc(r,!1),e=a.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return F(ao,ao.current&1|2),V&&Ei(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ee()>$l&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!V)return Nc(t),null}else 2*Ee()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ee(),e.sibling=null,n=ao.current,F(ao,i?n&1|2:n&1),V&&Ei(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(H),Nc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Fc(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(H),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(ao),null;case 4:return pe(),null;case 10:return qi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&se(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(H),null;case 25:return null;default:return null}}function Ic(e,t){switch(ki(t),t.tag){case 3:qi(H),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:se(ao);break;case 10:qi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&se(ma);break;case 24:qi(H)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Uu(e,e.return,t)}}}function Bc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ct]=t}catch(t){Uu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[st]=e,t[ct]=n}catch(t){Uu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Rd=sp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(a,r,n),a[st]=e,vt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;cg&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,j.T=null,n=su,su=null;var a=ru,o=au;if(nu=0,iu=ru=null,au=0,Y&6)throw Error(s(331));var c=Y;if(Y|=4,jl(a.current),Cl(a,a.current,o,n),Y=c,rd(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,a)}catch{}return!0}finally{M.p=i,j.T=r,zu(e,t)}}function Hu(e,t,n){t=gi(n,t),t=Js(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ze(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=gi(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),Ze(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Q=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Z&n)===n&&(Hl===4||Hl===3&&(Z&62914560)===Z&&300>Ee()-Zl?!(Y&2)&&bu(e,0):Gl|=n,ql===Z&&(ql=0)),nd(e)}function Ku(e,t){t===0&&(t=Ye()),e=ti(e,t),e!==null&&(Ze(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Se(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Z,a=Ke(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,cd(r,a))}r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Ee(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}nu!==0&&nu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=_t(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);vt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ue.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=_t(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=_t(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=_t(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Lt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),vt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Lt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,vt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),vt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,vt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),vt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=new class{state={conn:`connecting`,lastFrameAt:0,tick:0,alerts:[]};listeners=new Set;backoff=500;timer=null;started=!1;frameSubs=new Set;getState=()=>this.state;subscribe=e=>(this.listeners.add(e),this.start(),()=>{this.listeners.delete(e)});onFrame=e=>(this.frameSubs.add(e),()=>{this.frameSubs.delete(e)});set(e){this.state={...this.state,...e};for(let e of this.listeners)e()}start(){this.started||typeof WebSocket>`u`||(this.started=!0,this.connect())}connect(){let e=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/v1/live`;this.set({conn:`connecting`});let t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.onopen=()=>{this.backoff=500,this.set({conn:`open`})},t.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}this.handle(t)},t.onclose=()=>{this.set({conn:`closed`}),this.scheduleReconnect()},t.onerror=()=>{t.close()}}scheduleReconnect(){this.timer===null&&(this.timer=window.setTimeout(()=>{this.timer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,1e4))}handle(e){let t=Date.now();for(let t of this.frameSubs)try{t(e)}catch(e){console.error(`[caprock] live frame subscriber failed`,e)}switch(e.type){case`alert`:this.set({lastFrameAt:t,alerts:[e.data,...this.state.alerts.filter(t=>t.session_id!==e.data.session_id)].slice(0,50),tick:this.state.tick+1});break;case`event`:this.set({lastFrameAt:t,lastEvent:e.data,tick:this.state.tick+1});break;case`session`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;case`task`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;default:this.set({lastFrameAt:t})}}dismissAlert(e){this.set({alerts:this.state.alerts.filter(t=>t.session_id!==e)})}};function f(){return(0,l.useSyncExternalStore)(d.subscribe,d.getState,d.getState)}function p(e=400){let{tick:t}=f(),[n,r]=m(t,e);return(0,l.useEffect)(()=>{r(t)},[t,r]),n}function m(e,t){let[n,r]=(0,l.useState)(e),i=(0,l.useRef)(null),a=(0,l.useRef)(e);return[n,(0,l.useCallback)(e=>{a.current=e,i.current===null&&(i.current=window.setTimeout(()=>{i.current=null,r(a.current)},t))},[t])]}function h(e){let[t,n]=e.replace(/^#\/?/,``).split(`?`),r=(t??``).split(`/`).filter(Boolean),i=new URLSearchParams(n??``),a=i.get(`tab`)??void 0,o=Number(i.get(`at`)),s=Number.isFinite(o)&&o>0?o:void 0;switch(r[0]){case void 0:case``:case`now`:return{name:`now`};case`session`:return r[1]?{name:`session`,id:decodeURIComponent(r[1]),tab:a,at:s}:{name:`now`};case`cost`:return{name:`cost`};case`history`:return{name:`history`};case`tasks`:return{name:`tasks`};case`graph`:return{name:`graph`};case`notes`:return{name:`notes`};case`settings`:return{name:`settings`};default:return{name:`now`}}}function g(e){switch(e.name){case`now`:return`#/`;case`session`:{let t=new URLSearchParams;e.tab&&t.set(`tab`,e.tab),e.at&&t.set(`at`,String(e.at));let n=t.toString();return`#/session/${encodeURIComponent(e.id)}${n?`?${n}`:``}`}case`cost`:return`#/cost`;case`history`:return`#/history`;case`tasks`:return`#/tasks`;case`graph`:return`#/graph`;case`notes`:return`#/notes`;case`settings`:return`#/settings`}}function _(){let[e,t]=(0,l.useState)(()=>h(location.hash));return(0,l.useEffect)(()=>{let e=()=>t(h(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(e){location.hash=g(e)}var y=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:4,maximumFractionDigits:4});function x(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function S(e){return x(e)===null?`—`:(e=e,e!==0&&Math.abs(e)<.01?b.format(e):y.format(e))}function C(e){if(x(e)===null)return`—`;e=e;let t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e4?`${(e/1e3).toFixed(1)}k`:new Intl.NumberFormat(`en-US`).format(e)}function w(e,t=0){if(x(e)===null)return`—`;let n=e;if(t===0){let e=Math.floor(n);return`${Number.isFinite(e)?e:0}%`}let r=Math.min(100,Math.max(0,Math.trunc(x(t)??0)));return`${e.toFixed(r)}%`}function T(e,t=Date.now()){if(!e)return`—`;let n=typeof e==`number`?e:Date.parse(e);if(Number.isNaN(n))return`—`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<5)return`now`;if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<48?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ee(e){if(x(e)===null)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function E(e){return e.length>8?e.slice(0,8):e}function D(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.slice(n+1):t}function te(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t?`${t[1]}·${t[2]}`:e}function ne(e){return e.replace(/-\d{6,}$/,`…`)}function re(e){let[t,n]=(0,l.useState)(()=>Date.now());return(0,l.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}var ie=`caprock-theme`;function O(){let e=localStorage.getItem(ie);return e===`dark`||e===`light`?e:window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function k(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function A(){let[e,t]=(0,l.useState)(O);return(0,l.useEffect)(()=>{k(e),localStorage.setItem(ie,e)},[e]),[e,()=>t(e=>e===`dark`?`light`:`dark`)]}async function j(e,t,n=`POST`){let r=await fetch(e,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok){let e;try{e=await r.json()}catch{}throw new M(r.status,`${r.status} ${r.statusText}`,e)}return r.status===204?void 0:await r.json()}var M=class extends Error{status;body;constructor(e,t,n){super(t),this.status=e,this.body=n}};function ae(e){if(e instanceof M){let t=e.body,n=t?.error??e.message;return t?.detail?`${n} — ${t.detail}`:n}return e instanceof Error?e.message:String(e)}async function N(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok){let e;try{e=await t.json()}catch{}throw new M(t.status,`${t.status} ${t.statusText}`,e)}return await t.json()}var P={sessions:(e=!1)=>N(`/v1/sessions${e?`?active=true`:``}`),session:e=>N(`/v1/sessions/${encodeURIComponent(e)}`),events:(e,t=0,n=500)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?after=${t}&limit=${n}`),eventsBefore:(e,t,n=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?before=${t}&limit=${n}`),recentEvents:(e,t=2e3)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?newest=1&limit=${t}`),diff:e=>N(`/v1/sessions/${encodeURIComponent(e)}/diff`),notes:(e,t=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/notes?limit=${t}`),searchNotes:(e,t=100,n=0)=>N(`/v1/notes?q=${encodeURIComponent(e)}&limit=${t}${n?`&before=${n}`:``}`),settings:()=>N(`/v1/settings`),update:()=>N(`/v1/update`),checkUpdate:()=>j(`/v1/update/check`,{}),saveSettings:e=>j(`/v1/settings`,e,`PUT`),summary:(e=`today`,t)=>N(`/v1/stats/summary?range=${e}${t&&t!==`all`?`&agent=${t}`:``}`),daily:(e=30)=>N(`/v1/stats/daily?days=${e}`),premium:()=>N(`/v1/premium`),gemini:()=>N(`/v1/gemini`),askGemini:(e,t)=>j(`/v1/gemini/ask`,{prompt:e,model:t}),browse:(e=``)=>N(`/v1/browse${e?`?dir=${encodeURIComponent(e)}`:``}`),recentDirs:()=>N(`/v1/recent-dirs`),history:(e=`all`)=>N(`/v1/history?range=${e}`),enableHive:(e,t)=>j(`/v1/hive`,{hive:e??``,repo:t??``}),tasks:()=>N(`/v1/tasks`),task:e=>N(`/v1/tasks/${encodeURIComponent(e)}`),createTask:e=>j(`/v1/tasks`,e),approve:(e,t)=>j(`/v1/tasks/${encodeURIComponent(e)}/${t?`approve`:`reject`}`,{}),startOrchestrator:()=>j(`/v1/orchestrator/start`,{}),stopOrchestrator:()=>j(`/v1/orchestrator/stop`,{}),status:()=>N(`/v1/status`),spawn:e=>j(`/v1/agents`,e),signal:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/signal`,{action:t}),paste:(e,t)=>j(`/v1/paste`,{type:e,data:t}),agentInput:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/input`,{data:t})},oe=[{id:`macos`,label:`macOS`},{id:`linux`,label:`Linux`},{id:`windows`,label:`Windows`}],se={cmd:`caprock down && caprock up`,note:`The running daemon is the old binary until it restarts. Your database is untouched.`},F={cmd:`caprock status`,note:`Confirms the new version is the one running, and that hooks are still registered.`},ce={label:`Homebrew`,steps:[{cmd:`brew update && brew upgrade caprock`,note:`The update is not optional: without it Homebrew reads a cached copy of the tap, refreshed at most once a day, and reports "already installed" for a release that is already out.`},se,F]},le={label:`Scoop`,steps:[{cmd:`scoop update caprock`,note:`Scoop refreshes its buckets as part of this, so no separate step.`},se,F]},ue={label:`go install`,steps:[{cmd:`go install github.com/dspv/caprock/cmd/caprock@latest`,note:`Also install the hook shim: same command with cmd/caprock-hook.`},se,F]},de={label:`Downloaded binary`,steps:[{cmd:``,note:`Download the archive for your platform from the release page, and replace the caprock and caprock-hook binaries with the ones inside it.`},se,F]};function fe(e){switch(e){case`macos`:return[ce,ue,de];case`linux`:return[ce,ue,de];case`windows`:return[le,ue,de]}}function pe(e,t){let n=`${t??``} ${e}`.toLowerCase();return n.includes(`win`)?`windows`:n.includes(`mac`)||n.includes(`darwin`)||n.includes(`iphone`)||n.includes(`ipad`)?`macos`:`linux`}function me(e){if(e&&e.startsWith(`scoop`))return`windows`}function he(e,t){return e?ye(e,fe(t))===void 0:!1}var ge=`caprock-update-platform`;function _e(){try{let e=localStorage.getItem(ge);return oe.some(t=>t.id===e)?e:void 0}catch{return}}function ve(e){try{localStorage.setItem(ge,e)}catch{}}function ye(e,t){if(!e)return;let n=e.split(/\s+/)[0];if(n)return t.find(e=>e.steps.some(e=>e.cmd.startsWith(n)))}function I(e,t=[],n={}){let{live:r=!0,intervalMs:i=0}=n,a=p(400),[o,s]=(0,l.useState)({data:void 0,error:void 0,loading:!0,refresh:()=>{},loadedAt:0}),c=(0,l.useRef)(0),u=(0,l.useRef)(e);u.current=e;let d=(0,l.useCallback)(()=>{let e=++c.current;u.current().then(t=>{e===c.current&&s(e=>({...e,data:t,error:void 0,loading:!1,loadedAt:Date.now()}))},t=>{e===c.current&&s(e=>({...e,error:t,loading:!1}))})},[]);return(0,l.useEffect)(d,[d,...t]),(0,l.useEffect)(()=>{r&&a>0&&d()},[r,a,d]),(0,l.useEffect)(()=>{if(!i)return;let e=window.setInterval(d,i);return()=>window.clearInterval(e)},[i,d]),{...o,refresh:d}}var be=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=be()}))(),xe=[{label:`Pro`,kind:`flat`,usd:20,note:`$20/mo`},{label:`Max 5×`,kind:`flat`,usd:100,note:`$100/mo`},{label:`Max 20×`,kind:`flat`,usd:200,note:`$200/mo`},{label:`Team seat`,kind:`flat`,usd:30,note:`$30/seat/mo`},{label:`API / Bedrock`,kind:`metered`,usd:0,note:`billed per token`}],Se,Ce=null,we=new Set;function Te(){for(let e of we)e()}function Ee(){let[,e]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let t=()=>e(e=>e+1);return we.add(t),!Se&&!Ce&&(Ce=P.settings().then(e=>{Se=e}).catch(()=>{Se={update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0}}).finally(()=>{Ce=null,Te()})),()=>{we.delete(t)}},[]),[Se,e=>{Se=e,Te(),P.saveSettings(e).catch(()=>{})}]}function De({plan:e,onSave:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let a=e?.plan_kind?e.plan_kind===`metered`?e.plan_label||`API`:`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`set plan`;return(0,L.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,L.jsx)(`button`,{onClick:()=>r(e=>!e),className:`mono text-[11px] px-1.5 py-0.5 rounded-sm border ${e?.plan_kind?`border-border text-fg-muted hover:text-fg`:`border-accent/50 text-accent`}`,title:`How you pay for Claude Code — Caprock cannot detect this, so you tell it`,children:a}),n&&(0,L.jsx)(Oe,{plan:e,onSave:e=>{t(e),r(!1)}})]})}function Oe({plan:e,onSave:t}){let[n,r]=(0,l.useState)(String(e?.plan_usd_per_month||``)),i=e??{update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0};return(0,L.jsxs)(`div`,{className:`absolute right-0 top-7 z-20 w-[268px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg p-2`,children:[(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted px-1 pb-1.5`,children:`How do you pay for Claude Code? Caprock can't detect this and never guesses.`}),xe.map(n=>{let r=e?.plan_label===n.label;return(0,L.jsxs)(`button`,{onClick:()=>t({...i,plan_kind:n.kind,plan_label:n.label,plan_usd_per_month:n.usd}),className:`w-full flex items-baseline gap-2 px-1.5 py-1 rounded-sm text-left text-[12px] hover:bg-panel-2 ${r?`text-accent`:`text-fg`}`,children:[(0,L.jsx)(`span`,{children:n.label}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint ml-auto`,children:n.note})]},n.label)}),(0,L.jsxs)(`div`,{className:`border-t border-border mt-1.5 pt-1.5 px-1.5`,children:[(0,L.jsx)(`label`,{className:`text-[11px] text-fg-faint`,children:`Or a different monthly price`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] text-fg-faint`,children:`$`}),(0,L.jsx)(`input`,{className:`input`,inputMode:`decimal`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. 150`}),(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-1 rounded-sm hover:border-border-strong`,onClick:()=>{let e=Number(n);!Number.isFinite(e)||e<0||t({...i,plan_kind:`flat`,plan_label:`plan`,plan_usd_per_month:e})},children:`set`})]})]})]})}var ke=[{id:`bug`,label:`bug`,hint:`What did you see?`,gh:`bug`},{id:`feature`,label:`feature`,hint:`What would you want?`,gh:`enhancement`},{id:`unclear`,label:`unclear`,hint:`What did not make sense?`,gh:`question`},{id:`other`,label:`other`,hint:`Anything else — a sentence is enough.`,gh:`question`}],Ae=`dspv/caprock`;function je(e,t){if(!e)return[`Screen: ${t}`];let n=e.hooks,r=n?(n.missing?.length??0)>0?`partly installed`:n.shim_exists?`installed`:`not installed`:`unknown`;return[`Caprock ${e.version}${e.platform?` (${e.platform})`:``}`,`Screen: ${t}`,`${e.events.toLocaleString(`en-US`)} events${e.owned_active?` · ${e.owned_active} owned session(s) running`:``}`,`Hooks: ${r} · Orchestration: ${e.orchestration?`on`:`off`}`]}function Me(e,t,n){let r=n.trim().split(` +`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,a);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=_t(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);vt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ue.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=_t(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=_t(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=_t(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Lt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),vt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Lt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,vt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),vt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,vt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),vt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=new class{state={conn:`connecting`,lastFrameAt:0,tick:0,alerts:[]};listeners=new Set;backoff=500;timer=null;started=!1;frameSubs=new Set;getState=()=>this.state;subscribe=e=>(this.listeners.add(e),this.start(),()=>{this.listeners.delete(e)});onFrame=e=>(this.frameSubs.add(e),()=>{this.frameSubs.delete(e)});set(e){this.state={...this.state,...e};for(let e of this.listeners)e()}start(){this.started||typeof WebSocket>`u`||(this.started=!0,this.connect())}connect(){let e=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/v1/live`;this.set({conn:`connecting`});let t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.onopen=()=>{this.backoff=500,this.set({conn:`open`})},t.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}this.handle(t)},t.onclose=()=>{this.set({conn:`closed`}),this.scheduleReconnect()},t.onerror=()=>{t.close()}}scheduleReconnect(){this.timer===null&&(this.timer=window.setTimeout(()=>{this.timer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,1e4))}handle(e){let t=Date.now();for(let t of this.frameSubs)try{t(e)}catch(e){console.error(`[caprock] live frame subscriber failed`,e)}switch(e.type){case`alert`:this.set({lastFrameAt:t,alerts:[e.data,...this.state.alerts.filter(t=>t.session_id!==e.data.session_id)].slice(0,50),tick:this.state.tick+1});break;case`event`:this.set({lastFrameAt:t,lastEvent:e.data,tick:this.state.tick+1});break;case`session`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;case`task`:this.set({lastFrameAt:t,tick:this.state.tick+1});break;default:this.set({lastFrameAt:t})}}dismissAlert(e){this.set({alerts:this.state.alerts.filter(t=>t.session_id!==e)})}};function f(){return(0,l.useSyncExternalStore)(d.subscribe,d.getState,d.getState)}function p(e=400){let{tick:t}=f(),[n,r]=m(t,e);return(0,l.useEffect)(()=>{r(t)},[t,r]),n}function m(e,t){let[n,r]=(0,l.useState)(e),i=(0,l.useRef)(null),a=(0,l.useRef)(e);return[n,(0,l.useCallback)(e=>{a.current=e,i.current===null&&(i.current=window.setTimeout(()=>{i.current=null,r(a.current)},t))},[t])]}function h(e){let[t,n]=e.replace(/^#\/?/,``).split(`?`),r=(t??``).split(`/`).filter(Boolean),i=new URLSearchParams(n??``),a=i.get(`tab`)??void 0,o=Number(i.get(`at`)),s=Number.isFinite(o)&&o>0?o:void 0;switch(r[0]){case void 0:case``:case`now`:return{name:`now`};case`session`:return r[1]?{name:`session`,id:decodeURIComponent(r[1]),tab:a,at:s}:{name:`now`};case`cost`:return{name:`cost`};case`history`:return{name:`history`};case`tasks`:return{name:`tasks`};case`graph`:return{name:`graph`};case`notes`:return{name:`notes`};case`settings`:return{name:`settings`};default:return{name:`now`}}}function g(e){switch(e.name){case`now`:return`#/`;case`session`:{let t=new URLSearchParams;e.tab&&t.set(`tab`,e.tab),e.at&&t.set(`at`,String(e.at));let n=t.toString();return`#/session/${encodeURIComponent(e.id)}${n?`?${n}`:``}`}case`cost`:return`#/cost`;case`history`:return`#/history`;case`tasks`:return`#/tasks`;case`graph`:return`#/graph`;case`notes`:return`#/notes`;case`settings`:return`#/settings`}}function _(){let[e,t]=(0,l.useState)(()=>h(location.hash));return(0,l.useEffect)(()=>{let e=()=>t(h(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(e){location.hash=g(e)}var y=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),b=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:4,maximumFractionDigits:4});function x(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function S(e){return x(e)===null?`—`:(e=e,e!==0&&Math.abs(e)<.01?b.format(e):y.format(e))}function C(e){if(x(e)===null)return`—`;e=e;let t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e4?`${(e/1e3).toFixed(1)}k`:new Intl.NumberFormat(`en-US`).format(e)}function w(e,t=0){if(x(e)===null)return`—`;let n=e;if(t===0){let e=Math.floor(n);return`${Number.isFinite(e)?e:0}%`}let r=Math.min(100,Math.max(0,Math.trunc(x(t)??0)));return`${e.toFixed(r)}%`}function T(e,t=Date.now()){if(!e)return`—`;let n=typeof e==`number`?e:Date.parse(e);if(Number.isNaN(n))return`—`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<5)return`now`;if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<48?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ee(e){if(x(e)===null)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function E(e){return e.length>8?e.slice(0,8):e}function D(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.slice(n+1):t}function te(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t?`${t[1]}·${t[2]}`:e}function ne(e){return e.replace(/-\d{6,}$/,`…`)}function re(e){let[t,n]=(0,l.useState)(()=>Date.now());return(0,l.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e);return()=>window.clearInterval(t)},[e]),t}var ie=`caprock-theme`;function O(){let e=localStorage.getItem(ie);return e===`dark`||e===`light`?e:window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function k(e){document.documentElement.setAttribute(`data-theme`,e),document.documentElement.style.colorScheme=e}function A(){let[e,t]=(0,l.useState)(O);return(0,l.useEffect)(()=>{k(e),localStorage.setItem(ie,e)},[e]),[e,()=>t(e=>e===`dark`?`light`:`dark`)]}async function j(e,t,n=`POST`){let r=await fetch(e,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok){let e;try{e=await r.json()}catch{}throw new M(r.status,`${r.status} ${r.statusText}`,e)}return r.status===204?void 0:await r.json()}var M=class extends Error{status;body;constructor(e,t,n){super(t),this.status=e,this.body=n}};function ae(e){if(e instanceof M){let t=e.body,n=t?.error??e.message;return t?.detail?`${n} — ${t.detail}`:n}return e instanceof Error?e.message:String(e)}async function N(e){let t=await fetch(e,{headers:{Accept:`application/json`}});if(!t.ok){let e;try{e=await t.json()}catch{}throw new M(t.status,`${t.status} ${t.statusText}`,e)}return await t.json()}var P={sessions:(e=!1)=>N(`/v1/sessions${e?`?active=true`:``}`),session:e=>N(`/v1/sessions/${encodeURIComponent(e)}`),events:(e,t=0,n=500)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?after=${t}&limit=${n}`),eventsBefore:(e,t,n=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?before=${t}&limit=${n}`),recentEvents:(e,t=2e3)=>N(`/v1/sessions/${encodeURIComponent(e)}/events?newest=1&limit=${t}`),diff:e=>N(`/v1/sessions/${encodeURIComponent(e)}/diff`),notes:(e,t=200)=>N(`/v1/sessions/${encodeURIComponent(e)}/notes?limit=${t}`),searchNotes:(e,t=100,n=0)=>N(`/v1/notes?q=${encodeURIComponent(e)}&limit=${t}${n?`&before=${n}`:``}`),settings:()=>N(`/v1/settings`),update:()=>N(`/v1/update`),checkUpdate:()=>j(`/v1/update/check`,{}),saveSettings:e=>j(`/v1/settings`,e,`PUT`),summary:(e=`today`,t)=>N(`/v1/stats/summary?range=${e}${t&&t!==`all`?`&agent=${t}`:``}`),daily:(e=30)=>N(`/v1/stats/daily?days=${e}`),premium:()=>N(`/v1/premium`),gemini:()=>N(`/v1/gemini`),askGemini:(e,t)=>j(`/v1/gemini/ask`,{prompt:e,model:t}),browse:(e=``)=>N(`/v1/browse${e?`?dir=${encodeURIComponent(e)}`:``}`),recentDirs:()=>N(`/v1/recent-dirs`),history:(e=`all`)=>N(`/v1/history?range=${e}`),enableHive:(e,t)=>j(`/v1/hive`,{hive:e??``,repo:t??``}),tasks:()=>N(`/v1/tasks`),task:e=>N(`/v1/tasks/${encodeURIComponent(e)}`),createTask:e=>j(`/v1/tasks`,e),approve:(e,t)=>j(`/v1/tasks/${encodeURIComponent(e)}/${t?`approve`:`reject`}`,{}),startOrchestrator:()=>j(`/v1/orchestrator/start`,{}),stopOrchestrator:()=>j(`/v1/orchestrator/stop`,{}),status:()=>N(`/v1/status`),spawn:e=>j(`/v1/agents`,e),signal:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/signal`,{action:t}),paste:(e,t)=>j(`/v1/paste`,{type:e,data:t}),agentInput:(e,t)=>j(`/v1/agents/${encodeURIComponent(e)}/input`,{data:t})},oe=[{id:`macos`,label:`macOS`},{id:`linux`,label:`Linux`},{id:`windows`,label:`Windows`}],se={cmd:`caprock down && caprock up`,note:`The running daemon is the old binary until it restarts. Your database is untouched.`},F={cmd:`caprock status`,note:`Confirms the new version is the one running, and that hooks are still registered.`},ce={label:`Homebrew`,steps:[{cmd:`brew update && brew upgrade caprock`,note:`The update is not optional: without it Homebrew reads a cached copy of the tap, refreshed at most once a day, and reports "already installed" for a release that is already out.`},se,F]},le={label:`Scoop`,steps:[{cmd:`scoop update caprock`,note:`Scoop refreshes its buckets as part of this, so no separate step.`},se,F]},ue={label:`go install`,steps:[{cmd:`go install github.com/dspv/caprock/cmd/caprock@latest`,note:`Also install the hook shim: same command with cmd/caprock-hook.`},se,F]},de={label:`Downloaded binary`,steps:[{cmd:``,note:`Download the archive for your platform from the release page, and replace the caprock and caprock-hook binaries with the ones inside it.`},se,F]};function fe(e){switch(e){case`macos`:return[ce,ue,de];case`linux`:return[ce,ue,de];case`windows`:return[le,ue,de]}}function pe(e,t){let n=`${t??``} ${e}`.toLowerCase();return n.includes(`win`)?`windows`:n.includes(`mac`)||n.includes(`darwin`)||n.includes(`iphone`)||n.includes(`ipad`)?`macos`:`linux`}function me(e){if(e&&e.startsWith(`scoop`))return`windows`}function he(e,t){return e?ye(e,fe(t))===void 0:!1}var ge=`caprock-update-platform`;function _e(){try{let e=localStorage.getItem(ge);return oe.some(t=>t.id===e)?e:void 0}catch{return}}function ve(e){try{localStorage.setItem(ge,e)}catch{}}function ye(e,t){if(!e)return;let n=e.split(/\s+/)[0];if(n)return t.find(e=>e.steps.some(e=>e.cmd.startsWith(n)))}function I(e,t=[],n={}){let{live:r=!0,intervalMs:i=0}=n,a=p(400),[o,s]=(0,l.useState)({data:void 0,error:void 0,loading:!0,refresh:()=>{},loadedAt:0}),c=(0,l.useRef)(0),u=(0,l.useRef)(e);u.current=e;let d=(0,l.useCallback)(()=>{let e=++c.current;u.current().then(t=>{e===c.current&&s(e=>({...e,data:t,error:void 0,loading:!1,loadedAt:Date.now()}))},t=>{e===c.current&&s(e=>({...e,error:t,loading:!1}))})},[]);return(0,l.useEffect)(d,[d,...t]),(0,l.useEffect)(()=>{r&&a>0&&d()},[r,a,d]),(0,l.useEffect)(()=>{if(!i)return;let e=window.setInterval(d,i);return()=>window.clearInterval(e)},[i,d]),{...o,refresh:d}}var be=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=be()}))(),xe=[{label:`Pro`,kind:`flat`,usd:20,note:`$20/mo`},{label:`Max 5×`,kind:`flat`,usd:100,note:`$100/mo`},{label:`Max 20×`,kind:`flat`,usd:200,note:`$200/mo`},{label:`Team seat`,kind:`flat`,usd:30,note:`$30/seat/mo`},{label:`API / Bedrock`,kind:`metered`,usd:0,note:`billed per token`}],Se,Ce=null,we=new Set;function Te(){for(let e of we)e()}function Ee(){let[,e]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let t=()=>e(e=>e+1);return we.add(t),!Se&&!Ce&&(Ce=P.settings().then(e=>{Se=e}).catch(()=>{Se={update_checks:!1,plan_kind:``,plan_label:``,plan_usd_per_month:0}}).finally(()=>{Ce=null,Te()})),()=>{we.delete(t)}},[]),[Se,e=>{Se={...Se??{},...e},Te(),P.saveSettings(e).catch(()=>{})}]}function De({plan:e,onSave:t}){let[n,r]=(0,l.useState)(!1),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let a=e?.plan_kind?e.plan_kind===`metered`?e.plan_label||`API`:`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`set plan`;return(0,L.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,L.jsx)(`button`,{onClick:()=>r(e=>!e),className:`mono text-[11px] px-1.5 py-0.5 rounded-sm border ${e?.plan_kind?`border-border text-fg-muted hover:text-fg`:`border-accent/50 text-accent`}`,title:`How you pay for Claude Code — Caprock cannot detect this, so you tell it`,children:a}),n&&(0,L.jsx)(Oe,{plan:e,onSave:e=>{t(e),r(!1)}})]})}function Oe({plan:e,onSave:t}){let[n,r]=(0,l.useState)(String(e?.plan_usd_per_month||``));return(0,L.jsxs)(`div`,{className:`absolute right-0 top-7 z-20 w-[268px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg p-2`,children:[(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted px-1 pb-1.5`,children:`How do you pay for Claude Code? Caprock can't detect this and never guesses.`}),xe.map(n=>{let r=e?.plan_label===n.label;return(0,L.jsxs)(`button`,{onClick:()=>t({plan_kind:n.kind,plan_label:n.label,plan_usd_per_month:n.usd}),className:`w-full flex items-baseline gap-2 px-1.5 py-1 rounded-sm text-left text-[12px] hover:bg-panel-2 ${r?`text-accent`:`text-fg`}`,children:[(0,L.jsx)(`span`,{children:n.label}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint ml-auto`,children:n.note})]},n.label)}),(0,L.jsxs)(`div`,{className:`border-t border-border mt-1.5 pt-1.5 px-1.5`,children:[(0,L.jsx)(`label`,{className:`text-[11px] text-fg-faint`,children:`Or a different monthly price`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] text-fg-faint`,children:`$`}),(0,L.jsx)(`input`,{className:`input`,inputMode:`decimal`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. 150`}),(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-1 rounded-sm hover:border-border-strong`,onClick:()=>{let e=Number(n);!Number.isFinite(e)||e<0||t({plan_kind:`flat`,plan_label:`plan`,plan_usd_per_month:e})},children:`set`})]})]})]})}var ke=[{id:`bug`,label:`bug`,hint:`What did you see?`,gh:`bug`},{id:`feature`,label:`feature`,hint:`What would you want?`,gh:`enhancement`},{id:`unclear`,label:`unclear`,hint:`What did not make sense?`,gh:`question`},{id:`other`,label:`other`,hint:`Anything else — a sentence is enough.`,gh:`question`}],Ae=`dspv/caprock`;function je(e,t){if(!e)return[`Screen: ${t}`];let n=e.hooks,r=n?(n.missing?.length??0)>0?`partly installed`:n.shim_exists?`installed`:`not installed`:`unknown`;return[`Caprock ${e.version}${e.platform?` (${e.platform})`:``}`,`Screen: ${t}`,`${e.events.toLocaleString(`en-US`)} events${e.owned_active?` · ${e.owned_active} owned session(s) running`:``}`,`Hooks: ${r} · Orchestration: ${e.orchestration?`on`:`off`}`]}function Me(e,t,n){let r=n.trim().split(` `)[0]?.trim()??``;return`[${e}] ${t}: ${r.length>60?`${r.slice(0,57)}…`:r}`}function Ne(e,t,n){let r=e===`bug`?`What happened`:e===`feature`?`What is missing`:e===`unclear`?`What is unclear`:`Feedback`,i=t.trim(),a=i.length>6e3?`${i.slice(0,Fe)}\n\n_[…truncated — the rest did not fit in the link; paste it below]_`:i;return[`### ${r}`,``,a,``,`### Context`,``,...n.map(e=>`- ${e}`),``,`Filed from the Caprock dashboard. Nothing was sent automatically — this issue was opened in your browser for you to review.`].join(` -`)}function Pe(e,t,n,r){let i=ke.find(t=>t.id===e)??ke[0];return`https://github.com/${Ae}/issues/new?${new URLSearchParams({title:Me(e,t,n),body:Ne(e,n,r),labels:i.gh}).toString()}`}var Fe=6e3;function Ie(e){return e.trim().length>=8}function Le({screen:e}){let[t,n]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,title:`Report a bug, ask for something, or say what was unclear`,children:`feedback`}),t&&(0,L.jsx)(Re,{screen:e,onClose:()=>n(!1)})]})}function Re({screen:e,onClose:t}){let[n,r]=(0,l.useState)(`bug`),[i,a]=(0,l.useState)(``),o=je(I(()=>P.status(),[],{live:!1,intervalMs:0}).data,e),s=Ie(i),c=ke.find(e=>e.id===n)??ke[0],u=()=>{s&&(window.open(Pe(n,e,i,o),`_blank`,`noopener`),t())};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[12vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[660px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Tell us what happened`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,L.jsx)(`div`,{className:`flex gap-1.5`,children:ke.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.id),className:`text-[13px] px-3.5 py-1.5 rounded-sm border font-mono ${e.id===n?`border-accent/60 bg-accent/10 text-accent`:`border-border text-fg-muted hover:text-fg`}`,children:e.label},e.id))}),(0,L.jsx)(`textarea`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:c.hint,rows:6,className:`input w-full resize-y text-[14px] leading-relaxed`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&u()}}),(0,L.jsxs)(`div`,{className:`border border-border rounded-sm bg-panel-2/50 px-3 py-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:`Attached`}),(0,L.jsx)(`ul`,{className:`text-[11px] text-fg-muted num grid gap-0.5`,children:o.map(e=>(0,L.jsx)(`li`,{children:e},e))})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:u,disabled:!s,className:`text-[12px] px-3 py-1.5 rounded-sm border ${s?`border-accent/50 bg-accent/10 text-accent hover:bg-accent/20`:`border-border text-fg-faint cursor-not-allowed`}`,children:`Open a GitHub issue →`}),(0,L.jsx)(`span`,{className:`text-[12px] ${s?`text-fg-faint`:`text-fg-muted`}`,children:s?`⌘↵ to open`:`One sentence is enough.`})]}),(0,L.jsx)(`p`,{className:`text-[11px] text-fg-faint leading-relaxed`,children:`Nothing is sent from here — the issue opens prefilled in your browser for you to submit.`})]})]})})}var ze=1200,Be=630;function Ve(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}var He={command:`running commands`,edit:`writing code`,read:`reading code`,mcp:`MCP tools`,web:`web research`,other:`other tools`,none:`no tool call`};function Ue(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/^claude-/,``).replace(/-\d{8}$/,``).slice(0,18)}function We(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function Ge(e,t){let n=Ve(`--color-bg`,`#141414`),r=Ve(`--color-panel`,`#1a1a19`),i=Ve(`--color-border`,`#2a2a28`),a=Ve(`--color-fg`,`#e8e6e2`),o=Ve(`--color-fg-muted`,`#a9a59e`),s=Ve(`--color-fg-faint`,`#6f6b64`),c=Ve(`--color-accent`,`#feb157`),l=Ve(`--color-ok`,`#7fc99a`),u=`"JetBrains Mono", ui-monospace, monospace`,d=`"Hanken Grotesk", ui-sans-serif, system-ui, sans-serif`;e.fillStyle=n,e.fillRect(0,0,ze,Be);let f=(t,n,r,i,a=12)=>{e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()},p=(t,n,a,o)=>{f(t,n,a,o),e.fillStyle=r,e.fill(),e.strokeStyle=i,e.lineWidth=1,e.stroke()},m=(t,n,r,i,a,o=d,s=400,c=`left`)=>{e.fillStyle=a,e.font=`${s} ${i}px ${o}`,e.textAlign=c,e.fillText(r,t,n)};e.font=`600 32px ${d}`;let h=`My stats on`,g=e.measureText(` `).width,_=e.measureText(h).width;m(64,78,h,32,a,d,600);let v=64+_+g;m(v,78,`caprock.dev`,32,c,d,600);let y=e.measureText(`caprock.dev`).width,b=t.takenAt.toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`});m(v+y+g*2,78,`– ${b}`,26,s,d,600),[[`TODAY`,S(t.today.cost),`${t.today.sessions} sessions`,c],[`THIS WEEK`,S(t.week.cost),`${t.week.sessions} sessions`,a],[`THIS MONTH`,S(t.month.cost),`${We(t.month.tokens)} tokens`,a],[`ALL TIME`,S(t.allTime.cost),`${t.allTime.days} active days`,c],[`A DAY`,S(t.allTime.cost/Math.max(1,t.allTime.days)),`on average`,a],[`TOKENS`,We(t.allTime.tokens),`all time`,a],[`PER 1M TOKENS`,S(t.allTime.cost/Math.max(1,t.allTime.tokens/1e6)),`what a million costs`,a],[`CACHE HIT`,`${Math.round(t.cacheHitPct)}%`,`input cost cut`,l]].forEach(([e,t,n,r],i)=>{let a=64+i%4*272,c=130+Math.floor(i/4)*114;p(a,c,256,98),m(a+20,c+30,e,13,s,u),m(a+20,c+56,t,28,r,d,600),m(a+20,c+81,n,14,o)});let x=(t,n,r,i)=>{let l=44+r.length*26+12;p(t,n,524,l),m(t+20,n+30,i,13,s,u);let d=Math.max(...r.map(e=>e.cost),1),h=r.reduce((e,t)=>e+t.cost,0),g=t+170;return r.forEach((r,i)=>{let l=n+62+i*26;m(t+20,l,r.label,14,o,u),e.fillStyle=c,e.globalAlpha=.85;let p=Math.max(2,164*(r.cost/d));f(g,l-10,p,10,Math.min(3,p/2)),e.fill(),e.globalAlpha=1,m(t+524-62,l,S(r.cost),14,a,u,400,`right`);let _=h>0?Math.max(1,Math.floor(100*r.cost/h)):0;m(t+524-20,l,`${_}%`,14,s,u,400,`right`)}),l},C=x(64,372,t.models,`WHERE THE MONEY WENT`);x(612,372,t.work,`WHAT IT WENT ON`);let w=372+C+34;m(64,w,`at API list prices — not a bill, and not money saved`,14,s),m(1136,w,`What's yours?`,15,c,d,600,`right`),e.textAlign=`left`}function Ke(e=new Date){let t=e=>String(e).padStart(2,`0`);return`caprock-${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}.png`}async function qe(){let[e,t,n,r]=await Promise.all([P.summary(`today`),P.summary(`7d`),P.summary(`30d`),P.history(`all`)]),i=e=>e.tokens_in+e.tokens_out+e.cache_read+e.cache_write;return{takenAt:new Date,today:{cost:e.cost_usd,sessions:e.sessions},week:{cost:t.cost_usd,sessions:t.sessions},month:{cost:n.cost_usd,tokens:i(n)},allTime:{cost:r.totals.cost_usd,days:r.totals.days,tokens:i(r.summary)},cacheHitPct:(n.savings?.hit_rate??0)*100,models:(n.models??[]).slice(0,5).map(e=>({label:Ue(e.model),cost:e.cost_usd})),work:(n.work??[]).slice(0,5).map(e=>({label:He[e.kind]??e.kind,cost:e.cost_usd}))}}async function Je(e){let t=document.createElement(`canvas`);t.width=ze,t.height=Be;let n=null;try{n=t.getContext(`2d`)}catch{return null}return n?(Ge(n,e),await new Promise(e=>{if(typeof t.toBlob!=`function`){e(null);return}t.toBlob(t=>e(t),`image/png`)})):null}function Ye(e){let t=`over ${e.days} active days`;return`${S(e.cost_usd)} of Claude Code ${t}, across ${e.sessions.toLocaleString(`en-US`)} sessions — measured on my own machine with Caprock. https://caprock.dev`}function Xe(){let[e,t]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>t(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2 py-0.5 text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of your figures`,children:`Share`}),e&&(0,L.jsx)(Ze,{onClose:()=>t(!1)})]})}function Ze({onClose:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=async()=>{let[e,t]=await Promise.all([qe(),P.history(`all`)]);return{blob:await Je(e),text:Ye(t.totals)}},c=async()=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t}=await s();if(!t){o(`Could not draw the card in this browser.`),i(!1);return}let r=new File([t],Ke(),{type:`image/png`});n(!1),await navigator.share({files:[r]}),e()}catch(e){e?.name!==`AbortError`&&o(`Sharing was not available — the card was not sent.`),i(!1)}finally{n(!1)}}},u=async e=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t,text:n}=await s();if(!t){o(`Could not draw the card in this browser.`);return}let r=URL.createObjectURL(t),i=document.createElement(`a`);if(i.href=r,i.download=Ke(),i.click(),URL.revokeObjectURL(r),e===`download`){o(`Saved to your downloads.`);return}let a=e===`x`?`https://x.com/intent/tweet?text=${encodeURIComponent(n)}`:`https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(n)}`;window.open(a,`_blank`,`noopener`),o(`Card saved and the post opened — drag the image in.`)}finally{n(!1),i(!1)}}},d=typeof navigator<`u`&&typeof navigator.canShare==`function`&&navigator.canShare({files:[new File([],`x.png`,{type:`image/png`})]});return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[14vh]`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":`Share your figures`,children:(0,L.jsxs)(`div`,{className:`w-[420px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-center border-b border-border px-4 py-3`,children:[(0,L.jsx)(`h2`,{className:`text-[13px] font-medium text-fg`,children:`Share your figures`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2.5`,children:[d&&(0,L.jsxs)(`button`,{onClick:c,disabled:r,className:`rounded-md border border-accent bg-accent/15 px-4 py-3 text-[14px] font-medium text-accent hover:bg-accent/25 disabled:opacity-50`,children:[t?`Drawing the card…`:`Send it somewhere`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] font-normal text-fg-muted`,children:`Opens your share menu — Messages, Mail, anywhere`})]}),(0,L.jsxs)(`button`,{onClick:()=>u(`download`),disabled:r,className:`rounded-md border border-border bg-transparent px-4 py-3 text-[14px] text-fg transition-colors hover:border-border-strong hover:bg-panel-2 disabled:opacity-50`,children:[t&&!d?`Drawing the card…`:`Save the image`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] text-fg-muted`,children:`A PNG in your downloads, to post wherever you like`})]})]}),(0,L.jsxs)(`ul`,{className:`mt-4 grid gap-1 text-[13px] text-fg-muted`,children:[(0,L.jsx)(`li`,{children:`Totals only — no names, no paths, nothing Claude wrote.`}),(0,L.jsx)(`li`,{children:`Drawn on your machine. Uploaded nowhere.`})]}),a&&(0,L.jsx)(`p`,{className:`mt-2 text-[12px] text-fg-muted`,children:a})]})]})})}function Qe(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),[t,n]=(0,l.useState)(!1),r=e.data?.totals;return!r||r.sessions===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1 text-[12px] text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of these figures`,children:`Share these numbers`}),t&&(0,L.jsx)(Ze,{onClose:()=>n(!1)})]})}var $e={cap:{title:`A daily cap that pauses sessions`,body:`A number for the day. Cross it and Caprock stops its own sessions.`,points:[`A runaway loop stops at $40 instead of finishing at $400`,`It happens while you are asleep, not in tomorrow’s summary`,`Your own sessions are never touched — only the ones Caprock started`]},gemini:{title:`Ask Gemini, on your own key`,body:`A second model inside Caprock, paid for by you, at Google’s prices.`,points:[`Ask about your own sessions without leaving the dashboard`,`What it costs is counted and shown beside your Claude spend`,`Caprock never stores the key — it reads it from your environment`],setup:`Set GEMINI_API_KEY in the daemon’s environment and restart it. Google bills you directly.`},report:{title:`A weekly report, sent where you are`,body:`Monday morning, before you open a terminal.`,points:[`What moved: the repository that cost 3× its usual week`,`Last week against the one before it, per repository and model`,`Through your own Telegram bot — nothing passes our server`],setup:`Setup: one message to BotFather, about two minutes.`}};function et({p:e,onClose:t}){return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsxs)(`a`,{href:e.yearly.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium/75 px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:bg-premium`,children:[`$`,e.yearly.charged_usd,` / year`]}),(0,L.jsxs)(`a`,{href:e.lifetime?.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium-strong px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:brightness-110`,children:[`$`,e.lifetime?.charged_usd,` once`]})]}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-center text-[11px] leading-snug text-fg-faint`,children:[(0,L.jsx)(`span`,{children:`Every Premium feature, renews yearly`}),(0,L.jsx)(`span`,{children:`Every Premium feature, now and future — no renewal`})]})]}):(0,L.jsx)(`div`,{className:`h-[92px] text-[13px] text-fg-faint`,children:`…`})}function tt({feature:e,onClose:t}){let n=I(()=>P.premium(),[]).data,r=$e[e];return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[12vh]`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Caprock Premium`,children:(0,L.jsxs)(`div`,{className:`w-[440px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-premium-strong`,children:`Caprock Premium`}),(0,L.jsx)(`h2`,{className:`mt-1 text-[16px] font-medium leading-snug text-fg`,children:r.title})]}),(0,L.jsx)(`button`,{onClick:t,className:`-mr-1 ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-5 pt-3`,children:[(0,L.jsx)(`p`,{className:`text-[13px] leading-relaxed text-fg-muted`,children:r.body}),(0,L.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:r.points.map(e=>(0,L.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-fg`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-premium-strong`,children:`·`}),(0,L.jsx)(`span`,{children:e})]},e))}),r.setup&&(0,L.jsx)(`p`,{className:`mt-2.5 text-[12px] text-fg-faint`,children:r.setup})]}),(0,L.jsx)(`div`,{className:`mt-4 border-t border-border px-5 py-4`,children:(0,L.jsx)(et,{p:n,onClose:t})}),(0,L.jsx)(`footer`,{className:`border-t border-border px-5 py-3 text-[12px]`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`a`,{href:n?.info_url??`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`whitespace-nowrap text-fg-muted no-underline hover:text-fg`,children:`Read more`}),(0,L.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:`opens a new tab`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`Close`})]})}),(0,L.jsx)(`p`,{className:`border-t border-border px-5 py-2.5 text-[11px] leading-relaxed text-fg-faint`,children:`Everything Caprock does now stays free and Apache-2.0 — Premium only ever adds.`})]})})}function nt(){let[e,t]=(0,l.useState)(!1),n=I(()=>P.premium(),[],{live:!1,intervalMs:3e5});if(!n.data?.yearly?.url)return null;if(n.data.license?.active)return(0,L.jsx)(`span`,{className:`text-premium-strong`,children:`premium`});let r=n.data;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center overflow-hidden rounded-sm border border-premium/60`,children:[(0,L.jsxs)(`a`,{href:r.yearly.url,target:`_blank`,rel:`noreferrer`,className:`bg-premium px-2 py-0.5 text-white no-underline hover:brightness-110`,children:[`premium $`,r.yearly.charged_usd,`/yr`]}),(0,L.jsx)(`button`,{onClick:()=>t(!0),"aria-label":`What Premium includes`,title:`What Premium includes`,className:`px-1.5 py-0.5 text-premium-strong hover:bg-premium/10`,children:`›`})]}),e&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>t(!1)})]})}var rt=`https://github.com/dspv/caprock`,it=`https://caprock.dev/teams`,at=`https://caprock.dev/premium`,ot=`caprock.footer.starred`;function st(){let[e,t]=(0,l.useState)(()=>localStorage.getItem(ot)===`1`);return(0,L.jsx)(`footer`,{className:`mt-6 border-t border-border`,children:(0,L.jsxs)(`div`,{className:`max-w-[1600px] mx-auto px-3 py-4 flex flex-wrap items-center gap-x-6 gap-y-3 text-[11px] text-fg-faint`,children:[(0,L.jsxs)(`a`,{href:it,target:`_blank`,rel:`noreferrer`,className:`group inline-flex items-center gap-2 no-underline`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted group-hover:text-fg`,children:`Want this for your team?`}),(0,L.jsx)(`span`,{className:`text-accent group-hover:text-accent-strong`,children:`Caprock for Teams →`})]}),(0,L.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-4`,children:[(0,L.jsx)(`a`,{href:at,target:`_blank`,rel:`noreferrer`,className:`text-fg-muted hover:text-fg no-underline`,title:`A daily spend cap — Caprock pauses its own sessions when the day passes a limit you set`,children:`premium`}),!e&&(0,L.jsx)(`a`,{href:rt,target:`_blank`,rel:`noreferrer`,onClick:()=>{localStorage.setItem(ot,`1`),t(!0)},className:`text-fg-faint hover:text-fg no-underline`,title:`Opens GitHub in a new tab`,children:`★ star on GitHub`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/blog`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`blog`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/docs`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`docs`})]})]})})}var ct=[{route:{name:`now`},label:`Now`},{route:{name:`cost`},label:`Cost`},{route:{name:`history`},label:`Lifetime`},{route:{name:`notes`},label:`Answers`},{route:{name:`tasks`},label:`Tasks`}];function lt(e){switch(e.name){case`now`:return`Now`;case`session`:return`Session detail`;case`cost`:return`Cost`;case`history`:return`Lifetime`;case`tasks`:return`Tasks`;case`graph`:return`Graph`;case`notes`:return`Answers`;case`settings`:return`Status`}}function ut({route:e,children:t}){let n=f(),[r,i]=Ee(),a=t=>t.name===e.name||t.name===`now`&&e.name===`session`;return(0,L.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,L.jsxs)(`header`,{className:`h-10 border-b border-border bg-panel flex items-center px-3 gap-4 sticky top-0 z-10`,children:[(0,L.jsxs)(`a`,{href:`#/`,className:`flex items-center gap-2 text-fg no-underline hover:no-underline`,children:[(0,L.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 32 32`,"aria-hidden":!0,children:[(0,L.jsx)(`path`,{d:`M6 22 L16 8 L26 22 Z`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`3`,strokeLinejoin:`round`}),(0,L.jsx)(`rect`,{x:`6`,y:`22`,width:`20`,height:`3`,fill:`var(--color-accent)`})]}),(0,L.jsx)(`span`,{className:`font-medium tracking-wide text-[13px]`,children:`caprock`}),(0,L.jsx)(`span`,{className:`text-fg-faint text-[11px] hidden sm:inline`,children:`mission control`})]}),(0,L.jsx)(`nav`,{className:`inline-flex items-center gap-0.5 ml-2 rounded-md bg-panel-2 p-0.5`,children:ct.map(e=>(0,L.jsxs)(`a`,{href:g(e.route),"aria-current":a(e.route)?`page`:void 0,className:`px-2.5 py-1 rounded-[5px] text-[12px] no-underline hover:no-underline transition-colors ${a(e.route)?`bg-accent text-panel font-medium`:`text-fg hover:text-accent`}`,children:[e.label,e.phase&&(0,L.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wider text-fg-faint`,children:e.phase})]},e.label))}),(0,L.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-fg-muted`,children:[(0,L.jsx)(Xe,{}),(0,L.jsx)(nt,{}),(0,L.jsx)(Le,{screen:lt(e)}),(0,L.jsx)(ft,{state:n.conn,lastFrameAt:n.lastFrameAt}),(0,L.jsx)(De,{plan:r,onSave:i}),(0,L.jsx)(dt,{}),(0,L.jsx)(pt,{}),(0,L.jsx)(`a`,{href:`#/settings`,className:`text-fg-muted hover:text-fg no-underline`,children:`status`})]})]}),(0,L.jsx)(`main`,{className:`flex-1 p-3 max-w-[1600px] w-full mx-auto`,children:t}),(0,L.jsx)(st,{})]})}function dt(){let[e,t]=A(),n=e===`dark`;return(0,L.jsx)(`button`,{type:`button`,onClick:t,title:n?`Switch to light theme`:`Switch to dark theme`,"aria-label":n?`Switch to light theme`:`Switch to dark theme`,className:`text-fg-muted hover:text-fg inline-flex items-center`,children:n?(0,L.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M19.1 4.9l-1.4 1.4M6.3 17.7l-1.4 1.4`})]}):(0,L.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,L.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})})})}function ft({state:e,lastFrameAt:t}){let n=re(1e3),r=e===`open`?`bg-ok`:e===`connecting`?`bg-warn`:`bg-danger`,i=e===`open`?`live · ${t?T(t,n):`connected`}`:e===`connecting`?`connecting…`:`disconnected — reconnecting`;return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:e===`open`?`Connected to the daemon. The time is when it last sent anything — on an idle machine that keeps counting up, which is normal.`:`WebSocket /v1/live`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${r}`}),(0,L.jsx)(`span`,{className:`num`,children:i})]})}function pt(){let e=I(()=>P.status(),[],{live:!1,intervalMs:6e4}),t=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:6e4}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=e.data?.version;if(!o)return null;let s=/^v?\d+\.\d+\.\d+$/.test(o),c=s&&t.data?.update_available?t.data.latest:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>r(!0),className:c?`mono text-[11px] text-accent hover:text-accent-strong`:`mono text-[11px] text-fg-faint hover:text-fg`,title:c?`${c} is available — you are on ${o}`:`version and updates`,children:c?`${o} → ${c}`:s?o:`dev build`}),t.data?.notes&&(0,L.jsx)(`button`,{onClick:()=>a(!0),className:`text-[11px] text-fg-faint hover:text-accent`,title:`what changed in ${t.data.notes_for??`the latest release`}`,children:`what's new`}),n&&(0,L.jsx)(ht,{onClose:()=>r(!1)}),i&&t.data&&(0,L.jsx)(mt,{u:t.data,onClose:()=>a(!1)})]})}function mt({u:e,onClose:t}){return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[620px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`What's new`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`What's new`}),e.notes_for&&(0,L.jsx)(`span`,{className:`mono text-[12px] text-accent`,children:e.notes_for}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsx)(`div`,{className:`overflow-y-auto px-4 py-3`,children:(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[13px] leading-relaxed text-fg-muted`,children:e.notes})}),(0,L.jsx)(`div`,{className:`border-t border-border px-4 py-2.5`,children:(0,L.jsx)(`a`,{href:e.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`the full release on GitHub →`})})]})})}function ht({onClose:e}){let t=I(()=>P.status(),[],{live:!1,intervalMs:0}),n=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:0}),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(void 0),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(()=>_e()??pe(navigator.userAgent,navigator.userAgentData?.platform)),[f,p]=(0,l.useState)(!1),m=a??n.data,h=t.data?.version??``,g=/^v?\d+\.\d+\.\d+$/.test(h),_=!f&&he(m?.command,u)?me(m?.command)??(u===`windows`?`macos`:u):u,v=fe(_),y=ye(m?.command,v),[b,x]=(0,l.useState)(void 0),S=v.find(e=>e.label===b)??y??v[0],C=e=>{d(e),p(!0),ve(e),x(void 0)},w=async()=>{i(!0);try{o(await P.checkUpdate())}catch{}finally{i(!1)}},T=e=>{navigator.clipboard.writeText(e),c(e),setTimeout(()=>c(``),1600)};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:e,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[560px] max-h-[80vh] overflow-y-auto border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Version and updates`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Version`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`running`}),(0,L.jsx)(`span`,{className:`mono text-fg`,children:g?h:`${h} (local build)`}),m?.update_available&&(0,L.jsxs)(`span`,{className:`mono text-accent`,children:[`→ `,m.latest,` is out`]})]}),m?.enabled===!1?(0,L.jsxs)(`div`,{className:`text-[13px] text-fg-muted`,children:[`Release checks are off, so this copy never asks GitHub what the latest version is. Turn them on in`,` `,(0,L.jsx)(`a`,{href:`#/status`,onClick:e,className:`text-accent no-underline hover:text-accent-strong`,children:`status`}),`.`]}):m?.update_available?null:(0,L.jsx)(`div`,{className:`text-[13px] text-fg-muted`,children:m?.latest?`Up to date — ${m.latest} is the latest release.`:`No newer release found.`}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[oe.map(e=>(0,L.jsx)(`button`,{onClick:()=>C(e.id),className:`rounded-sm px-2.5 py-1 text-[12px] transition-colors ${_===e.id?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.id)),v.length>1&&(0,L.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:v.map(e=>(0,L.jsxs)(`button`,{onClick:()=>x(e.label),className:`rounded-sm px-2 py-1 text-[11px] transition-colors ${S.label===e.label?`text-accent`:`text-fg-faint hover:text-fg-muted`}`,title:e.label===y?.label?`how this copy appears to be installed`:void 0,children:[e.label,e.label===y?.label?` ·`:``]},e.label))})]}),(0,L.jsx)(`ol`,{className:`grid gap-2.5`,children:S.steps.map((e,t)=>(0,L.jsxs)(`li`,{className:`grid gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:t+1}),e.cmd?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`code`,{className:`mono flex-1 truncate rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-fg`,children:e.cmd}),(0,L.jsx)(`button`,{onClick:()=>T(e.cmd),className:`shrink-0 rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1.5 text-[12px] text-accent hover:bg-accent/[0.16]`,children:s===e.cmd?`copied`:`copy`})]}):(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1 rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-accent no-underline hover:text-accent-strong`,children:`Open the release page →`})]}),(0,L.jsx)(`p`,{className:`pl-5 text-[11px] leading-relaxed text-fg-faint`,children:e.note})]},t))})]}),(0,L.jsx)(`div`,{className:`text-[11px] leading-relaxed text-fg-faint border-t border-border pt-3`,children:`Caprock does not update itself: it would have to overwrite its own binary while running, and where a package manager owns that binary, replacing it behind their back breaks the next upgrade.`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:w,disabled:r,className:`rounded-md border border-border px-3 py-1.5 text-[13px] text-fg-muted hover:text-fg disabled:opacity-50`,children:r?`checking…`:`check now`}),(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`release notes →`})]})]})]})})}var gt=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[caprock ui]`,e,t.componentStack)}render(){return this.state.error?(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 rounded-[var(--radius-panel)] px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`div`,{className:`text-danger font-medium`,children:[this.props.label??`This view`,` failed to render`]}),(0,L.jsx)(`div`,{className:`mono text-fg-muted mt-1`,children:this.state.error.message}),(0,L.jsx)(`button`,{className:`mt-2 border border-border px-2 py-0.5 rounded-sm text-fg-muted hover:text-fg`,onClick:()=>this.setState({error:null}),children:`retry`})]}):this.props.children}};function R({title:e,center:t,right:n,children:r,className:i=``,onMouseEnter:a,onMouseLeave:o}){return(0,L.jsxs)(`section`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] shadow-[var(--shadow-panel)] min-w-0 ${i}`,onMouseEnter:a,onMouseLeave:o,children:[(e||t||n)&&(0,L.jsxs)(`header`,{className:`relative flex items-center justify-between px-3 py-2 border-b border-border bg-panel-2/60 rounded-t-[var(--radius-panel)]`,children:[(0,L.jsx)(`h2`,{className:`text-[11px] uppercase tracking-[0.12em] text-fg-muted font-medium`,children:e}),t?(0,L.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2`,children:t}):null,(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:n})]}),(0,L.jsx)(`div`,{children:r})]})}function z({label:e,value:t,sub:n,tone:r,size:i=`default`}){return(0,L.jsxs)(`div`,{className:`flex h-full flex-col px-3 py-2.5 min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`div`,{className:`num font-semibold tracking-[-0.01em] ${i===`hero`?`text-[34px] leading-[1.05]`:i===`compact`?`text-[17px] leading-tight`:`text-[24px] leading-[1.1]`} ${r===`ok`?`text-ok`:r===`warn`?`text-warn`:r===`danger`?`text-danger`:r===`info`?`text-info`:`text-fg`}`,children:t}),n&&(0,L.jsx)(`div`,{className:`mt-auto pt-1 text-[11px] text-fg-muted num truncate`,children:n})]})}var _t={working:`working`,idle:`idle`,"waiting-on-you":`waiting on you`,looping:`looping?`,error:`error`,ended:`ended`};function vt(e){switch(e){case`working`:return`ok`;case`idle`:return`warn`;case`waiting-on-you`:return`warn`;case`looping`:return`danger`;case`error`:return`danger`;case`ended`:return`muted`}}function yt({health:e}){let t=vt(e);return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 border rounded-sm px-1.5 py-[1px] text-[11px] leading-4 ${t===`ok`?`text-ok border-ok/40 bg-ok/10`:t===`warn`?`text-warn border-warn/40 bg-warn/10`:t===`danger`?`text-danger border-danger/40 bg-danger/10`:`text-fg-muted border-border bg-panel-2`}`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${t===`ok`?`bg-ok`:t===`warn`?`bg-warn`:t===`danger`?`bg-danger`:`bg-fg-faint`} ${e===`working`?`animate-pulse`:``}`}),_t[e]]})}function bt({values:e,width:t=120,height:n=24,tone:r=`info`}){if(e.length<2)return(0,L.jsx)(`svg`,{width:t,height:n,"aria-hidden":!0});let i=Math.max(...e,1e-9),a=Math.min(...e,0),o=i-a||1,s=t/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(n-(e-a)/o*(n-2)-1).toFixed(1)}`).join(` `),l=r===`ok`?`var(--color-ok)`:r===`warn`?`var(--color-warn)`:r===`danger`?`var(--color-danger)`:r===`accent`?`var(--color-accent)`:`var(--color-info)`;return(0,L.jsx)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:`block`,"aria-hidden":!0,children:(0,L.jsx)(`polyline`,{fill:`none`,stroke:l,strokeWidth:`1.25`,points:c,vectorEffect:`non-scaling-stroke`})})}function xt({title:e,children:t}){return(0,L.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,L.jsx)(`div`,{className:`text-fg-muted`,children:e}),t&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-faint mt-1`,children:t})]})}function St({rows:e=3,className:t=``}){return(0,L.jsx)(`div`,{className:`px-3 py-2 grid gap-2 ${t}`,"aria-hidden":!0,children:Array.from({length:e},(e,t)=>(0,L.jsx)(`div`,{className:`h-3 rounded-sm bg-panel-2 skeleton-pulse`,style:{width:`${[92,74,83,61,88][t%5]}%`}},t))})}function Ct({command:e,className:t=``}){let[n,r]=(0,l.useState)(!1);return(0,L.jsx)(`button`,{className:`mono text-[12px] bg-panel-2 border border-border px-2 py-0.5 rounded-sm hover:border-border-strong text-fg text-left ${t}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)})},title:`copy to clipboard — run it in your terminal`,children:n?`copied`:`$ ${e}`})}var wt={edit:{label:`writing code`,title:`Turns that wrote to a file — Edit, Write, NotebookEdit.`},command:{label:`running commands`,title:`Turns that ran a shell command — builds, tests, git, anything through Bash. The command itself is free; what costs is the turn that issued it and read its output.`},read:{label:`reading and searching`,title:`Turns that read or searched the codebase — Read, Grep, Glob. The file contents enter the prompt and are billed, which is why reading is not free.`},web:{label:`web research`,title:`Turns that fetched or searched the web — WebFetch, WebSearch.`},mcp:{label:`MCP tools`,title:`Turns that called one of your own MCP integrations.`},other:{label:`other tools`,title:`Turns that called a tool in none of the categories above — subagents, task and skill control, and any tool Caprock does not yet know by name.`},none:{label:`no tool call`,title:`Turns that called no tool at all. They may have been reasoning, planning, answering a question or writing prose — Caprock records which tools ran, not what a turn was thinking, so it does not claim to know which.`}},Tt=`Each turn counts toward one kind of work, decided by the tools it called: writing a file wins over running a command, which wins over reading or searching, then web, then an MCP tool, then anything else. A turn that called no tool is counted as exactly that. Each turn goes whole to one row, never split, so the rows add up to the total exactly.`;function Et({summary:e}){let t=e,n=t?.work??[],r=t?.work_unlinked_calls??0,i=t?.tool_calls??0,a=r>0&&i>0&&r/i>.01;return(0,L.jsxs)(R,{title:`What it went on`,right:(0,L.jsx)(`span`,{title:Tt,children:`by cost`}),children:[t?n.length===0&&(0,L.jsx)(xt,{title:`No priced turns in range`}):(0,L.jsx)(St,{rows:4}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:n.map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:w(e.cost_pct)})]},e.kind))})}),a&&(0,L.jsxs)(`div`,{className:`mx-3 mb-2.5 text-[11px] text-warn`,children:[r.toLocaleString(),` tool calls in this range could not be matched to the turn that paid for them, so their cost is counted under “no tool call” rather than the work they actually did. Every other row is understated by up to that much.`]})]})}function Dt({summary:e}){let t=e?.work??[],n=e?.work_unlinked_calls??0,r=e?.tool_calls??0;if(t.length===0||r===0||n/r>.2)return null;let i=t.filter(e=>e.cost_pct>=1).slice(0,5);return i.length===0?null:(0,L.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`what it went on`}),(0,L.jsx)(`a`,{href:`#/cost`,className:`text-[10px] text-fg-faint hover:text-accent no-underline`,children:`details →`})]}),(0,L.jsx)(`div`,{className:`mt-2 flex h-1.5 w-full overflow-hidden rounded-full bg-panel-2`,title:Tt,children:i.map((e,t)=>(0,L.jsx)(`span`,{className:`h-full`,style:{width:`${e.cost_pct}%`,background:`var(--color-accent)`,opacity:1-t*.17}},e.kind))}),(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1`,children:i.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-[2px] translate-y-[1px]`,style:{background:`var(--color-accent)`,opacity:1-t*.17}}),(0,L.jsx)(`span`,{className:`text-fg-muted`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsx)(`span`,{className:`num text-fg-faint`,children:w(e.cost_pct)})]},e.kind))})]})}var Ot=.62;function kt(e,t){return e?t===`tokens`?e.tokens??[]:e.cost??[]:[]}function At(e,t,n){let r=kt(e,t);if(!e||r.length===0)return[];let i=n>0?n:0;return r.map((t,n)=>{let r=Number.isFinite(t)&&t>0?t:0,a=i>0&&r>0?Math.min(1,r/i)**+Ot:0;return{value:r,at:e.from_ms+n*e.width_ms,height:a,empty:r<=0}})}function jt(e,t){let n=0;for(let r of e)for(let e of kt(r,t))Number.isFinite(e)&&e>n&&(n=e);return n}function Mt(e,t){let n=new Date(e);return t<864e5?n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function Nt(e){return e.split(`/`).filter(Boolean)}function Pt(e,t=3){let n=[],r=new Map,i=[],a=(e,t)=>{let n=r.get(e);if(n)return n;let o=Nt(e),s={path:e,name:o.length===0?`/`:o[o.length-1],depth:t,tokens:0,cost:0,turns:0,tokensPct:0,costPct:0,ownTokens:0,ownCost:0,ownTurns:0,ownTokensPct:0,ownCostPct:0,children:[],rolledUp:0};if(r.set(e,s),t===0)i.push(s);else{let e=t===1?`/`:`/`+o.slice(0,t-1).join(`/`);a(e,t-1).children.push(s)}return s};for(let r of e){if(r.unattributed||r.outside){n.push(r);continue}let e=Nt(r.path),i=e.length,o=Math.min(i,t),s=a(o===0?`/`:`/`+e.slice(0,o).join(`/`),o);s.ownTokens+=r.tokens,s.ownCost+=r.cost_usd,s.ownTurns+=r.turns,s.ownTokensPct+=r.tokens_pct,s.ownCostPct+=r.cost_pct,i>o&&s.rolledUp++;for(let t=0;t<=o;t++){let n=a(t===0?`/`:`/`+e.slice(0,t).join(`/`),t);n.tokens+=r.tokens,n.cost+=r.cost_usd,n.tokensPct+=r.tokens_pct,n.costPct+=r.cost_pct,n.turns+=r.turns}}let o=i[0],s=i;o&&o.path===`/`&&(s=[...o.children],(o.ownTokens>0||o.ownCost>0||o.ownTurns>0||o.rolledUp>0)&&s.push({...o,depth:1,tokens:o.ownTokens,cost:o.ownCost,turns:o.ownTurns,tokensPct:o.ownTokensPct,costPct:o.ownCostPct,children:[],ownTokens:o.ownTokens,ownCost:o.ownCost,ownTurns:o.ownTurns}));let c=e=>{e.sort((e,t)=>t.cost-e.cost);for(let t of e)c(t.children)};return c(s),{roots:s,buckets:n}}function Ft(e){return e.map(e=>{let t=e;for(;t.children.length===1&&t.ownTokens===0&&t.ownCost===0&&t.ownTurns===0&&t.rolledUp===0;)t=t.children[0];return{...t,children:Ft(t.children)}})}var It=[{key:`all`,label:`all`},{key:`claude`,label:`claude`},{key:`opencode`,label:`opencode`}],Lt=[{key:`today`,label:`today`},{key:`7d`,label:`7d`},{key:`30d`,label:`30d`},{key:`all`,label:`all`}],Rt=`tokens`,zt=`A turn counts toward the directory of the most recent file it touched, and keeps counting there until it touches a file somewhere else — so the commands, tests and searches between two edits count toward the directory being worked on. Reading, editing or writing a file counts as touching it; running a command does not. Each turn goes whole to one row, never split between two, so the rows add up to the repository total exactly.`,Bt=`repository-wide work`,Vt=`Turns from the start of a session, before Claude had touched any file — so there is no directory yet for them to count toward. Their cost is counted here whole rather than guessed onto the directory the session reached later.`,Ht=`outside the repository`,Ut=`Turns whose most recent file touch was outside this repository — Claude’s notes on the project, agent scratchpads, test-output directories, or another checkout. This is real work and it counts toward the repository total, but it happened outside the tree, so it is not charged to any directory inside it.`;function Wt({sessions:e,agent:t}){let[n,r]=(0,l.useState)(`7d`),[i,a]=(0,l.useState)(!1),o=I(()=>P.summary(n),[n],{intervalMs:3e4}),s=o.data?.projects??[],c=(0,l.useMemo)(()=>t===`all`?s:s.filter(e=>!e.agent||e.agent===t),[s,t]),[u,d]=(0,l.useState)(null),f=(0,l.useMemo)(()=>{if(!u)return c;let e=new Map(u.map((e,t)=>[e,t]));return[...c].sort((t,n)=>(e.get(t.project)??1/0)-(e.get(n.project)??1/0))},[c,u]),p=i?f:f.slice(0,6),m=c.reduce((e,t)=>e+t.cost_usd,0),h=c.reduce((e,t)=>e+t.tokens,0),g=(0,l.useMemo)(()=>jt(p.map(e=>e.spark),Rt),[p]),_=(0,l.useMemo)(()=>p.reduce((e,t)=>Math.max(e,t.tokens),0),[p]);return(0,L.jsx)(R,{onMouseEnter:()=>d(c.map(e=>e.project)),onMouseLeave:()=>d(null),title:`Projects`,right:(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`num text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg`,children:C(h)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,S(m),` total`]})]}),(0,L.jsx)(`span`,{className:`inline-flex border border-border rounded-sm overflow-hidden`,children:Lt.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),className:`px-1.5 py-0.5 text-[11px] mono ${n===e.key?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg-muted`}`,children:e.label},e.key))})]}),children:o.data?c.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:`No spend captured in this range yet.`}):(0,L.jsxs)(`div`,{className:`grid`,children:[p.map(t=>(0,L.jsx)(Kt,{p:t,max:_,ceiling:g,live:Gt(e).has(t.project)},t.project||`(unknown)`)),c.length>6&&(0,L.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[11px] text-fg-faint hover:text-fg-muted px-3 py-1.5 text-left border-t border-border`,children:i?`show less`:`show all ${c.length} projects`}),(0,L.jsx)(Dt,{summary:o.data}),(0,L.jsx)(Zt,{count:c.length})]}):(0,L.jsx)(St,{rows:5})})}function Gt(e){return new Set(e.filter(e=>e.status!==`ended`).map(e=>e.project).filter(Boolean))}function Kt({p:e,max:t,ceiling:n,live:r}){let i=e.paths??[],a=i.length>1,[o,s]=(0,l.useState)(!1),c=e.project||`unknown project`,u=t>0?100*e.tokens/t:0,d=(0,l.useMemo)(()=>At(e.spark,Rt,n),[e.spark,n]),f=(0,l.useMemo)(()=>{let e=Pt(i);return{roots:Ft(e.roots),buckets:e.buckets}},[i]),p=(0,l.useMemo)(()=>Math.max(0,...f.roots.map(e=>e.tokens),...f.buckets.map(e=>e.tokens)),[f]),m=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_128px_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsx)(`div`,{className:`min-w-0`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-ok shrink-0`,title:`a session is live in this project`}),(0,L.jsx)(`span`,{className:`truncate text-[14px]`,children:c}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint num shrink-0`,children:[e.sessions,` `,e.sessions===1?`session`:`sessions`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${o?`rotate-90`:``}`,children:`▶`})]})}),d.length>0?(0,L.jsx)(Xt,{bars:d,widthMs:e.spark?.width_ms??0,label:c}):(0,L.jsx)(`div`,{className:`h-1 bg-panel-2 rounded-sm overflow-hidden`,title:`${c}: share of the largest project`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${u}%`}})}),(0,L.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,L.jsx)(`div`,{className:`num text-[17px] font-semibold leading-tight text-accent`,children:C(e.tokens)}),(0,L.jsx)(`div`,{className:`num text-[13px] leading-tight text-fg-muted`,children:S(e.cost_usd)})]})]});return(0,L.jsxs)(`div`,{className:`border-t border-border first:border-t-0`,children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`w-full px-3 py-1.5 hover:bg-panel-2/50`,title:`${c}: show cost by directory`,children:m}):(0,L.jsx)(`div`,{className:`px-3 py-1.5`,children:m}),a&&o&&(0,L.jsxs)(`div`,{className:`pb-1.5 bg-panel-2/30`,children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-1 pb-0.5 text-[10px] text-fg-faint`,title:zt,children:`by files touched · share of this repository's tokens`}),f.roots.map(e=>(0,L.jsx)(qt,{n:e,max:p},e.path)),f.buckets.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-2 pb-0.5 text-[10px] uppercase tracking-[0.08em] text-fg-faint`,children:`not a directory`}),f.buckets.map(e=>(0,L.jsx)(Jt,{q:e,max:p},e.path))]})]})]})}function qt({n:e,max:t}){let[n,r]=(0,l.useState)(!1),i=t>0?100*e.tokens/t:0,a=e.children.length>0,o=(0,l.useMemo)(()=>Math.max(0,...e.children.map(e=>e.tokens)),[e.children]),s=a&&e.ownCost>0,c=e.children.length,u=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted mono`,children:e.path}),e.rolledUp>0&&(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint shrink-0`,title:`${e.rolledUp} ${e.rolledUp===1?`directory`:`directories`} below this one ${e.rolledUp===1?`is`:`are`} counted here rather than shown: the breakdown stops at 3 levels.`,children:[`+`,e.rolledUp,` deeper`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${n?`rotate-90`:``}`,children:`▶`})]}),s&&(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mt-0.5`,children:[S(e.ownCost),` here · `,S(e.cost-e.ownCost),` in `,c,` `,c===1?`subdirectory`:`subdirectories`]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/40`,style:{width:`${i}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.costPct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokensPct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost)]})]})]}),d={paddingLeft:`${28+(e.depth-1)*14}px`};return(0,L.jsxs)(`div`,{children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`w-full pr-3 py-1 hover:bg-panel-2/50`,style:d,title:`${e.path}: show the directories inside it`,children:u}):(0,L.jsx)(`div`,{className:`pr-3 py-1`,style:d,children:u}),a&&n&&e.children.map(e=>(0,L.jsx)(qt,{n:e,max:o},e.path))]})}function Jt({q:e,max:t}){let n=t>0?100*e.tokens/t:0,r=e.unattributed===!0;return(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 pl-7 pr-3 py-1`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted`,title:r?Vt:Ut,children:r?Bt:Ht}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]})]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-fg-faint/30`,style:{width:`${n}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.cost_pct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokens_pct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost_usd)]})]})]})}function Yt(e){return!Number.isFinite(e)||e<=0?`0%`:e<.1?`<0.1%`:w(e)}function Xt({bars:e,widthMs:t,label:n}){let r=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=o.getPropertyValue(`--color-accent`).trim()||`#feb157`,c=o.getPropertyValue(`--color-fg-faint`).trim()||`#837f78`,l=n/e.length;for(let t=0;ti.disconnect()},[e]);let i=e.filter(e=>!e.empty),a=i[0],o=i[i.length-1],s=!a||!o?`no spend in this range`:a===o?`all of it on ${Mt(a.at,t)}`:`${Mt(a.at,t)} → ${Mt(o.at,t)}`;return(0,L.jsx)(`canvas`,{ref:r,className:`w-full h-[14px] block`,role:`img`,"aria-label":`${n}: ${Rt} over time, ${s}`,title:`${n}: when the spend happened — ${s}`})}function Zt({count:e}){return e<10?null:(0,L.jsxs)(`a`,{href:`https://caprock.dev/teams`,target:`_blank`,rel:`noreferrer`,className:`flex items-baseline gap-2 border-t border-border px-3 py-1.5 text-[11px] no-underline hover:no-underline`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[e,` repositories on one machine.`]}),(0,L.jsx)(`span`,{className:`text-fg-faint hover:text-accent`,children:`See them across the team →`})]})}function Qt(e){return typeof e==`string`?e:``}function $t(e){let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}function en(e,t){let n=e.replace(/\s+/g,` `).trim(),r=[...n];return r.length>t?r.slice(0,t-1).join(``)+`…`:n}function tn(e){return e.replace(/(\/[\w.@%+-]+){3,}/g,e=>`…/`+e.split(`/`).filter(Boolean).slice(-2).join(`/`))}function nn(e,t){switch(e){case`Edit`:case`NotebookEdit`:return Qt(t.file_path)?{icon:`✎`,text:`editing`,detail:$t(Qt(t.file_path))}:null;case`Write`:return Qt(t.file_path)?{icon:`✎`,text:`writing`,detail:$t(Qt(t.file_path))}:null;case`Read`:return Qt(t.file_path)?{icon:`◇`,text:`reading`,detail:$t(Qt(t.file_path))}:null;case`Bash`:return Qt(t.command)?{icon:`$`,text:`running`,detail:en(tn(Qt(t.command)),46)}:null;case`Grep`:case`Glob`:return{icon:`⌕`,text:`searching`,detail:en(Qt(t.pattern)||Qt(t.query),40)||void 0};case`WebFetch`:case`WebSearch`:return{icon:`⇢`,text:`fetching`,detail:en(Qt(t.url)||Qt(t.query),44)||void 0};case`Agent`:return{icon:`⚑`,text:`spawned a subagent`,detail:Qt(t.subagent_type)||void 0};case`Skill`:return{icon:`⚑`,text:`invoked skill`,detail:Qt(t.skill)||void 0};case`TodoWrite`:return{icon:`☑`,text:`updated its plan`};default:return e?{icon:`·`,text:`used`,detail:e}:null}}function rn(e,t){let n=e.payload??{},r=Date.parse(e.ts),i={id:`${e.id}`,ts:Number.isNaN(r)?Date.now():r,sessionId:e.session_id,project:t};switch(e.kind){case`tool.pre`:{let t=nn(Qt(n.tool_name)||Qt(e.tool),n.tool_input??{});return t?{...i,...t,tone:`normal`}:null}case`tool.post`:return n.is_error?{...i,icon:`✕`,text:`a tool call failed`,tone:`danger`}:null;case`agent.spawn`:return{...i,icon:`▸`,text:`session started`,tone:`ok`};case`agent.stop`:return{...i,icon:`■`,text:`session ended`,tone:`normal`};case`context.compact`:return{...i,icon:`⇱`,text:`compacted its context`,tone:`warn`};case`throttle`:return{...i,icon:`⏳`,text:`rate-limited by the API`,tone:`warn`};case`task.created`:return{...i,icon:`+`,text:`task created`,tone:`normal`};case`task.done`:return{...i,icon:`✓`,text:`task verified — tests passed`,tone:`ok`};case`approval.requested`:return{...i,icon:`!`,text:`needs your approval`,tone:`warn`};default:return null}}function an(e,t,n=60){return e.some(e=>e.id===t.id)?e:[t,...e].slice(0,n)}function on({sessions:e,now:t,emptyHint:n}){let[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(!1),s=(0,l.useRef)(new Map),c=(0,l.useRef)(a);c.current=a;for(let t of e)t.project&&s.current.set(t.session_id,t.project);(0,l.useEffect)(()=>{let t=!1;return(async()=>{let n=[...e].sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,4),r=await Promise.all(n.map(e=>P.events(e.session_id,0,60).catch(()=>[])));if(t)return;let a=r.flat().map(e=>rn(e)).filter(e=>e!==null).sort((e,t)=>t.ts-e.ts).slice(0,40);i(e=>{let t=new Set(n.map(e=>e.session_id)),r=e.filter(e=>!e.sessionId||t.has(e.sessionId)),i=new Set(r.map(e=>e.id));return[...r,...a.filter(e=>!i.has(e.id))].sort((e,t)=>t.ts-e.ts).slice(0,60)})})(),()=>{t=!0}},[e.map(e=>e.session_id).join(`,`)]);let u=(0,l.useRef)(new Set);return u.current=new Set(e.map(e=>e.session_id)),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`||c.current)return;let t=e.data?.session_id;if(t&&s.current.has(t)&&!u.current.has(t))return;let n=rn(e.data);n&&i(e=>an(e,n))}),[]),(0,L.jsx)(R,{title:`Live activity`,right:(0,L.jsx)(`button`,{onClick:()=>o(e=>!e),className:`text-[11px] mono text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,children:a?`resume`:`pause`}),children:r.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:n??(0,L.jsxs)(L.Fragment,{children:[`Nothing yet — start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal.`]})}):(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`div`,{className:`max-h-[420px] overflow-y-auto`,children:r.map(e=>(0,L.jsx)(cn,{it:e,now:t,project:s.current.get(e.sessionId)},e.id))}),(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-panel to-transparent`})]})})}function sn(e){switch(e){case`ok`:return`text-ok`;case`warn`:return`text-warn`;case`danger`:return`text-danger`;default:return`text-fg-faint`}}function cn({it:e,now:t,project:n}){return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`grid grid-cols-[auto_auto_1fr_auto] items-baseline gap-2 px-3 py-1 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] w-3 text-center ${sn(e.tone)}`,children:e.icon}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate max-w-[12ch]`,children:n??e.project??E(e.sessionId)}),(0,L.jsxs)(`span`,{className:`text-[12px] truncate`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.text}),e.detail&&(0,L.jsx)(`span`,{className:`mono text-fg ml-1.5`,children:e.detail})]}),(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.ts,t)})]})}function ln(e){return e?.plan_kind===`metered`?`at API list price · ≈ your bill`:e?.plan_kind===`flat`?`at API list price · not a bill`:`at API list price`}function un(e){return e?.plan_kind===`metered`?`Priced from your captured tokens at Anthropic list prices. You are billed per token, so this is approximately your actual cost.`:e?.plan_kind===`flat`?`Priced from your captured tokens at Anthropic list prices. You pay ${e.plan_label||`a flat plan`}, so this is what the same work would have cost through the API — not money out of pocket.`:`Priced from your captured tokens at Anthropic list prices. Whether that is your actual bill depends on how you pay — set your plan in the header.`}function dn({plan:e}){let t=I(()=>P.history(`all`),[],{intervalMs:6e4}).data?.totals;if(!t||t.sessions===0)return null;let n=t.days>0?t.sessions/t.days:0;return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 rounded-[var(--radius-panel)] border border-border bg-panel px-3 py-2.5`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`all time`}),(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num font-semibold tracking-[-0.01em] text-[22px] leading-none text-info`,children:S(t.cost_usd)}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,title:un(e),children:ln(e)})]}),(0,L.jsx)(fn,{value:t.sessions.toLocaleString(`en-US`),label:`sessions`}),(0,L.jsx)(fn,{value:t.days.toLocaleString(`en-US`),label:`active days`}),(0,L.jsx)(fn,{value:t.turns.toLocaleString(`en-US`),label:`turns`}),n>=1&&(0,L.jsx)(fn,{value:n.toFixed(1),label:`sessions a day`}),(0,L.jsx)(`span`,{className:`ml-auto inline-flex items-baseline gap-4`,children:(0,L.jsx)(pn,{})})]})}function fn({value:e,label:t}){return(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,children:e}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:t})]})}function pn(){let e=I(()=>P.daily(30),[],{intervalMs:3e5}),t=I(()=>P.summary(`today`),[],{intervalMs:3e4}),n=e.data??[];if(n.length===0)return null;let r=new Map;for(let e of n)r.set(e.day,(r.get(e.day)??0)+e.cost_usd);let i=[...r.values()].filter(e=>e>0).sort((e,t)=>e-t);if(i.length<7)return null;let a=i[Math.floor(i.length/2)]??0,o=t.data?.cost_usd??0;return a<=0||o=99?{label:`outstanding`,color:`text-ok`}:e>=95?{label:`good`,color:`text-ok`}:e>=85?{label:`ok`,color:``}:{label:`low`,color:`text-warn`}}function hn({hitRate:e,cutPct:t,measured:n,size:r=`compact`,label:i=`Cache hit`}){let a=n&&e!==void 0?e*100:void 0,o=mn(a);return(0,L.jsx)(z,{label:i,value:(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{children:a===void 0?`—`:w(a)}),o&&(0,L.jsx)(`span`,{className:`text-[11px] font-normal ${o.color||`text-fg-faint`}`,children:o.label})]}),sub:n&&t!==void 0?`${w(t)} input cost cut`:void 0,size:r})}function gn(e,t){let n=Math.round(e.used_percentage),r=(e.resets_at??0)*1e3,i=r>t&&r85?`text-danger`:n>=60?`text-warn`:`text-fg`,resetsAt:i?new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,stale:e.resets_at?!i:!1}}function _n({label:e,w:t,now:n}){let{pct:r,color:i,resetsAt:a,stale:o}=gn(t,n);return(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-3`,children:[(0,L.jsxs)(`span`,{className:`font-mono tabular-nums ${i}`,children:[r,`%`]}),a&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[`resets `,a]}),o&&(0,L.jsx)(`span`,{className:`text-fg-faint`,title:`Claude Code has not refreshed this window recently`,children:`reset time stale`}),t.forecast&&(0,L.jsx)(`span`,{className:`text-warn`,children:t.forecast})]})]})}function vn({limits:e,now:t}){let n=[];if(e?.five_hour&&n.push([`5h`,e.five_hour]),e?.seven_day&&n.push([`7d`,e.seven_day]),n.length===0)return null;let r=n.map(([e,n])=>({label:e,...gn(n,t)})),i=r.filter(e=>!e.stale),a=i.length===0,o=(i.length?i:r).reduce((e,t)=>t.pct>e.pct?t:e),s=r.find(e=>e.label!==o.label);return(0,L.jsx)(z,{label:`Plan limits`,value:(0,L.jsxs)(`span`,{className:a?`text-fg-faint`:o.color,children:[o.pct,`%`]}),sub:a?(0,L.jsx)(`span`,{title:`Claude Code writes these to its status line; they stop updating when no session is running`,children:`last reported a while ago`}):(0,L.jsxs)(`span`,{children:[o.label,` window`,o.resetsAt?` · resets ${o.resetsAt}`:``,s?` · ${s.label} ${s.pct}%`:``]}),tone:a?void 0:o.pct>85?`danger`:o.pct>=60?`warn`:void 0,size:`compact`})}var yn=`caprock-prompts`,bn={"share-week":6048e5,"share-month":2592e6,"premium-hint":2592e6,"premium-banner":2592e6};function xn(){try{let e=localStorage.getItem(yn);return e?JSON.parse(e):{}}catch{return{}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}function Cn(e,t){let n=xn()[e];return!n||t-n>=bn[e]}function wn(e,t){let n={...xn(),[e]:t};e===`share-month`&&(n[`share-week`]=t),Sn(n)}var Tn=`premium-banner`;function En({costUSD:e,days:t,now:n}){let[r]=(0,l.useState)(()=>Cn(Tn,n)),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1);if(!r||i||e<=0||t<=0)return null;let c=e/t;return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[var(--radius-panel)] border border-border bg-panel-2 px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsx)(`span`,{className:`num`,children:S(c)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` a day, on average, across `,t,` active `,t===1?`day`:`days`,`.`]})]}),(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Premium pauses sessions when the day crosses a limit you set.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(`button`,{onClick:()=>s(!0),className:`rounded-sm border border-accent/50 bg-accent/10 px-2 py-0.5 text-accent hover:bg-accent/20`,children:`what it does`}),(0,L.jsx)(`button`,{onClick:()=>{wn(Tn,n),a(!0)},className:`rounded-sm border border-border px-1.5 py-0.5 text-[11px] text-fg-faint hover:text-fg-muted`,title:`hide this for a month`,children:`not now`})]}),o&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>s(!1)})]})}var Dn=[1e3,5e3,1e4,25e3,5e4,1e5],On=e=>e>=1e3?`$${Math.round(e).toLocaleString(`en-US`)}`:`$${e.toFixed(2)}`;function kn(e){let t=Dn.filter(t=>e>=t).pop();return t===void 0||e-t>t*.1?null:{kind:`milestone`,line:`You just passed ${On(t)} of Claude Code.`}}function An(e,t){return e<7||e>10?null:{kind:`first-week`,line:`A week of Claude Code: ${On(t)} measured.`}}function jn(e){if(e.length<3)return null;let[t,...n]=e;if(t===void 0)return null;let r=Math.max(...n);return r<=0||tt[0].localeCompare(e[0])),r=[];for(let e=0;ee+t[1],0));return r}function Nn(e,t,n){return e.sessions===0||e.cost_usd<=0?null:kn(e.cost_usd)??An(e.days,n.cost_usd)??jn(Mn(t))}var Pn=`share-week`;function Fn({now:e}){let[t]=(0,l.useState)(()=>Cn(Pn,e)),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=I(()=>P.history(`all`),[],{intervalMs:3e5}),s=I(()=>P.summary(`7d`),[],{intervalMs:3e5});if(!t||n||!o.data||!s.data)return null;let c=Nn(o.data.totals,o.data.daily??[],s.data);if(!c)return null;let u=()=>{wn(Pn,e),r(!0)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 rounded-lg border border-accent/35 bg-accent/[0.07] py-1.5 pl-3.5 pr-2 text-[13px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[c.line,` Don’t be shy and share it off —`]}),(0,L.jsx)(`button`,{onClick:()=>{a(!0),u()},className:`rounded-[5px] bg-accent px-3 py-1 font-medium text-panel hover:bg-accent/90`,children:`Share`}),(0,L.jsx)(`button`,{onClick:u,title:`hide this for a week`,className:`px-1 text-fg-faint hover:text-fg-muted`,children:`✕`})]}),i&&(0,L.jsx)(Ze,{onClose:()=>a(!1)})]})}function In(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),t=(e.data?.tools??[]).slice(0,6),n=(e.data?.summary?.models??[]).slice(0,5);if(t.length===0&&n.length===0)return null;let r=t[0]?.count??0,i=n[0]?.cost_usd??0,a=(e.data?.tools??[]).reduce((e,t)=>e+t.count,0),o=(e.data?.summary?.models??[]).reduce((e,t)=>e+t.cost_usd,0),s=e.data?.summary,c=s&&(s.tokens_in||s.tokens_out||s.cache_read||s.cache_write)?{in:s.tokens_in,out:s.tokens_out,cacheRead:s.cache_read,cacheWrite:s.cache_write}:null;return(0,L.jsxs)(R,{title:`All time`,right:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,L.jsx)(Fn,{now:Date.now()}),(0,L.jsx)(Qe,{}),(0,L.jsx)(`a`,{href:`#/history`,className:`text-fg-faint hover:text-accent no-underline`,children:`every tool, model and project →`})]}),children:[(0,L.jsxs)(`div`,{className:`grid gap-x-8 gap-y-5 px-3 py-3 md:grid-cols-2`,children:[(0,L.jsx)(Ln,{title:`Most-used tools`,note:`by calls`,rows:t.map(e=>({key:e.tool,label:te(e.tool),value:e.count.toLocaleString(`en-US`),share:a>0?100*e.count/a:null,frac:r>0?e.count/r:0}))}),(0,L.jsx)(Ln,{title:`Where the money went`,note:`by cost`,rows:n.map(e=>({key:e.model,label:e.model||`unknown`,value:S(e.cost_usd),sub:C(e.tokens),share:o>0?100*e.cost_usd/o:null,frac:i>0?e.cost_usd/i:0}))})]}),c&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 border-t border-border px-3 py-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`Tokens`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`input `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.in)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`output `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.out)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache read `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheRead)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache write `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheWrite)})]}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:`fresh input is billed at full price`})]})]})}function Ln({title:e,note:t,rows:n}){return n.length===0?null:(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`span`,{className:`text-[10px] text-fg-faint`,children:t})]}),(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:n.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`mono w-36 shrink-0 truncate text-fg-muted`,title:e.label,children:e.label}),(0,L.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full bg-panel-2`,children:(0,L.jsx)(`span`,{className:`block h-full rounded-full bg-accent/70`,style:{width:`${Math.max(2,Math.round(e.frac*100))}%`}})}),(0,L.jsx)(`span`,{className:`num w-20 shrink-0 text-right text-fg`,children:e.value}),(0,L.jsx)(`span`,{className:`num w-16 shrink-0 text-right text-fg-faint`,children:e.sub??``}),(0,L.jsx)(`span`,{className:`num w-9 shrink-0 text-right text-fg-faint`,children:e.share===null?``:e.share<1?`<1%`:`${Math.floor(e.share)}%`})]},e.key))})]})}function Rn(e){return e.bars.reduce((e,t)=>e+t.n,0)}function zn(e){return e.bars.reduce((e,t)=>e+t.cost,0)}var Bn=6,Vn=new Set([`description`,`timeout`,`run_in_background`]),Hn=new Set([`true`,`:`,`echo`,`pwd`,`clear`]);function Un(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return``}}function Wn(e){if(e.kind!==`tool.pre`)return null;let t=typeof e.tool==`string`?e.tool:``;if(!t)return null;let n=e.payload,r=n&&typeof n==`object`?n.tool_input:void 0,i=r&&typeof r==`object`?r:{},a=Un(i.command).trim();if(t===`Bash`&&Hn.has(a))return null;let o=[t],s=t;for(let e of Object.keys(i).sort()){if(Vn.has(e))continue;let n=Un(i[e]);(e===`content`||e===`new_string`||e===`old_string`)&&(n=n.slice(0,200)),o.push(`${e}=${n}`),s===t&&(e===`command`||e===`file_path`||e===`pattern`)&&(s=`${t} ${n.slice(0,48)}`)}return{sig:o.join(`|`),label:s}}function Gn(e){let t=Date.parse(e.ts);return Number.isFinite(t)?t:0}function Kn(e,t,n=60){let r=Array.from({length:n},()=>({n:0,turns:0,tools:0,cost:0})),i=t-n*6e4,a=[...e].sort((e,t)=>Gn(e)-Gn(t)),o=[],s=new Map,c=0,l=``;for(let e of a){let a=Gn(e);if(a<=0)continue;if(a>=i&&a<=t){let t=r[Math.min(n-1,Math.floor((a-i)/6e4))];if(t){t.n++,e.kind===`turn.assistant`?t.turns++:(e.kind===`tool.pre`||e.kind===`tool.post`)&&t.tools++;let n=typeof e.cost_usd==`number`&&Number.isFinite(e.cost_usd)?e.cost_usd:0;t.cost+=n}}let u=Wn(e);if(!u)continue;for(o.push({at:a,sig:u.sig,label:u.label});o.length>0;){let e=o[0];if(!e||a-e.at<=Bn*6e4)break;o.shift();let t=(s.get(e.sig)??1)-1;t<=0?s.delete(e.sig):s.set(e.sig,t)}let d=(s.get(u.sig)??0)+1;s.set(u.sig,d),d>c&&(c=d,l=u.label)}return{bars:r,repeats:c,repeatSample:l}}function qn(e,t){if(e.repeats>=8)return{kind:`repeat`,label:`×${e.repeats} same call`};switch(t){case`waiting-on-you`:return{kind:`waiting`,label:`waiting on you`};case`error`:return{kind:`error`,label:`error`};case`looping`:return{kind:`repeat`,label:`looping`};case`ended`:return{kind:`quiet`,label:`ended`};case`idle`:return{kind:`quiet`,label:`idle`};case`working`:return{kind:`working`,label:`working`}}return e.bars.filter(e=>e.n>0).length===0?{kind:`quiet`,label:`quiet`}:{kind:`working`,label:`working`}}function Jn(e,t){return t<=0?`mid`:e>=t*1.8?`high`:e<=t*.5?`low`:`mid`}function Yn(e){let t=e.filter(e=>e.cost>0).map(e=>e.cost).sort((e,t)=>e-t);return t.length===0?0:t[Math.floor(t.length/2)]??0}var Xn=6,Zn=2e3;function Qn({sessions:e,now:t}){let n=(0,l.useMemo)(()=>[...e].filter(e=>e.status!==`ended`).sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,Xn),[e]),r=n.map(e=>e.session_id).join(`,`),[i,a]=(0,l.useState)(new Map);(0,l.useEffect)(()=>{let e=!1;return(async()=>{let t=r?r.split(`,`):[],n=await Promise.all(t.map(e=>P.recentEvents(e,Zn).catch(()=>[])));e||a(new Map(t.map((e,t)=>[e,n[t]??[]])))})(),()=>{e=!0}},[r]),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`)return;let t=e.data;a(e=>{if(!e.has(t.session_id))return e;let n=new Map(e),r=n.get(t.session_id)??[];return n.set(t.session_id,[...r,t].slice(-4e3)),n})}),[]);let o=Math.floor(t/6e4),s=(0,l.useMemo)(()=>n.map(e=>({s:e,pulse:Kn(i.get(e.session_id)??[],o*6e4)})).filter(e=>Rn(e.pulse)>0),[n,i,o]);return n.length===0?null:(0,L.jsxs)(R,{title:`Live pulse`,right:(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`last `,60,` minutes · one bar per minute`]}),children:[(0,L.jsx)(`div`,{children:s.length===0?(0,L.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-fg-faint text-center`,children:[`Nothing ran in the last `,60,` minutes.`]}):s.map(({s:e,pulse:t})=>(0,L.jsx)(er,{s:e,pulse:t,minute:o,showId:s.length>1},e.session_id))}),(0,L.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-4 flex-wrap text-[11px] text-fg-faint border-t border-border`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,title:`They are independent: one call carrying a large context is a short bright bar, twenty greps are a tall dark one.`,children:`bar height = turns and tools · colour = what the minute cost`}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:nr,className:`h-[2px]`}),`idle`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.low}),`below this session's median`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.mid}),`around it`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.high}),`well above it`]}),(0,L.jsxs)(`span`,{className:`ml-auto`,children:[(0,L.jsx)(`span`,{className:`text-warn`,children:`×N same call`}),` = most-repeated identical tool call in six minutes`]})]})]})}function $n({tier:e,className:t=``}){return(0,L.jsx)(`span`,{"data-token":e.token,className:`inline-block w-3 h-3 rounded-[2px] ${t}`,style:{background:`var(${e.token}, ${e.fallback})`,opacity:e.alpha}})}function er({s:e,pulse:t,minute:n,showId:r}){let i=qn(t,e.activity?.health),a=i.kind===`repeat`||i.kind===`waiting`?`text-warn`:i.kind===`error`?`text-danger`:i.kind===`quiet`?`text-fg-faint`:`text-ok`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`grid grid-cols-[132px_1fr_92px_104px] items-center gap-3 px-3 py-2 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`text-[13px] font-medium flex items-baseline gap-1.5 min-w-0`,children:[(0,L.jsx)(`span`,{className:`shrink-0`,children:e.project||`unknown project`}),e.git_branch&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-fg-faint mono`,title:e.git_branch,children:e.git_branch}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`})]}),(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mono truncate`,children:[r&&(0,L.jsxs)(`span`,{title:`session ${e.session_id} · started ${T(e.started_at)} ago`,children:[E(e.session_id),` · `]}),e.activity?.phrase??``]})]}),(0,L.jsx)(ir,{pulse:t,now:n*6e4,sessionID:e.session_id}),(0,L.jsx)(`div`,{className:`num text-[13px] font-semibold text-right`,title:`${S(e.stats?.cost_usd)} for the whole session`,children:S(zn(t))}),(0,L.jsx)(`div`,{className:`text-[11px] text-right ${a}`,title:t.repeatSample,children:i.label})]})}var tr={low:{token:`--color-ok`,fallback:`#4fbf6b`,alpha:.55},mid:{token:`--color-accent`,fallback:`#feb157`,alpha:.85},high:{token:`--color-accent-strong`,fallback:`#ffcb85`,alpha:1}},nr={token:`--color-fg-faint`,fallback:`#837f78`,alpha:.3};function rr(e,t,n){return e.getPropertyValue(t).trim()||n}function ir({pulse:e,now:t,sessionID:n}){let r=(0,l.useRef)(null),[i,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=rr(o,nr.token,nr.fallback),c=e.bars,l=Math.max(...c.map(e=>e.n),1),u=Yn(c),d=n/c.length;for(let e=0;e{i.disconnect(),a.disconnect()}},[e]);let o=t=>{let n=t.currentTarget.getBoundingClientRect();if(n.width===0)return;let r=Math.floor((t.clientX-n.left)/n.width*e.bars.length);a(r>=0&&ra(null),onClick:e=>{i===null||!s||s.n===0||(e.preventDefault(),e.stopPropagation(),v({name:`session`,id:n,at:u}))},"aria-hidden":!0}),s&&(0,L.jsx)(`div`,{className:`absolute -top-1 left-0 right-0 pointer-events-none flex justify-center`,children:(0,L.jsxs)(`span`,{className:`num text-[10px] bg-panel-2 border border-border-strong rounded-sm px-1.5 py-0.5 text-fg-muted whitespace-nowrap`,children:[new Date(u).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),s.n===0?` · nothing happened`:(0,L.jsxs)(L.Fragment,{children:[` · ${s.n} event${s.n===1?``:`s`}`,s.turns>0&&` · ${s.turns} turn${s.turns===1?``:`s`}`,s.cost>0&&` · ${S(s.cost)}`,s.cost>0&&c>0&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` (median ${S(c)})`}),(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` · click to open`})]})]})})]})}function ar({session:e,now:t,onClose:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)();(0,l.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await P.notes(e.session_id,12);t||i(n)}catch(e){t||o(e instanceof Error?e.message:`could not load`)}})(),()=>{t=!0}},[e.session_id]);let s=r?.find(e=>!e.fragment),c=r?.[0],u=s??c;return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:n,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[720px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-medium truncate`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted truncate`,children:e.activity?.phrase}),(0,L.jsx)(`button`,{onClick:n,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`overflow-y-auto px-4 py-3 grid gap-3`,children:[!r&&!a&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`loading…`}),a&&(0,L.jsx)(`div`,{className:`text-[12px] text-danger`,children:a}),r&&!u&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`This session has not said anything yet — it may be running without hooks, or still on its first turn.`}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:[`Last thing Claude said · `,T(u.ts,t),s&&c&&s.event_id!==c.event_id&&(0,L.jsx)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:`(the newest line was mid-thought; this is the last complete one)`})]}),(0,L.jsx)(`div`,{className:`text-[13px] leading-relaxed whitespace-pre-wrap text-fg`,children:u.text})]}),e.activity?.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:[`Plan · `,e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`→ `,e.activity.plan.next]})]})]}),(0,L.jsxs)(`div`,{className:`px-4 py-2 border-t border-border flex items-center gap-3 text-[11px]`,children:[(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id}),className:`link text-fg-muted hover:text-fg`,children:`open the session →`}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:e.owned?`answer in its terminal tab`:`reply in the terminal you started it in`})]})]})})}var or=`premium-hint`;function sr({reason:e,now:t}){let[n]=(0,l.useState)(()=>Cn(or,t)),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1);return!n||r?null:(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,L.jsx)(`button`,{onClick:()=>o(!0),className:`rounded-sm border border-border px-1.5 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg`,children:`a cap that stops this`}),(0,L.jsx)(`button`,{title:`hide this for a month`,onClick:()=>{wn(or,t),i(!0)},className:`text-fg-faint hover:text-fg-muted`,children:`✕`}),a&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>o(!1)})]})}function cr({items:e,now:t,onDismiss:n,sessions:r}){return e.length===0?null:(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:e.map(e=>(0,L.jsx)(lr,{it:e,now:t,onDismiss:n,session:r?.find(t=>t.session_id===e.sessionId)},e.id))})}function lr({it:e,now:t,onDismiss:n,session:r}){let[i,a]=(0,l.useState)(!1),o=e.severity===`high`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 ${o?`border-danger/50 bg-danger/10`:`border-warn/50 bg-warn/10`}`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[13px] shrink-0 ${o?`text-danger`:`text-warn`}`,children:e.title}),(0,L.jsxs)(`span`,{className:`text-[12px] text-fg-muted truncate`,children:[e.sessionId&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`link mono text-fg`,children:e.project||E(e.sessionId)}),(0,L.jsx)(`span`,{className:e.sessionId?`ml-2`:``,children:e.detail})]}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 shrink-0`,children:[e.costUSD!==void 0&&e.costUSD>0&&(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,title:`spent by this session so far`,children:S(e.costUSD)}),e.since!==void 0&&(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.since,t)}),r&&e.id.startsWith(`waiting-`)&&(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong text-fg-muted hover:text-fg`,onClick:()=>a(!0),children:`what did it ask?`}),(0,L.jsx)(`a`,{href:e.sessionId?g({name:`session`,id:e.sessionId,tab:`timeline`,at:e.at}):`#/cost`,className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong no-underline text-fg-muted hover:text-fg`,children:e.sessionId?`open`:`details`}),(e.id.startsWith(`loop-`)||e.id.startsWith(`spent-`))&&(0,L.jsx)(sr,{reason:`this is what a cap stops`,now:t}),n&&e.id.startsWith(`loop-`)&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>n(e.sessionId),children:`dismiss`})]})]}),i&&r&&(0,L.jsx)(ar,{session:r,now:t,onClose:()=>a(!1)})]})}var ur=9e5,dr=25,fr=300,pr=2,mr=864e5,hr=90,gr=6912e5;function _r(e){return typeof e==`number`?e:e&&Date.parse(e)||0}function vr({sessions:e,alerts:t,now:n,limits:r,waitingMs:i=ur}){let a=[],o=Array.isArray(e)?e.filter(Boolean):[],s=Array.isArray(t)?t.filter(Boolean):[],c=new Map(o.map(e=>[e.session_id,e]));for(let e of s){let t=c.get(e.session_id);a.push({id:`loop-${e.session_id}`,sessionId:e.session_id,project:t?.project??``,severity:`high`,title:`Stuck in a loop`,detail:[`ran ${e.sample||e.tool||`the same call`}`,Number.isFinite(e.count)?`${e.count}×`:`repeatedly`,Number.isFinite(e.window_min)?`in ${e.window_min} min`:``].filter(Boolean).join(` `),costUSD:t?.stats?.cost_usd,since:_r(e.ts)||void 0,at:_r(e.first_ts)||_r(e.ts)||void 0})}for(let e of o)if(e.status!==`ended`&&e.activity){if(e.activity.health===`error`){a.push({id:`error-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`high`,title:`Session hit an error`,detail:e.activity.phrase,costUSD:e.stats?.cost_usd,since:_r(e.activity.at)||e.last_event_at});continue}if(e.activity.health===`waiting-on-you`){let t=_r(e.activity.at)||e.last_event_at;t>0&&n-t>=i&&a.push({id:`waiting-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Waiting on you`,detail:e.activity.phrase,since:t})}}for(let e of o){if(!e.stats||!e.activity)continue;let{cost_usd:t,turns:r,files_touched:i}=e.stats;if(tpr)continue;let o=_r(e.activity.at)||e.last_event_at;o>0&&n-o>mr||a.push({id:`spent-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Lots of turns, few files`,detail:`${r.toLocaleString()} turns, ${i===0?`no files`:i===1?`1 file`:`${i} files`} touched`,costUSD:t,since:_r(e.activity.at)||e.last_event_at})}let l={high:0,medium:1};for(let[e,t]of[[`5-hour`,r?.five_hour],[`7-day`,r?.seven_day]]){if(!t||t.used_percentagen&&r=95?`high`:`medium`,title:`${e} plan window ${i}% used`,detail:`resets at ${o}${t.forecast?` — ${t.forecast}`:``}`})}return a.sort((e,t)=>l[e.severity]-l[t.severity]||(e.since??0)-(t.since??0))}var yr=`caprock.update.dismissed`;function br({plan:e,onSave:t,now:n,owned:r=0}){let[i,a]=(0,l.useState)(),[o,s]=(0,l.useState)(()=>localStorage.getItem(yr)??``);return(0,l.useEffect)(()=>{if(!e?.update_checks){a(void 0);return}let t=!0,n=()=>{P.update().then(e=>{t&&a(e)}).catch(()=>{})};n();let r=window.setInterval(n,6e4);return()=>{t=!1,window.clearInterval(r)}},[e?.update_checks]),e&&!e.update_checks?o===`offer`?null:(0,L.jsxs)(xr,{tone:`muted`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Caprock can check GitHub for new releases. It's the only outbound call it makes, so it's off unless you turn it on — no usage data is sent, and you can turn it off again any time.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[(0,L.jsx)(`button`,{className:`text-[11px] border border-accent/50 text-accent bg-accent/10 px-2 py-0.5 rounded-sm hover:bg-accent/20`,onClick:()=>t({...e,update_checks:!0}),children:`check for updates`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,`offer`),s(`offer`)},children:`no thanks`})]})]}):!i?.update_available||!i.latest||o===i.latest?null:(0,L.jsxs)(xr,{tone:`accent`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[`Caprock `,i.latest]}),` is available — you're on `,(0,L.jsx)(`span`,{className:`mono`,children:i.current}),`.`]}),r>0&&(0,L.jsx)(`span`,{className:`text-[12px] text-warn shrink-0`,children:r===1?`1 session Caprock started will close`:`${r} sessions Caprock started will close`}),i.command?(0,L.jsx)(Ct,{command:i.command}):(0,L.jsx)(`a`,{className:`link text-[12px]`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`download it`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[i.checked_at?(0,L.jsxs)(`span`,{className:`num text-[11px] text-fg-faint`,children:[`checked `,T(i.checked_at,n)]}):null,(0,L.jsx)(`a`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm no-underline`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`what's new`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,i.latest),s(i.latest)},children:`not now`})]})]})}function xr({tone:e,children:t}){return(0,L.jsx)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 text-[12px] ${e===`accent`?`border-accent/40 bg-accent/5`:`border-border bg-panel`}`,children:t})}function Sr({u:e,className:t=``}){return!e||e.turns===0?null:(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] ${t}`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Cost is incomplete`}),` `,(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[C(e.tokens),` tokens over `,e.turns,` turn`,e.turns===1?``:`s`,` could not be priced, so they are missing from the total above — not free. `,e.models.length===1?`Model`:`Models`,` with no entry in the pricing table:`,` `,e.models.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0&&`, `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:e||`unknown`})]},e)),`. This happens when a model ships newer than the pricing table, or when a gateway reports ids that do not normalise.`]})]})}function Cr({value:e,onPick:t}){let[n,r]=(0,l.useState)(`recent`),[i,a]=(0,l.useState)(``),o=I(()=>P.recentDirs(),[],{live:!1}),s=I(()=>P.browse(i),[i],{live:!1});return(0,l.useEffect)(()=>{o.data&&o.data.length===0&&r(`browse`)},[o.data]),(0,L.jsxs)(`div`,{className:`rounded-[3px] border border-border-strong bg-panel-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border-strong px-2 py-1.5 text-[12px]`,children:[(0,L.jsx)(wr,{on:n===`recent`,onClick:()=>r(`recent`),children:`Recent`}),(0,L.jsx)(wr,{on:n===`browse`,onClick:()=>r(`browse`),children:`Browse`}),n===`browse`&&s.data&&(0,L.jsx)(`span`,{className:`mono ml-auto min-w-0 truncate pl-2 text-[11px] text-fg-faint`,title:s.data.dir,children:kr(s.data.dir,s.data.root)})]}),(0,L.jsx)(`div`,{className:`h-[168px] overflow-y-auto overflow-x-hidden`,children:n===`recent`?(0,L.jsx)(Tr,{rows:o.data,value:e,onPick:t}):(0,L.jsx)(Er,{data:s.data,value:e,onOpen:a,onPick:t,error:s.error?.message})})]})}function wr({on:e,onClick:t,children:n}){return(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-sm px-2 py-0.5 ${e?`bg-accent/15 text-accent`:`text-fg-muted hover:text-fg`}`,children:n})}function Tr({rows:e,value:t,onPick:n}){return e?e.length===0?(0,L.jsx)(Or,{children:`No sessions yet — use Browse, or type a path.`}):(0,L.jsx)(`ul`,{children:e.map(e=>(0,L.jsxs)(Dr,{selected:t===e.dir,onClick:()=>n(e.dir),children:[(0,L.jsx)(`span`,{className:`shrink-0 text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`mono ml-2 min-w-0 flex-1 truncate text-[11px] text-fg-faint`,title:e.dir,children:e.dir}),(0,L.jsx)(`span`,{className:`shrink-0 pl-2 text-[11px] text-fg-faint`,children:T(e.last_event_at)})]},e.dir))}):(0,L.jsx)(Or,{children:`…`})}function Er({data:e,value:t,onOpen:n,onPick:r,error:i}){return i?(0,L.jsx)(Or,{children:i}):e?(0,L.jsxs)(`ul`,{children:[e.parent&&(0,L.jsx)(Dr,{selected:!1,onClick:()=>n(e.parent),children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`↑ up`})}),e.entries.length===0&&(0,L.jsx)(Or,{children:`Nothing here.`}),e.entries.map(e=>(0,L.jsxs)(Dr,{selected:t===e.path,onClick:()=>e.repo?r(e.path):n(e.path),children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate ${e.repo?`text-fg`:`text-fg-muted`}`,children:e.name}),e.repo&&(0,L.jsx)(`span`,{className:`ml-2 shrink-0 text-[10px] uppercase tracking-wide text-accent`,children:`repo`}),(0,L.jsx)(`span`,{className:`flex-1`}),(0,L.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.repo?n(e.path):r(e.path)},className:`shrink-0 px-1 text-[11px] text-fg-faint hover:text-fg`,title:e.repo?`Open this folder`:`Use this folder`,children:e.repo?`›`:`use`})]},e.path))]}):(0,L.jsx)(Or,{children:`…`})}function Dr({selected:e,onClick:t,children:n}){return(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`flex w-full min-w-0 items-center px-2.5 py-1 text-left text-[12px] hover:bg-panel ${e?`bg-accent/10`:``}`,children:n})})}function Or({children:e}){return(0,L.jsx)(`p`,{className:`px-2.5 py-3 text-[12px] text-fg-faint`,children:e})}function kr(e,t){return e===t?`~`:e.startsWith(t+`/`)?`~`+e.slice(t.length):e}var Ar=`claude-opus-5`,jr=`acceptEdits`,Mr=[[`claude-opus-5`,`Opus 5 · most capable`],[`claude-sonnet-5`,`Sonnet 5 · faster, cheaper`],[`claude-haiku-4-5`,`Haiku 4.5 · cheapest`]],Nr=[[`acceptEdits`,`Accept edits · asks before commands`],[`plan`,`Plan · reads and plans, changes nothing`],[`bypassPermissions`,`Bypass · never asks`]];function Pr({available:e,onClose:t,initialCwd:n=``}){let[r,i]=(0,l.useState)(n),[a,o]=(0,l.useState)(Ar),[s,c]=(0,l.useState)(jr),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),y=async()=>{if(!r.trim()){_(`Working directory is required.`);return}h(!0),_(``);try{let e={cwd:r.trim()};a&&(e.model=a),s&&(e.permission_mode=s),u.trim()&&(e.worktree=u.trim()),f&&(e.create=!0);let{session_id:n}=await P.spawn(e);t(),v({name:`session`,id:n,tab:`terminal`})}catch(e){_(ae(e))}finally{h(!1)}};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:t,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[520px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New session`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),e?(0,L.jsxs)(`div`,{className:`px-4 py-3 grid min-w-0 gap-3 text-[13px]`,children:[(0,L.jsxs)(Fr,{label:`Working directory`,hint:`pick one, or type a path`,children:[(0,L.jsx)(`input`,{autoFocus:!0,className:`input`,placeholder:`/Users/you/dev/project`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&y()}),(0,L.jsx)(`div`,{className:`mt-1.5 min-w-0 max-w-full`,children:(0,L.jsx)(Cr,{value:r,onPick:i})})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsx)(Fr,{label:`Model`,children:(0,L.jsx)(`select`,{className:`input`,value:a,onChange:e=>o(e.target.value),children:Mr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})}),(0,L.jsx)(Fr,{label:`Permissions`,children:(0,L.jsx)(`select`,{className:`input`,value:s,onChange:e=>c(e.target.value),children:Nr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})})]}),(0,L.jsxs)(`details`,{className:`text-[12px] group`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer select-none text-fg-muted hover:text-fg list-none marker:content-none`,children:[(0,L.jsx)(`span`,{className:`inline-block transition-transform group-open:rotate-90 text-fg-faint`,children:`▶`}),` Advanced`]}),(0,L.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none text-fg-muted`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:f,onChange:e=>p(e.target.checked)}),`create the directory if it does not exist`]}),(0,L.jsx)(Fr,{label:`Git worktree`,hint:`creates .caprock-worktrees/ on a new branch`,children:(0,L.jsx)(`input`,{className:`input`,placeholder:`feature-x`,value:u,onChange:e=>d(e.target.value)})})]})]}),g&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:g})]}):(0,L.jsxs)(`div`,{className:`px-4 py-6 text-[13px] text-fg-muted`,children:[`The `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself.`]}),e&&(0,L.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,L.jsx)(`button`,{onClick:t,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,L.jsx)(`button`,{onClick:y,disabled:m,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:m?`starting…`:`Start session`})]})]})})}function Fr({label:e,hint:t,children:n}){return(0,L.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[e,t&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,t]})]}),n]})}function Ir(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(`all`),[i,a]=(0,l.useState)(!1),o=I(()=>P.sessions(!e),[e],{intervalMs:5e3}),s=I(()=>P.status(),[],{live:!1,intervalMs:3e4}),c=I(()=>P.summary(`today`,n),[n],{intervalMs:5e3}),u=I(()=>P.history(`all`),[],{intervalMs:6e4}),{alerts:p}=f(),m=re(1e3),h=o.data??[],g=n===`all`?h:h.filter(e=>(e.agent??`claude`)===n),_=!!s.data?.opencode,v=g.filter(e=>e.activity.health===`working`||e.activity.health===`looping`||e.activity.health===`error`||e.activity.health===`waiting-on-you`),y=g.filter(e=>!v.includes(e)&&e.status!==`ended`),b=g.filter(e=>e.status===`ended`),[x,w]=Ee(),ee=vr({sessions:g,alerts:p,now:m,limits:c.data?.rate_limits}),E=s.data?.hooks&&(s.data.hooks.missing??[]).length>0,D=!!c.data&&c.data.turns>0,te=s.data?.ingest_error;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[te&&(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-danger font-medium`,children:`Ingest stopped`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`No new sessions are being captured. `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:te}),` — check that`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})]}),E&&(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Hooks not installed`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`Activity is coming from transcripts only (a few seconds late, no tool-level detail for running commands). Run `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:`caprock hooks install`}),` for real-time narration.`]}),(0,L.jsx)(`a`,{href:`#/settings`,className:`link ml-auto text-[11px]`,children:`details`})]}),(0,L.jsx)(br,{plan:x,onSave:w,now:m,owned:g.filter(e=>e.owned&&e.status!==`ended`).length}),(0,L.jsx)(cr,{items:ee,now:m,onDismiss:e=>d.dismissAlert(e),sessions:g}),(0,L.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(dn,{plan:x})}),(0,L.jsx)(Lr,{available:s.data?.claude_available}),(0,L.jsx)(Rr,{available:s.data?.claude_available,onClick:()=>a(!0)})]}),D&&u.data?.totals&&(0,L.jsx)(En,{costUSD:u.data.totals.cost_usd,days:u.data.totals.days,now:m}),(0,L.jsxs)(R,{title:`Today`,center:_?(0,L.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-panel-2 p-0.5`,children:It.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),title:e.key===`all`?`Every agent`:`Only ${e.label}`,className:`px-2.5 py-1 text-[12px] mono rounded-[5px] transition-colors ${n===e.key?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.key))}):null,right:c.data?(0,L.jsxs)(`span`,{className:`num`,children:[`pricing `,c.data.pricing_version,` · at API list price`]}):null,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-[1.4fr_1fr_1fr_1fr_1fr_1fr] divide-x divide-border`,children:[(0,L.jsx)(z,{label:`Cost today`,value:D?S(c.data?.cost_usd):`—`,sub:(0,L.jsx)(`span`,{title:un(x),children:D?ln(x):`nothing measured yet`}),tone:`info`,size:`hero`}),(0,L.jsx)(z,{label:`Burn now`,value:D?`${S(c.data.burn.usd_per_hour)}/h`:`—`,sub:D?`${C(Math.round(c.data.burn.tokens_per_min))} tok/min · last ${c.data.burn.window_min}m`:void 0}),(0,L.jsx)(z,{label:`Sessions`,value:D?c.data.sessions:`—`,sub:D?`${c.data.active_sessions} active`:void 0,size:`compact`}),(0,L.jsx)(z,{label:`Turns`,value:D?c.data.turns:`—`,sub:D?`${c.data.tool_calls} tool calls`:void 0,size:`compact`}),(0,L.jsx)(vn,{limits:c.data?.rate_limits,now:m}),(0,L.jsx)(hn,{hitRate:c.data?.savings.hit_rate,cutPct:c.data?.savings.cut_pct,measured:D})]}),(0,L.jsx)(Sr,{u:c.data?.unpriced,className:`mx-3 mb-2.5`})]}),(0,L.jsx)(Qn,{sessions:g,now:m}),(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,L.jsx)(on,{sessions:g,now:m,emptyHint:n===`all`?void 0:(0,L.jsxs)(L.Fragment,{children:[`Nothing from `,n===`opencode`?`OpenCode`:`Claude Code`,` yet.`]})}),(0,L.jsx)(Wt,{sessions:g,agent:n})]}),(0,L.jsx)(In,{}),o.error&&!o.data&&(0,L.jsxs)(xt,{title:`Cannot reach the daemon`,children:[o.error.message,` — is `,(0,L.jsx)(`span`,{className:`mono`,children:`caprock up`}),` running?`]}),!o.data&&!o.error&&(0,L.jsx)(St,{rows:4,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),o.data&&g.length===0&&(n===`all`?(0,L.jsxs)(xt,{title:`No sessions yet`,children:[`Start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal — it will show up here within seconds.`]}):(0,L.jsxs)(xt,{title:`No ${n===`opencode`?`OpenCode`:`Claude Code`} sessions here`,children:[`Nothing from this agent in the current view. Switch to`,` `,(0,L.jsx)(`button`,{className:`link underline`,onClick:()=>r(`all`),children:`all`}),` `,`to see everything.`]})),(0,L.jsx)(zr,{groups:[{label:`Active`,items:v},{label:`Idle`,items:y,dim:!0},...e?[{label:`Ended`,items:b,dim:!0}]:[]],now:m}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:e,onChange:e=>t(e.target.checked)}),`show ended sessions`]}),o.loadedAt>0&&(0,L.jsxs)(`span`,{className:`num ml-auto`,children:[`refreshed `,T(o.loadedAt,m)]})]}),i&&(0,L.jsx)(Pr,{available:s.data?.claude_available??!1,onClose:()=>{a(!1),o.refresh()}})]})}function Lr({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return e===!1?null:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`button`,{onClick:async()=>{n(!0),i(``);try{let{session_id:e}=await P.spawn({chat:!0});v({name:`session`,id:e,tab:`terminal`})}catch(e){i(ae(e))}finally{n(!1)}},disabled:t,title:`start a session without picking a folder`,className:`relative shrink-0 rounded-[var(--radius-panel)] border border-border-strong px-3 py-2 text-[13px] leading-5 text-fg-muted hover:text-fg hover:border-accent/50 disabled:opacity-50`,children:[t?`starting…`:`Quick chat`,r&&(0,L.jsx)(`span`,{className:`absolute right-0 top-full mt-1 block max-w-[220px] text-right text-[11px] text-danger`,children:r})]})})}function Rr({available:e,onClick:t}){let n=e===!1;return(0,L.jsxs)(`button`,{onClick:t,title:n?`claude was not found on this machine — click for details`:`start a session Caprock owns`,className:`shrink-0 rounded-[var(--radius-panel)] border px-3 py-2 text-[13px] leading-5 font-medium transition-colors ${n?`border-border text-fg-faint hover:text-fg-muted`:`border-accent/60 bg-accent/15 text-accent hover:bg-accent/25`}`,children:[`+ New session`,n?` (claude not found)`:``]})}function zr({groups:e,now:t}){let n=e.flatMap(e=>e.items.map((t,n)=>({s:t,dim:e.dim,label:n===0?`${e.label} · ${e.items.length}`:null})));return n.length===0?null:(0,L.jsx)(`div`,{"data-testid":`session-grid`,className:`mt-3 grid gap-2 gap-y-6`,children:n.map(({s:e,dim:n,label:r})=>(0,L.jsxs)(`div`,{className:`relative ${n?`opacity-80`:``}`,children:[r&&(0,L.jsx)(`div`,{className:`absolute -top-4 left-0.5 text-[11px] uppercase tracking-[0.08em] text-fg-faint`,children:r}),(0,L.jsx)(Br,{s:e,now:t})]},e.session_id))})}function Br({s:e,now:t}){let n=e.context,r=n?n.pct>=85?`danger`:n.pct>=60?`warn`:void 0:void 0,[i,a]=(0,l.useState)(!1),o=e.activity?.health===`waiting-on-you`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`block border border-border bg-panel rounded-[var(--radius-panel)] hover:border-border-strong no-underline hover:no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`px-3 pt-2 pb-1 flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium truncate text-[15px]`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:E(e.session_id)}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.08em] text-fg-muted border border-border px-1 py-px rounded-sm`,children:`opencode`}),e.git_branch&&(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate`,children:e.git_branch}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[o&&(0,L.jsx)(`button`,{className:`text-[11px] border border-warn/50 text-warn bg-warn/10 px-1.5 py-0.5 rounded-sm hover:bg-warn/20`,onClick:e=>{e.preventDefault(),a(!0)},children:`what did it ask?`}),(0,L.jsx)(yt,{health:e.activity.health})]})]}),i&&(0,L.jsx)(ar,{session:e,now:t,onClose:()=>a(!1)}),(0,L.jsxs)(`div`,{className:`px-3 pb-2 text-[13px] truncate`,title:e.activity.phrase,children:[(0,L.jsx)(`span`,{className:e.activity.health===`working`?`text-fg`:`text-fg-muted`,children:e.activity.phrase}),(0,L.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(e.activity.at||e.last_event_at,t)})]}),e.activity.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`px-3 pb-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,L.jsx)(`div`,{className:`h-1 flex-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent`,style:{width:`${Math.min(100,Math.max(0,100*e.activity.plan.done/e.activity.plan.total))}%`}})}),(0,L.jsxs)(`span`,{className:`num`,children:[e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`span`,{className:`truncate max-w-[50%]`,children:[`→ `,e.activity.plan.next]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 divide-x divide-border border-t border-border`,children:[(0,L.jsx)(z,{label:`Cost`,value:S(e.stats.cost_usd),sub:e.model||`—`,tone:`info`}),(0,L.jsx)(z,{label:`Tokens`,value:C(e.stats.tokens_in+e.stats.tokens_out+e.stats.cache_read+e.stats.cache_write),sub:`${w(e.savings.hit_rate*100)} cache hit`}),(0,L.jsx)(z,{label:`Context`,value:n?w(n.pct):`—`,sub:n?`${C(n.tokens)} / ${C(n.window)}`:`unknown model`,tone:r}),(0,L.jsx)(z,{label:`Activity`,value:e.stats.tool_calls,sub:`${e.stats.turns} turns · ${e.stats.files_touched} files`})]})]})}function Vr({id:e,now:t}){let n=I(()=>P.notes(e),[e],{intervalMs:1e4}),r=n.data??[],[i,a]=(0,l.useState)(!1),o=r.filter(e=>!e.fragment),s=i?r:o;return n.error&&!n.data?(0,L.jsx)(xt,{title:`Cannot load notes`,children:n.error.message}):n.data?r.length===0?(0,L.jsx)(xt,{title:`Nothing said yet`,children:`Claude's written answers appear here — the reasoning and the “what changed, what I still need from you” that otherwise lives only in your terminal scrollback.`}):(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`span`,{children:[o.length,` `,o.length===1?`answer`:`answers`,r.length>o.length&&` · ${r.length-o.length} short remarks`]}),r.length>o.length&&(0,L.jsx)(`button`,{className:`text-fg-muted hover:text-fg border border-border px-1.5 rounded-sm`,onClick:()=>a(e=>!e),children:i?`hide short remarks`:`show everything`}),(0,L.jsx)(`span`,{className:`ml-auto`,children:`subagent chatter excluded · newest first`})]}),s.map(e=>(0,L.jsx)(Ur,{note:e,now:t},e.event_id))]}):(0,L.jsx)(St,{rows:4})}var Hr=600;function Ur({note:e,now:t,showSession:n=!1}){let[r,i]=(0,l.useState)(!1),a=typeof e.text==`string`?e.text:``,o=[...a],s=o.length>Hr,c=r||!s?a:o.slice(0,Hr).join(``)+`…`;return(0,L.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-2 text-[11px] text-fg-faint`,children:[n&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id,at:e.ts}),className:`link`,title:`Open the session at this moment`,children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.project||E(e.session_id)})}),(0,L.jsx)(`span`,{className:`mono`,children:e.model||`assistant`}),e.fragment&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:`· mid-thought`}),(0,L.jsx)(`span`,{className:`num ml-auto`,children:T(e.ts,t)})]}),(0,L.jsx)(`div`,{className:`px-3 py-2 text-[13px] leading-[1.55] whitespace-pre-wrap break-words`,children:c}),s&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg px-3 pb-2`,onClick:()=>i(e=>!e),children:r?`show less`:`show all ${o.length.toLocaleString()} characters`})]})}var Wr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Kr=(e,t)=>{for(var n in t)Wr(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gr(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wr(t,n,i),i},B=(e,t)=>(n,r)=>t(n,r,e),Jr=`Terminal input`,Yr={get:()=>Jr,set:e=>Jr=e},Xr=`Too much output to announce, navigate to rows manually to read`,Zr={get:()=>Xr,set:e=>Xr=e};function Qr(e){return e.replace(/\r?\n/g,`\r`)}function $r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ei(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ti(e,t,n,r){e.stopPropagation(),e.clipboardData&&ni(e.clipboardData.getData(`text/plain`),t,n,r)}function ni(e,t,n,r){e=Qr(e),e=$r(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ri(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ii(e,t,n,r,i){ri(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ai(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oi(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var si=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ci=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},li=``,ui=` `,di=class e{constructor(){this.fg=0,this.bg=0,this.extended=new fi}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},fi=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pi=class e extends di{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fi,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ai(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mi=`di$target`,hi=`di$dependencies`,gi=new Map;function _i(e){return e[hi]||[]}function vi(e){if(gi.has(e))return gi.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);yi(t,e,r)};return t._id=e,gi.set(e,t),t}function yi(e,t,n){t[mi]===t?t[hi].push({id:e,index:n}):(t[hi]=[{id:e,index:n}],t[mi]=t)}var bi=vi(`BufferService`),xi=vi(`CoreMouseService`),Si=vi(`CoreService`),Ci=vi(`CharsetService`),wi=vi(`InstantiationService`),Ti=vi(`LogService`),Ei=vi(`OptionsService`),Di=vi(`OscLinkService`),Oi=vi(`UnicodeService`),ki=vi(`DecorationService`),Ai=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new pi,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):ji(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ai=qr([B(0,bi),B(1,Ei),B(2,Di)],Ai);function ji(e,t){if(confirm(`Do you want to navigate to ${t}? +`)}function Pe(e,t,n,r){let i=ke.find(t=>t.id===e)??ke[0];return`https://github.com/${Ae}/issues/new?${new URLSearchParams({title:Me(e,t,n),body:Ne(e,n,r),labels:i.gh}).toString()}`}var Fe=6e3;function Ie(e){return e.trim().length>=8}function Le({screen:e}){let[t,n]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,title:`Report a bug, ask for something, or say what was unclear`,children:`feedback`}),t&&(0,L.jsx)(Re,{screen:e,onClose:()=>n(!1)})]})}function Re({screen:e,onClose:t}){let[n,r]=(0,l.useState)(`bug`),[i,a]=(0,l.useState)(``),o=je(I(()=>P.status(),[],{live:!1,intervalMs:0}).data,e),s=Ie(i),c=ke.find(e=>e.id===n)??ke[0],u=()=>{s&&(window.open(Pe(n,e,i,o),`_blank`,`noopener`),t())};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[12vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[660px] border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Tell us what happened`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,L.jsx)(`div`,{className:`flex gap-1.5`,children:ke.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.id),className:`text-[13px] px-3.5 py-1.5 rounded-sm border font-mono ${e.id===n?`border-accent/60 bg-accent/10 text-accent`:`border-border text-fg-muted hover:text-fg`}`,children:e.label},e.id))}),(0,L.jsx)(`textarea`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:c.hint,rows:6,className:`input w-full resize-y text-[14px] leading-relaxed`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&u()}}),(0,L.jsxs)(`div`,{className:`border border-border rounded-sm bg-panel-2/50 px-3 py-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:`Attached`}),(0,L.jsx)(`ul`,{className:`text-[11px] text-fg-muted num grid gap-0.5`,children:o.map(e=>(0,L.jsx)(`li`,{children:e},e))})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:u,disabled:!s,className:`text-[12px] px-3 py-1.5 rounded-sm border ${s?`border-accent/50 bg-accent/10 text-accent hover:bg-accent/20`:`border-border text-fg-faint cursor-not-allowed`}`,children:`Open a GitHub issue →`}),(0,L.jsx)(`span`,{className:`text-[12px] ${s?`text-fg-faint`:`text-fg-muted`}`,children:s?`⌘↵ to open`:`One sentence is enough.`})]}),(0,L.jsx)(`p`,{className:`text-[11px] text-fg-faint leading-relaxed`,children:`Nothing is sent from here — the issue opens prefilled in your browser for you to submit.`})]})]})})}var ze=1200,Be=630;function Ve(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}var He={command:`running commands`,edit:`writing code`,read:`reading code`,mcp:`MCP tools`,web:`web research`,other:`other tools`,none:`no tool call`};function Ue(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/^claude-/,``).replace(/-\d{8}$/,``).slice(0,18)}function We(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function Ge(e,t){let n=Ve(`--color-bg`,`#141414`),r=Ve(`--color-panel`,`#1a1a19`),i=Ve(`--color-border`,`#2a2a28`),a=Ve(`--color-fg`,`#e8e6e2`),o=Ve(`--color-fg-muted`,`#a9a59e`),s=Ve(`--color-fg-faint`,`#6f6b64`),c=Ve(`--color-accent`,`#feb157`),l=Ve(`--color-ok`,`#7fc99a`),u=`"JetBrains Mono", ui-monospace, monospace`,d=`"Hanken Grotesk", ui-sans-serif, system-ui, sans-serif`;e.fillStyle=n,e.fillRect(0,0,ze,Be);let f=(t,n,r,i,a=12)=>{e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()},p=(t,n,a,o)=>{f(t,n,a,o),e.fillStyle=r,e.fill(),e.strokeStyle=i,e.lineWidth=1,e.stroke()},m=(t,n,r,i,a,o=d,s=400,c=`left`)=>{e.fillStyle=a,e.font=`${s} ${i}px ${o}`,e.textAlign=c,e.fillText(r,t,n)};e.font=`600 32px ${d}`;let h=`My stats on`,g=e.measureText(` `).width,_=e.measureText(h).width;m(64,78,h,32,a,d,600);let v=64+_+g;m(v,78,`caprock.dev`,32,c,d,600);let y=e.measureText(`caprock.dev`).width,b=t.takenAt.toLocaleDateString(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`});m(v+y+g*2,78,`– ${b}`,26,s,d,600),[[`TODAY`,S(t.today.cost),`${t.today.sessions} sessions`,c],[`THIS WEEK`,S(t.week.cost),`${t.week.sessions} sessions`,a],[`THIS MONTH`,S(t.month.cost),`${We(t.month.tokens)} tokens`,a],[`ALL TIME`,S(t.allTime.cost),`${t.allTime.days} active days`,c],[`A DAY`,S(t.allTime.cost/Math.max(1,t.allTime.days)),`on average`,a],[`TOKENS`,We(t.allTime.tokens),`all time`,a],[`PER 1M TOKENS`,S(t.allTime.cost/Math.max(1,t.allTime.tokens/1e6)),`what a million costs`,a],[`CACHE HIT`,`${Math.round(t.cacheHitPct)}%`,`input cost cut`,l]].forEach(([e,t,n,r],i)=>{let a=64+i%4*272,c=130+Math.floor(i/4)*114;p(a,c,256,98),m(a+20,c+30,e,13,s,u),m(a+20,c+56,t,28,r,d,600),m(a+20,c+81,n,14,o)});let x=(t,n,r,i)=>{let l=44+r.length*26+12;p(t,n,524,l),m(t+20,n+30,i,13,s,u);let d=Math.max(...r.map(e=>e.cost),1),h=r.reduce((e,t)=>e+t.cost,0),g=t+170;return r.forEach((r,i)=>{let l=n+62+i*26;m(t+20,l,r.label,14,o,u),e.fillStyle=c,e.globalAlpha=.85;let p=Math.max(2,164*(r.cost/d));f(g,l-10,p,10,Math.min(3,p/2)),e.fill(),e.globalAlpha=1,m(t+524-62,l,S(r.cost),14,a,u,400,`right`);let _=h>0?Math.max(1,Math.floor(100*r.cost/h)):0;m(t+524-20,l,`${_}%`,14,s,u,400,`right`)}),l},C=x(64,372,t.models,`WHERE THE MONEY WENT`);x(612,372,t.work,`WHAT IT WENT ON`);let w=372+C+34;m(64,w,`at API list prices — not a bill, and not money saved`,14,s),m(1136,w,`What's yours?`,15,c,d,600,`right`),e.textAlign=`left`}function Ke(e=new Date){let t=e=>String(e).padStart(2,`0`);return`caprock-${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}.png`}async function qe(){let[e,t,n,r]=await Promise.all([P.summary(`today`),P.summary(`7d`),P.summary(`30d`),P.history(`all`)]),i=e=>e.tokens_in+e.tokens_out+e.cache_read+e.cache_write;return{takenAt:new Date,today:{cost:e.cost_usd,sessions:e.sessions},week:{cost:t.cost_usd,sessions:t.sessions},month:{cost:n.cost_usd,tokens:i(n)},allTime:{cost:r.totals.cost_usd,days:r.totals.days,tokens:i(r.summary)},cacheHitPct:(n.savings?.hit_rate??0)*100,models:(n.models??[]).slice(0,5).map(e=>({label:Ue(e.model),cost:e.cost_usd})),work:(n.work??[]).slice(0,5).map(e=>({label:He[e.kind]??e.kind,cost:e.cost_usd}))}}async function Je(e){let t=document.createElement(`canvas`);t.width=ze,t.height=Be;let n=null;try{n=t.getContext(`2d`)}catch{return null}return n?(Ge(n,e),await new Promise(e=>{if(typeof t.toBlob!=`function`){e(null);return}t.toBlob(t=>e(t),`image/png`)})):null}function Ye(e){let t=`over ${e.days} active days`;return`${S(e.cost_usd)} of Claude Code ${t}, across ${e.sessions.toLocaleString(`en-US`)} sessions — measured on my own machine with Caprock. https://caprock.dev`}function Xe(){let[e,t]=(0,l.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>t(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2 py-0.5 text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of your figures`,children:`Share`}),e&&(0,L.jsx)(Ze,{onClose:()=>t(!1)})]})}function Ze({onClose:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=async()=>{let[e,t]=await Promise.all([qe(),P.history(`all`)]);return{blob:await Je(e),text:Ye(t.totals)}},c=async()=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t}=await s();if(!t){o(`Could not draw the card in this browser.`),i(!1);return}let r=new File([t],Ke(),{type:`image/png`});n(!1),await navigator.share({files:[r]}),e()}catch(e){e?.name!==`AbortError`&&o(`Sharing was not available — the card was not sent.`),i(!1)}finally{n(!1)}}},u=async e=>{if(!r){i(!0),n(!0),o(``);try{let{blob:t,text:n}=await s();if(!t){o(`Could not draw the card in this browser.`);return}let r=URL.createObjectURL(t),i=document.createElement(`a`);if(i.href=r,i.download=Ke(),i.click(),URL.revokeObjectURL(r),e===`download`){o(`Saved to your downloads.`);return}let a=e===`x`?`https://x.com/intent/tweet?text=${encodeURIComponent(n)}`:`https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(n)}`;window.open(a,`_blank`,`noopener`),o(`Card saved and the post opened — drag the image in.`)}finally{n(!1),i(!1)}}},d=typeof navigator<`u`&&typeof navigator.canShare==`function`&&navigator.canShare({files:[new File([],`x.png`,{type:`image/png`})]});return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[14vh]`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":`Share your figures`,children:(0,L.jsxs)(`div`,{className:`w-[420px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-center border-b border-border px-4 py-3`,children:[(0,L.jsx)(`h2`,{className:`text-[13px] font-medium text-fg`,children:`Share your figures`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2.5`,children:[d&&(0,L.jsxs)(`button`,{onClick:c,disabled:r,className:`rounded-md border border-accent bg-accent/15 px-4 py-3 text-[14px] font-medium text-accent hover:bg-accent/25 disabled:opacity-50`,children:[t?`Drawing the card…`:`Send it somewhere`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] font-normal text-fg-muted`,children:`Opens your share menu — Messages, Mail, anywhere`})]}),(0,L.jsxs)(`button`,{onClick:()=>u(`download`),disabled:r,className:`rounded-md border border-border bg-transparent px-4 py-3 text-[14px] text-fg transition-colors hover:border-border-strong hover:bg-panel-2 disabled:opacity-50`,children:[t&&!d?`Drawing the card…`:`Save the image`,(0,L.jsx)(`span`,{className:`mt-0.5 block text-[12px] text-fg-muted`,children:`A PNG in your downloads, to post wherever you like`})]})]}),(0,L.jsxs)(`ul`,{className:`mt-4 grid gap-1 text-[13px] text-fg-muted`,children:[(0,L.jsx)(`li`,{children:`Totals only — no names, no paths, nothing Claude wrote.`}),(0,L.jsx)(`li`,{children:`Drawn on your machine. Uploaded nowhere.`})]}),a&&(0,L.jsx)(`p`,{className:`mt-2 text-[12px] text-fg-muted`,children:a})]})]})})}function Qe(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),[t,n]=(0,l.useState)(!1),r=e.data?.totals;return!r||r.sessions===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>n(!0),className:`rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1 text-[12px] text-accent hover:bg-accent/[0.16]`,title:`Draw a shareable image of these figures`,children:`Share these numbers`}),t&&(0,L.jsx)(Ze,{onClose:()=>n(!1)})]})}var $e={cap:{title:`A daily cap that pauses sessions`,body:`A number for the day. Cross it and Caprock stops its own sessions.`,points:[`A runaway loop stops at $40 instead of finishing at $400`,`It happens while you are asleep, not in tomorrow’s summary`,`Your own sessions are never touched — only the ones Caprock started`]},gemini:{title:`Ask Gemini, on your own key`,body:`A second model inside Caprock, paid for by you, at Google’s prices.`,points:[`Ask about your own sessions without leaving the dashboard`,`What it costs is counted and shown beside your Claude spend`,`Caprock never stores the key — it reads it from your environment`],setup:`Set GEMINI_API_KEY in the daemon’s environment and restart it. Google bills you directly.`},report:{title:`A weekly report, sent where you are`,body:`Monday morning, before you open a terminal.`,points:[`What moved: the repository that cost 3× its usual week`,`Last week against the one before it, per repository and model`,`Through your own Telegram bot — nothing passes our server`],setup:`Setup: one message to BotFather, about two minutes.`}};function et({p:e,onClose:t}){return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsxs)(`a`,{href:e.yearly.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium/75 px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:bg-premium`,children:[`$`,e.yearly.charged_usd,` / year`]}),(0,L.jsxs)(`a`,{href:e.lifetime?.url,target:`_blank`,rel:`noreferrer`,onClick:t,className:`rounded-sm bg-premium-strong px-3 py-2.5 text-center text-[14px] font-medium text-white no-underline hover:brightness-110`,children:[`$`,e.lifetime?.charged_usd,` once`]})]}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-center text-[11px] leading-snug text-fg-faint`,children:[(0,L.jsx)(`span`,{children:`Every Premium feature, renews yearly`}),(0,L.jsx)(`span`,{children:`Every Premium feature, now and future — no renewal`})]})]}):(0,L.jsx)(`div`,{className:`h-[92px] text-[13px] text-fg-faint`,children:`…`})}function tt({feature:e,onClose:t}){let n=I(()=>P.premium(),[]).data,r=$e[e];return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 flex items-start justify-center bg-black/50 px-4 pt-[12vh]`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Caprock Premium`,children:(0,L.jsxs)(`div`,{className:`w-[440px] max-w-full rounded-[var(--radius-panel)] border border-border-strong bg-panel`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`flex items-start gap-3 px-5 pt-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-premium-strong`,children:`Caprock Premium`}),(0,L.jsx)(`h2`,{className:`mt-1 text-[16px] font-medium leading-snug text-fg`,children:r.title})]}),(0,L.jsx)(`button`,{onClick:t,className:`-mr-1 ml-auto text-fg-muted hover:text-fg`,"aria-label":`Close`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`px-5 pt-3`,children:[(0,L.jsx)(`p`,{className:`text-[13px] leading-relaxed text-fg-muted`,children:r.body}),(0,L.jsx)(`ul`,{className:`mt-3 space-y-1.5`,children:r.points.map(e=>(0,L.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-fg`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-premium-strong`,children:`·`}),(0,L.jsx)(`span`,{children:e})]},e))}),r.setup&&(0,L.jsx)(`p`,{className:`mt-2.5 text-[12px] text-fg-faint`,children:r.setup})]}),(0,L.jsx)(`div`,{className:`mt-4 border-t border-border px-5 py-4`,children:(0,L.jsx)(et,{p:n,onClose:t})}),(0,L.jsx)(`footer`,{className:`border-t border-border px-5 py-3 text-[12px]`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`a`,{href:n?.info_url??`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`whitespace-nowrap text-fg-muted no-underline hover:text-fg`,children:`Read more`}),(0,L.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:`opens a new tab`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`Close`})]})}),(0,L.jsx)(`p`,{className:`border-t border-border px-5 py-2.5 text-[11px] leading-relaxed text-fg-faint`,children:`Everything Caprock does now stays free and Apache-2.0 — Premium only ever adds.`})]})})}function nt(){let[e,t]=(0,l.useState)(!1),n=I(()=>P.premium(),[],{live:!1,intervalMs:3e5});if(!n.data?.yearly?.url)return null;let r=n.data.license;if(r?.active){let e=r.expires_at?new Date(r.expires_at):null,t=!!e&&e.getFullYear()-new Date().getFullYear()>10;return(0,L.jsxs)(`span`,{className:`text-premium-strong`,title:e&&!t?`Covers you through ${e.toLocaleDateString()}`:`Bought outright`,children:[`premium `,(0,L.jsx)(`span`,{className:`opacity-70`,children:t?`lifetime`:`yearly`}),r.in_grace&&(0,L.jsx)(`span`,{className:`ml-1 text-warn`,children:`· renew`})]})}let i=n.data;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{onClick:()=>t(!0),title:`What Premium includes`,className:`inline-flex items-center gap-1.5 rounded-sm border border-premium/60 bg-premium px-2 py-0.5 text-white hover:brightness-110`,children:[(0,L.jsx)(`span`,{children:`Get premium`}),(0,L.jsxs)(`span`,{className:`opacity-75`,children:[`$`,i.yearly.charged_usd,`/yr`]})]}),e&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>t(!1)})]})}var rt=`https://github.com/dspv/caprock`,it=`https://caprock.dev/teams`,at=`https://caprock.dev/premium`,ot=`caprock.footer.starred`;function st(){let[e,t]=(0,l.useState)(()=>localStorage.getItem(ot)===`1`);return(0,L.jsx)(`footer`,{className:`mt-6 border-t border-border`,children:(0,L.jsxs)(`div`,{className:`max-w-[1600px] mx-auto px-3 py-4 flex flex-wrap items-center gap-x-6 gap-y-3 text-[11px] text-fg-faint`,children:[(0,L.jsxs)(`a`,{href:it,target:`_blank`,rel:`noreferrer`,className:`group inline-flex items-center gap-2 no-underline`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted group-hover:text-fg`,children:`Want this for your team?`}),(0,L.jsx)(`span`,{className:`text-accent group-hover:text-accent-strong`,children:`Caprock for Teams →`})]}),(0,L.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-4`,children:[(0,L.jsx)(`a`,{href:at,target:`_blank`,rel:`noreferrer`,className:`text-fg-muted hover:text-fg no-underline`,title:`A daily spend cap — Caprock pauses its own sessions when the day passes a limit you set`,children:`premium`}),!e&&(0,L.jsx)(`a`,{href:rt,target:`_blank`,rel:`noreferrer`,onClick:()=>{localStorage.setItem(ot,`1`),t(!0)},className:`text-fg-faint hover:text-fg no-underline`,title:`Opens GitHub in a new tab`,children:`★ star on GitHub`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/blog`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`blog`}),(0,L.jsx)(`a`,{href:`https://caprock.dev/docs`,target:`_blank`,rel:`noreferrer`,className:`text-fg-faint hover:text-fg no-underline`,children:`docs`})]})]})})}var ct=[{route:{name:`now`},label:`Now`},{route:{name:`cost`},label:`Cost`},{route:{name:`history`},label:`Lifetime`},{route:{name:`notes`},label:`Answers`},{route:{name:`tasks`},label:`Tasks`}];function lt(e){switch(e.name){case`now`:return`Now`;case`session`:return`Session detail`;case`cost`:return`Cost`;case`history`:return`Lifetime`;case`tasks`:return`Tasks`;case`graph`:return`Graph`;case`notes`:return`Answers`;case`settings`:return`Status`}}function ut({route:e,children:t}){let n=f(),[r,i]=Ee(),a=t=>t.name===e.name||t.name===`now`&&e.name===`session`;return(0,L.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,L.jsxs)(`header`,{className:`h-10 border-b border-border bg-panel flex items-center px-3 gap-4 sticky top-0 z-10`,children:[(0,L.jsxs)(`a`,{href:`#/`,className:`flex items-center gap-2 text-fg no-underline hover:no-underline`,children:[(0,L.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 32 32`,"aria-hidden":!0,children:[(0,L.jsx)(`path`,{d:`M6 22 L16 8 L26 22 Z`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`3`,strokeLinejoin:`round`}),(0,L.jsx)(`rect`,{x:`6`,y:`22`,width:`20`,height:`3`,fill:`var(--color-accent)`})]}),(0,L.jsx)(`span`,{className:`font-medium tracking-wide text-[13px]`,children:`caprock`}),(0,L.jsx)(`span`,{className:`text-fg-faint text-[11px] hidden sm:inline`,children:`mission control`})]}),(0,L.jsx)(`nav`,{className:`inline-flex items-center gap-0.5 ml-2 rounded-md bg-panel-2 p-0.5`,children:ct.map(e=>(0,L.jsxs)(`a`,{href:g(e.route),"aria-current":a(e.route)?`page`:void 0,className:`px-2.5 py-1 rounded-[5px] text-[12px] no-underline hover:no-underline transition-colors ${a(e.route)?`bg-accent text-panel font-medium`:`text-fg hover:text-accent`}`,children:[e.label,e.phase&&(0,L.jsx)(`span`,{className:`ml-1 text-[9px] uppercase tracking-wider text-fg-faint`,children:e.phase})]},e.label))}),(0,L.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 text-[11px] text-fg-muted`,children:[(0,L.jsx)(Xe,{}),(0,L.jsx)(nt,{}),(0,L.jsx)(Le,{screen:lt(e)}),(0,L.jsx)(ft,{state:n.conn,lastFrameAt:n.lastFrameAt}),(0,L.jsx)(De,{plan:r,onSave:i}),(0,L.jsx)(dt,{}),(0,L.jsx)(pt,{}),(0,L.jsx)(`a`,{href:`#/settings`,className:`text-fg-muted hover:text-fg no-underline`,children:`status`})]})]}),(0,L.jsx)(`main`,{className:`flex-1 p-3 max-w-[1600px] w-full mx-auto`,children:t}),(0,L.jsx)(st,{})]})}function dt(){let[e,t]=A(),n=e===`dark`;return(0,L.jsx)(`button`,{type:`button`,onClick:t,title:n?`Switch to light theme`:`Switch to dark theme`,"aria-label":n?`Switch to light theme`:`Switch to dark theme`,className:`text-fg-muted hover:text-fg inline-flex items-center`,children:n?(0,L.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,L.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M19.1 4.9l-1.4 1.4M6.3 17.7l-1.4 1.4`})]}):(0,L.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:(0,L.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})})})}function ft({state:e,lastFrameAt:t}){let n=re(1e3),r=e===`open`?`bg-ok`:e===`connecting`?`bg-warn`:`bg-danger`,i=e===`open`?`live · ${t?T(t,n):`connected`}`:e===`connecting`?`connecting…`:`disconnected — reconnecting`;return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:e===`open`?`Connected to the daemon. The time is when it last sent anything — on an idle machine that keeps counting up, which is normal.`:`WebSocket /v1/live`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${r}`}),(0,L.jsx)(`span`,{className:`num`,children:i})]})}function pt(){let e=I(()=>P.status(),[],{live:!1,intervalMs:6e4}),t=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:6e4}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=e.data?.version;if(!o)return null;let s=/^v?\d+\.\d+\.\d+$/.test(o),c=s&&t.data?.update_available?t.data.latest:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{onClick:()=>r(!0),className:c?`mono text-[11px] text-accent hover:text-accent-strong`:`mono text-[11px] text-fg-faint hover:text-fg`,title:c?`${c} is available — you are on ${o}`:`version and updates`,children:c?`${o} → ${c}`:s?o:`dev build`}),t.data?.notes&&(0,L.jsx)(`button`,{onClick:()=>a(!0),className:`text-[11px] text-fg-faint hover:text-accent`,title:`what changed in ${t.data.notes_for??`the latest release`}`,children:`what's new`}),n&&(0,L.jsx)(ht,{onClose:()=>r(!1)}),i&&t.data&&(0,L.jsx)(mt,{u:t.data,onClose:()=>a(!1)})]})}function mt({u:e,onClose:t}){return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:t,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[620px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`What's new`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`What's new`}),e.notes_for&&(0,L.jsx)(`span`,{className:`mono text-[12px] text-accent`,children:e.notes_for}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsx)(`div`,{className:`overflow-y-auto px-4 py-3`,children:(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-[13px] leading-relaxed text-fg-muted`,children:e.notes})}),(0,L.jsx)(`div`,{className:`border-t border-border px-4 py-2.5`,children:(0,L.jsx)(`a`,{href:e.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`the full release on GitHub →`})})]})})}function ht({onClose:e}){let t=I(()=>P.status(),[],{live:!1,intervalMs:0}),n=I(()=>P.update().catch(()=>void 0),[],{live:!1,intervalMs:0}),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(void 0),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(()=>_e()??pe(navigator.userAgent,navigator.userAgentData?.platform)),[f,p]=(0,l.useState)(!1),m=a??n.data,h=t.data?.version??``,g=/^v?\d+\.\d+\.\d+$/.test(h),_=!f&&he(m?.command,u)?me(m?.command)??(u===`windows`?`macos`:u):u,v=fe(_),y=ye(m?.command,v),[b,x]=(0,l.useState)(void 0),S=v.find(e=>e.label===b)??y??v[0],C=e=>{d(e),p(!0),ve(e),x(void 0)},w=async()=>{i(!0);try{o(await P.checkUpdate())}catch{}finally{i(!1)}},T=e=>{navigator.clipboard.writeText(e),c(e),setTimeout(()=>c(``),1600)};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:e,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[560px] max-h-[80vh] overflow-y-auto border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),role:`dialog`,"aria-label":`Version and updates`,children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`span`,{className:`text-[15px] font-medium`,children:`Version`}),(0,L.jsx)(`button`,{onClick:e,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`p-4 grid gap-3.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`running`}),(0,L.jsx)(`span`,{className:`mono text-fg`,children:g?h:`${h} (local build)`}),m?.update_available&&(0,L.jsxs)(`span`,{className:`mono text-accent`,children:[`→ `,m.latest,` is out`]})]}),m?.enabled===!1?(0,L.jsxs)(`div`,{className:`text-[13px] text-fg-muted`,children:[`Release checks are off, so this copy never asks GitHub what the latest version is. Turn them on in`,` `,(0,L.jsx)(`a`,{href:`#/status`,onClick:e,className:`text-accent no-underline hover:text-accent-strong`,children:`status`}),`.`]}):m?.update_available?null:(0,L.jsx)(`div`,{className:`text-[13px] text-fg-muted`,children:m?.latest?`Up to date — ${m.latest} is the latest release.`:`No newer release found.`}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[oe.map(e=>(0,L.jsx)(`button`,{onClick:()=>C(e.id),className:`rounded-sm px-2.5 py-1 text-[12px] transition-colors ${_===e.id?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.id)),v.length>1&&(0,L.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:v.map(e=>(0,L.jsxs)(`button`,{onClick:()=>x(e.label),className:`rounded-sm px-2 py-1 text-[11px] transition-colors ${S.label===e.label?`text-accent`:`text-fg-faint hover:text-fg-muted`}`,title:e.label===y?.label?`how this copy appears to be installed`:void 0,children:[e.label,e.label===y?.label?` ·`:``]},e.label))})]}),(0,L.jsx)(`ol`,{className:`grid gap-2.5`,children:S.steps.map((e,t)=>(0,L.jsxs)(`li`,{className:`grid gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:t+1}),e.cmd?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`code`,{className:`mono flex-1 truncate rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-fg`,children:e.cmd}),(0,L.jsx)(`button`,{onClick:()=>T(e.cmd),className:`shrink-0 rounded-md border border-accent/45 bg-accent/[0.08] px-2.5 py-1.5 text-[12px] text-accent hover:bg-accent/[0.16]`,children:s===e.cmd?`copied`:`copy`})]}):(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1 rounded-sm border border-border bg-bg px-2 py-1.5 text-[13px] text-accent no-underline hover:text-accent-strong`,children:`Open the release page →`})]}),(0,L.jsx)(`p`,{className:`pl-5 text-[11px] leading-relaxed text-fg-faint`,children:e.note})]},t))})]}),(0,L.jsx)(`div`,{className:`text-[11px] leading-relaxed text-fg-faint border-t border-border pt-3`,children:`Caprock does not update itself: it would have to overwrite its own binary while running, and where a package manager owns that binary, replacing it behind their back breaks the next upgrade.`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`button`,{onClick:w,disabled:r,className:`rounded-md border border-border px-3 py-1.5 text-[13px] text-fg-muted hover:text-fg disabled:opacity-50`,children:r?`checking…`:`check now`}),(0,L.jsx)(`a`,{href:m?.url??`https://github.com/dspv/caprock/releases/latest`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[12px] text-fg-faint no-underline hover:text-accent`,children:`release notes →`})]})]})]})})}var gt=class extends l.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[caprock ui]`,e,t.componentStack)}render(){return this.state.error?(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 rounded-[var(--radius-panel)] px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`div`,{className:`text-danger font-medium`,children:[this.props.label??`This view`,` failed to render`]}),(0,L.jsx)(`div`,{className:`mono text-fg-muted mt-1`,children:this.state.error.message}),(0,L.jsx)(`button`,{className:`mt-2 border border-border px-2 py-0.5 rounded-sm text-fg-muted hover:text-fg`,onClick:()=>this.setState({error:null}),children:`retry`})]}):this.props.children}};function R({title:e,center:t,right:n,children:r,className:i=``,onMouseEnter:a,onMouseLeave:o}){return(0,L.jsxs)(`section`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] shadow-[var(--shadow-panel)] min-w-0 ${i}`,onMouseEnter:a,onMouseLeave:o,children:[(e||t||n)&&(0,L.jsxs)(`header`,{className:`relative flex items-center justify-between px-3 py-2 border-b border-border bg-panel-2/60 rounded-t-[var(--radius-panel)]`,children:[(0,L.jsx)(`h2`,{className:`text-[11px] uppercase tracking-[0.12em] text-fg-muted font-medium`,children:e}),t?(0,L.jsx)(`div`,{className:`absolute left-1/2 -translate-x-1/2`,children:t}):null,(0,L.jsx)(`div`,{className:`text-[11px] text-fg-muted`,children:n})]}),(0,L.jsx)(`div`,{children:r})]})}function z({label:e,value:t,sub:n,tone:r,size:i=`default`}){return(0,L.jsxs)(`div`,{className:`flex h-full flex-col px-3 py-2.5 min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`div`,{className:`num font-semibold tracking-[-0.01em] ${i===`hero`?`text-[34px] leading-[1.05]`:i===`compact`?`text-[17px] leading-tight`:`text-[24px] leading-[1.1]`} ${r===`ok`?`text-ok`:r===`warn`?`text-warn`:r===`danger`?`text-danger`:r===`info`?`text-info`:`text-fg`}`,children:t}),n&&(0,L.jsx)(`div`,{className:`mt-auto pt-1 text-[11px] text-fg-muted num truncate`,children:n})]})}var _t={working:`working`,idle:`idle`,"waiting-on-you":`waiting on you`,looping:`looping?`,error:`error`,ended:`ended`};function vt(e){switch(e){case`working`:return`ok`;case`idle`:return`warn`;case`waiting-on-you`:return`warn`;case`looping`:return`danger`;case`error`:return`danger`;case`ended`:return`muted`}}function yt({health:e}){let t=vt(e);return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 border rounded-sm px-1.5 py-[1px] text-[11px] leading-4 ${t===`ok`?`text-ok border-ok/40 bg-ok/10`:t===`warn`?`text-warn border-warn/40 bg-warn/10`:t===`danger`?`text-danger border-danger/40 bg-danger/10`:`text-fg-muted border-border bg-panel-2`}`,children:[(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${t===`ok`?`bg-ok`:t===`warn`?`bg-warn`:t===`danger`?`bg-danger`:`bg-fg-faint`} ${e===`working`?`animate-pulse`:``}`}),_t[e]]})}function bt({values:e,width:t=120,height:n=24,tone:r=`info`}){if(e.length<2)return(0,L.jsx)(`svg`,{width:t,height:n,"aria-hidden":!0});let i=Math.max(...e,1e-9),a=Math.min(...e,0),o=i-a||1,s=t/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(n-(e-a)/o*(n-2)-1).toFixed(1)}`).join(` `),l=r===`ok`?`var(--color-ok)`:r===`warn`?`var(--color-warn)`:r===`danger`?`var(--color-danger)`:r===`accent`?`var(--color-accent)`:`var(--color-info)`;return(0,L.jsx)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:`block`,"aria-hidden":!0,children:(0,L.jsx)(`polyline`,{fill:`none`,stroke:l,strokeWidth:`1.25`,points:c,vectorEffect:`non-scaling-stroke`})})}function xt({title:e,children:t}){return(0,L.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,L.jsx)(`div`,{className:`text-fg-muted`,children:e}),t&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-faint mt-1`,children:t})]})}function St({rows:e=3,className:t=``}){return(0,L.jsx)(`div`,{className:`px-3 py-2 grid gap-2 ${t}`,"aria-hidden":!0,children:Array.from({length:e},(e,t)=>(0,L.jsx)(`div`,{className:`h-3 rounded-sm bg-panel-2 skeleton-pulse`,style:{width:`${[92,74,83,61,88][t%5]}%`}},t))})}function Ct({command:e,className:t=``}){let[n,r]=(0,l.useState)(!1);return(0,L.jsx)(`button`,{className:`mono text-[12px] bg-panel-2 border border-border px-2 py-0.5 rounded-sm hover:border-border-strong text-fg text-left ${t}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),window.setTimeout(()=>r(!1),1500)})},title:`copy to clipboard — run it in your terminal`,children:n?`copied`:`$ ${e}`})}var wt={edit:{label:`writing code`,title:`Turns that wrote to a file — Edit, Write, NotebookEdit.`},command:{label:`running commands`,title:`Turns that ran a shell command — builds, tests, git, anything through Bash. The command itself is free; what costs is the turn that issued it and read its output.`},read:{label:`reading and searching`,title:`Turns that read or searched the codebase — Read, Grep, Glob. The file contents enter the prompt and are billed, which is why reading is not free.`},web:{label:`web research`,title:`Turns that fetched or searched the web — WebFetch, WebSearch.`},mcp:{label:`MCP tools`,title:`Turns that called one of your own MCP integrations.`},other:{label:`other tools`,title:`Turns that called a tool in none of the categories above — subagents, task and skill control, and any tool Caprock does not yet know by name.`},none:{label:`no tool call`,title:`Turns that called no tool at all. They may have been reasoning, planning, answering a question or writing prose — Caprock records which tools ran, not what a turn was thinking, so it does not claim to know which.`}},Tt=`Each turn counts toward one kind of work, decided by the tools it called: writing a file wins over running a command, which wins over reading or searching, then web, then an MCP tool, then anything else. A turn that called no tool is counted as exactly that. Each turn goes whole to one row, never split, so the rows add up to the total exactly.`;function Et({summary:e}){let t=e,n=t?.work??[],r=t?.work_unlinked_calls??0,i=t?.tool_calls??0,a=r>0&&i>0&&r/i>.01;return(0,L.jsxs)(R,{title:`What it went on`,right:(0,L.jsx)(`span`,{title:Tt,children:`by cost`}),children:[t?n.length===0&&(0,L.jsx)(xt,{title:`No priced turns in range`}):(0,L.jsx)(St,{rows:4}),(0,L.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,L.jsx)(`tbody`,{children:n.map(e=>(0,L.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,L.jsx)(`td`,{className:`px-3 py-1`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,L.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:w(e.cost_pct)})]},e.kind))})}),a&&(0,L.jsxs)(`div`,{className:`mx-3 mb-2.5 text-[11px] text-warn`,children:[r.toLocaleString(),` tool calls in this range could not be matched to the turn that paid for them, so their cost is counted under “no tool call” rather than the work they actually did. Every other row is understated by up to that much.`]})]})}function Dt({summary:e}){let t=e?.work??[],n=e?.work_unlinked_calls??0,r=e?.tool_calls??0;if(t.length===0||r===0||n/r>.2)return null;let i=t.filter(e=>e.cost_pct>=1).slice(0,5);return i.length===0?null:(0,L.jsxs)(`div`,{className:`border-t border-border px-3 py-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`what it went on`}),(0,L.jsx)(`a`,{href:`#/cost`,className:`text-[10px] text-fg-faint hover:text-accent no-underline`,children:`details →`})]}),(0,L.jsx)(`div`,{className:`mt-2 flex h-1.5 w-full overflow-hidden rounded-full bg-panel-2`,title:Tt,children:i.map((e,t)=>(0,L.jsx)(`span`,{className:`h-full`,style:{width:`${e.cost_pct}%`,background:`var(--color-accent)`,opacity:1-t*.17}},e.kind))}),(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1`,children:i.map((e,t)=>(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-[2px] translate-y-[1px]`,style:{background:`var(--color-accent)`,opacity:1-t*.17}}),(0,L.jsx)(`span`,{className:`text-fg-muted`,title:wt[e.kind]?.title,children:wt[e.kind]?.label??e.kind}),(0,L.jsx)(`span`,{className:`num text-fg-faint`,children:w(e.cost_pct)})]},e.kind))})]})}var Ot=.62;function kt(e,t){return e?t===`tokens`?e.tokens??[]:e.cost??[]:[]}function At(e,t,n){let r=kt(e,t);if(!e||r.length===0)return[];let i=n>0?n:0;return r.map((t,n)=>{let r=Number.isFinite(t)&&t>0?t:0,a=i>0&&r>0?Math.min(1,r/i)**+Ot:0;return{value:r,at:e.from_ms+n*e.width_ms,height:a,empty:r<=0}})}function jt(e,t){let n=0;for(let r of e)for(let e of kt(r,t))Number.isFinite(e)&&e>n&&(n=e);return n}function Mt(e,t){let n=new Date(e);return t<864e5?n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function Nt(e){return e.split(`/`).filter(Boolean)}function Pt(e,t=3){let n=[],r=new Map,i=[],a=(e,t)=>{let n=r.get(e);if(n)return n;let o=Nt(e),s={path:e,name:o.length===0?`/`:o[o.length-1],depth:t,tokens:0,cost:0,turns:0,tokensPct:0,costPct:0,ownTokens:0,ownCost:0,ownTurns:0,ownTokensPct:0,ownCostPct:0,children:[],rolledUp:0};if(r.set(e,s),t===0)i.push(s);else{let e=t===1?`/`:`/`+o.slice(0,t-1).join(`/`);a(e,t-1).children.push(s)}return s};for(let r of e){if(r.unattributed||r.outside){n.push(r);continue}let e=Nt(r.path),i=e.length,o=Math.min(i,t),s=a(o===0?`/`:`/`+e.slice(0,o).join(`/`),o);s.ownTokens+=r.tokens,s.ownCost+=r.cost_usd,s.ownTurns+=r.turns,s.ownTokensPct+=r.tokens_pct,s.ownCostPct+=r.cost_pct,i>o&&s.rolledUp++;for(let t=0;t<=o;t++){let n=a(t===0?`/`:`/`+e.slice(0,t).join(`/`),t);n.tokens+=r.tokens,n.cost+=r.cost_usd,n.tokensPct+=r.tokens_pct,n.costPct+=r.cost_pct,n.turns+=r.turns}}let o=i[0],s=i;o&&o.path===`/`&&(s=[...o.children],(o.ownTokens>0||o.ownCost>0||o.ownTurns>0||o.rolledUp>0)&&s.push({...o,depth:1,tokens:o.ownTokens,cost:o.ownCost,turns:o.ownTurns,tokensPct:o.ownTokensPct,costPct:o.ownCostPct,children:[],ownTokens:o.ownTokens,ownCost:o.ownCost,ownTurns:o.ownTurns}));let c=e=>{e.sort((e,t)=>t.cost-e.cost);for(let t of e)c(t.children)};return c(s),{roots:s,buckets:n}}function Ft(e){return e.map(e=>{let t=e;for(;t.children.length===1&&t.ownTokens===0&&t.ownCost===0&&t.ownTurns===0&&t.rolledUp===0;)t=t.children[0];return{...t,children:Ft(t.children)}})}var It=[{key:`all`,label:`all`},{key:`claude`,label:`claude`},{key:`opencode`,label:`opencode`}],Lt=[{key:`today`,label:`today`},{key:`7d`,label:`7d`},{key:`30d`,label:`30d`},{key:`all`,label:`all`}],Rt=`tokens`,zt=`A turn counts toward the directory of the most recent file it touched, and keeps counting there until it touches a file somewhere else — so the commands, tests and searches between two edits count toward the directory being worked on. Reading, editing or writing a file counts as touching it; running a command does not. Each turn goes whole to one row, never split between two, so the rows add up to the repository total exactly.`,Bt=`repository-wide work`,Vt=`Turns from the start of a session, before Claude had touched any file — so there is no directory yet for them to count toward. Their cost is counted here whole rather than guessed onto the directory the session reached later.`,Ht=`outside the repository`,Ut=`Turns whose most recent file touch was outside this repository — Claude’s notes on the project, agent scratchpads, test-output directories, or another checkout. This is real work and it counts toward the repository total, but it happened outside the tree, so it is not charged to any directory inside it.`;function Wt({sessions:e,agent:t}){let[n,r]=(0,l.useState)(`7d`),[i,a]=(0,l.useState)(!1),o=I(()=>P.summary(n),[n],{intervalMs:3e4}),s=o.data?.projects??[],c=(0,l.useMemo)(()=>t===`all`?s:s.filter(e=>!e.agent||e.agent===t),[s,t]),[u,d]=(0,l.useState)(null),f=(0,l.useMemo)(()=>{if(!u)return c;let e=new Map(u.map((e,t)=>[e,t]));return[...c].sort((t,n)=>(e.get(t.project)??1/0)-(e.get(n.project)??1/0))},[c,u]),p=i?f:f.slice(0,6),m=c.reduce((e,t)=>e+t.cost_usd,0),h=c.reduce((e,t)=>e+t.tokens,0),g=(0,l.useMemo)(()=>jt(p.map(e=>e.spark),Rt),[p]),_=(0,l.useMemo)(()=>p.reduce((e,t)=>Math.max(e,t.tokens),0),[p]);return(0,L.jsx)(R,{onMouseEnter:()=>d(c.map(e=>e.project)),onMouseLeave:()=>d(null),title:`Projects`,right:(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`num text-[13px]`,children:[(0,L.jsx)(`span`,{className:`text-fg`,children:C(h)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,S(m),` total`]})]}),(0,L.jsx)(`span`,{className:`inline-flex border border-border rounded-sm overflow-hidden`,children:Lt.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),className:`px-1.5 py-0.5 text-[11px] mono ${n===e.key?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg-muted`}`,children:e.label},e.key))})]}),children:o.data?c.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:`No spend captured in this range yet.`}):(0,L.jsxs)(`div`,{className:`grid`,children:[p.map(t=>(0,L.jsx)(Kt,{p:t,max:_,ceiling:g,live:Gt(e).has(t.project)},t.project||`(unknown)`)),c.length>6&&(0,L.jsx)(`button`,{onClick:()=>a(e=>!e),className:`text-[11px] text-fg-faint hover:text-fg-muted px-3 py-1.5 text-left border-t border-border`,children:i?`show less`:`show all ${c.length} projects`}),(0,L.jsx)(Dt,{summary:o.data}),(0,L.jsx)(Zt,{count:c.length})]}):(0,L.jsx)(St,{rows:5})})}function Gt(e){return new Set(e.filter(e=>e.status!==`ended`).map(e=>e.project).filter(Boolean))}function Kt({p:e,max:t,ceiling:n,live:r}){let i=e.paths??[],a=i.length>1,[o,s]=(0,l.useState)(!1),c=e.project||`unknown project`,u=t>0?100*e.tokens/t:0,d=(0,l.useMemo)(()=>At(e.spark,Rt,n),[e.spark,n]),f=(0,l.useMemo)(()=>{let e=Pt(i);return{roots:Ft(e.roots),buckets:e.buckets}},[i]),p=(0,l.useMemo)(()=>Math.max(0,...f.roots.map(e=>e.tokens),...f.buckets.map(e=>e.tokens)),[f]),m=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_128px_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsx)(`div`,{className:`min-w-0`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-ok shrink-0`,title:`a session is live in this project`}),(0,L.jsx)(`span`,{className:`truncate text-[14px]`,children:c}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`}),(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint num shrink-0`,children:[e.sessions,` `,e.sessions===1?`session`:`sessions`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${o?`rotate-90`:``}`,children:`▶`})]})}),d.length>0?(0,L.jsx)(Xt,{bars:d,widthMs:e.spark?.width_ms??0,label:c}):(0,L.jsx)(`div`,{className:`h-1 bg-panel-2 rounded-sm overflow-hidden`,title:`${c}: share of the largest project`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${u}%`}})}),(0,L.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,L.jsx)(`div`,{className:`num text-[17px] font-semibold leading-tight text-accent`,children:C(e.tokens)}),(0,L.jsx)(`div`,{className:`num text-[13px] leading-tight text-fg-muted`,children:S(e.cost_usd)})]})]});return(0,L.jsxs)(`div`,{className:`border-t border-border first:border-t-0`,children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`w-full px-3 py-1.5 hover:bg-panel-2/50`,title:`${c}: show cost by directory`,children:m}):(0,L.jsx)(`div`,{className:`px-3 py-1.5`,children:m}),a&&o&&(0,L.jsxs)(`div`,{className:`pb-1.5 bg-panel-2/30`,children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-1 pb-0.5 text-[10px] text-fg-faint`,title:zt,children:`by files touched · share of this repository's tokens`}),f.roots.map(e=>(0,L.jsx)(qt,{n:e,max:p},e.path)),f.buckets.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`pl-7 pr-3 pt-2 pb-0.5 text-[10px] uppercase tracking-[0.08em] text-fg-faint`,children:`not a directory`}),f.buckets.map(e=>(0,L.jsx)(Jt,{q:e,max:p},e.path))]})]})]})}function qt({n:e,max:t}){let[n,r]=(0,l.useState)(!1),i=t>0?100*e.tokens/t:0,a=e.children.length>0,o=(0,l.useMemo)(()=>Math.max(0,...e.children.map(e=>e.tokens)),[e.children]),s=a&&e.ownCost>0,c=e.children.length,u=(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 w-full text-left`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted mono`,children:e.path}),e.rolledUp>0&&(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint shrink-0`,title:`${e.rolledUp} ${e.rolledUp===1?`directory`:`directories`} below this one ${e.rolledUp===1?`is`:`are`} counted here rather than shown: the breakdown stops at 3 levels.`,children:[`+`,e.rolledUp,` deeper`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]}),a&&(0,L.jsx)(`span`,{"aria-hidden":!0,className:`text-[9px] text-fg-faint shrink-0 transition-transform ${n?`rotate-90`:``}`,children:`▶`})]}),s&&(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mt-0.5`,children:[S(e.ownCost),` here · `,S(e.cost-e.ownCost),` in `,c,` `,c===1?`subdirectory`:`subdirectories`]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent/40`,style:{width:`${i}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.costPct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokensPct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost)]})]})]}),d={paddingLeft:`${28+(e.depth-1)*14}px`};return(0,L.jsxs)(`div`,{children:[a?(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`w-full pr-3 py-1 hover:bg-panel-2/50`,style:d,title:`${e.path}: show the directories inside it`,children:u}):(0,L.jsx)(`div`,{className:`pr-3 py-1`,style:d,children:u}),a&&n&&e.children.map(e=>(0,L.jsx)(qt,{n:e,max:o},e.path))]})}function Jt({q:e,max:t}){let n=t>0?100*e.tokens/t:0,r=e.unattributed===!0;return(0,L.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-3 pl-7 pr-3 py-1`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-[12px] text-fg-muted`,title:r?Vt:Ut,children:r?Bt:Ht}),(0,L.jsxs)(`span`,{className:`text-[10px] text-fg-faint num shrink-0`,children:[e.turns,` `,e.turns===1?`turn`:`turns`]})]}),(0,L.jsx)(`div`,{className:`h-0.5 mt-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-fg-faint/30`,style:{width:`${n}%`}})})]}),(0,L.jsxs)(`div`,{className:`text-right shrink-0 num text-[12px]`,title:`${Yt(e.cost_pct)} of this repository's cost`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:C(e.tokens)}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` `,Yt(e.tokens_pct)]}),(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,S(e.cost_usd)]})]})]})}function Yt(e){return!Number.isFinite(e)||e<=0?`0%`:e<.1?`<0.1%`:w(e)}function Xt({bars:e,widthMs:t,label:n}){let r=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=o.getPropertyValue(`--color-accent`).trim()||`#feb157`,c=o.getPropertyValue(`--color-fg-faint`).trim()||`#837f78`,l=n/e.length;for(let t=0;ti.disconnect()},[e]);let i=e.filter(e=>!e.empty),a=i[0],o=i[i.length-1],s=!a||!o?`no spend in this range`:a===o?`all of it on ${Mt(a.at,t)}`:`${Mt(a.at,t)} → ${Mt(o.at,t)}`;return(0,L.jsx)(`canvas`,{ref:r,className:`w-full h-[14px] block`,role:`img`,"aria-label":`${n}: ${Rt} over time, ${s}`,title:`${n}: when the spend happened — ${s}`})}function Zt({count:e}){return e<10?null:(0,L.jsxs)(`a`,{href:`https://caprock.dev/teams`,target:`_blank`,rel:`noreferrer`,className:`flex items-baseline gap-2 border-t border-border px-3 py-1.5 text-[11px] no-underline hover:no-underline`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[e,` repositories on one machine.`]}),(0,L.jsx)(`span`,{className:`text-fg-faint hover:text-accent`,children:`See them across the team →`})]})}function Qt(e){return typeof e==`string`?e:``}function $t(e){let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??e}function en(e,t){let n=e.replace(/\s+/g,` `).trim(),r=[...n];return r.length>t?r.slice(0,t-1).join(``)+`…`:n}function tn(e){return e.replace(/(\/[\w.@%+-]+){3,}/g,e=>`…/`+e.split(`/`).filter(Boolean).slice(-2).join(`/`))}function nn(e,t){switch(e){case`Edit`:case`NotebookEdit`:return Qt(t.file_path)?{icon:`✎`,text:`editing`,detail:$t(Qt(t.file_path))}:null;case`Write`:return Qt(t.file_path)?{icon:`✎`,text:`writing`,detail:$t(Qt(t.file_path))}:null;case`Read`:return Qt(t.file_path)?{icon:`◇`,text:`reading`,detail:$t(Qt(t.file_path))}:null;case`Bash`:return Qt(t.command)?{icon:`$`,text:`running`,detail:en(tn(Qt(t.command)),46)}:null;case`Grep`:case`Glob`:return{icon:`⌕`,text:`searching`,detail:en(Qt(t.pattern)||Qt(t.query),40)||void 0};case`WebFetch`:case`WebSearch`:return{icon:`⇢`,text:`fetching`,detail:en(Qt(t.url)||Qt(t.query),44)||void 0};case`Agent`:return{icon:`⚑`,text:`spawned a subagent`,detail:Qt(t.subagent_type)||void 0};case`Skill`:return{icon:`⚑`,text:`invoked skill`,detail:Qt(t.skill)||void 0};case`TodoWrite`:return{icon:`☑`,text:`updated its plan`};default:return e?{icon:`·`,text:`used`,detail:e}:null}}function rn(e,t){let n=e.payload??{},r=Date.parse(e.ts),i={id:`${e.id}`,ts:Number.isNaN(r)?Date.now():r,sessionId:e.session_id,project:t};switch(e.kind){case`tool.pre`:{let t=nn(Qt(n.tool_name)||Qt(e.tool),n.tool_input??{});return t?{...i,...t,tone:`normal`}:null}case`tool.post`:return n.is_error?{...i,icon:`✕`,text:`a tool call failed`,tone:`danger`}:null;case`agent.spawn`:return{...i,icon:`▸`,text:`session started`,tone:`ok`};case`agent.stop`:return{...i,icon:`■`,text:`session ended`,tone:`normal`};case`context.compact`:return{...i,icon:`⇱`,text:`compacted its context`,tone:`warn`};case`throttle`:return{...i,icon:`⏳`,text:`rate-limited by the API`,tone:`warn`};case`task.created`:return{...i,icon:`+`,text:`task created`,tone:`normal`};case`task.done`:return{...i,icon:`✓`,text:`task verified — tests passed`,tone:`ok`};case`approval.requested`:return{...i,icon:`!`,text:`needs your approval`,tone:`warn`};default:return null}}function an(e,t,n=60){return e.some(e=>e.id===t.id)?e:[t,...e].slice(0,n)}function on({sessions:e,now:t,emptyHint:n}){let[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(!1),s=(0,l.useRef)(new Map),c=(0,l.useRef)(a);c.current=a;for(let t of e)t.project&&s.current.set(t.session_id,t.project);(0,l.useEffect)(()=>{let t=!1;return(async()=>{let n=[...e].sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,4),r=await Promise.all(n.map(e=>P.recentEvents(e.session_id,60).catch(()=>[])));if(t)return;let a=r.flat().map(e=>rn(e)).filter(e=>e!==null).sort((e,t)=>t.ts-e.ts).slice(0,40);i(e=>{let t=new Set(n.map(e=>e.session_id)),r=e.filter(e=>!e.sessionId||t.has(e.sessionId)),i=new Set(r.map(e=>e.id));return[...r,...a.filter(e=>!i.has(e.id))].sort((e,t)=>t.ts-e.ts).slice(0,60)})})(),()=>{t=!0}},[e.map(e=>e.session_id).join(`,`)]);let u=(0,l.useRef)(new Set);return u.current=new Set(e.map(e=>e.session_id)),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`||c.current)return;let t=e.data?.session_id;if(t&&s.current.has(t)&&!u.current.has(t))return;let n=rn(e.data);n&&i(e=>an(e,n))}),[]),(0,L.jsx)(R,{title:`Live activity`,right:(0,L.jsx)(`button`,{onClick:()=>o(e=>!e),className:`text-[11px] mono text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,children:a?`resume`:`pause`}),children:r.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-muted`,children:n??(0,L.jsxs)(L.Fragment,{children:[`Nothing yet — start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal.`]})}):(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(`div`,{className:`max-h-[420px] overflow-y-auto`,children:r.map(e=>(0,L.jsx)(cn,{it:e,now:t,project:s.current.get(e.sessionId)},e.id))}),(0,L.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-panel to-transparent`})]})})}function sn(e){switch(e){case`ok`:return`text-ok`;case`warn`:return`text-warn`;case`danger`:return`text-danger`;default:return`text-fg-faint`}}function cn({it:e,now:t,project:n}){return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`grid grid-cols-[auto_auto_1fr_auto] items-baseline gap-2 px-3 py-1 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsx)(`span`,{className:`mono text-[12px] w-3 text-center ${sn(e.tone)}`,children:e.icon}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate max-w-[12ch]`,children:n??e.project??E(e.sessionId)}),(0,L.jsxs)(`span`,{className:`text-[12px] truncate`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.text}),e.detail&&(0,L.jsx)(`span`,{className:`mono text-fg ml-1.5`,children:e.detail})]}),(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.ts,t)})]})}function ln(e){return e?.plan_kind===`metered`?`at API list price · ≈ your bill`:e?.plan_kind===`flat`?`at API list price · not a bill`:`at API list price`}function un(e){return e?.plan_kind===`metered`?`Priced from your captured tokens at Anthropic list prices. You are billed per token, so this is approximately your actual cost.`:e?.plan_kind===`flat`?`Priced from your captured tokens at Anthropic list prices. You pay ${e.plan_label||`a flat plan`}, so this is what the same work would have cost through the API — not money out of pocket.`:`Priced from your captured tokens at Anthropic list prices. Whether that is your actual bill depends on how you pay — set your plan in the header.`}function dn({plan:e}){let t=I(()=>P.history(`all`),[],{intervalMs:6e4}).data?.totals;if(!t||t.sessions===0)return null;let n=t.days>0?t.sessions/t.days:0;return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 rounded-[var(--radius-panel)] border border-border bg-panel px-3 py-2.5`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`all time`}),(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`num font-semibold tracking-[-0.01em] text-[22px] leading-none text-info`,children:S(t.cost_usd)}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-faint`,title:un(e),children:ln(e)})]}),(0,L.jsx)(fn,{value:t.sessions.toLocaleString(`en-US`),label:`sessions`}),(0,L.jsx)(fn,{value:t.days.toLocaleString(`en-US`),label:`active days`}),(0,L.jsx)(fn,{value:t.turns.toLocaleString(`en-US`),label:`turns`}),n>=1&&(0,L.jsx)(fn,{value:n.toFixed(1),label:`sessions a day`}),(0,L.jsx)(`span`,{className:`ml-auto inline-flex items-baseline gap-4`,children:(0,L.jsx)(pn,{})})]})}function fn({value:e,label:t}){return(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,children:e}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:t})]})}function pn(){let e=I(()=>P.daily(30),[],{intervalMs:3e5}),t=I(()=>P.summary(`today`),[],{intervalMs:3e4}),n=e.data??[];if(n.length===0)return null;let r=new Map;for(let e of n)r.set(e.day,(r.get(e.day)??0)+e.cost_usd);let i=[...r.values()].filter(e=>e>0).sort((e,t)=>e-t);if(i.length<7)return null;let a=i[Math.floor(i.length/2)]??0,o=t.data?.cost_usd??0;return a<=0||o=99?{label:`outstanding`,color:`text-ok`}:e>=95?{label:`good`,color:`text-ok`}:e>=85?{label:`ok`,color:``}:{label:`low`,color:`text-warn`}}function hn({hitRate:e,cutPct:t,measured:n,size:r=`compact`,label:i=`Cache hit`}){let a=n&&e!==void 0?e*100:void 0,o=mn(a);return(0,L.jsx)(z,{label:i,value:(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{children:a===void 0?`—`:w(a)}),o&&(0,L.jsx)(`span`,{className:`text-[11px] font-normal ${o.color||`text-fg-faint`}`,children:o.label})]}),sub:n&&t!==void 0?`${w(t)} input cost cut`:void 0,size:r})}function gn(e,t){let n=Math.round(e.used_percentage),r=(e.resets_at??0)*1e3,i=r>t&&r85?`text-danger`:n>=60?`text-warn`:`text-fg`,resetsAt:i?new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,stale:e.resets_at?!i:!1}}function _n({label:e,w:t,now:n}){let{pct:r,color:i,resetsAt:a,stale:o}=gn(t,n);return(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-3`,children:[(0,L.jsxs)(`span`,{className:`font-mono tabular-nums ${i}`,children:[r,`%`]}),a&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[`resets `,a]}),o&&(0,L.jsx)(`span`,{className:`text-fg-faint`,title:`Claude Code has not refreshed this window recently`,children:`reset time stale`}),t.forecast&&(0,L.jsx)(`span`,{className:`text-warn`,children:t.forecast})]})]})}function vn({limits:e,now:t}){let n=[];if(e?.five_hour&&n.push([`5h`,e.five_hour]),e?.seven_day&&n.push([`7d`,e.seven_day]),n.length===0)return null;let r=n.map(([e,n])=>({label:e,...gn(n,t)})),i=r.filter(e=>!e.stale),a=i.length===0,o=(i.length?i:r).reduce((e,t)=>t.pct>e.pct?t:e),s=r.find(e=>e.label!==o.label);return(0,L.jsx)(z,{label:`Plan limits`,value:(0,L.jsxs)(`span`,{className:a?`text-fg-faint`:o.color,children:[o.pct,`%`]}),sub:a?(0,L.jsx)(`span`,{title:`Claude Code writes these to its status line; they stop updating when no session is running`,children:`last reported a while ago`}):(0,L.jsxs)(`span`,{children:[o.label,` window`,o.resetsAt?` · resets ${o.resetsAt}`:``,s?` · ${s.label} ${s.pct}%`:``]}),tone:a?void 0:o.pct>85?`danger`:o.pct>=60?`warn`:void 0,size:`compact`})}var yn=`caprock-prompts`,bn={"share-week":6048e5,"share-month":2592e6,"premium-hint":2592e6,"premium-banner":2592e6};function xn(){try{let e=localStorage.getItem(yn);return e?JSON.parse(e):{}}catch{return{}}}function Sn(e){try{localStorage.setItem(yn,JSON.stringify(e))}catch{}}function Cn(e,t){let n=xn()[e];return!n||t-n>=bn[e]}function wn(e,t){let n={...xn(),[e]:t};e===`share-month`&&(n[`share-week`]=t),Sn(n)}var Tn=`premium-banner`;function En({costUSD:e,days:t,now:n}){let[r]=(0,l.useState)(()=>Cn(Tn,n)),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1);if(!r||i||e<=0||t<=0)return null;let c=e/t;return(0,L.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[var(--radius-panel)] border border-border bg-panel-2 px-3 py-2 text-[12px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsx)(`span`,{className:`num`,children:S(c)}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[` a day, on average, across `,t,` active `,t===1?`day`:`days`,`.`]})]}),(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Premium pauses sessions when the day crosses a limit you set.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,L.jsx)(`button`,{onClick:()=>s(!0),className:`rounded-sm border border-accent/50 bg-accent/10 px-2 py-0.5 text-accent hover:bg-accent/20`,children:`what it does`}),(0,L.jsx)(`button`,{onClick:()=>{wn(Tn,n),a(!0)},className:`rounded-sm border border-border px-1.5 py-0.5 text-[11px] text-fg-faint hover:text-fg-muted`,title:`hide this for a month`,children:`not now`})]}),o&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>s(!1)})]})}var Dn=[1e3,5e3,1e4,25e3,5e4,1e5],On=e=>e>=1e3?`$${Math.round(e).toLocaleString(`en-US`)}`:`$${e.toFixed(2)}`;function kn(e){let t=Dn.filter(t=>e>=t).pop();return t===void 0||e-t>t*.1?null:{kind:`milestone`,line:`You just passed ${On(t)} of Claude Code.`}}function An(e,t){return e<7||e>10?null:{kind:`first-week`,line:`A week of Claude Code: ${On(t)} measured.`}}function jn(e){if(e.length<3)return null;let[t,...n]=e;if(t===void 0)return null;let r=Math.max(...n);return r<=0||tt[0].localeCompare(e[0])),r=[];for(let e=0;ee+t[1],0));return r}function Nn(e,t,n){return e.sessions===0||e.cost_usd<=0?null:kn(e.cost_usd)??An(e.days,n.cost_usd)??jn(Mn(t))}var Pn=`share-week`;function Fn({now:e}){let[t]=(0,l.useState)(()=>Cn(Pn,e)),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),o=I(()=>P.history(`all`),[],{intervalMs:3e5}),s=I(()=>P.summary(`7d`),[],{intervalMs:3e5});if(!t||n||!o.data||!s.data)return null;let c=Nn(o.data.totals,o.data.daily??[],s.data);if(!c)return null;let u=()=>{wn(Pn,e),r(!0)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 rounded-lg border border-accent/35 bg-accent/[0.07] py-1.5 pl-3.5 pr-2 text-[13px]`,children:[(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[c.line,` Don’t be shy and share it off —`]}),(0,L.jsx)(`button`,{onClick:()=>{a(!0),u()},className:`rounded-[5px] bg-accent px-3 py-1 font-medium text-panel hover:bg-accent/90`,children:`Share`}),(0,L.jsx)(`button`,{onClick:u,title:`hide this for a week`,className:`px-1 text-fg-faint hover:text-fg-muted`,children:`✕`})]}),i&&(0,L.jsx)(Ze,{onClose:()=>a(!1)})]})}function In(){let e=I(()=>P.history(`all`),[],{intervalMs:6e4}),t=(e.data?.tools??[]).slice(0,6),n=(e.data?.summary?.models??[]).slice(0,5);if(t.length===0&&n.length===0)return null;let r=t[0]?.count??0,i=n[0]?.cost_usd??0,a=(e.data?.tools??[]).reduce((e,t)=>e+t.count,0),o=(e.data?.summary?.models??[]).reduce((e,t)=>e+t.cost_usd,0),s=e.data?.summary,c=s&&(s.tokens_in||s.tokens_out||s.cache_read||s.cache_write)?{in:s.tokens_in,out:s.tokens_out,cacheRead:s.cache_read,cacheWrite:s.cache_write}:null;return(0,L.jsxs)(R,{title:`All time`,right:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[(0,L.jsx)(Fn,{now:Date.now()}),(0,L.jsx)(Qe,{}),(0,L.jsx)(`a`,{href:`#/history`,className:`text-fg-faint hover:text-accent no-underline`,children:`every tool, model and project →`})]}),children:[(0,L.jsxs)(`div`,{className:`grid gap-x-8 gap-y-5 px-3 py-3 md:grid-cols-2`,children:[(0,L.jsx)(Ln,{title:`Most-used tools`,note:`by calls`,rows:t.map(e=>({key:e.tool,label:te(e.tool),value:e.count.toLocaleString(`en-US`),share:a>0?100*e.count/a:null,frac:r>0?e.count/r:0}))}),(0,L.jsx)(Ln,{title:`Where the money went`,note:`by cost`,rows:n.map(e=>({key:e.model,label:e.model||`unknown`,value:S(e.cost_usd),sub:C(e.tokens),share:o>0?100*e.cost_usd/o:null,frac:i>0?e.cost_usd/i:0}))})]}),c&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-6 gap-y-1 border-t border-border px-3 py-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:`Tokens`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`input `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.in)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`output `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.out)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache read `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheRead)})]}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`cache write `,(0,L.jsx)(`span`,{className:`num text-fg`,children:C(c.cacheWrite)})]}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:`fresh input is billed at full price`})]})]})}function Ln({title:e,note:t,rows:n}){return n.length===0?null:(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:e}),(0,L.jsx)(`span`,{className:`text-[10px] text-fg-faint`,children:t})]}),(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:n.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`mono w-36 shrink-0 truncate text-fg-muted`,title:e.label,children:e.label}),(0,L.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full bg-panel-2`,children:(0,L.jsx)(`span`,{className:`block h-full rounded-full bg-accent/70`,style:{width:`${Math.max(2,Math.round(e.frac*100))}%`}})}),(0,L.jsx)(`span`,{className:`num w-20 shrink-0 text-right text-fg`,children:e.value}),(0,L.jsx)(`span`,{className:`num w-16 shrink-0 text-right text-fg-faint`,children:e.sub??``}),(0,L.jsx)(`span`,{className:`num w-9 shrink-0 text-right text-fg-faint`,children:e.share===null?``:e.share<1?`<1%`:`${Math.floor(e.share)}%`})]},e.key))})]})}function Rn(e){return e.bars.reduce((e,t)=>e+t.n,0)}function zn(e){return e.bars.reduce((e,t)=>e+t.cost,0)}var Bn=6,Vn=new Set([`description`,`timeout`,`run_in_background`]),Hn=new Set([`true`,`:`,`echo`,`pwd`,`clear`]);function Un(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return``}}function Wn(e){if(e.kind!==`tool.pre`)return null;let t=typeof e.tool==`string`?e.tool:``;if(!t)return null;let n=e.payload,r=n&&typeof n==`object`?n.tool_input:void 0,i=r&&typeof r==`object`?r:{},a=Un(i.command).trim();if(t===`Bash`&&Hn.has(a))return null;let o=[t],s=t;for(let e of Object.keys(i).sort()){if(Vn.has(e))continue;let n=Un(i[e]);(e===`content`||e===`new_string`||e===`old_string`)&&(n=n.slice(0,200)),o.push(`${e}=${n}`),s===t&&(e===`command`||e===`file_path`||e===`pattern`)&&(s=`${t} ${n.slice(0,48)}`)}return{sig:o.join(`|`),label:s}}function Gn(e){let t=Date.parse(e.ts);return Number.isFinite(t)?t:0}function Kn(e,t,n=60){let r=Array.from({length:n},()=>({n:0,turns:0,tools:0,cost:0})),i=t-n*6e4,a=[...e].sort((e,t)=>Gn(e)-Gn(t)),o=[],s=new Map,c=0,l=``;for(let e of a){let a=Gn(e);if(a<=0)continue;if(a>=i&&a<=t){let t=r[Math.min(n-1,Math.floor((a-i)/6e4))];if(t){t.n++,e.kind===`turn.assistant`?t.turns++:(e.kind===`tool.pre`||e.kind===`tool.post`)&&t.tools++;let n=typeof e.cost_usd==`number`&&Number.isFinite(e.cost_usd)?e.cost_usd:0;t.cost+=n}}let u=Wn(e);if(!u)continue;for(o.push({at:a,sig:u.sig,label:u.label});o.length>0;){let e=o[0];if(!e||a-e.at<=Bn*6e4)break;o.shift();let t=(s.get(e.sig)??1)-1;t<=0?s.delete(e.sig):s.set(e.sig,t)}let d=(s.get(u.sig)??0)+1;s.set(u.sig,d),d>c&&(c=d,l=u.label)}return{bars:r,repeats:c,repeatSample:l}}function qn(e,t){if(e.repeats>=8)return{kind:`repeat`,label:`×${e.repeats} same call`};switch(t){case`waiting-on-you`:return{kind:`waiting`,label:`waiting on you`};case`error`:return{kind:`error`,label:`error`};case`looping`:return{kind:`repeat`,label:`looping`};case`ended`:return{kind:`quiet`,label:`ended`};case`idle`:return{kind:`quiet`,label:`idle`};case`working`:return{kind:`working`,label:`working`}}return e.bars.filter(e=>e.n>0).length===0?{kind:`quiet`,label:`quiet`}:{kind:`working`,label:`working`}}function Jn(e,t){return t<=0?`mid`:e>=t*1.8?`high`:e<=t*.5?`low`:`mid`}function Yn(e){let t=e.filter(e=>e.cost>0).map(e=>e.cost).sort((e,t)=>e-t);return t.length===0?0:t[Math.floor(t.length/2)]??0}var Xn=6,Zn=2e3;function Qn({sessions:e,now:t}){let n=(0,l.useMemo)(()=>[...e].filter(e=>e.status!==`ended`).sort((e,t)=>t.last_event_at-e.last_event_at).slice(0,Xn),[e]),r=n.map(e=>e.session_id).join(`,`),[i,a]=(0,l.useState)(new Map);(0,l.useEffect)(()=>{let e=!1;return(async()=>{let t=r?r.split(`,`):[],n=await Promise.all(t.map(e=>P.recentEvents(e,Zn).catch(()=>[])));e||a(new Map(t.map((e,t)=>[e,n[t]??[]])))})(),()=>{e=!0}},[r]),(0,l.useEffect)(()=>d.onFrame(e=>{if(e.type!==`event`)return;let t=e.data;a(e=>{if(!e.has(t.session_id))return e;let n=new Map(e),r=n.get(t.session_id)??[];return n.set(t.session_id,[...r,t].slice(-4e3)),n})}),[]);let o=Math.floor(t/6e4),s=(0,l.useMemo)(()=>n.map(e=>({s:e,pulse:Kn(i.get(e.session_id)??[],o*6e4)})).filter(e=>Rn(e.pulse)>0),[n,i,o]);return n.length===0?null:(0,L.jsxs)(R,{title:`Live pulse`,right:(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`last `,60,` minutes · one bar per minute`]}),children:[(0,L.jsx)(`div`,{children:s.length===0?(0,L.jsxs)(`div`,{className:`px-3 py-6 text-[12px] text-fg-faint text-center`,children:[`Nothing ran in the last `,60,` minutes.`]}):s.map(({s:e,pulse:t})=>(0,L.jsx)(er,{s:e,pulse:t,minute:o,showId:s.length>1},e.session_id))}),(0,L.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-4 flex-wrap text-[11px] text-fg-faint border-t border-border`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,title:`They are independent: one call carrying a large context is a short bright bar, twenty greps are a tall dark one.`,children:`bar height = turns and tools · colour = what the minute cost`}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:nr,className:`h-[2px]`}),`idle`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.low}),`below this session's median`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.mid}),`around it`]}),(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)($n,{tier:tr.high}),`well above it`]}),(0,L.jsxs)(`span`,{className:`ml-auto`,children:[(0,L.jsx)(`span`,{className:`text-warn`,children:`×N same call`}),` = most-repeated identical tool call in six minutes`]})]})]})}function $n({tier:e,className:t=``}){return(0,L.jsx)(`span`,{"data-token":e.token,className:`inline-block w-3 h-3 rounded-[2px] ${t}`,style:{background:`var(${e.token}, ${e.fallback})`,opacity:e.alpha}})}function er({s:e,pulse:t,minute:n,showId:r}){let i=qn(t,e.activity?.health),a=i.kind===`repeat`||i.kind===`waiting`?`text-warn`:i.kind===`error`?`text-danger`:i.kind===`quiet`?`text-fg-faint`:`text-ok`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`grid grid-cols-[132px_1fr_92px_104px] items-center gap-3 px-3 py-2 border-t border-border first:border-t-0 hover:bg-panel-2 no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`text-[13px] font-medium flex items-baseline gap-1.5 min-w-0`,children:[(0,L.jsx)(`span`,{className:`shrink-0`,children:e.project||`unknown project`}),e.git_branch&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[10px] text-fg-faint mono`,title:e.git_branch,children:e.git_branch}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-[0.08em] text-fg-faint border border-border px-1 rounded-sm`,children:`oc`})]}),(0,L.jsxs)(`div`,{className:`text-[10px] text-fg-faint mono truncate`,children:[r&&(0,L.jsxs)(`span`,{title:`session ${e.session_id} · started ${T(e.started_at)} ago`,children:[E(e.session_id),` · `]}),e.activity?.phrase??``]})]}),(0,L.jsx)(ir,{pulse:t,now:n*6e4,sessionID:e.session_id}),(0,L.jsx)(`div`,{className:`num text-[13px] font-semibold text-right`,title:`${S(e.stats?.cost_usd)} for the whole session`,children:S(zn(t))}),(0,L.jsx)(`div`,{className:`text-[11px] text-right ${a}`,title:t.repeatSample,children:i.label})]})}var tr={low:{token:`--color-ok`,fallback:`#4fbf6b`,alpha:.55},mid:{token:`--color-accent`,fallback:`#feb157`,alpha:.85},high:{token:`--color-accent-strong`,fallback:`#ffcb85`,alpha:1}},nr={token:`--color-fg-faint`,fallback:`#837f78`,alpha:.3};function rr(e,t,n){return e.getPropertyValue(t).trim()||n}function ir({pulse:e,now:t,sessionID:n}){let r=(0,l.useRef)(null),[i,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{let t=r.current;if(!t)return;let n=()=>{let n=t.clientWidth,r=t.clientHeight;if(n===0||r===0)return;let i=window.devicePixelRatio||1;t.width=Math.round(n*i),t.height=Math.round(r*i);let a=t.getContext(`2d`);if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r);let o=getComputedStyle(t),s=rr(o,nr.token,nr.fallback),c=e.bars,l=Math.max(...c.map(e=>e.n),1),u=Yn(c),d=n/c.length;for(let e=0;e{i.disconnect(),a.disconnect()}},[e]);let o=t=>{let n=t.currentTarget.getBoundingClientRect();if(n.width===0)return;let r=Math.floor((t.clientX-n.left)/n.width*e.bars.length);a(r>=0&&ra(null),onClick:e=>{i===null||!s||s.n===0||(e.preventDefault(),e.stopPropagation(),v({name:`session`,id:n,at:u}))},"aria-hidden":!0}),s&&(0,L.jsx)(`div`,{className:`absolute -top-1 left-0 right-0 pointer-events-none flex justify-center`,children:(0,L.jsxs)(`span`,{className:`num text-[10px] bg-panel-2 border border-border-strong rounded-sm px-1.5 py-0.5 text-fg-muted whitespace-nowrap`,children:[new Date(u).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),s.n===0?` · nothing happened`:(0,L.jsxs)(L.Fragment,{children:[` · ${s.n} event${s.n===1?``:`s`}`,s.turns>0&&` · ${s.turns} turn${s.turns===1?``:`s`}`,s.cost>0&&` · ${S(s.cost)}`,s.cost>0&&c>0&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` (median ${S(c)})`}),(0,L.jsx)(`span`,{className:`text-fg-faint`,children:` · click to open`})]})]})})]})}function ar({session:e,now:t,onClose:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)();(0,l.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await P.notes(e.session_id,12);t||i(n)}catch(e){t||o(e instanceof Error?e.message:`could not load`)}})(),()=>{t=!0}},[e.session_id]);let s=r?.find(e=>!e.fragment),c=r?.[0],u=s??c;return(0,L.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/50 flex items-start justify-center pt-[10vh] px-4`,onClick:n,children:(0,L.jsxs)(`div`,{className:`w-full max-w-[720px] max-h-[76vh] flex flex-col border border-border-strong bg-panel rounded-[var(--radius-panel)] shadow-lg`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`px-4 pt-3 pb-2 border-b border-border flex items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-medium truncate`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`text-[11px] text-fg-muted truncate`,children:e.activity?.phrase}),(0,L.jsx)(`button`,{onClick:n,className:`ml-auto text-[16px] leading-none text-fg-faint hover:text-fg`,children:`×`})]}),(0,L.jsxs)(`div`,{className:`overflow-y-auto px-4 py-3 grid gap-3`,children:[!r&&!a&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`loading…`}),a&&(0,L.jsx)(`div`,{className:`text-[12px] text-danger`,children:a}),r&&!u&&(0,L.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`This session has not said anything yet — it may be running without hooks, or still on its first turn.`}),u&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint`,children:[`Last thing Claude said · `,T(u.ts,t),s&&c&&s.event_id!==c.event_id&&(0,L.jsx)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:`(the newest line was mid-thought; this is the last complete one)`})]}),(0,L.jsx)(`div`,{className:`text-[13px] leading-relaxed whitespace-pre-wrap text-fg`,children:u.text})]}),e.activity?.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,L.jsxs)(`div`,{className:`text-[10px] uppercase tracking-[0.12em] text-fg-faint mb-1`,children:[`Plan · `,e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`→ `,e.activity.plan.next]})]})]}),(0,L.jsxs)(`div`,{className:`px-4 py-2 border-t border-border flex items-center gap-3 text-[11px]`,children:[(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id}),className:`link text-fg-muted hover:text-fg`,children:`open the session →`}),(0,L.jsx)(`span`,{className:`ml-auto text-fg-faint`,children:e.owned?`answer in its terminal tab`:`reply in the terminal you started it in`})]})]})})}var or=`premium-hint`;function sr({reason:e,now:t}){let[n]=(0,l.useState)(()=>Cn(or,t)),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1);return!n||r?null:(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,L.jsx)(`span`,{className:`text-fg-faint`,children:e}),(0,L.jsx)(`button`,{onClick:()=>o(!0),className:`rounded-sm border border-border px-1.5 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg`,children:`a cap that stops this`}),(0,L.jsx)(`button`,{title:`hide this for a month`,onClick:()=>{wn(or,t),i(!0)},className:`text-fg-faint hover:text-fg-muted`,children:`✕`}),a&&(0,L.jsx)(tt,{feature:`cap`,onClose:()=>o(!1)})]})}function cr({items:e,now:t,onDismiss:n,sessions:r}){return e.length===0?null:(0,L.jsx)(`div`,{className:`grid gap-1.5`,children:e.map(e=>(0,L.jsx)(lr,{it:e,now:t,onDismiss:n,session:r?.find(t=>t.session_id===e.sessionId)},e.id))})}function lr({it:e,now:t,onDismiss:n,session:r}){let[i,a]=(0,l.useState)(!1),o=e.severity===`high`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 ${o?`border-danger/50 bg-danger/10`:`border-warn/50 bg-warn/10`}`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[13px] shrink-0 ${o?`text-danger`:`text-warn`}`,children:e.title}),(0,L.jsxs)(`span`,{className:`text-[12px] text-fg-muted truncate`,children:[e.sessionId&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.sessionId}),className:`link mono text-fg`,children:e.project||E(e.sessionId)}),(0,L.jsx)(`span`,{className:e.sessionId?`ml-2`:``,children:e.detail})]}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 shrink-0`,children:[e.costUSD!==void 0&&e.costUSD>0&&(0,L.jsx)(`span`,{className:`num text-[13px] text-fg`,title:`spent by this session so far`,children:S(e.costUSD)}),e.since!==void 0&&(0,L.jsx)(`span`,{className:`num text-[11px] text-fg-faint`,children:T(e.since,t)}),r&&e.id.startsWith(`waiting-`)&&(0,L.jsx)(`button`,{className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong text-fg-muted hover:text-fg`,onClick:()=>a(!0),children:`what did it ask?`}),(0,L.jsx)(`a`,{href:e.sessionId?g({name:`session`,id:e.sessionId,tab:`timeline`,at:e.at}):`#/cost`,className:`text-[11px] border border-border px-1.5 py-0.5 rounded-sm hover:border-border-strong no-underline text-fg-muted hover:text-fg`,children:e.sessionId?`open`:`details`}),(e.id.startsWith(`loop-`)||e.id.startsWith(`spent-`))&&(0,L.jsx)(sr,{reason:`this is what a cap stops`,now:t}),n&&e.id.startsWith(`loop-`)&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>n(e.sessionId),children:`dismiss`})]})]}),i&&r&&(0,L.jsx)(ar,{session:r,now:t,onClose:()=>a(!1)})]})}var ur=9e5,dr=25,fr=300,pr=2,mr=864e5,hr=90,gr=6912e5;function _r(e){return typeof e==`number`?e:e&&Date.parse(e)||0}function vr({sessions:e,alerts:t,now:n,limits:r,waitingMs:i=ur}){let a=[],o=Array.isArray(e)?e.filter(Boolean):[],s=Array.isArray(t)?t.filter(Boolean):[],c=new Map(o.map(e=>[e.session_id,e]));for(let e of s){let t=c.get(e.session_id);a.push({id:`loop-${e.session_id}`,sessionId:e.session_id,project:t?.project??``,severity:`high`,title:`Stuck in a loop`,detail:[`ran ${e.sample||e.tool||`the same call`}`,Number.isFinite(e.count)?`${e.count}×`:`repeatedly`,Number.isFinite(e.window_min)?`in ${e.window_min} min`:``].filter(Boolean).join(` `),costUSD:t?.stats?.cost_usd,since:_r(e.ts)||void 0,at:_r(e.first_ts)||_r(e.ts)||void 0})}for(let e of o)if(e.status!==`ended`&&e.activity){if(e.activity.health===`error`){a.push({id:`error-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`high`,title:`Session hit an error`,detail:e.activity.phrase,costUSD:e.stats?.cost_usd,since:_r(e.activity.at)||e.last_event_at});continue}if(e.activity.health===`waiting-on-you`){let t=_r(e.activity.at)||e.last_event_at;t>0&&n-t>=i&&a.push({id:`waiting-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Waiting on you`,detail:e.activity.phrase,since:t})}}for(let e of o){if(!e.stats||!e.activity)continue;let{cost_usd:t,turns:r,files_touched:i}=e.stats;if(tpr)continue;let o=_r(e.activity.at)||e.last_event_at;o>0&&n-o>mr||a.push({id:`spent-${e.session_id}`,sessionId:e.session_id,project:e.project,severity:`medium`,title:`Lots of turns, few files`,detail:`${r.toLocaleString()} turns, ${i===0?`no files`:i===1?`1 file`:`${i} files`} touched`,costUSD:t,since:_r(e.activity.at)||e.last_event_at})}let l={high:0,medium:1};for(let[e,t]of[[`5-hour`,r?.five_hour],[`7-day`,r?.seven_day]]){if(!t||t.used_percentagen&&r=95?`high`:`medium`,title:`${e} plan window ${i}% used`,detail:`resets at ${o}${t.forecast?` — ${t.forecast}`:``}`})}return a.sort((e,t)=>l[e.severity]-l[t.severity]||(e.since??0)-(t.since??0))}var yr=`caprock.update.dismissed`;function br({plan:e,onSave:t,now:n,owned:r=0}){let[i,a]=(0,l.useState)(),[o,s]=(0,l.useState)(()=>localStorage.getItem(yr)??``);return(0,l.useEffect)(()=>{if(!e?.update_checks){a(void 0);return}let t=!0,n=()=>{P.update().then(e=>{t&&a(e)}).catch(()=>{})};n();let r=window.setInterval(n,6e4);return()=>{t=!1,window.clearInterval(r)}},[e?.update_checks]),e&&!e.update_checks?o===`offer`?null:(0,L.jsxs)(xr,{tone:`muted`,children:[(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`Caprock can check GitHub for new releases. It's the only outbound call it makes, so it's off unless you turn it on — no usage data is sent, and you can turn it off again any time.`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[(0,L.jsx)(`button`,{className:`text-[11px] border border-accent/50 text-accent bg-accent/10 px-2 py-0.5 rounded-sm hover:bg-accent/20`,onClick:()=>t({update_checks:!0}),children:`check for updates`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,`offer`),s(`offer`)},children:`no thanks`})]})]}):!i?.update_available||!i.latest||o===i.latest?null:(0,L.jsxs)(xr,{tone:`accent`,children:[(0,L.jsxs)(`span`,{className:`text-fg`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[`Caprock `,i.latest]}),` is available — you're on `,(0,L.jsx)(`span`,{className:`mono`,children:i.current}),`.`]}),r>0&&(0,L.jsx)(`span`,{className:`text-[12px] text-warn shrink-0`,children:r===1?`1 session Caprock started will close`:`${r} sessions Caprock started will close`}),i.command?(0,L.jsx)(Ct,{command:i.command}):(0,L.jsx)(`a`,{className:`link text-[12px]`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`download it`}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 shrink-0`,children:[i.checked_at?(0,L.jsxs)(`span`,{className:`num text-[11px] text-fg-faint`,children:[`checked `,T(i.checked_at,n)]}):null,(0,L.jsx)(`a`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm no-underline`,href:i.url,target:`_blank`,rel:`noreferrer`,children:`what's new`}),(0,L.jsx)(`button`,{className:`text-[11px] text-fg-faint hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>{localStorage.setItem(yr,i.latest),s(i.latest)},children:`not now`})]})]})}function xr({tone:e,children:t}){return(0,L.jsx)(`div`,{className:`border rounded-[var(--radius-panel)] px-3 py-2 flex items-center gap-3 text-[12px] ${e===`accent`?`border-accent/40 bg-accent/5`:`border-border bg-panel`}`,children:t})}function Sr({u:e,className:t=``}){return!e||e.turns===0?null:(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] ${t}`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Cost is incomplete`}),` `,(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[C(e.tokens),` tokens over `,e.turns,` turn`,e.turns===1?``:`s`,` could not be priced, so they are missing from the total above — not free. `,e.models.length===1?`Model`:`Models`,` with no entry in the pricing table:`,` `,e.models.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0&&`, `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:e||`unknown`})]},e)),`. This happens when a model ships newer than the pricing table, or when a gateway reports ids that do not normalise.`]})]})}function Cr({value:e,onPick:t}){let[n,r]=(0,l.useState)(`recent`),[i,a]=(0,l.useState)(``),o=I(()=>P.recentDirs(),[],{live:!1}),s=I(()=>P.browse(i),[i],{live:!1});return(0,l.useEffect)(()=>{o.data&&o.data.length===0&&r(`browse`)},[o.data]),(0,L.jsxs)(`div`,{className:`rounded-[3px] border border-border-strong bg-panel-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border-strong px-2 py-1.5 text-[12px]`,children:[(0,L.jsx)(wr,{on:n===`recent`,onClick:()=>r(`recent`),children:`Recent`}),(0,L.jsx)(wr,{on:n===`browse`,onClick:()=>r(`browse`),children:`Browse`}),n===`browse`&&s.data&&(0,L.jsx)(`span`,{className:`mono ml-auto min-w-0 truncate pl-2 text-[11px] text-fg-faint`,title:s.data.dir,children:kr(s.data.dir,s.data.root)})]}),(0,L.jsx)(`div`,{className:`h-[168px] overflow-y-auto overflow-x-hidden`,children:n===`recent`?(0,L.jsx)(Tr,{rows:o.data,value:e,onPick:t}):(0,L.jsx)(Er,{data:s.data,value:e,onOpen:a,onPick:t,error:s.error?.message})})]})}function wr({on:e,onClick:t,children:n}){return(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-sm px-2 py-0.5 ${e?`bg-accent/15 text-accent`:`text-fg-muted hover:text-fg`}`,children:n})}function Tr({rows:e,value:t,onPick:n}){return e?e.length===0?(0,L.jsx)(Or,{children:`No sessions yet — use Browse, or type a path.`}):(0,L.jsx)(`ul`,{children:e.map(e=>(0,L.jsxs)(Dr,{selected:t===e.dir,onClick:()=>n(e.dir),children:[(0,L.jsx)(`span`,{className:`shrink-0 text-fg`,children:e.name}),(0,L.jsx)(`span`,{className:`mono ml-2 min-w-0 flex-1 truncate text-[11px] text-fg-faint`,title:e.dir,children:e.dir}),(0,L.jsx)(`span`,{className:`shrink-0 pl-2 text-[11px] text-fg-faint`,children:T(e.last_event_at)})]},e.dir))}):(0,L.jsx)(Or,{children:`…`})}function Er({data:e,value:t,onOpen:n,onPick:r,error:i}){return i?(0,L.jsx)(Or,{children:i}):e?(0,L.jsxs)(`ul`,{children:[e.parent&&(0,L.jsx)(Dr,{selected:!1,onClick:()=>n(e.parent),children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:`↑ up`})}),e.entries.length===0&&(0,L.jsx)(Or,{children:`Nothing here.`}),e.entries.map(e=>(0,L.jsxs)(Dr,{selected:t===e.path,onClick:()=>e.repo?r(e.path):n(e.path),children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate ${e.repo?`text-fg`:`text-fg-muted`}`,children:e.name}),e.repo&&(0,L.jsx)(`span`,{className:`ml-2 shrink-0 text-[10px] uppercase tracking-wide text-accent`,children:`repo`}),(0,L.jsx)(`span`,{className:`flex-1`}),(0,L.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.repo?n(e.path):r(e.path)},className:`shrink-0 px-1 text-[11px] text-fg-faint hover:text-fg`,title:e.repo?`Open this folder`:`Use this folder`,children:e.repo?`›`:`use`})]},e.path))]}):(0,L.jsx)(Or,{children:`…`})}function Dr({selected:e,onClick:t,children:n}){return(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`flex w-full min-w-0 items-center px-2.5 py-1 text-left text-[12px] hover:bg-panel ${e?`bg-accent/10`:``}`,children:n})})}function Or({children:e}){return(0,L.jsx)(`p`,{className:`px-2.5 py-3 text-[12px] text-fg-faint`,children:e})}function kr(e,t){return e===t?`~`:e.startsWith(t+`/`)?`~`+e.slice(t.length):e}var Ar=`claude-opus-5`,jr=`acceptEdits`,Mr=[[`claude-opus-5`,`Opus 5 · most capable`],[`claude-sonnet-5`,`Sonnet 5 · faster, cheaper`],[`claude-haiku-4-5`,`Haiku 4.5 · cheapest`]],Nr=[[`acceptEdits`,`Accept edits · asks first`],[`plan`,`Plan · changes nothing`],[`bypassPermissions`,`Bypass · never asks`]];function Pr({available:e,onClose:t,initialCwd:n=``}){let[r,i]=(0,l.useState)(n),[a,o]=(0,l.useState)(Ar),[s,c]=(0,l.useState)(jr),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),y=async()=>{if(!r.trim()){_(`Working directory is required.`);return}h(!0),_(``);try{let e={cwd:r.trim()};a&&(e.model=a),s&&(e.permission_mode=s),u.trim()&&(e.worktree=u.trim()),f&&(e.create=!0);let{session_id:n}=await P.spawn(e);t(),v({name:`session`,id:n,tab:`terminal`})}catch(e){_(ae(e))}finally{h(!1)}};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:t,children:(0,L.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[620px] max-w-[94vw]`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New session`}),(0,L.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),e?(0,L.jsxs)(`div`,{className:`px-4 py-3 grid min-w-0 gap-3 text-[13px]`,children:[(0,L.jsxs)(Fr,{label:`Working directory`,hint:`pick one, or type a path`,children:[(0,L.jsx)(`input`,{autoFocus:!0,className:`input`,placeholder:`/Users/you/dev/project`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&y()}),(0,L.jsx)(`div`,{className:`mt-1.5 min-w-0 max-w-full`,children:(0,L.jsx)(Cr,{value:r,onPick:i})})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsx)(Fr,{label:`Model`,children:(0,L.jsx)(`select`,{className:`input`,value:a,onChange:e=>o(e.target.value),children:Mr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})}),(0,L.jsx)(Fr,{label:`Permissions`,children:(0,L.jsx)(`select`,{className:`input`,value:s,onChange:e=>c(e.target.value),children:Nr.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})})]}),(0,L.jsxs)(`details`,{className:`text-[12px] group`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer select-none text-fg-muted hover:text-fg list-none marker:content-none`,children:[(0,L.jsx)(`span`,{className:`inline-block transition-transform group-open:rotate-90 text-fg-faint`,children:`▶`}),` Advanced`]}),(0,L.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none text-fg-muted`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:f,onChange:e=>p(e.target.checked)}),`create the directory if it does not exist`]}),(0,L.jsx)(Fr,{label:`Git worktree`,hint:`creates .caprock-worktrees/ on a new branch`,children:(0,L.jsx)(`input`,{className:`input`,placeholder:`feature-x`,value:u,onChange:e=>d(e.target.value)})})]})]}),g&&(0,L.jsx)(`div`,{className:`text-danger text-[12px]`,children:g})]}):(0,L.jsxs)(`div`,{className:`px-4 py-6 text-[13px] text-fg-muted`,children:[`The `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself.`]}),e&&(0,L.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,L.jsx)(`button`,{onClick:t,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,L.jsx)(`button`,{onClick:y,disabled:m,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:m?`starting…`:`Start session`})]})]})})}function Fr({label:e,hint:t,children:n}){return(0,L.jsxs)(`label`,{className:`grid min-w-0 gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[e,t&&(0,L.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,t]})]}),n]})}function Ir(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(`all`),[i,a]=(0,l.useState)(!1),o=I(()=>P.sessions(!e),[e],{intervalMs:5e3}),s=I(()=>P.status(),[],{live:!1,intervalMs:3e4}),c=I(()=>P.summary(`today`,n),[n],{intervalMs:5e3}),u=I(()=>P.history(`all`),[],{intervalMs:6e4}),{alerts:p}=f(),m=re(1e3),h=o.data??[],g=n===`all`?h:h.filter(e=>(e.agent??`claude`)===n),_=!!s.data?.opencode,v=g.filter(e=>e.activity.health===`working`||e.activity.health===`looping`||e.activity.health===`error`||e.activity.health===`waiting-on-you`),y=g.filter(e=>!v.includes(e)&&e.status!==`ended`),b=g.filter(e=>e.status===`ended`),[x,w]=Ee(),ee=vr({sessions:g,alerts:p,now:m,limits:c.data?.rate_limits}),E=s.data?.hooks&&(s.data.hooks.missing??[]).length>0,D=!!c.data&&c.data.turns>0,te=s.data?.ingest_error;return(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[te&&(0,L.jsxs)(`div`,{className:`border border-danger/50 bg-danger/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-danger font-medium`,children:`Ingest stopped`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`No new sessions are being captured. `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:te}),` — check that`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,L.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})]}),E&&(0,L.jsxs)(`div`,{className:`border border-warn/50 bg-warn/10 px-3 py-2 text-[12px] rounded-[var(--radius-panel)] flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`text-warn font-medium`,children:`Hooks not installed`}),(0,L.jsxs)(`span`,{className:`text-fg-muted`,children:[`Activity is coming from transcripts only (a few seconds late, no tool-level detail for running commands). Run `,(0,L.jsx)(`span`,{className:`mono text-fg`,children:`caprock hooks install`}),` for real-time narration.`]}),(0,L.jsx)(`a`,{href:`#/settings`,className:`link ml-auto text-[11px]`,children:`details`})]}),(0,L.jsx)(br,{plan:x,onSave:w,now:m,owned:g.filter(e=>e.owned&&e.status!==`ended`).length}),(0,L.jsx)(cr,{items:ee,now:m,onDismiss:e=>d.dismissAlert(e),sessions:g}),(0,L.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,L.jsx)(dn,{plan:x})}),(0,L.jsx)(Lr,{available:s.data?.claude_available}),(0,L.jsx)(Rr,{available:s.data?.claude_available,onClick:()=>a(!0)})]}),D&&u.data?.totals&&(0,L.jsx)(En,{costUSD:u.data.totals.cost_usd,days:u.data.totals.days,now:m}),(0,L.jsxs)(R,{title:`Today`,center:_?(0,L.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md bg-panel-2 p-0.5`,children:It.map(e=>(0,L.jsx)(`button`,{onClick:()=>r(e.key),title:e.key===`all`?`Every agent`:`Only ${e.label}`,className:`px-2.5 py-1 text-[12px] mono rounded-[5px] transition-colors ${n===e.key?`bg-accent text-panel font-medium`:`text-fg-muted hover:text-fg`}`,children:e.label},e.key))}):null,right:c.data?(0,L.jsxs)(`span`,{className:`num`,children:[`pricing `,c.data.pricing_version,` · at API list price`]}):null,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-[1.4fr_1fr_1fr_1fr_1fr_1fr] divide-x divide-border`,children:[(0,L.jsx)(z,{label:`Cost today`,value:D?S(c.data?.cost_usd):`—`,sub:(0,L.jsx)(`span`,{title:un(x),children:D?ln(x):`nothing measured yet`}),tone:`info`,size:`hero`}),(0,L.jsx)(z,{label:`Burn now`,value:D?`${S(c.data.burn.usd_per_hour)}/h`:`—`,sub:D?`${C(Math.round(c.data.burn.tokens_per_min))} tok/min · last ${c.data.burn.window_min}m`:void 0}),(0,L.jsx)(z,{label:`Sessions`,value:D?c.data.sessions:`—`,sub:D?`${c.data.active_sessions} active`:void 0,size:`compact`}),(0,L.jsx)(z,{label:`Turns`,value:D?c.data.turns:`—`,sub:D?`${c.data.tool_calls} tool calls`:void 0,size:`compact`}),(0,L.jsx)(vn,{limits:c.data?.rate_limits,now:m}),(0,L.jsx)(hn,{hitRate:c.data?.savings.hit_rate,cutPct:c.data?.savings.cut_pct,measured:D})]}),(0,L.jsx)(Sr,{u:c.data?.unpriced,className:`mx-3 mb-2.5`})]}),(0,L.jsx)(Qn,{sessions:g,now:m}),(0,L.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,L.jsx)(on,{sessions:g,now:m,emptyHint:n===`all`?void 0:(0,L.jsxs)(L.Fragment,{children:[`Nothing from `,n===`opencode`?`OpenCode`:`Claude Code`,` yet.`]})}),(0,L.jsx)(Wt,{sessions:g,agent:n})]}),(0,L.jsx)(In,{}),o.error&&!o.data&&(0,L.jsxs)(xt,{title:`Cannot reach the daemon`,children:[o.error.message,` — is `,(0,L.jsx)(`span`,{className:`mono`,children:`caprock up`}),` running?`]}),!o.data&&!o.error&&(0,L.jsx)(St,{rows:4,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),o.data&&g.length===0&&(n===`all`?(0,L.jsxs)(xt,{title:`No sessions yet`,children:[`Start `,(0,L.jsx)(`span`,{className:`mono`,children:`claude`}),` in any terminal — it will show up here within seconds.`]}):(0,L.jsxs)(xt,{title:`No ${n===`opencode`?`OpenCode`:`Claude Code`} sessions here`,children:[`Nothing from this agent in the current view. Switch to`,` `,(0,L.jsx)(`button`,{className:`link underline`,onClick:()=>r(`all`),children:`all`}),` `,`to see everything.`]})),(0,L.jsx)(zr,{groups:[{label:`Active`,items:v},{label:`Idle`,items:y,dim:!0},...e?[{label:`Ended`,items:b,dim:!0}]:[]],now:m}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 cursor-pointer select-none`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)]`,checked:e,onChange:e=>t(e.target.checked)}),`show ended sessions`]}),o.loadedAt>0&&(0,L.jsxs)(`span`,{className:`num ml-auto`,children:[`refreshed `,T(o.loadedAt,m)]})]}),i&&(0,L.jsx)(Pr,{available:s.data?.claude_available??!1,onClose:()=>{a(!1),o.refresh()}})]})}function Lr({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return e===!1?null:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`button`,{onClick:async()=>{n(!0),i(``);try{let{session_id:e}=await P.spawn({chat:!0});v({name:`session`,id:e,tab:`terminal`})}catch(e){i(ae(e))}finally{n(!1)}},disabled:t,title:`start a session without picking a folder`,className:`relative shrink-0 rounded-[var(--radius-panel)] border border-border-strong px-3 py-2 text-[13px] leading-5 text-fg-muted hover:text-fg hover:border-accent/50 disabled:opacity-50`,children:[t?`starting…`:`Quick chat`,r&&(0,L.jsx)(`span`,{className:`absolute right-0 top-full mt-1 block max-w-[220px] text-right text-[11px] text-danger`,children:r})]})})}function Rr({available:e,onClick:t}){let n=e===!1;return(0,L.jsxs)(`button`,{onClick:t,title:n?`claude was not found on this machine — click for details`:`start a session Caprock owns`,className:`shrink-0 rounded-[var(--radius-panel)] border px-3 py-2 text-[13px] leading-5 font-medium transition-colors ${n?`border-border text-fg-faint hover:text-fg-muted`:`border-accent/60 bg-accent/15 text-accent hover:bg-accent/25`}`,children:[`+ New session`,n?` (claude not found)`:``]})}function zr({groups:e,now:t}){let n=e.flatMap(e=>e.items.map((t,n)=>({s:t,dim:e.dim,label:n===0?`${e.label} · ${e.items.length}`:null})));return n.length===0?null:(0,L.jsx)(`div`,{"data-testid":`session-grid`,className:`mt-3 grid gap-2 gap-y-6`,children:n.map(({s:e,dim:n,label:r})=>(0,L.jsxs)(`div`,{className:`relative ${n?`opacity-80`:``}`,children:[r&&(0,L.jsx)(`div`,{className:`absolute -top-4 left-0.5 text-[11px] uppercase tracking-[0.08em] text-fg-faint`,children:r}),(0,L.jsx)(Br,{s:e,now:t})]},e.session_id))})}function Br({s:e,now:t}){let n=e.context,r=n?n.pct>=85?`danger`:n.pct>=60?`warn`:void 0:void 0,[i,a]=(0,l.useState)(!1),o=e.activity?.health===`waiting-on-you`;return(0,L.jsxs)(`a`,{href:g({name:`session`,id:e.session_id}),className:`block border border-border bg-panel rounded-[var(--radius-panel)] hover:border-border-strong no-underline hover:no-underline text-fg`,children:[(0,L.jsxs)(`div`,{className:`px-3 pt-2 pb-1 flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium truncate text-[15px]`,children:e.project||`unknown project`}),(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:E(e.session_id)}),e.agent===`opencode`&&(0,L.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.08em] text-fg-muted border border-border px-1 py-px rounded-sm`,children:`opencode`}),e.git_branch&&(0,L.jsx)(`span`,{className:`mono text-[11px] text-fg-muted truncate`,children:e.git_branch}),(0,L.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[o&&(0,L.jsx)(`button`,{className:`text-[11px] border border-warn/50 text-warn bg-warn/10 px-1.5 py-0.5 rounded-sm hover:bg-warn/20`,onClick:e=>{e.preventDefault(),a(!0)},children:`what did it ask?`}),(0,L.jsx)(yt,{health:e.activity.health})]})]}),i&&(0,L.jsx)(ar,{session:e,now:t,onClose:()=>a(!1)}),(0,L.jsxs)(`div`,{className:`px-3 pb-2 text-[13px] truncate`,title:e.activity.phrase,children:[(0,L.jsx)(`span`,{className:e.activity.health===`working`?`text-fg`:`text-fg-muted`,children:e.activity.phrase}),(0,L.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(e.activity.at||e.last_event_at,t)})]}),e.activity.plan&&e.activity.plan.total>0&&(0,L.jsxs)(`div`,{className:`px-3 pb-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,L.jsx)(`div`,{className:`h-1 flex-1 bg-panel-2 rounded-sm overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-accent`,style:{width:`${Math.min(100,Math.max(0,100*e.activity.plan.done/e.activity.plan.total))}%`}})}),(0,L.jsxs)(`span`,{className:`num`,children:[e.activity.plan.done,`/`,e.activity.plan.total]}),e.activity.plan.next&&(0,L.jsxs)(`span`,{className:`truncate max-w-[50%]`,children:[`→ `,e.activity.plan.next]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 divide-x divide-border border-t border-border`,children:[(0,L.jsx)(z,{label:`Cost`,value:S(e.stats.cost_usd),sub:e.model||`—`,tone:`info`}),(0,L.jsx)(z,{label:`Tokens`,value:C(e.stats.tokens_in+e.stats.tokens_out+e.stats.cache_read+e.stats.cache_write),sub:`${w(e.savings.hit_rate*100)} cache hit`}),(0,L.jsx)(z,{label:`Context`,value:n?w(n.pct):`—`,sub:n?`${C(n.tokens)} / ${C(n.window)}`:`unknown model`,tone:r}),(0,L.jsx)(z,{label:`Activity`,value:e.stats.tool_calls,sub:`${e.stats.turns} turns · ${e.stats.files_touched} files`})]})]})}function Vr({id:e,now:t}){let n=I(()=>P.notes(e),[e],{intervalMs:1e4}),r=n.data??[],[i,a]=(0,l.useState)(!1),o=r.filter(e=>!e.fragment),s=i?r:o;return n.error&&!n.data?(0,L.jsx)(xt,{title:`Cannot load notes`,children:n.error.message}):n.data?r.length===0?(0,L.jsx)(xt,{title:`Nothing said yet`,children:`Claude's written answers appear here — the reasoning and the “what changed, what I still need from you” that otherwise lives only in your terminal scrollback.`}):(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint px-0.5`,children:[(0,L.jsxs)(`span`,{children:[o.length,` `,o.length===1?`answer`:`answers`,r.length>o.length&&` · ${r.length-o.length} short remarks`]}),r.length>o.length&&(0,L.jsx)(`button`,{className:`text-fg-muted hover:text-fg border border-border px-1.5 rounded-sm`,onClick:()=>a(e=>!e),children:i?`hide short remarks`:`show everything`}),(0,L.jsx)(`span`,{className:`ml-auto`,children:`subagent chatter excluded · newest first`})]}),s.map(e=>(0,L.jsx)(Ur,{note:e,now:t},e.event_id))]}):(0,L.jsx)(St,{rows:4})}var Hr=600;function Ur({note:e,now:t,showSession:n=!1}){let[r,i]=(0,l.useState)(!1),a=typeof e.text==`string`?e.text:``,o=[...a],s=o.length>Hr,c=r||!s?a:o.slice(0,Hr).join(``)+`…`;return(0,L.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 px-3 pt-2 text-[11px] text-fg-faint`,children:[n&&(0,L.jsx)(`a`,{href:g({name:`session`,id:e.session_id,at:e.ts}),className:`link`,title:`Open the session at this moment`,children:(0,L.jsx)(`span`,{className:`text-fg-muted`,children:e.project||E(e.session_id)})}),(0,L.jsx)(`span`,{className:`mono`,children:e.model||`assistant`}),e.fragment&&(0,L.jsx)(`span`,{className:`text-fg-faint`,children:`· mid-thought`}),(0,L.jsx)(`span`,{className:`num ml-auto`,children:T(e.ts,t)})]}),(0,L.jsx)(`div`,{className:`px-3 py-2 text-[13px] leading-[1.55] whitespace-pre-wrap break-words`,children:c}),s&&(0,L.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg px-3 pb-2`,onClick:()=>i(e=>!e),children:r?`show less`:`show all ${o.length.toLocaleString()} characters`})]})}var Wr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Kr=(e,t)=>{for(var n in t)Wr(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gr(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wr(t,n,i),i},B=(e,t)=>(n,r)=>t(n,r,e),Jr=`Terminal input`,Yr={get:()=>Jr,set:e=>Jr=e},Xr=`Too much output to announce, navigate to rows manually to read`,Zr={get:()=>Xr,set:e=>Xr=e};function Qr(e){return e.replace(/\r?\n/g,`\r`)}function $r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ei(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function ti(e,t,n,r){e.stopPropagation(),e.clipboardData&&ni(e.clipboardData.getData(`text/plain`),t,n,r)}function ni(e,t,n,r){e=Qr(e),e=$r(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ri(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ii(e,t,n,r,i){ri(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ai(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oi(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var si=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ci=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},li=``,ui=` `,di=class e{constructor(){this.fg=0,this.bg=0,this.extended=new fi}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},fi=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pi=class e extends di{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fi,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ai(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mi=`di$target`,hi=`di$dependencies`,gi=new Map;function _i(e){return e[hi]||[]}function vi(e){if(gi.has(e))return gi.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);yi(t,e,r)};return t._id=e,gi.set(e,t),t}function yi(e,t,n){t[mi]===t?t[hi].push({id:e,index:n}):(t[hi]=[{id:e,index:n}],t[mi]=t)}var bi=vi(`BufferService`),xi=vi(`CoreMouseService`),Si=vi(`CoreService`),Ci=vi(`CharsetService`),wi=vi(`InstantiationService`),Ti=vi(`LogService`),Ei=vi(`OptionsService`),Di=vi(`OscLinkService`),Oi=vi(`UnicodeService`),ki=vi(`DecorationService`),Ai=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new pi,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):ji(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ai=qr([B(0,bi),B(1,Ei),B(2,Di)],Ai);function ji(e,t){if(confirm(`Do you want to navigate to ${t}? WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Mi=vi(`CharSizeService`),V=vi(`CoreBrowserService`),Ni=vi(`MouseService`),Pi=vi(`RenderService`),Fi=vi(`SelectionService`),Ii=vi(`CharacterJoinerService`),Li=vi(`ThemeService`),Ri=vi(`LinkProviderService`),zi=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Gi.isErrorNoTelemetry(e)?new Gi(e.message+` diff --git a/internal/api/dist/assets/index-1ZVeIGiX.css b/internal/api/dist/assets/index-JzCSeTjz.css similarity index 66% rename from internal/api/dist/assets/index-1ZVeIGiX.css rename to internal/api/dist/assets/index-JzCSeTjz.css index a538d69..f372664 100644 --- a/internal/api/dist/assets/index-1ZVeIGiX.css +++ b/internal/api/dist/assets/index-JzCSeTjz.css @@ -1 +1 @@ -@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[520px\]{width:520px}.w-\[560px\]{width:560px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-panel\/95{background-color:#211f1df2}@supports (color:color-mix(in lab, red, red)){.bg-panel\/95{background-color:color-mix(in oklab, var(--color-panel) 95%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-\[0_2px_12px_var\(--color-bg\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,var(--color-bg));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-premium\/10:hover{background-color:#4d5cf01a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-premium\/10:hover{background-color:color-mix(in oklab, var(--color-premium) 10%, transparent)}}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} +@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[560px\]{width:560px}.w-\[620px\]{width:620px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-panel\/95{background-color:#211f1df2}@supports (color:color-mix(in lab, red, red)){.bg-panel\/95{background-color:color-mix(in oklab, var(--color-panel) 95%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-\[0_2px_12px_var\(--color-bg\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,var(--color-bg));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} diff --git a/internal/api/dist/index.html b/internal/api/dist/index.html index eaf4091..be5055d 100644 --- a/internal/api/dist/index.html +++ b/internal/api/dist/index.html @@ -20,8 +20,8 @@ } catch (e) {} })(); - - + +
diff --git a/internal/store/queries.go b/internal/store/queries.go index dff6c7e..a5b06be 100644 --- a/internal/store/queries.go +++ b/internal/store/queries.go @@ -612,11 +612,20 @@ func EventsBefore(ctx context.Context, q Querier, sessionID string, before int64 } where, args := `session_id = ?`, []any{sessionID} if before > 0 { - where += ` AND id < ?` + // Paged by the timestamp of the row the caller already has, because the sort + // is by time: mixing an id cursor with a ts ordering skips rows on any + // session whose insert order and chronology disagree — which is every + // session that was ever backfilled from a transcript. + where += ` AND ts < (SELECT ts FROM events WHERE id = ?)` args = append(args, before) } args = append(args, n) - rows, err := q.QueryContext(ctx, `SELECT * FROM (SELECT `+eventCols+` FROM events WHERE `+where+` ORDER BY id DESC LIMIT ?) ORDER BY id ASC`, args...) + // Ordered by ts, not by id. The two agree for a session captured live, and + // diverge for one whose transcript was re-read: a backfill inserts old + // events with new rowids, so "the newest sixty by id" returned a fortnight + // of history and the activity feed showed it as what just happened. The id + // stays as the tie-break, since two events can share a millisecond. + rows, err := q.QueryContext(ctx, `SELECT * FROM (SELECT `+eventCols+` FROM events WHERE `+where+` ORDER BY ts DESC, id DESC LIMIT ?) ORDER BY ts ASC, id ASC`, args...) if err != nil { return nil, err } diff --git a/internal/store/queries_more_test.go b/internal/store/queries_more_test.go index 3c44264..83819d3 100644 --- a/internal/store/queries_more_test.go +++ b/internal/store/queries_more_test.go @@ -669,3 +669,44 @@ func TestEventsBeforePagesBackwards(t *testing.T) { t.Fatalf("before the first row: %d %v", len(empty), err) } } + +// The newest events are the newest by TIME, not by rowid. +// +// The two agree for a session captured live and diverge for one whose +// transcript was re-read: a backfill inserts old events with new rowids. On a +// session with fifteen thousand events that made "the newest sixty" a fortnight +// of history, and the activity feed presented it as what just happened — +// reported as "I only see 9-10 day old entries and cannot scroll", because +// every row was equally stale. +func TestLastEventsOrdersByTimeNotInsertion(t *testing.T) { + ctx := context.Background() + s := openTest(t) + + base := time.Date(2026, 9, 1, 12, 0, 0, 0, time.UTC) + // Inserted newest-first, so rowid order is the reverse of time order — + // exactly what a backfill produces. + for i := 0; i < 5; i++ { + ev := &event.Event{ + SessionID: "s", Source: event.SourceHook, Kind: event.KindTurnUser, + Ts: base.Add(time.Duration(-i) * time.Hour), + } + if _, err := InsertEvent(ctx, s.db, ev); err != nil { + t.Fatal(err) + } + } + + got, err := LastEvents(ctx, s.db, "s", 2) + if err != nil { + t.Fatal(err) + } + if len(got) != 2 { + t.Fatalf("got %d events", len(got)) + } + // The two newest by clock are the last hour and the one before it — not the + // two most recently inserted, which are the oldest. + newest := got[len(got)-1] + if !newest.Ts.Equal(base) { + t.Errorf("newest event is %v, want %v — ordered by rowid instead of time", + newest.Ts.UTC(), base) + } +} diff --git a/ui/src/components/ActivityFeed.test.tsx b/ui/src/components/ActivityFeed.test.tsx new file mode 100644 index 0000000..cb96086 --- /dev/null +++ b/ui/src/components/ActivityFeed.test.tsx @@ -0,0 +1,73 @@ +/** + * The feed seeds from the NEWEST events, and getting that wrong is subtle: the + * panel fills, the rows are real, and every one of them is a fortnight old. + * + * `api.events(id, after, limit)` pages FORWARD from `after`, so `events(id, 0, + * 60)` returns the first sixty events a session ever recorded. On a session + * with thousands that is ancient history presented as live activity — and the + * reader's complaint is not "this is wrong" but "why can I only see old rows + * and why won't it scroll", because every row is equally stale. The session + * timeline had the identical defect. + */ +import { render, screen, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' +import { ActivityFeed } from './ActivityFeed' +import type { Event, SessionSummary } from '@/lib/api' + +const calls = vi.hoisted(() => ({ recent: [] as number[], forward: [] as number[] })) + +vi.mock('@/lib/api', async (orig) => { + const actual = await orig() + return { + ...actual, + api: { + ...actual.api, + recentEvents: async (_id: string, limit: number) => { + calls.recent.push(limit) + return [ev(9_000, 'newest')] + }, + events: async (_id: string, after: number) => { + calls.forward.push(after) + return [ev(1, 'ancient')] + }, + }, + } +}) + +vi.mock('@/lib/live', async (orig) => { + const actual = await orig() + return { ...actual, live: { ...actual.live, onFrame: () => () => {} } } +}) + +const NOW = Date.parse('2026-09-01T12:00:00Z') + +function ev(id: number, command: string): Event { + return { + id, ts: new Date(NOW - 60_000).toISOString(), session_id: 's1', + source: 'hook', kind: 'tool.pre', tool: 'Bash', + payload: { tool_input: { command } }, + } as Event +} + +const session = (): SessionSummary => + ({ session_id: 's1', project: 'p', status: 'active', last_event_at: NOW } as SessionSummary) + +describe('ActivityFeed', () => { + it('asks for the newest events, never the first ones ever recorded', async () => { + calls.recent = [] + calls.forward = [] + render() + + await waitFor(() => expect(calls.recent.length).toBeGreaterThan(0)) + // The forward-paging call is the bug: it returns a session's opening + // moments, which on a long session is a fortnight ago. + expect(calls.forward).toHaveLength(0) + }) + + it('shows what just happened', async () => { + calls.recent = [] + render() + await waitFor(() => expect(screen.getByText(/newest/)).toBeInTheDocument()) + expect(screen.queryByText(/ancient/)).toBeNull() + }) +}) diff --git a/ui/src/components/ActivityFeed.tsx b/ui/src/components/ActivityFeed.tsx index d1b5254..afe481e 100644 --- a/ui/src/components/ActivityFeed.tsx +++ b/ui/src/components/ActivityFeed.tsx @@ -36,8 +36,12 @@ export function ActivityFeed({ sessions, now, emptyHint }: { sessions: SessionSu const recent = [...sessions] .sort((a, b) => b.last_event_at - a.last_event_at) .slice(0, 4) + // The NEWEST sixty, not the oldest: `events(id, 0, 60)` pages forward + // from the start of a session, so on anything long-running this seeded + // the feed with a fortnight-old history and called it live activity. + // Same defect the session timeline had. const batches = await Promise.all( - recent.map((s) => api.events(s.session_id, 0, 60).catch(() => [] as never[])), + recent.map((s) => api.recentEvents(s.session_id, 60).catch(() => [] as never[])), ) if (cancelled) return const seeded = batches diff --git a/ui/src/components/PlanPicker.test.tsx b/ui/src/components/PlanPicker.test.tsx index 9cdb4e9..6abee6d 100644 --- a/ui/src/components/PlanPicker.test.tsx +++ b/ui/src/components/PlanPicker.test.tsx @@ -1,43 +1,57 @@ /** - * The plan menu writes the whole settings object, so it must carry unrelated - * preferences through untouched. Setting a plan silently turning off release - * checks would be a genuinely confusing bug — the user changed one thing and - * two things changed. + * Saving one setting must not carry the others with it. + * + * The hook used to PUT the whole Settings object, built from a module-level + * cache, so any control could overwrite a field it knew nothing about with a + * value it had read minutes earlier. Two tabs were enough to see it: change the + * plan in one, click "check for updates" in the other, and the second wrote the + * plan back to what its cache still held. Nothing failed to save — a stale copy + * undid it, which is indistinguishable from "it does not stick". + * + * The server has always treated PUT as a patch. This pins that the client + * behaves like one too. */ -import { fireEvent, render, screen } from '@testing-library/react' +import { fireEvent, render, screen, waitFor } from '@testing-library/react' import { describe, expect, it, vi } from 'vitest' -import { PlanChip } from './PlanPicker' +import { UpdateBanner } from './UpdateBanner' import type { Settings } from '@/lib/api' -const enabled: Settings = { - update_checks: true, - plan_kind: 'flat', - plan_label: 'Pro', - plan_usd_per_month: 20, -} +const sent = vi.hoisted(() => ({ bodies: [] as Record[] })) -describe('PlanChip', () => { - it('keeps release checks on when the plan changes', () => { - const onSave = vi.fn() - render() - fireEvent.click(screen.getByRole('button', { name: /Pro/ })) - fireEvent.click(screen.getByText('Max 20×')) - expect(onSave).toHaveBeenCalledWith( - expect.objectContaining({ plan_kind: 'flat', plan_label: 'Max 20×', plan_usd_per_month: 200, update_checks: true }), - ) - }) +vi.mock('@/lib/api', async (orig) => { + const actual = await orig() + return { + ...actual, + api: { + ...actual.api, + update: async () => ({ enabled: true, current: 'v1', update_available: false }), + saveSettings: async (s: Settings) => { + sent.bodies.push(s as unknown as Record) + return s + }, + }, + } +}) - it('prompts to set a plan when none is stated', () => { - render() - expect(screen.getByRole('button', { name: 'set plan' })).toBeTruthy() - }) +describe('saving one setting', () => { + it('sends only the field that changed', async () => { + sent.bodies = [] + const saves: Partial[] = [] + const plan = { + update_checks: false, + plan_kind: 'flat', + plan_label: 'Max 20×', + plan_usd_per_month: 200, + } as Settings + + render( saves.push(p)} now={Date.now()} />) + fireEvent.click(await screen.findByText('check for updates')) - it('rejects a nonsense custom price instead of storing it', () => { - const onSave = vi.fn() - render() - fireEvent.click(screen.getByRole('button', { name: /Pro/ })) - fireEvent.change(screen.getByPlaceholderText('e.g. 150'), { target: { value: 'abc' } }) - fireEvent.click(screen.getByRole('button', { name: 'set' })) - expect(onSave).not.toHaveBeenCalled() + await waitFor(() => expect(saves.length).toBe(1)) + // The whole point: turning on update checks must not also restate the + // plan, because this component's copy of it may be minutes old. + expect(saves[0]).toEqual({ update_checks: true }) + expect(saves[0]).not.toHaveProperty('plan_label') + expect(saves[0]).not.toHaveProperty('plan_usd_per_month') }) }) diff --git a/ui/src/components/PlanPicker.tsx b/ui/src/components/PlanPicker.tsx index 6f4306a..6e1212d 100644 --- a/ui/src/components/PlanPicker.tsx +++ b/ui/src/components/PlanPicker.tsx @@ -37,7 +37,7 @@ function emit() { for (const s of subs) s() } -export function usePlan(): [Settings | undefined, (s: Settings) => void] { +export function usePlan(): [Settings | undefined, (patch: Partial) => void] { const [, force] = useState(0) useEffect(() => { const fn = () => force((v) => v + 1) @@ -52,15 +52,26 @@ export function usePlan(): [Settings | undefined, (s: Settings) => void] { return () => { subs.delete(fn) } }, []) - const save = (s: Settings) => { - cached = s // optimistic: the chip must never lag the click + // Send only what changed. + // + // This used to PUT the whole Settings object, built from this module's + // cached copy — so any control could overwrite a field it knew nothing + // about with a value it read minutes ago. Two tabs were enough: change the + // plan in one, click "check for updates" in the other, and the second wrote + // the plan back to what its cache still held. The setting had saved; a stale + // copy undid it, which reads as "it does not stick". + // + // The server has always been a patch — absent fields are left alone — so the + // fix is to stop pretending otherwise on this side. + const save = (patch: Partial) => { + cached = { ...(cached ?? ({} as Settings)), ...patch } // optimistic: the chip must never lag the click emit() - void api.saveSettings(s).catch(() => { /* stays local until the next load */ }) + void api.saveSettings(patch as Settings).catch(() => { /* stays local until the next load */ }) } return [cached, save] } -export function PlanChip({ plan, onSave }: { plan?: Settings; onSave: (s: Settings) => void }) { +export function PlanChip({ plan, onSave }: { plan?: Settings; onSave: (patch: Partial) => void }) { const [open, setOpen] = useState(false) const box = useRef(null) @@ -95,11 +106,10 @@ export function PlanChip({ plan, onSave }: { plan?: Settings; onSave: (s: Settin ) } -function PlanMenu({ plan, onSave }: { plan?: Settings; onSave: (s: Settings) => void }) { +function PlanMenu({ plan, onSave }: { plan?: Settings; onSave: (patch: Partial) => void }) { const [custom, setCustom] = useState(String(plan?.plan_usd_per_month || '')) // Carry every other setting through: changing the plan must not silently // reset an unrelated preference such as release checks. - const base: Settings = plan ?? { update_checks: false, plan_kind: '', plan_label: '', plan_usd_per_month: 0 } return (
@@ -110,7 +120,7 @@ function PlanMenu({ plan, onSave }: { plan?: Settings; onSave: (s: Settings) => return ( - + {/* A verb, because "premium $30/yr" is a price tag and a price tag asks + * nothing. What this control does is open the dialog, so it says so — + * and carries the price, because a reader deciding whether to click + * deserves to know the number before they do. */} + {/* The cap, not the report: it is the feature people arrive worried * about, and the one a runaway session makes them want. */} {open && setOpen(false)} />} diff --git a/ui/src/components/SpawnDialog.tsx b/ui/src/components/SpawnDialog.tsx index 7ad5e84..5e6592f 100644 --- a/ui/src/components/SpawnDialog.tsx +++ b/ui/src/components/SpawnDialog.tsx @@ -24,9 +24,12 @@ const MODELS: [value: string, label: string][] = [ // which is not one of them, and "" — so the dialog could send a mode the // binary rejects. Three are offered here; the rest are reachable by starting // claude yourself, which Caprock watches all the same. +// Short enough to survive a narrow window. The label has to carry what the +// session will DO without being opened — a mode cut off mid-word ("asks before +// com…") is the one label where truncation hides the consequence. const MODES: [value: string, label: string][] = [ - ['acceptEdits', 'Accept edits · asks before commands'], - ['plan', 'Plan · reads and plans, changes nothing'], + ['acceptEdits', 'Accept edits · asks first'], + ['plan', 'Plan · changes nothing'], ['bypassPermissions', 'Bypass · never asks'], ] @@ -68,7 +71,7 @@ export function SpawnDialog({ } return (
-
e.stopPropagation()}> +
e.stopPropagation()}>

New session

diff --git a/ui/src/components/UpdateBanner.tsx b/ui/src/components/UpdateBanner.tsx index 1998866..4d73e64 100644 --- a/ui/src/components/UpdateBanner.tsx +++ b/ui/src/components/UpdateBanner.tsx @@ -20,7 +20,7 @@ const DISMISS_KEY = 'caprock.update.dismissed' export function UpdateBanner({ plan, onSave, now, owned = 0 }: { plan?: Settings - onSave: (s: Settings) => void + onSave: (patch: Partial) => void now: number /** Live sessions Caprock started, which upgrading will close. */ owned?: number @@ -52,7 +52,7 @@ export function UpdateBanner({ plan, onSave, now, owned = 0 }: {