From 2afa933153edcfa254d1c7f7dcbc025e4582c737 Mon Sep 17 00:00:00 2001 From: merefield Date: Sat, 19 Sep 2026 13:50:35 +0100 Subject: [PATCH 1/3] FEAT: add conditional Thresholds tab to terminal and web --- README.md | 12 +++ internal/codex/quota_profiles.go | 54 +++++++++++++ internal/codex/quota_profiles_test.go | 24 ++++++ internal/i18n/locales/da.json | 13 ++++ internal/i18n/locales/de.json | 13 ++++ internal/i18n/locales/en-GB.json | 13 ++++ internal/i18n/locales/es.json | 13 ++++ internal/i18n/locales/et.json | 13 ++++ internal/i18n/locales/fi.json | 13 ++++ internal/i18n/locales/fr.json | 13 ++++ internal/i18n/locales/it.json | 13 ++++ internal/i18n/locales/ja.json | 13 ++++ internal/i18n/locales/nb.json | 13 ++++ internal/i18n/locales/nl.json | 13 ++++ internal/i18n/locales/pt-BR.json | 13 ++++ internal/i18n/locales/pt-PT.json | 13 ++++ internal/i18n/locales/ru.json | 13 ++++ internal/i18n/locales/sv.json | 13 ++++ internal/i18n/locales/tr.json | 13 ++++ internal/i18n/locales/zh-Hans.json | 13 ++++ internal/ui/english_snapshot_test.go | 5 ++ internal/ui/model.go | 36 ++++++++- internal/ui/preferences.go | 6 +- internal/ui/preferences_test.go | 12 ++- internal/ui/tabs.go | 61 +++++++++++---- internal/ui/tabs_test.go | 20 ++++- internal/ui/theme.go | 2 + internal/ui/thresholds.go | 77 +++++++++++++++++++ internal/ui/thresholds_test.go | 59 ++++++++++++++ internal/ui/view.go | 6 +- internal/ui/view_test.go | 7 ++ ...{index-DX-9TojK.css => index-BF0PrFr9.css} | 2 +- internal/web/dist/assets/index-CCAs5nbB.js | 30 ++++++++ internal/web/dist/assets/index-S94ToOzX.js | 26 ------- internal/web/dist/index.html | 4 +- internal/web/server.go | 5 ++ internal/web/state.go | 43 +++++++++++ internal/web/thresholds_test.go | 31 ++++++++ intro-post.md | 3 + web/src/App.svelte | 21 ++++- web/src/Thresholds.svelte | 44 +++++++++++ web/src/preferences.svelte.ts | 4 +- web/src/state.svelte.ts | 10 +++ web/src/style.css | 58 ++++++++++++++ web/tests/browser.spec.ts | 21 +++++ 45 files changed, 846 insertions(+), 58 deletions(-) create mode 100644 internal/ui/thresholds.go create mode 100644 internal/ui/thresholds_test.go rename internal/web/dist/assets/{index-DX-9TojK.css => index-BF0PrFr9.css} (83%) create mode 100644 internal/web/dist/assets/index-CCAs5nbB.js delete mode 100644 internal/web/dist/assets/index-S94ToOzX.js create mode 100644 internal/web/thresholds_test.go create mode 100644 web/src/Thresholds.svelte diff --git a/README.md b/README.md index d10663f..247dfa7 100644 --- a/README.md +++ b/README.md @@ -2082,6 +2082,18 @@ are rejected before changing settings. `standard` clears an explicit tier; omitting speed leaves the session's current tier intact. Codexometer ships no enabled profile and does not infer which model is cheaper. +When one or more steps are configured, Codexometer adds a primary +**Thresholds** tab in both the terminal and experimental web interface. It keeps +the complete policy visible in trigger order, including model, reasoning level, +speed and `ask`/`auto` behavior, and marks the active and next steps against the +longest Codex quota window. The tab is omitted entirely on ordinary launches; +saved navigation also falls back to the last Quota view when no policy is +configured. Approvals remain attached to their individual sessions in +**Sessions** rather than being actioned from the policy overview. +`ACTIVE` identifies the selected policy, not confirmation that every session has +applied it; `PASSED` means a higher threshold now takes precedence. Scroll long +policies with the mouse wheel, arrow keys or Page Up/Down in the terminal. + The optional final mode defaults to **`ask`**, preserving per-session approval for existing command lines. **`auto`** authorizes applying the profile at launch: when the threshold is reached, each eligible loaded session is updated for its diff --git a/internal/codex/quota_profiles.go b/internal/codex/quota_profiles.go index 65e41b9..649fcae 100644 --- a/internal/codex/quota_profiles.go +++ b/internal/codex/quota_profiles.go @@ -4,10 +4,64 @@ import ( "context" "errors" "fmt" + "slices" "sync" "time" ) +type QuotaStepStage string + +const ( + QuotaStepConfigured QuotaStepStage = "CONFIGURED" + QuotaStepPassed QuotaStepStage = "PASSED" + QuotaStepActive QuotaStepStage = "ACTIVE" + QuotaStepNext QuotaStepStage = "NEXT" + QuotaStepArmed QuotaStepStage = "ARMED" +) + +type QuotaStepStatus struct { + Step QuotaStep + Stage QuotaStepStage + Remaining int +} + +// QuotaStepStatuses returns a stable, trigger-ordered policy projection for +// any presentation. The used percentage is nil until the policy window can be +// identified authoritatively. +func QuotaStepStatuses(s Snapshot, steps []QuotaStep) ([]QuotaStepStatus, *int) { + ordered := append([]QuotaStep(nil), steps...) + slices.SortStableFunc(ordered, func(a, b QuotaStep) int { return a.Threshold - b.Threshold }) + used, active := -1, -1 + if meter, _, ok := QuotaPolicyWindow(s); ok { + used = meter.Window.UsedPercent + for index, step := range ordered { + if step.Threshold <= used { + active = index + } + } + } + statuses := make([]QuotaStepStatus, 0, len(ordered)) + for index, step := range ordered { + status := QuotaStepStatus{Step: step, Stage: QuotaStepArmed} + switch { + case used < 0: + status.Stage = QuotaStepConfigured + case index < active: + status.Stage = QuotaStepPassed + case index == active: + status.Stage = QuotaStepActive + case index == active+1: + status.Stage = QuotaStepNext + status.Remaining = max(step.Threshold-used, 0) + } + statuses = append(statuses, status) + } + if used < 0 { + return statuses, nil + } + return statuses, &used +} + // QuotaProfiles owns the policy lifecycle independently of either presentation. // Its lock also serializes inventory and writes from browser tabs or UI commands. type QuotaProfiles struct { diff --git a/internal/codex/quota_profiles_test.go b/internal/codex/quota_profiles_test.go index f441eca..f42cee1 100644 --- a/internal/codex/quota_profiles_test.go +++ b/internal/codex/quota_profiles_test.go @@ -74,6 +74,30 @@ func TestQuotaProfileCaptureAndSelection(t *testing.T) { } } +func TestQuotaStepStatusesAreSortedAndClassified(t *testing.T) { + s := DemoSnapshot() + s.AccountFingerprint = "account" + s.RateLimits.Secondary.UsedPercent = 65 + statuses, used := QuotaStepStatuses(s, []QuotaStep{{Threshold: 90}, {Threshold: 25}, {Threshold: 80}, {Threshold: 50}}) + want := []QuotaStepStage{QuotaStepPassed, QuotaStepActive, QuotaStepNext, QuotaStepArmed} + if used == nil || *used != 65 || len(statuses) != len(want) { + t.Fatalf("status summary = %#v, used=%v", statuses, used) + } + for index, stage := range want { + if statuses[index].Stage != stage { + t.Fatalf("status %d = %#v, want %s", index, statuses[index], stage) + } + } + if statuses[2].Remaining != 15 { + t.Fatalf("next remaining = %d", statuses[2].Remaining) + } + + configured, used := QuotaStepStatuses(Snapshot{}, []QuotaStep{{Threshold: 80}}) + if used != nil || configured[0].Stage != QuotaStepConfigured { + t.Fatalf("unobserved status = %#v, used=%v", configured, used) + } +} + func TestQuotaProfilesStaleAttemptConsumed(t *testing.T) { c := &policyTestClient{} p := NewQuotaProfiles(c) diff --git a/internal/i18n/locales/da.json b/internal/i18n/locales/da.json index 47e2a2b..87f0eba 100644 --- a/internal/i18n/locales/da.json +++ b/internal/i18n/locales/da.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "TÆRSKLER", + "MODEL STEP POLICY": "POLITIK FOR MODELTRIN", + "QUOTA WINDOW UNAVAILABLE": "KVOTEVINDUE IKKE TILGÆNGELIGT", + "QUOTA WINDOW // %d%% USED": "KVOTEVINDUE // %d%% BRUGT", + "TRIGGER": "UDLØSER", + "ACTION": "HANDLING", + "STATE": "STATUS", + "ASK": "SPØRG", + "AUTO": "AUTO", + "ARMED": "KLAR", + "CONFIGURED": "KONFIGURERET", + "PASSED": "PASSERET", + "NEXT // %d PP": "NÆSTE // %d PP", "WHY THIS CHANGE": "HVORFOR DENNE ÆNDRING", "CURRENT PROFILE": "AKTUEL PROFIL", "PROPOSED PROFILE": "FORESLÅET PROFIL", diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index 5a33086..7fc38d4 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "SCHWELLENWERTE", + "MODEL STEP POLICY": "MODELLSTUFENREGEL", + "QUOTA WINDOW UNAVAILABLE": "KONTINGENTFENSTER NICHT VERFÜGBAR", + "QUOTA WINDOW // %d%% USED": "KONTINGENTFENSTER // %d%% VERBRAUCHT", + "TRIGGER": "AUSLÖSER", + "ACTION": "AKTION", + "STATE": "STATUS", + "ASK": "FRAGEN", + "AUTO": "AUTO", + "ARMED": "BEREIT", + "CONFIGURED": "KONFIGURIERT", + "PASSED": "ÜBERSCHRITTEN", + "NEXT // %d PP": "NÄCHSTE // %d PP", "WHY THIS CHANGE": "WARUM DIESE ÄNDERUNG", "CURRENT PROFILE": "AKTUELLES PROFIL", "PROPOSED PROFILE": "VORGESCHLAGENES PROFIL", diff --git a/internal/i18n/locales/en-GB.json b/internal/i18n/locales/en-GB.json index 6f5be87..f5d3cd7 100644 --- a/internal/i18n/locales/en-GB.json +++ b/internal/i18n/locales/en-GB.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "THRESHOLDS", + "MODEL STEP POLICY": "MODEL STEP POLICY", + "QUOTA WINDOW UNAVAILABLE": "QUOTA WINDOW UNAVAILABLE", + "QUOTA WINDOW // %d%% USED": "QUOTA WINDOW // %d%% USED", + "TRIGGER": "TRIGGER", + "ACTION": "ACTION", + "STATE": "STATE", + "ASK": "ASK", + "AUTO": "AUTO", + "ARMED": "ARMED", + "CONFIGURED": "CONFIGURED", + "PASSED": "PASSED", + "NEXT // %d PP": "NEXT // %d PP", "WHY THIS CHANGE": "WHY THIS CHANGE", "CURRENT PROFILE": "CURRENT PROFILE", "PROPOSED PROFILE": "PROPOSED PROFILE", diff --git a/internal/i18n/locales/es.json b/internal/i18n/locales/es.json index 8bf9670..a6422b7 100644 --- a/internal/i18n/locales/es.json +++ b/internal/i18n/locales/es.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "UMBRALES", + "MODEL STEP POLICY": "POLÍTICA DE CAMBIO DE MODELO", + "QUOTA WINDOW UNAVAILABLE": "VENTANA DE CUOTA NO DISPONIBLE", + "QUOTA WINDOW // %d%% USED": "VENTANA DE CUOTA // %d%% USADO", + "TRIGGER": "ACTIVACIÓN", + "ACTION": "ACCIÓN", + "STATE": "ESTADO", + "ASK": "PREGUNTAR", + "AUTO": "AUTO", + "ARMED": "PREPARADO", + "CONFIGURED": "CONFIGURADO", + "PASSED": "SUPERADO", + "NEXT // %d PP": "SIGUIENTE // %d PP", "WHY THIS CHANGE": "MOTIVO DEL CAMBIO", "CURRENT PROFILE": "PERFIL ACTUAL", "PROPOSED PROFILE": "PERFIL PROPUESTO", diff --git a/internal/i18n/locales/et.json b/internal/i18n/locales/et.json index f7c8357..2ec653a 100644 --- a/internal/i18n/locales/et.json +++ b/internal/i18n/locales/et.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "LÄVENDID", + "MODEL STEP POLICY": "MUDELIASTMETE REEGEL", + "QUOTA WINDOW UNAVAILABLE": "KVOODIAKEN POLE SAADAVAL", + "QUOTA WINDOW // %d%% USED": "KVOODIAKEN // %d%% KASUTATUD", + "TRIGGER": "KÄIVITI", + "ACTION": "TOIMING", + "STATE": "OLEK", + "ASK": "KÜSI", + "AUTO": "AUTO", + "ARMED": "VALMIS", + "CONFIGURED": "SEADISTATUD", + "PASSED": "ÜLETATUD", + "NEXT // %d PP": "JÄRGMINE // %d PP", "WHY THIS CHANGE": "MUUDATUSE PÕHJUS", "CURRENT PROFILE": "PRAEGUNE PROFIIL", "PROPOSED PROFILE": "SOOVITATUD PROFIIL", diff --git a/internal/i18n/locales/fi.json b/internal/i18n/locales/fi.json index a041a12..2d144e8 100644 --- a/internal/i18n/locales/fi.json +++ b/internal/i18n/locales/fi.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "KYNNYSARVOT", + "MODEL STEP POLICY": "MALLIPORRAIDEN KÄYTÄNTÖ", + "QUOTA WINDOW UNAVAILABLE": "KIINTIÖIKKUNA EI SAATAVILLA", + "QUOTA WINDOW // %d%% USED": "KIINTIÖIKKUNA // %d%% KÄYTETTY", + "TRIGGER": "LAUKAISIN", + "ACTION": "TOIMINTO", + "STATE": "TILA", + "ASK": "KYSY", + "AUTO": "AUTO", + "ARMED": "VALMIINA", + "CONFIGURED": "MÄÄRITETTY", + "PASSED": "OHITETTU", + "NEXT // %d PP": "SEURAAVA // %d PP", "WHY THIS CHANGE": "MUUTOKSEN SYY", "CURRENT PROFILE": "NYKYINEN PROFIILI", "PROPOSED PROFILE": "EHDOTETTU PROFIILI", diff --git a/internal/i18n/locales/fr.json b/internal/i18n/locales/fr.json index da9e0f9..9cd4328 100644 --- a/internal/i18n/locales/fr.json +++ b/internal/i18n/locales/fr.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "SEUILS", + "MODEL STEP POLICY": "POLITIQUE DE PALIERS DE MODÈLE", + "QUOTA WINDOW UNAVAILABLE": "FENÊTRE DE QUOTA INDISPONIBLE", + "QUOTA WINDOW // %d%% USED": "FENÊTRE DE QUOTA // %d%% UTILISÉ", + "TRIGGER": "DÉCLENCHEUR", + "ACTION": "ACTION", + "STATE": "ÉTAT", + "ASK": "DEMANDER", + "AUTO": "AUTO", + "ARMED": "PRÊT", + "CONFIGURED": "CONFIGURÉ", + "PASSED": "DÉPASSÉ", + "NEXT // %d PP": "SUIVANT // %d PP", "WHY THIS CHANGE": "POURQUOI CE CHANGEMENT", "CURRENT PROFILE": "PROFIL ACTUEL", "PROPOSED PROFILE": "PROFIL PROPOSÉ", diff --git a/internal/i18n/locales/it.json b/internal/i18n/locales/it.json index 6b67433..288cd2f 100644 --- a/internal/i18n/locales/it.json +++ b/internal/i18n/locales/it.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "SOGLIE", + "MODEL STEP POLICY": "CRITERI DI CAMBIO MODELLO", + "QUOTA WINDOW UNAVAILABLE": "FINESTRA QUOTA NON DISPONIBILE", + "QUOTA WINDOW // %d%% USED": "FINESTRA QUOTA // %d%% USATO", + "TRIGGER": "ATTIVAZIONE", + "ACTION": "AZIONE", + "STATE": "STATO", + "ASK": "CHIEDI", + "AUTO": "AUTO", + "ARMED": "PRONTO", + "CONFIGURED": "CONFIGURATO", + "PASSED": "SUPERATO", + "NEXT // %d PP": "PROSSIMO // %d PP", "WHY THIS CHANGE": "PERCHÉ QUESTO CAMBIAMENTO", "CURRENT PROFILE": "PROFILO ATTUALE", "PROPOSED PROFILE": "PROFILO PROPOSTO", diff --git a/internal/i18n/locales/ja.json b/internal/i18n/locales/ja.json index 8bb811f..649d0b2 100644 --- a/internal/i18n/locales/ja.json +++ b/internal/i18n/locales/ja.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "しきい値", + "MODEL STEP POLICY": "モデル切替ポリシー", + "QUOTA WINDOW UNAVAILABLE": "クォータ期間を取得できません", + "QUOTA WINDOW // %d%% USED": "クォータ期間 // %d%% 使用", + "TRIGGER": "トリガー", + "ACTION": "動作", + "STATE": "状態", + "ASK": "確認", + "AUTO": "自動", + "ARMED": "待機", + "CONFIGURED": "設定済み", + "PASSED": "通過済み", + "NEXT // %d PP": "次 // %d PP", "WHY THIS CHANGE": "変更の理由", "CURRENT PROFILE": "現在のプロファイル", "PROPOSED PROFILE": "提案するプロファイル", diff --git a/internal/i18n/locales/nb.json b/internal/i18n/locales/nb.json index 2f2330b..6801c36 100644 --- a/internal/i18n/locales/nb.json +++ b/internal/i18n/locales/nb.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "TERSKLER", + "MODEL STEP POLICY": "REGLER FOR MODELLTRINN", + "QUOTA WINDOW UNAVAILABLE": "KVOTEVINDU IKKE TILGJENGELIG", + "QUOTA WINDOW // %d%% USED": "KVOTEVINDU // %d%% BRUKT", + "TRIGGER": "UTLØSER", + "ACTION": "HANDLING", + "STATE": "STATUS", + "ASK": "SPØR", + "AUTO": "AUTO", + "ARMED": "KLAR", + "CONFIGURED": "KONFIGURERT", + "PASSED": "PASSERT", + "NEXT // %d PP": "NESTE // %d PP", "WHY THIS CHANGE": "HVORFOR DENNE ENDRINGEN", "CURRENT PROFILE": "GJELDENDE PROFIL", "PROPOSED PROFILE": "FORESLÅTT PROFIL", diff --git a/internal/i18n/locales/nl.json b/internal/i18n/locales/nl.json index b989ddb..20eae91 100644 --- a/internal/i18n/locales/nl.json +++ b/internal/i18n/locales/nl.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "DREMPELS", + "MODEL STEP POLICY": "BELEID VOOR MODELSTAPPEN", + "QUOTA WINDOW UNAVAILABLE": "QUOTAVENSTER NIET BESCHIKBAAR", + "QUOTA WINDOW // %d%% USED": "QUOTAVENSTER // %d%% GEBRUIKT", + "TRIGGER": "DREMPEL", + "ACTION": "ACTIE", + "STATE": "STATUS", + "ASK": "VRAGEN", + "AUTO": "AUTO", + "ARMED": "GEREED", + "CONFIGURED": "INGESTELD", + "PASSED": "GEPASSEERD", + "NEXT // %d PP": "VOLGENDE // %d PP", "WHY THIS CHANGE": "WAAROM DEZE WIJZIGING", "CURRENT PROFILE": "HUIDIG PROFIEL", "PROPOSED PROFILE": "VOORGESTELD PROFIEL", diff --git a/internal/i18n/locales/pt-BR.json b/internal/i18n/locales/pt-BR.json index 0fd5a06..727177f 100644 --- a/internal/i18n/locales/pt-BR.json +++ b/internal/i18n/locales/pt-BR.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "LIMITES", + "MODEL STEP POLICY": "POLÍTICA DE ETAPAS DO MODELO", + "QUOTA WINDOW UNAVAILABLE": "JANELA DE COTA INDISPONÍVEL", + "QUOTA WINDOW // %d%% USED": "JANELA DE COTA // %d%% USADA", + "TRIGGER": "ACIONAMENTO", + "ACTION": "AÇÃO", + "STATE": "ESTADO", + "ASK": "PERGUNTAR", + "AUTO": "AUTO", + "ARMED": "PRONTO", + "CONFIGURED": "CONFIGURADO", + "PASSED": "ULTRAPASSADO", + "NEXT // %d PP": "PRÓXIMO // %d PP", "WHY THIS CHANGE": "MOTIVO DA ALTERAÇÃO", "CURRENT PROFILE": "PERFIL ATUAL", "PROPOSED PROFILE": "PERFIL PROPOSTO", diff --git a/internal/i18n/locales/pt-PT.json b/internal/i18n/locales/pt-PT.json index 9c4bcf9..a7db9c0 100644 --- a/internal/i18n/locales/pt-PT.json +++ b/internal/i18n/locales/pt-PT.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "LIMITES", + "MODEL STEP POLICY": "POLÍTICA DE ETAPAS DO MODELO", + "QUOTA WINDOW UNAVAILABLE": "JANELA DE QUOTA INDISPONÍVEL", + "QUOTA WINDOW // %d%% USED": "JANELA DE QUOTA // %d%% UTILIZADA", + "TRIGGER": "ACIONAMENTO", + "ACTION": "AÇÃO", + "STATE": "ESTADO", + "ASK": "PERGUNTAR", + "AUTO": "AUTO", + "ARMED": "PRONTO", + "CONFIGURED": "CONFIGURADO", + "PASSED": "ULTRAPASSADO", + "NEXT // %d PP": "PRÓXIMO // %d PP", "WHY THIS CHANGE": "MOTIVO DA ALTERAÇÃO", "CURRENT PROFILE": "PERFIL ATUAL", "PROPOSED PROFILE": "PERFIL PROPOSTO", diff --git a/internal/i18n/locales/ru.json b/internal/i18n/locales/ru.json index c6b196f..e346b82 100644 --- a/internal/i18n/locales/ru.json +++ b/internal/i18n/locales/ru.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "ПОРОГИ", + "MODEL STEP POLICY": "ПОЛИТИКА СМЕНЫ МОДЕЛИ", + "QUOTA WINDOW UNAVAILABLE": "ОКНО КВОТЫ НЕДОСТУПНО", + "QUOTA WINDOW // %d%% USED": "ОКНО КВОТЫ // %d%% ИСПОЛЬЗОВАНО", + "TRIGGER": "ПОРОГ", + "ACTION": "ДЕЙСТВИЕ", + "STATE": "СОСТОЯНИЕ", + "ASK": "СПРОСИТЬ", + "AUTO": "АВТО", + "ARMED": "ГОТОВО", + "CONFIGURED": "НАСТРОЕНО", + "PASSED": "ПРОЙДЕНО", + "NEXT // %d PP": "СЛЕДУЮЩИЙ // %d ПП", "WHY THIS CHANGE": "ПРИЧИНА ИЗМЕНЕНИЯ", "CURRENT PROFILE": "ТЕКУЩИЙ ПРОФИЛЬ", "PROPOSED PROFILE": "ПРЕДЛАГАЕМЫЙ ПРОФИЛЬ", diff --git a/internal/i18n/locales/sv.json b/internal/i18n/locales/sv.json index 6f1c498..c453b99 100644 --- a/internal/i18n/locales/sv.json +++ b/internal/i18n/locales/sv.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "TRÖSKLAR", + "MODEL STEP POLICY": "POLICY FÖR MODELLSTEG", + "QUOTA WINDOW UNAVAILABLE": "KVOTFÖNSTER INTE TILLGÄNGLIGT", + "QUOTA WINDOW // %d%% USED": "KVOTFÖNSTER // %d%% ANVÄNT", + "TRIGGER": "UTLÖSARE", + "ACTION": "ÅTGÄRD", + "STATE": "STATUS", + "ASK": "FRÅGA", + "AUTO": "AUTO", + "ARMED": "REDO", + "CONFIGURED": "KONFIGURERAD", + "PASSED": "PASSERAD", + "NEXT // %d PP": "NÄSTA // %d PP", "WHY THIS CHANGE": "VARFÖR DENNA ÄNDRING", "CURRENT PROFILE": "AKTUELL PROFIL", "PROPOSED PROFILE": "FÖRESLAGEN PROFIL", diff --git a/internal/i18n/locales/tr.json b/internal/i18n/locales/tr.json index 900b107..79ddfe4 100644 --- a/internal/i18n/locales/tr.json +++ b/internal/i18n/locales/tr.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "EŞİKLER", + "MODEL STEP POLICY": "MODEL ADIMI POLİTİKASI", + "QUOTA WINDOW UNAVAILABLE": "KOTA PENCERESİ KULLANILAMIYOR", + "QUOTA WINDOW // %d%% USED": "KOTA PENCERESİ // %d%% KULLANILDI", + "TRIGGER": "TETİKLEYİCİ", + "ACTION": "EYLEM", + "STATE": "DURUM", + "ASK": "SOR", + "AUTO": "OTOMATİK", + "ARMED": "HAZIR", + "CONFIGURED": "YAPILANDIRILDI", + "PASSED": "GEÇİLDİ", + "NEXT // %d PP": "SONRAKİ // %d PP", "WHY THIS CHANGE": "BU DEĞİŞİKLİĞİN NEDENİ", "CURRENT PROFILE": "GEÇERLİ PROFİL", "PROPOSED PROFILE": "ÖNERİLEN PROFİL", diff --git a/internal/i18n/locales/zh-Hans.json b/internal/i18n/locales/zh-Hans.json index 13f866c..fbe0129 100644 --- a/internal/i18n/locales/zh-Hans.json +++ b/internal/i18n/locales/zh-Hans.json @@ -1,4 +1,17 @@ { + "THRESHOLDS": "阈值", + "MODEL STEP POLICY": "模型切换策略", + "QUOTA WINDOW UNAVAILABLE": "配额周期不可用", + "QUOTA WINDOW // %d%% USED": "配额周期 // 已使用 %d%%", + "TRIGGER": "触发值", + "ACTION": "操作", + "STATE": "状态", + "ASK": "询问", + "AUTO": "自动", + "ARMED": "待命", + "CONFIGURED": "已配置", + "PASSED": "已越过", + "NEXT // %d PP": "下一个 // %d 个百分点", "WHY THIS CHANGE": "更改原因", "CURRENT PROFILE": "当前配置", "PROPOSED PROFILE": "建议配置", diff --git a/internal/ui/english_snapshot_test.go b/internal/ui/english_snapshot_test.go index 74c277a..59e3ad1 100644 --- a/internal/ui/english_snapshot_test.go +++ b/internal/ui/english_snapshot_test.go @@ -17,6 +17,11 @@ func TestEnglishPresentationSnapshot(t *testing.T) { stripVersionLink := regexp.MustCompile(regexp.QuoteMeta(ansi.SetHyperlink(versionHighlightsURL(snapshotVersion))) + `(.*?)` + regexp.QuoteMeta(ansi.ResetHyperlink())) for theme := themeHacker; theme < themeCount; theme++ { for view := viewBars; view < viewCount; view++ { + // The opt-in Thresholds view has separate coverage. Preserve the + // existing snapshot for launches without a threshold policy. + if view == viewThresholds { + continue + } for _, size := range []struct{ w, h int }{{40, 16}, {80, 24}, {120, 40}} { snapshot := codex.DemoSnapshot() snapshot.RateLimits.Primary.ResetsAt = nil diff --git a/internal/ui/model.go b/internal/ui/model.go index bc47d52..2540d1c 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -73,6 +73,7 @@ type Model struct { resetConfirmUntil time.Time resetRevision uint64 quotaSteps []codex.QuotaStep + thresholdScroll int quota quotaControl quotaStepPending *codex.QuotaStep quotaStepWindow string @@ -603,6 +604,23 @@ func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { return m, nil } } + if m.meterView == viewThresholds { + step := 0 + switch strings.ToLower(message.String()) { + case "up": + step = -1 + case "down": + step = 1 + case "pgup": + step = -max(m.dashboardLayout().meterHeight-2, 1) + case "pgdown": + step = max(m.dashboardLayout().meterHeight-2, 1) + } + if step != 0 { + m.scrollThresholds(step) + return m, nil + } + } if m.meterView == viewUsage { if action, ok := historyKey(strings.ToLower(message.String())); ok { m.activateHistory(action) @@ -667,9 +685,9 @@ func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { return m.pressFooterButton(footerButtonView) } case "tab": - return m.pressMainTab(m.currentMainTab().next()) + return m.pressMainTab(m.adjacentMainTab(1)) case "shift+tab": - return m.pressMainTab(m.currentMainTab().previous()) + return m.pressMainTab(m.adjacentMainTab(-1)) case "r": return m.pressFooterButton(footerButtonRefresh) case "q": @@ -862,6 +880,16 @@ func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { return m, nil } m.viewHovered = false + if m.meterView == viewThresholds { + switch mouse.Button { + case tea.MouseWheelUp: + m.scrollThresholds(-3) + return m, nil + case tea.MouseWheelDown: + m.scrollThresholds(3) + return m, nil + } + } if m.meterView == viewBenchmark && m.benchmarkScopeOpen { if item, ok := m.benchmarkScopeItemAt(mouse.X, mouse.Y); ok { m.hoveredButton = footerButtonNone @@ -1493,7 +1521,7 @@ func (m Model) dashboardLayout() dashboardGeometry { extraHeight += framedErrorHeight } meters := m.snapshot.Meters() - if len(meters) == 0 && m.meterView != viewUsage && m.meterView != viewResets { + if len(meters) == 0 && m.meterView != viewUsage && m.meterView != viewResets && m.meterView != viewThresholds { extraHeight += framedErrorHeight } if (m.meterView == viewBars || m.meterView == viewConsumptionPace || m.meterView == viewFuel) && len(meters) > 0 { @@ -1513,7 +1541,7 @@ func (m Model) dashboardLayout() dashboardGeometry { meterY := tabsY + tabsHeight + extraHeight meterHeight := max(contentHeight-headerHeight-statusHeight-tabsHeight-extraHeight-footerHeight, 1) footerY := meterY - if m.meterView == viewUsage || m.meterView == viewResets || m.meterView == viewMonitor || m.meterView == viewBenchmark || len(m.snapshot.Meters()) > 0 { + if m.meterView == viewUsage || m.meterView == viewResets || m.meterView == viewThresholds || m.meterView == viewMonitor || m.meterView == viewBenchmark || len(m.snapshot.Meters()) > 0 { footerY += meterHeight } return dashboardGeometry{ diff --git a/internal/ui/preferences.go b/internal/ui/preferences.go index 6d86780..59d9f75 100644 --- a/internal/ui/preferences.go +++ b/internal/ui/preferences.go @@ -92,6 +92,10 @@ func (m *Model) applyPreferences(preferences Preferences) { m.meterView = viewUsage case "benchmark": m.meterView = viewBenchmark + case "thresholds": + if len(m.quotaSteps) > 0 { + m.meterView = viewThresholds + } } if filter, ok := benchmarkFilterPreferenceIDs[preferences.BenchmarkFilter]; ok { m.benchmarkFilter = filter @@ -116,7 +120,7 @@ func (m Model) persistPreferences() { } var mainTabPreferenceNames = map[mainTabID]string{ - mainTabQuota: "quota", mainTabMonitor: "monitor", mainTabUsage: "usage", mainTabBenchmark: "benchmark", + mainTabQuota: "quota", mainTabMonitor: "monitor", mainTabUsage: "usage", mainTabBenchmark: "benchmark", mainTabThresholds: "thresholds", } var themePreferenceNames = map[themeID]string{ diff --git a/internal/ui/preferences_test.go b/internal/ui/preferences_test.go index 044d2cc..9894b68 100644 --- a/internal/ui/preferences_test.go +++ b/internal/ui/preferences_test.go @@ -83,13 +83,17 @@ func TestPreferencesRememberMainTabSeparatelyFromQuotaView(t *testing.T) { for tab, name := range mainTabPreferenceNames { t.Run(name, func(t *testing.T) { store := &memoryPreferenceStore{preferences: Preferences{QuotaView: "fuel-tank"}} - m := NewWithPreferences(nil, time.Minute, store) + var fetcher Fetcher + if tab == mainTabThresholds { + fetcher = "aStepTestFetcher{steps: []codex.QuotaStep{{Threshold: 80, Model: "small", Effort: "medium"}}} + } + m := NewWithPreferences(fetcher, time.Minute, store) next, _ := m.pressMainTab(tab) m = next.(Model) if store.preferences.MainTab != name || store.preferences.QuotaView != "fuel-tank" { t.Fatalf("saved preferences = %+v", store.preferences) } - restarted := NewWithPreferences(nil, time.Minute, store) + restarted := NewWithPreferences(fetcher, time.Minute, store) if restarted.currentMainTab() != tab || restarted.selectedQuotaView() != viewFuel { t.Fatal("restart lost tab or quota view") } @@ -102,6 +106,10 @@ func TestPreferencesRememberMainTabSeparatelyFromQuotaView(t *testing.T) { } }) } + m := NewWithPreferences(nil, time.Minute, &memoryPreferenceStore{preferences: Preferences{MainTab: "thresholds", QuotaView: "pie"}}) + if m.meterView != viewPie { + t.Fatal("hidden Thresholds preference did not fall back to the saved quota view") + } for _, tab := range []string{"", "unknown"} { m := NewWithPreferences(nil, time.Minute, &memoryPreferenceStore{preferences: Preferences{MainTab: tab, QuotaView: "pie"}}) if m.meterView != viewPie { diff --git a/internal/ui/tabs.go b/internal/ui/tabs.go index 8f0d8dd..0b38dd6 100644 --- a/internal/ui/tabs.go +++ b/internal/ui/tabs.go @@ -17,17 +17,10 @@ const ( mainTabMonitor mainTabUsage mainTabBenchmark + mainTabThresholds mainTabCount ) -func (t mainTabID) next() mainTabID { - return (t + 1) % mainTabCount -} - -func (t mainTabID) previous() mainTabID { - return (t - 1 + mainTabCount) % mainTabCount -} - type mainTab struct { tab mainTabID label string @@ -65,6 +58,10 @@ func responsiveTabLabels(width int, tiers [][]string) ([]string, string) { } func mainTabLayout(width int, showMonitorLight bool) ([]mainTab, string) { + return mainTabLayoutFor(width, showMonitorLight, false) +} + +func mainTabLayoutFor(width int, showMonitorLight, showThresholds bool) ([]mainTab, string) { monitorFull := i18n.Text("╭ SESSIONS ╮") monitorCompact := "╭SES╮" monitorMinimal := "[S]" @@ -75,21 +72,32 @@ func mainTabLayout(width int, showMonitorLight bool) ([]mainTab, string) { monitorMinimal = "[S●]" microMonitor = "●" } - labels, separator := responsiveTabLabels(width, [][]string{ + ids := []mainTabID{mainTabQuota, mainTabMonitor, mainTabUsage, mainTabBenchmark} + tiers := [][]string{ {i18n.Text("╭ QUOTA ╮"), monitorFull, i18n.Text("╭ USAGE ╮"), i18n.Text("╭ BENCHMARK ╮")}, {"╭QTA╮", monitorCompact, "╭USE╮", "╭TEST╮"}, {"[Q]", monitorMinimal, "[U]", "[B]"}, {"Q", microMonitor, "U", "B"}, - }) + } + if showThresholds { + ids = []mainTabID{mainTabQuota, mainTabThresholds, mainTabMonitor, mainTabUsage, mainTabBenchmark} + tiers = [][]string{ + {i18n.Text("╭ QUOTA ╮"), "╭ " + i18n.Text("THRESHOLDS") + " ╮", monitorFull, i18n.Text("╭ USAGE ╮"), i18n.Text("╭ BENCHMARK ╮")}, + {"╭QTA╮", "╭STEP╮", monitorCompact, "╭USE╮", "╭TEST╮"}, + {"[Q]", "[T]", monitorMinimal, "[U]", "[B]"}, + {"Q", "T", microMonitor, "U", "B"}, + } + } + labels, separator := responsiveTabLabels(width, tiers) - tabs := make([]mainTab, 0, mainTabCount) + tabs := make([]mainTab, 0, len(ids)) x := 0 - for tab, label := range labels { + for index, label := range labels { tabWidth := lipgloss.Width(label) if x+tabWidth > width { break } - tabs = append(tabs, mainTab{tab: mainTabID(tab), label: label, x: x, width: tabWidth}) + tabs = append(tabs, mainTab{tab: ids[index], label: label, x: x, width: tabWidth}) x += tabWidth + len(separator) } return tabs, separator @@ -124,6 +132,8 @@ func (m Model) currentMainTab() mainTabID { return mainTabMonitor case viewBenchmark: return mainTabBenchmark + case viewThresholds: + return mainTabThresholds default: return mainTabQuota } @@ -152,6 +162,11 @@ func (m Model) pressMainTab(tab mainTabID) (tea.Model, tea.Cmd) { return m.pressViewTab(viewUsage) case mainTabBenchmark: return m.pressViewTab(viewBenchmark) + case mainTabThresholds: + if len(m.quotaSteps) > 0 { + return m.pressViewTab(viewThresholds) + } + return m, nil default: return m, nil } @@ -165,6 +180,8 @@ func mainTabForView(view meterViewID) mainTabID { return mainTabMonitor case viewBenchmark: return mainTabBenchmark + case viewThresholds: + return mainTabThresholds default: return mainTabQuota } @@ -172,7 +189,7 @@ func mainTabForView(view meterViewID) mainTabID { func (m Model) renderMainTabs(width int, colors palette) string { tabWidth, _ := m.resetLayout(width) - tabs, separator := mainTabLayout(tabWidth, true) + tabs, separator := mainTabLayoutFor(tabWidth, true, len(m.quotaSteps) > 0) parts := make([]string, 0, len(tabs)) used := 0 for _, tab := range tabs { @@ -269,7 +286,7 @@ func (m Model) mainTabAt(x, y int) (mainTabID, bool) { } localX := x - 2 tabWidth, _ := m.resetLayout(layout.contentWidth) - tabs, _ := mainTabLayout(tabWidth, true) + tabs, _ := mainTabLayoutFor(tabWidth, true, len(m.quotaSteps) > 0) for _, tab := range tabs { if localX >= tab.x && localX < tab.x+tab.width { return tab.tab, true @@ -278,6 +295,20 @@ func (m Model) mainTabAt(x, y int) (mainTabID, bool) { return mainTabQuota, false } +func (m Model) adjacentMainTab(direction int) mainTabID { + tabs := []mainTabID{mainTabQuota, mainTabMonitor, mainTabUsage, mainTabBenchmark} + if len(m.quotaSteps) > 0 { + tabs = []mainTabID{mainTabQuota, mainTabThresholds, mainTabMonitor, mainTabUsage, mainTabBenchmark} + } + current := m.currentMainTab() + for index, tab := range tabs { + if tab == current { + return tabs[(index+direction+len(tabs))%len(tabs)] + } + } + return mainTabQuota +} + func (m Model) quotaViewTabAt(x, y int) (meterViewID, bool) { if x < 0 || y < 0 || !m.meterView.isQuota() || (m.loading && len(m.snapshot.Meters()) == 0) { return viewBars, false diff --git a/internal/ui/tabs_test.go b/internal/ui/tabs_test.go index bcbfa7d..377f1f0 100644 --- a/internal/ui/tabs_test.go +++ b/internal/ui/tabs_test.go @@ -24,8 +24,8 @@ func TestMainTabsChooseResponsiveLabels(t *testing.T) { } { t.Run(test.want, func(t *testing.T) { tabs, _ := mainTabLayout(test.width, true) - if len(tabs) != int(mainTabCount) { - t.Fatalf("width %d displayed %d main tabs, want %d", test.width, len(tabs), mainTabCount) + if len(tabs) != int(mainTabCount)-1 { + t.Fatalf("width %d displayed %d main tabs, want %d", test.width, len(tabs), mainTabCount-1) } var labels strings.Builder for _, tab := range tabs { @@ -41,6 +41,22 @@ func TestMainTabsChooseResponsiveLabels(t *testing.T) { } } +func TestThresholdTabOnlyAppearsWithConfiguredSteps(t *testing.T) { + without, _ := mainTabLayoutFor(100, true, false) + with, _ := mainTabLayoutFor(100, true, true) + if len(without) != 4 || len(with) != 5 || with[1].tab != mainTabThresholds || !strings.Contains(with[1].label, "THRESHOLDS") { + t.Fatalf("conditional tab layout: without=%#v with=%#v", without, with) + } + m := Model{meterView: viewBars} + if got := m.adjacentMainTab(1); got != mainTabMonitor { + t.Fatalf("next tab without policy = %d", got) + } + m.quotaSteps = []codex.QuotaStep{{Threshold: 80}} + if got := m.adjacentMainTab(1); got != mainTabThresholds { + t.Fatalf("next tab with policy = %d", got) + } +} + func TestSessionsBrandingAndLegacyPreference(t *testing.T) { store := &memoryPreferenceStore{preferences: Preferences{MainTab: "monitor", QuotaView: "pie"}} m := NewWithPreferences(nil, time.Minute, store) diff --git a/internal/ui/theme.go b/internal/ui/theme.go index d544cf0..9f67142 100644 --- a/internal/ui/theme.go +++ b/internal/ui/theme.go @@ -34,6 +34,7 @@ const ( viewBenchmark viewUsage viewResets + viewThresholds viewCount ) @@ -73,6 +74,7 @@ func (s meterViewID) name() string { i18n.Text("BENCHMARK"), i18n.Text("USAGE"), i18n.Text("RESETS"), + i18n.Text("THRESHOLDS"), }[s] } diff --git a/internal/ui/thresholds.go b/internal/ui/thresholds.go new file mode 100644 index 0000000..0cdbf6e --- /dev/null +++ b/internal/ui/thresholds.go @@ -0,0 +1,77 @@ +package ui + +import ( + "fmt" + "strings" + + "charm.land/lipgloss/v2" + "github.com/charmbracelet/x/ansi" + + "github.com/merefield/codexometer/internal/codex" + "github.com/merefield/codexometer/internal/i18n" +) + +func (m Model) thresholdDetailLines(width int, colors palette) []string { + statuses, used := codex.QuotaStepStatuses(m.snapshot, m.quotaSteps) + + lines := []string{colors.dimmed().Render(i18n.Text("MODEL STEP POLICY"))} + if used == nil { + lines = append(lines, colors.dimmed().Render(i18n.Text("QUOTA WINDOW UNAVAILABLE"))) + } else { + lines = append(lines, colors.label().Render(i18n.Format("QUOTA WINDOW // %d%% USED", *used))) + } + lines = append(lines, "") + + wide := width >= 72 + if wide { + lines = append(lines, colors.dimmed().Render(fitTableCell(i18n.Text("TRIGGER"), 10)+fitTableCell(i18n.Text("MODEL / REASONING LEVEL / SPEED"), width-40)+fitTableCell(i18n.Text("ACTION"), 10)+fitTableCell(i18n.Text("STATE"), 20))) + } + for _, status := range statuses { + step := status.Step + speed := step.ServiceTier + if speed == "" { + speed = i18n.Text("speed unchanged") + } + mode := i18n.Text("ASK") + if step.Mode == "auto" { + mode = i18n.Text("AUTO") + } + state := i18n.Text(string(status.Stage)) + style := colors.dimmed() + switch status.Stage { + case codex.QuotaStepActive: + style = colors.label() + case codex.QuotaStepNext: + state, style = i18n.Format("NEXT // %d PP", status.Remaining), colors.label() + } + profile := codex.SanitizeSessionContext(step.Model + " / " + step.Effort + " / " + speed) + if wide { + line := fitTableCell(fmt.Sprintf("%d%%", step.Threshold), 10) + fitTableCell(profile, width-40) + fitTableCell(mode, 10) + fitTableCell(state, 20) + lines = append(lines, style.Render(ansi.Truncate(line, width, ""))) + } else { + lines = append(lines, + style.Render(fmt.Sprintf("%d%% // %s // %s", step.Threshold, mode, state)), + colors.dimmed().Render(ansi.Truncate(profile, width, "")), + ) + } + } + return strings.Split(ansi.Hardwrap(strings.Join(lines, "\n"), max(width, 1), true), "\n") +} + +func (m Model) renderThresholds(width, height int, colors palette) string { + lines := m.thresholdDetailLines(max(width-4, 1), colors) + rows := max(height-2, 1) + start := min(m.thresholdScroll, max(len(lines)-rows, 0)) + title := i18n.Text("THRESHOLDS") + if len(lines) > rows { + title += " // ↑↓ PgUp/PgDn" + } + body := strings.Join(lines[start:min(start+rows, len(lines))], "\n") + return lipgloss.NewStyle().MaxWidth(width).MaxHeight(height).Render(frameSized(width, rows, title, body, colors.primary, colors)) +} + +func (m *Model) scrollThresholds(delta int) { + g := m.dashboardLayout() + limit := max(len(m.thresholdDetailLines(max(g.contentWidth-4, 1), paletteFor(m.theme)))-max(g.meterHeight-2, 1), 0) + m.thresholdScroll = min(max(m.thresholdScroll+delta, 0), limit) +} diff --git a/internal/ui/thresholds_test.go b/internal/ui/thresholds_test.go new file mode 100644 index 0000000..c7693ef --- /dev/null +++ b/internal/ui/thresholds_test.go @@ -0,0 +1,59 @@ +package ui + +import ( + "strings" + "testing" + + tea "charm.land/bubbletea/v2" + "charm.land/lipgloss/v2" + "github.com/charmbracelet/x/ansi" + "github.com/merefield/codexometer/internal/codex" +) + +func TestThresholdsRenderActiveAndNextPolicySteps(t *testing.T) { + snapshot := codex.DemoSnapshot() + snapshot.AccountFingerprint = "account" + snapshot.RateLimits.Secondary.UsedPercent = 65 + m := Model{snapshot: snapshot, quotaSteps: []codex.QuotaStep{ + {Threshold: 80, Model: "gpt-small", Effort: "low", Mode: "auto"}, + {Threshold: 50, Model: "gpt-medium", Effort: "medium", ServiceTier: "fast"}, + }} + output := ansi.Strip(m.renderThresholds(100, 16, paletteFor(themeHacker))) + for _, want := range []string{"THRESHOLDS", "50%", "ACTIVE", "gpt-medium / medium / fast", "80%", "AUTO", "NEXT // 15 PP"} { + if !strings.Contains(output, want) { + t.Fatalf("threshold view missing %q:\n%s", want, output) + } + } +} + +func TestThresholdNavigationHitboxesAndScroll(t *testing.T) { + for _, width := range []int{20, 40, 80, 120} { + m := Model{width: width, height: 16, snapshot: codex.DemoSnapshot(), quotaSteps: []codex.QuotaStep{{Threshold: 80, Model: "small", Effort: "low"}}} + g := m.dashboardLayout() + tabWidth, _ := m.resetLayout(g.contentWidth) + tabs, _ := mainTabLayoutFor(tabWidth, true, true) + for _, tab := range tabs { + for x := tab.x; x < tab.x+tab.width; x++ { + if got, ok := m.mainTabAt(x+2, g.tabsY); !ok || got != tab.tab { + t.Fatalf("width %d: tab %d hitbox mismatch at %d", width, tab.tab, x) + } + } + } + m.meterView = viewThresholds + for i := 1; i < 20; i++ { + m.quotaSteps = append(m.quotaSteps, codex.QuotaStep{Threshold: i, Model: "model", Effort: "medium"}) + } + next, _ := m.Update(specialKey(tea.KeyPgDown)) + if next.(Model).thresholdScroll == 0 { + t.Fatal("Page Down did not scroll overflowing thresholds") + } + } +} + +func TestThresholdsRenderCompactAndStayWithinBounds(t *testing.T) { + m := Model{quotaSteps: []codex.QuotaStep{{Threshold: 80, Model: "gpt-very-long-model-name", Effort: "medium"}}} + output := m.renderThresholds(36, 8, paletteFor(themeHacker)) + if lipgloss.Width(output) > 36 || strings.Count(output, "\n")+1 > 8 { + t.Fatalf("compact threshold view exceeded 36x8:\n%s", ansi.Strip(output)) + } +} diff --git a/internal/ui/view.go b/internal/ui/view.go index ac7771e..e833d19 100644 --- a/internal/ui/view.go +++ b/internal/ui/view.go @@ -55,12 +55,14 @@ func (m Model) render() string { if m.meterView.isQuota() && m.meterView != viewResets { meters = m.quotaMetersWithInsights(contentWidth) } - if len(meters) == 0 && m.meterView != viewUsage && m.meterView != viewResets { + if len(meters) == 0 && m.meterView != viewUsage && m.meterView != viewResets && m.meterView != viewThresholds { emptyView := renderError(contentWidth, fmt.Errorf("no quota windows returned"), colors) parts = append(parts, emptyView) } footer := m.renderFooter(contentWidth, colors) - if m.meterView == viewResets { + if m.meterView == viewThresholds { + parts = append(parts, m.renderThresholds(contentWidth, layout.meterHeight, colors)) + } else if m.meterView == viewResets { parts = append(parts, m.renderResets(contentWidth, layout.meterHeight, colors)) } else if m.meterView == viewUsage { parts = append(parts, m.renderHistory(contentWidth, layout.meterHeight, colors)) diff --git a/internal/ui/view_test.go b/internal/ui/view_test.go index 12280c6..fec5b1c 100644 --- a/internal/ui/view_test.go +++ b/internal/ui/view_test.go @@ -24,6 +24,9 @@ func TestViewRendersEveryThemeAndViewWithinStandardTerminal(t *testing.T) { theme: theme, meterView: view, } + if view == viewThresholds { + model.quotaSteps = []codex.QuotaStep{{Threshold: 50, Model: "gpt-5.6-sol", Effort: "medium"}} + } output := ansi.Strip(model.render()) if !strings.Contains(output, paletteFor(theme).name) { t.Errorf("theme %d name missing from view", theme) @@ -47,6 +50,10 @@ func TestViewRendersEveryThemeAndViewWithinStandardTerminal(t *testing.T) { if !strings.Contains(output, "LIFETIME") { t.Error("usage summary missing") } + } else if view == viewThresholds { + if !strings.Contains(output, "MODEL STEP POLICY") || !strings.Contains(output, "gpt-5.6-sol") { + t.Error("threshold policy missing") + } } else if !strings.Contains(output, "5 HOURS LOOP") || !strings.Contains(output, "1 WEEK LOOP") { t.Errorf("quota windows missing for theme %d view %d", theme, view) } diff --git a/internal/web/dist/assets/index-DX-9TojK.css b/internal/web/dist/assets/index-BF0PrFr9.css similarity index 83% rename from internal/web/dist/assets/index-DX-9TojK.css rename to internal/web/dist/assets/index-BF0PrFr9.css index 3bf2a40..9f30cdf 100644 --- a/internal/web/dist/assets/index-DX-9TojK.css +++ b/internal/web/dist/assets/index-BF0PrFr9.css @@ -1 +1 @@ -.observation-details.svelte-1wk8llw{font-size:12px}summary.svelte-1wk8llw{cursor:pointer;color:var(--accent)}.observation-table.svelte-1wk8llw{max-height:240px;overflow:auto}.zone-canvas.svelte-1wk8llw{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1wk8llw{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1wk8llw{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1wk8llw{letter-spacing:.04em;font-size:12px}.grid.svelte-1wk8llw{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1wk8llw{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1wk8llw{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1wk8llw{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1wk8llw{fill:#fff}.observation-trail.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2.5px;stroke-linejoin:round}.trail-start.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2px}.trail-caption.svelte-1wk8llw{text-align:center;font-size:11px}.zone-caption.svelte-1wk8llw{color:var(--accent);text-align:center}fieldset.svelte-1oupzfc{border:1px solid;margin:.5rem 0;padding:.35rem .6rem}.decision.svelte-1oupzfc,.answer.svelte-1oupzfc{margin:.3rem 0;display:block}.decision.svelte-1oupzfc code:where(.svelte-1oupzfc),.decision.svelte-1oupzfc span:where(.svelte-1oupzfc){overflow-wrap:anywhere;margin:.3rem 0 .3rem 1.5rem;display:block}textarea.svelte-1oupzfc,.answer.svelte-1oupzfc input:where(.svelte-1oupzfc),.answer.svelte-1oupzfc select:where(.svelte-1oupzfc){box-sizing:border-box;background:var(--bg);width:100%;color:inherit;font:inherit;border:1px solid;margin-top:.4rem;padding:.5rem;display:block}textarea.svelte-1oupzfc{resize:vertical}button.svelte-1oupzfc{margin:.3rem .5rem .3rem 0}h3.svelte-1oupzfc,p.svelte-1oupzfc{margin-block:.4rem}.sent.svelte-1oupzfc{color:var(--accent)}.session-copy.svelte-543j00{justify-content:flex-end;align-items:center;gap:8px;margin-top:auto;padding-top:6px;display:flex}span.svelte-543j00{color:var(--muted);overflow-wrap:anywhere;font-size:12px}button.svelte-543j00{color:var(--accent);flex-shrink:0;padding:3px 7px}button.svelte-543j00:hover,button.flashed.svelte-543j00{color:var(--bg);background:var(--accent)}:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#080e0c;font-family:Cascadia Code,SFMono-Regular,Consolas,monospace}*{box-sizing:border-box}body{margin:0}.shell{--accent:#80edac;--approval:#ffca58;--muted:#98aaa0;--edge:#31473a;--panel:#101c16;--bg:#080e0c;--ink:#e2eee5;background:var(--bg);height:100dvh;color:var(--ink);grid-template-rows:auto auto minmax(0,1fr) auto;padding:clamp(10px,1.2vw,20px);display:grid}.shell[data-theme=rust]{--approval:#ff8a3d;--accent:#ffbc75;--muted:#bfac95;--edge:#59412c;--panel:#261b14;--bg:#140e0a}.shell[data-theme=blue-steel]{--approval:#e8c46a;--accent:#85c8ff;--muted:#9cacc4;--edge:#334d69;--panel:#142235;--bg:#0b1421}.shell[data-theme=ultraviolet]{--approval:#f9a8d4;--accent:#c5adff;--muted:#b3a6c9;--edge:#4b3c68;--panel:#241a35;--bg:#140d22}.shell[data-theme=nightshade]{--approval:#8f7cff;--accent:#e59bff;--muted:#c6a7cf;--edge:#673976;--panel:#301739;--bg:#1c0b24}header,.spread,footer,.controls{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px;display:flex}header{margin-bottom:10px}.brand{letter-spacing:.08em;color:var(--accent);text-shadow:0 0 22px color-mix(in srgb, var(--accent) 20%, transparent);font-size:clamp(22px,2.5vw,32px);font-weight:800;text-decoration:none}header p{color:var(--muted);margin:3px 0 0;font-size:13px}.connection{color:var(--accent);text-align:right}small,.eyebrow{letter-spacing:.04em;font-size:12px}.connection small{color:var(--muted);margin-top:4px;display:block}.lamp{background:var(--muted);border-radius:50%;width:9px;height:9px;margin-right:9px;display:inline-block}.lamp.lit{background:var(--accent);box-shadow:0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)}.working{animation:1.5s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.3}}nav{flex-wrap:wrap;gap:6px;margin-bottom:10px;display:flex}nav a,button,.button,select{font:inherit;color:var(--accent);border:1px solid var(--edge);background:var(--panel);cursor:pointer;border-radius:3px;padding:7px 11px;font-size:13px;text-decoration:none}button:hover,.button:hover,nav a:hover{border-color:var(--accent)}nav a.active{background:var(--accent);color:var(--bg);border-color:var(--accent)}:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.secondary{margin-bottom:8px}.secondary a{padding:6px 10px;font-size:12px}main{scrollbar-gutter:stable;flex-direction:column;min-width:0;min-height:0;display:flex;overflow:auto}main>*{flex-shrink:0}.panel{border:1px solid var(--edge);border-top:2px solid var(--accent);background:var(--panel);border-radius:4px;min-width:0;padding:clamp(10px,1vw,16px)}h1{color:var(--accent);font-size:20px}h2{letter-spacing:.04em;color:var(--accent);overflow-wrap:anywhere;margin:0 0 10px;font-size:13px}h3{overflow-wrap:anywhere;font-size:13px}p{margin:6px 0;font-size:13px;line-height:1.45}a{color:var(--accent)}.muted,.eyebrow{color:var(--muted)}.notice{color:#ffe0aa;background:#332611;border-left:3px solid #ffc26e;padding:12px 16px}.empty{color:var(--muted);padding:35px 0}.quota-grid{flex:1 0 auto;grid-auto-rows:minmax(220px,1fr);gap:10px;display:grid}.quota-card{flex-direction:column;min-height:0;display:flex}.quota-card>:not(.meter-graphic){flex-shrink:0}.meter-graphic{flex-direction:column;flex:1;min-height:100px;display:flex}.bar-graphic{min-height:65px}.quota-card .gauge{flex:2;height:auto;min-height:16px;margin:7px 0}.quota-card .timeline{flex:1;min-height:8px}.quota-card .pace{flex:1;height:auto;min-height:20px;margin:20px 14px 8px}.quota-card .readout{margin:6px 0;font-size:clamp(18px,2vw,28px)}.quota-grid.zone{grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));grid-auto-rows:minmax(330px,1fr)}.quota-grid.radial{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));grid-auto-rows:minmax(260px,1fr)}.gauge{background:var(--edge);height:35px;margin:15px 0;overflow:hidden}.gauge>div{background:repeating-linear-gradient(90deg, var(--accent) 0, var(--accent) 9px, transparent 9px, transparent 12px);height:100%;transition:width .5s}.gauge.timeline{height:14px}.pie-wrap{flex:1;min-height:100px;margin:6px 0;position:relative}.pie-wrap svg{width:100%;height:100%;position:absolute;inset:0}.pie-base{fill:var(--edge);stroke:var(--accent);stroke-width:1px}.pie-fill{fill:var(--accent)}.pace{background:linear-gradient(90deg, #6d3838, var(--edge) 50%, #376348);height:28px;margin:28px 14px 15px;position:relative}.pace-mid{border-left:2px solid var(--ink);height:100%;position:absolute;left:50%}.pace-marker{color:var(--accent);font-size:27px;position:absolute;top:-16px;transform:translate(-50%)}.readout{overflow-wrap:anywhere;color:var(--accent);margin:18px 0;font-size:clamp(22px,3vw,34px)}.credit+.credit{border-top:1px solid var(--edge);padding-top:20px}.credit{margin-top:24px}.session-row{grid-template-columns:minmax(210px,1.1fr) minmax(0,1.2fr) minmax(0,1.5fr);align-items:stretch;gap:14px;margin:18px 0;display:grid}.session-totals{grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr));gap:8px;margin:8px 0;display:grid}.session-totals>div{border:1px solid var(--edge);min-width:0;padding:10px}.session-totals dt{color:var(--muted);font-size:11px}.session-totals dd{color:var(--accent);overflow-wrap:anywhere;margin:6px 0 0;font-size:24px}.session-totals.stale dd{color:var(--muted)}.session-row.selected{outline:1px solid var(--accent);outline-offset:4px}.session-row.wide .context{grid-column:2/-1}.detail-controls{flex-wrap:wrap;gap:6px;display:flex}.attention-summary{flex-wrap:wrap;gap:8px;margin-block:8px;display:flex}.attention-summary .approval{color:var(--approval);border-color:var(--approval)}.attention-summary .approval:hover{background:color-mix(in srgb, var(--approval) 12%, var(--panel))}.attention-summary .approval:focus-visible{outline-color:var(--approval)}.attention-note,.attention-badge{color:var(--accent);border-left:3px solid;padding-left:8px}.attention-note.inferred{color:var(--muted)}.attention-badge{font-size:12px}.session-select{text-align:left;overflow-wrap:anywhere;max-width:100%}button:disabled{opacity:.4;cursor:default}.session-row .graph-panel{flex-direction:column;grid-column:2/-1;display:flex}.session-row.split .graph-panel{grid-column:auto}.session-row .button,.session-row button{margin-top:8px;display:inline-block}.context pre{max-height:230px;overflow:auto}.session-row .context{flex-direction:column;display:flex}pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7}.full-detail{margin-top:6px}.detail-heading{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:6px 12px;display:flex}.detail-heading h2{flex:250px;min-width:0;margin:0}.detail-metadata{overflow-wrap:anywhere}.detail-workspace{border-top:1px solid var(--edge);flex-direction:column;gap:10px;margin-top:8px;padding-top:4px;display:flex}.detail-context,.detail-workspace .session-actions{min-width:0}.detail-workspace .session-actions{border-top:1px solid var(--edge);padding-top:6px}.full-detail h3{margin-block:8px}.full-detail pre{margin-block:8px;line-height:1.5}.full-detail hr{margin-block:12px}.full-detail .command,.full-detail .notice{padding:8px 10px}.command{background:var(--bg);border-left:3px solid var(--accent);padding:16px}hr{border:0;border-top:1px solid var(--edge);margin:24px 0}.chart{border-bottom:1px solid var(--muted);align-items:flex-end;gap:2px;height:clamp(120px,22vh,320px);margin-top:18px;display:flex}.chart-bar{background:var(--accent);flex:1;min-width:0;max-height:100%}.controls{justify-content:flex-start;margin:20px 0}.summary-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:16px;margin:20px 0;display:grid}.heat-scroll{overflow-x:auto}.heatmap{grid-template-rows:repeat(7,13px);grid-auto-columns:minmax(9px,1fr);grid-auto-flow:column;gap:4px;min-width:620px;margin:25px 0;display:grid}.heat-cell{background:var(--accent);border-radius:2px}.heat-cell.zero{background:var(--edge)}.table-scroll{max-height:280px;overflow:auto}table{border-collapse:collapse;width:100%;margin-top:15px}th,td{text-align:left;border-bottom:1px solid var(--edge);padding:8px}summary{cursor:pointer;color:var(--accent);padding-top:14px}footer{border-top:1px solid var(--edge);color:var(--muted);margin-top:8px;padding-top:8px;font-size:11px}footer select{padding:6px}@media (width<=850px){.session-row{grid-template-columns:minmax(0,1fr)}.session-row.wide .context,.session-row .graph-panel{grid-column:auto}.connection{text-align:left}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}} +.observation-details.svelte-1wk8llw{font-size:12px}summary.svelte-1wk8llw{cursor:pointer;color:var(--accent)}.observation-table.svelte-1wk8llw{max-height:240px;overflow:auto}.zone-canvas.svelte-1wk8llw{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1wk8llw{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1wk8llw{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1wk8llw{letter-spacing:.04em;font-size:12px}.grid.svelte-1wk8llw{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1wk8llw{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1wk8llw{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1wk8llw{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1wk8llw{fill:#fff}.observation-trail.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2.5px;stroke-linejoin:round}.trail-start.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2px}.trail-caption.svelte-1wk8llw{text-align:center;font-size:11px}.zone-caption.svelte-1wk8llw{color:var(--accent);text-align:center}fieldset.svelte-1oupzfc{border:1px solid;margin:.5rem 0;padding:.35rem .6rem}.decision.svelte-1oupzfc,.answer.svelte-1oupzfc{margin:.3rem 0;display:block}.decision.svelte-1oupzfc code:where(.svelte-1oupzfc),.decision.svelte-1oupzfc span:where(.svelte-1oupzfc){overflow-wrap:anywhere;margin:.3rem 0 .3rem 1.5rem;display:block}textarea.svelte-1oupzfc,.answer.svelte-1oupzfc input:where(.svelte-1oupzfc),.answer.svelte-1oupzfc select:where(.svelte-1oupzfc){box-sizing:border-box;background:var(--bg);width:100%;color:inherit;font:inherit;border:1px solid;margin-top:.4rem;padding:.5rem;display:block}textarea.svelte-1oupzfc{resize:vertical}button.svelte-1oupzfc{margin:.3rem .5rem .3rem 0}h3.svelte-1oupzfc,p.svelte-1oupzfc{margin-block:.4rem}.sent.svelte-1oupzfc{color:var(--accent)}.session-copy.svelte-543j00{justify-content:flex-end;align-items:center;gap:8px;margin-top:auto;padding-top:6px;display:flex}span.svelte-543j00{color:var(--muted);overflow-wrap:anywhere;font-size:12px}button.svelte-543j00{color:var(--accent);flex-shrink:0;padding:3px 7px}button.svelte-543j00:hover,button.flashed.svelte-543j00{color:var(--bg);background:var(--accent)}:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#080e0c;font-family:Cascadia Code,SFMono-Regular,Consolas,monospace}*{box-sizing:border-box}body{margin:0}.shell{--accent:#80edac;--approval:#ffca58;--muted:#98aaa0;--edge:#31473a;--panel:#101c16;--bg:#080e0c;--ink:#e2eee5;background:var(--bg);height:100dvh;color:var(--ink);grid-template-rows:auto auto minmax(0,1fr) auto;padding:clamp(10px,1.2vw,20px);display:grid}.shell[data-theme=rust]{--approval:#ff8a3d;--accent:#ffbc75;--muted:#bfac95;--edge:#59412c;--panel:#261b14;--bg:#140e0a}.shell[data-theme=blue-steel]{--approval:#e8c46a;--accent:#85c8ff;--muted:#9cacc4;--edge:#334d69;--panel:#142235;--bg:#0b1421}.shell[data-theme=ultraviolet]{--approval:#f9a8d4;--accent:#c5adff;--muted:#b3a6c9;--edge:#4b3c68;--panel:#241a35;--bg:#140d22}.shell[data-theme=nightshade]{--approval:#8f7cff;--accent:#e59bff;--muted:#c6a7cf;--edge:#673976;--panel:#301739;--bg:#1c0b24}header,.spread,footer,.controls{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px;display:flex}header{margin-bottom:10px}.brand{letter-spacing:.08em;color:var(--accent);text-shadow:0 0 22px color-mix(in srgb, var(--accent) 20%, transparent);font-size:clamp(22px,2.5vw,32px);font-weight:800;text-decoration:none}header p{color:var(--muted);margin:3px 0 0;font-size:13px}.connection{color:var(--accent);text-align:right}small,.eyebrow{letter-spacing:.04em;font-size:12px}.connection small{color:var(--muted);margin-top:4px;display:block}.lamp{background:var(--muted);border-radius:50%;width:9px;height:9px;margin-right:9px;display:inline-block}.lamp.lit{background:var(--accent);box-shadow:0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)}.working{animation:1.5s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.3}}nav{flex-wrap:wrap;gap:6px;margin-bottom:10px;display:flex}nav a,button,.button,select{font:inherit;color:var(--accent);border:1px solid var(--edge);background:var(--panel);cursor:pointer;border-radius:3px;padding:7px 11px;font-size:13px;text-decoration:none}button:hover,.button:hover,nav a:hover{border-color:var(--accent)}nav a.active{background:var(--accent);color:var(--bg);border-color:var(--accent)}:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.secondary{margin-bottom:8px}.secondary a{padding:6px 10px;font-size:12px}main{scrollbar-gutter:stable;flex-direction:column;min-width:0;min-height:0;display:flex;overflow:auto}main>*{flex-shrink:0}.panel{border:1px solid var(--edge);border-top:2px solid var(--accent);background:var(--panel);border-radius:4px;min-width:0;padding:clamp(10px,1vw,16px)}h1{color:var(--accent);font-size:20px}h2{letter-spacing:.04em;color:var(--accent);overflow-wrap:anywhere;margin:0 0 10px;font-size:13px}h3{overflow-wrap:anywhere;font-size:13px}p{margin:6px 0;font-size:13px;line-height:1.45}a{color:var(--accent)}.muted,.eyebrow{color:var(--muted)}.notice{color:#ffe0aa;background:#332611;border-left:3px solid #ffc26e;padding:12px 16px}.empty{color:var(--muted);padding:35px 0}.quota-grid{flex:1 0 auto;grid-auto-rows:minmax(220px,1fr);gap:10px;display:grid}.quota-card{flex-direction:column;min-height:0;display:flex}.quota-card>:not(.meter-graphic){flex-shrink:0}.meter-graphic{flex-direction:column;flex:1;min-height:100px;display:flex}.bar-graphic{min-height:65px}.quota-card .gauge{flex:2;height:auto;min-height:16px;margin:7px 0}.quota-card .timeline{flex:1;min-height:8px}.quota-card .pace{flex:1;height:auto;min-height:20px;margin:20px 14px 8px}.quota-card .readout{margin:6px 0;font-size:clamp(18px,2vw,28px)}.quota-grid.zone{grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));grid-auto-rows:minmax(330px,1fr)}.quota-grid.radial{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));grid-auto-rows:minmax(260px,1fr)}.gauge{background:var(--edge);height:35px;margin:15px 0;overflow:hidden}.gauge>div{background:repeating-linear-gradient(90deg, var(--accent) 0, var(--accent) 9px, transparent 9px, transparent 12px);height:100%;transition:width .5s}.gauge.timeline{height:14px}.pie-wrap{flex:1;min-height:100px;margin:6px 0;position:relative}.pie-wrap svg{width:100%;height:100%;position:absolute;inset:0}.pie-base{fill:var(--edge);stroke:var(--accent);stroke-width:1px}.pie-fill{fill:var(--accent)}.pace{background:linear-gradient(90deg, #6d3838, var(--edge) 50%, #376348);height:28px;margin:28px 14px 15px;position:relative}.pace-mid{border-left:2px solid var(--ink);height:100%;position:absolute;left:50%}.pace-marker{color:var(--accent);font-size:27px;position:absolute;top:-16px;transform:translate(-50%)}.readout{overflow-wrap:anywhere;color:var(--accent);margin:18px 0;font-size:clamp(22px,3vw,34px)}.credit+.credit{border-top:1px solid var(--edge);padding-top:20px}.credit{margin-top:24px}.session-row{grid-template-columns:minmax(210px,1.1fr) minmax(0,1.2fr) minmax(0,1.5fr);align-items:stretch;gap:14px;margin:18px 0;display:grid}.session-totals{grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr));gap:8px;margin:8px 0;display:grid}.session-totals>div{border:1px solid var(--edge);min-width:0;padding:10px}.session-totals dt{color:var(--muted);font-size:11px}.session-totals dd{color:var(--accent);overflow-wrap:anywhere;margin:6px 0 0;font-size:24px}.session-totals.stale dd{color:var(--muted)}.session-row.selected{outline:1px solid var(--accent);outline-offset:4px}.session-row.wide .context{grid-column:2/-1}.detail-controls{flex-wrap:wrap;gap:6px;display:flex}.attention-summary{flex-wrap:wrap;gap:8px;margin-block:8px;display:flex}.attention-summary .approval{color:var(--approval);border-color:var(--approval)}.attention-summary .approval:hover{background:color-mix(in srgb, var(--approval) 12%, var(--panel))}.attention-summary .approval:focus-visible{outline-color:var(--approval)}.attention-note,.attention-badge{color:var(--accent);border-left:3px solid;padding-left:8px}.attention-note.inferred{color:var(--muted)}.attention-badge{font-size:12px}.session-select{text-align:left;overflow-wrap:anywhere;max-width:100%}button:disabled{opacity:.4;cursor:default}.session-row .graph-panel{flex-direction:column;grid-column:2/-1;display:flex}.session-row.split .graph-panel{grid-column:auto}.session-row .button,.session-row button{margin-top:8px;display:inline-block}.context pre{max-height:230px;overflow:auto}.session-row .context{flex-direction:column;display:flex}pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7}.full-detail{margin-top:6px}.detail-heading{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:6px 12px;display:flex}.detail-heading h2{flex:250px;min-width:0;margin:0}.detail-metadata{overflow-wrap:anywhere}.detail-workspace{border-top:1px solid var(--edge);flex-direction:column;gap:10px;margin-top:8px;padding-top:4px;display:flex}.detail-context,.detail-workspace .session-actions{min-width:0}.detail-workspace .session-actions{border-top:1px solid var(--edge);padding-top:6px}.full-detail h3{margin-block:8px}.full-detail pre{margin-block:8px;line-height:1.5}.full-detail hr{margin-block:12px}.full-detail .command,.full-detail .notice{padding:8px 10px}.command{background:var(--bg);border-left:3px solid var(--accent);padding:16px}hr{border:0;border-top:1px solid var(--edge);margin:24px 0}.chart{border-bottom:1px solid var(--muted);align-items:flex-end;gap:2px;height:clamp(120px,22vh,320px);margin-top:18px;display:flex}.chart-bar{background:var(--accent);flex:1;min-width:0;max-height:100%}.controls{justify-content:flex-start;margin:20px 0}.summary-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:16px;margin:20px 0;display:grid}.thresholds-panel{padding:clamp(14px,2vw,22px)}.thresholds-panel h1{margin-top:0}.threshold-list{gap:8px;margin-top:16px;display:grid}.threshold-list article{border:1px solid var(--edge);grid-template-columns:minmax(64px,.5fr) minmax(220px,3fr) minmax(64px,.6fr) minmax(120px,1.2fr);align-items:center;gap:12px;padding:10px 12px;display:grid}.threshold-list article.active{border-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}.threshold-list article.next{border-color:var(--approval);box-shadow:inset 3px 0 0 var(--approval)}.threshold-list p{color:var(--muted);margin:3px 0 0;font-size:12px}.threshold-trigger{color:var(--accent);font-size:22px;font-weight:800}.threshold-mode,.threshold-state{color:var(--muted);font-size:12px;font-weight:700}.threshold-list article.active .threshold-state{color:var(--accent)}.threshold-list article.next .threshold-state{color:var(--approval)}.heat-scroll{overflow-x:auto}.heatmap{grid-template-rows:repeat(7,13px);grid-auto-columns:minmax(9px,1fr);grid-auto-flow:column;gap:4px;min-width:620px;margin:25px 0;display:grid}.heat-cell{background:var(--accent);border-radius:2px}.heat-cell.zero{background:var(--edge)}.table-scroll{max-height:280px;overflow:auto}table{border-collapse:collapse;width:100%;margin-top:15px}th,td{text-align:left;border-bottom:1px solid var(--edge);padding:8px}summary{cursor:pointer;color:var(--accent);padding-top:14px}footer{border-top:1px solid var(--edge);color:var(--muted);margin-top:8px;padding-top:8px;font-size:11px}footer select{padding:6px}@media (width<=850px){.session-row{grid-template-columns:minmax(0,1fr)}.session-row.wide .context,.session-row .graph-panel{grid-column:auto}.connection{text-align:left}.threshold-list article{grid-template-columns:64px minmax(0,1fr)}.threshold-mode,.threshold-state{grid-column:2}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}} diff --git a/internal/web/dist/assets/index-CCAs5nbB.js b/internal/web/dist/assets/index-CCAs5nbB.js new file mode 100644 index 0000000..0f2b940 --- /dev/null +++ b/internal/web/dist/assets/index-CCAs5nbB.js @@ -0,0 +1,30 @@ +(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 e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return e()}function m(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function g(e,t,n=!1){return e===void 0?n?t():t:e}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,ee=1<<20,te=1<<25,D=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`component`),se=Symbol(`legacy props`),ce=Symbol(``),le=Symbol(`attributes`),ue=Symbol(`class`),de=Symbol(`style`),fe=Symbol(`text`),pe=Symbol(`form reset`),me=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},he=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ge={},O=Symbol(`uninitialized`),_e=`http://www.w3.org/1999/xhtml`;function ve(){console.warn(`https://svelte.dev/e/derived_inert`)}function ye(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function be(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function xe(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var k=!1;function Se(e){k=e}var A;function Ce(e){if(e===null)throw ye(),ge;return A=e}function we(){return Ce(ln(A))}function j(e){if(k){if(ln(A)!==null)throw ye(),ge;A=e}}function Te(e=1){if(k){for(var t=e,n=A;t--;)n=ln(n);A=n}}function Ee(e=!0){for(var t=0,n=A;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=ln(n);e&&n.remove(),n=i}}function De(e){if(!e||e.nodeType!==8)throw ye(),ge;return e.data}function Oe(e){return e===this.v}function ke(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ae(e){return!ke(e,this.v)}function je(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Me(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Ne(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Pe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Fe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ie(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Le(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Re(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ze(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Be(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ve(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function He(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ue=!1;function We(){Ue=!0}var M=null;function Ge(e){M=e}function Ke(e,t=!1,n){M={p:M,i:!1,c:null,e:null,s:e,x:null,r:W,l:Ue&&!t?{s:null,u:null,$:[]}:null}}function qe(e){var t=M,n=t.e;if(n!==null){t.e=null;for(var r of n)Sn(r)}return e!==void 0&&(t.x=e),t.i=!0,M=t.p,Je(e)}function Je(e={}){return i(e,oe,{value:!0}),e}function Ye(){return!Ue||M!==null&&M.l===null}var Xe=[];function Ze(){var e=Xe;Xe=[],m(e)}function Qe(e){if(Xe.length===0&&!Ot){var t=Xe;queueMicrotask(()=>{t===Xe&&Ze()})}Xe.push(e)}function $e(){for(;Xe.length>0;)Ze()}var et=~(y|b|v);function N(e,t){e.f=e.f&et|t}function tt(e){e.f&512||e.deps===null?N(e,v):N(e,b)}function nt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=D,nt(t.deps))}function rt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),nt(e.deps),N(e,v)}var it=!1;function at(e){var t=it;try{return it=!1,[e(),it]}finally{it=t}}function ot(e){k&&cn(e)!==null&&un(e)}var st=!1;function ct(){st||(st=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[pe]?.()})},{capture:!0}))}function lt(e){var t=U,n=W;Kn(null),qn(null);try{return e()}finally{Kn(t),qn(n)}}function ut(e,t,n,r=n){e.addEventListener(t,()=>lt(n));let i=e[pe];e[pe]=i?()=>{i(),r(!0)}:()=>r(!0),ct()}function dt(e,t,n,r){let i=Ye()?ht:vt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=W,c=ft(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){hn(e,s)}pt()}}var d=mt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>_t(e))).then(u).catch(e=>hn(e,s)).finally(d)}l?l.then(()=>{c(),f(),pt()}):f()}function ft(){var e=W,t=U,n=M,r=F;return function(i=!0){qn(e),Kn(t),Ge(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function pt(e=!0){qn(null),Kn(null),Ge(null),e&&F?.deactivate()}function mt(){var e=W,t=e.b,n=F,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ht(e){var t=2|y;return W!==null&&(W.f|=E),{ctx:M,deps:null,effects:null,equals:Oe,f:t,fn:e,reactions:null,rv:0,v:O,wv:0,parent:W,ac:null}}var gt=Symbol(`obsolete`);function _t(e,t,n){let r=W;r===null&&Me();var i=void 0,a=Gt(O),o=!U,s=new Set;return En(()=>{var t=W,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==me&&n.reject(e)}).finally(pt)}catch(e){n.reject(e),pt()}var c=F;if(o){if(t.f&32768)var l=mt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(gt);else for(let e of s.values())e.reject(gt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==gt&&(c.activate(),t?(a.f|=ie,qt(a,t)):(a.f&8388608&&(a.f^=ie),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),bn(()=>{for(let e of s)e.reject(gt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function P(e){let t=ht(e);return Yn(t),t}function vt(e){let t=ht(e);return t.equals=Ae,t}function yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(me),t.ac=null}),t.fn!==null&&(t.teardown=f),ur(t,0),jn(t))}function Ct(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&dr(t)}var wt=null,F=null,Tt=null,Et=null,Dt=null,Ot=!1,kt=!1,At=null,jt=null,Mt=0,Nt=1,Pt=class e{id=Nt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){wt===null?wt=this:(wt.#n=this,this.#t=wt),wt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)N(r,y),t(r);for(r of n.m)N(r,b),t(r)}this.#p.add(e)}#g(){this.#e=!0,Mt++>1e3&&(this.#x(),It());for(let e of this.#u)this.#d.delete(e),N(e,y),this.schedule(e);for(let e of this.#d)N(e,b),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=At=[],r=[],i=jt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Vt(e),this.#h()||this.discard(),t}if(F=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(At=null,jt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Bt(e,t);i.length>0&&F.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Tt=this,Rt(r),Rt(n),Tt=null,this.#s?.resolve();var s=F;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Ut.clear(),s.#g())}#_(e,t,n){e.f^=v;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=v:i&4?t.push(r):ar(r)&&(i&16&&this.#d.add(r),dr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),N(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),F=this,this.#g()}#b(e){for(var t=0;t{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=h()).promise}static ensure(){if(F===null){let t=F=new e;!kt&&!Ot&&Qe(()=>{t.#e||t.flush()})}return F}apply(){Et=null}schedule(e){if(Dt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(At!==null&&t===W&&(U===null||!(U.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?wt=e:t.#t=e,this.linked=!1}}};function Ft(e){var t=Ot;Ot=!0;try{var n;for(e&&(F!==null&&!F.is_fork&&F.flush(),n=e());;){if($e(),F===null)return n;F.flush()}}finally{Ot=t}}function It(){try{Le()}catch(e){hn(e,Dt)}}var Lt=null;function Rt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Ut.clear();for(let e of Lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Lt.has(n)&&(Lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||dr(n)}}Lt.clear()}}Lt=null}}function zt(e){F.schedule(e)}function Bt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),N(e,v);for(var n=e.first;n!==null;)Bt(n,t),n=n.next}}function Vt(e){N(e,v);for(var t=e.first;t!==null;)Vt(t),t=t.next}var Ht=new Set,Ut=new Map,Wt=!1;function Gt(e,t){return{f:0,v:e,reactions:null,equals:Oe,rv:0,wv:0}}function I(e,t){let n=Gt(e,t);return Yn(n),n}function Kt(e,t=!1,n=!0){let r=Gt(e);return t||(r.equals=Ae),Ue&&n&&M!==null&&M.l!==null&&(M.l.s??=[]).push(r),r}function L(e,t,n=!1){return U!==null&&(!Gn||U.f&131072)&&Ye()&&U.f&4325394&&(Jn===null||!Jn.has(e))&&Ve(),qt(e,n?Qt(t):t,jt)}function qt(e,t,n=null){if(!e.equals(t)){Un?Ut.set(e,t):Ut.has(e)||Ut.set(e,e.v);var r=Pt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&bt(t),Et===null&&tt(t)}e.wv=ir(),Zt(e,y,n),Ye()&&W!==null&&W.f&1024&&!(W.f&96)&&(Qn===null?$n([e]):Qn.push(e)),!r.is_fork&&Ht.size>0&&!Wt&&Jt()}return t}function Jt(){Wt=!1;for(let e of Ht){e.f&1024&&N(e,b);let t;try{t=ar(e)}catch{t=!0}t&&dr(e)}Ht.clear()}function Yt(e,t=1){var n=G(e),r=t===1?n++:n--;return L(e,n),r}function Xt(e){L(e,e.v+1)}function Zt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ye(),a=r.length,o=0;o{if(nr===d)return e();var t=U,n=nr;Kn(null),rr(d);var r=e();return Kn(t),rr(n),r};return i&&r.set(`length`,I(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ze();var i=r.get(t);return i===void 0?f(()=>{var e=I(n.value,u);return r.set(t,e),e}):L(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>I(O,u));r.set(t,e),Xt(o)}}else L(n,O),Xt(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>I(Qt(s?e[n]:O),u)),r.set(n,o)),o!==void 0){var c=G(o);return c===O?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=G(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==O)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==O||Reflect.has(e,t);return(n!==void 0||W!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>I(i?Qt(e[t]):O,u)),r.set(t,n)),G(n)===O)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dI(O,u)),r.set(d+``,p)):L(p,O)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>I(void 0,u)),L(c,Qt(n)),r.set(t,c));else{l=c.v!==O;var m=f(()=>Qt(n));L(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&L(g,_+1)}Xt(o)}return!0},ownKeys(e){G(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==O});for(var[n,i]of r)i.v!==O&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Be()}})}function $t(e){try{if(typeof e==`object`&&e&&ae in e)return e[ae]}catch{}return e}function en(e,t){return Object.is($t(e),$t(t))}var tn,nn,rn,an;function on(){if(tn===void 0){tn=window,nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;rn=a(t,`firstChild`).get,an=a(t,`nextSibling`).get,u(e)&&(e[ue]=void 0,e[le]=null,e[de]=void 0,e.__e=void 0),u(n)&&(n[fe]=void 0)}}function sn(e=``){return document.createTextNode(e)}function cn(e){return rn.call(e)}function ln(e){return an.call(e)}function R(e,t){if(!k)return cn(e);var n=cn(A);if(n===null)n=A.appendChild(sn());else if(t&&n.nodeType!==3){var r=sn();return n?.before(r),Ce(r),r}return t&&pn(n),Ce(n),n}function z(e,t=!1){if(!k){var n=cn(e);return n instanceof Comment&&n.data===``?ln(n):n}if(t){if(A?.nodeType!==3){var r=sn();return A?.before(r),Ce(r),r}pn(A)}return A}function B(e,t=!1){if(!k)return cn(e);var n=R(e,t);return j(e),n}function V(e,t=1,n=!1){let r=k?A:e;for(var i;t--;)i=r,r=ln(r);if(!k)return r;if(n){if(r?.nodeType!==3){var a=sn();return r===null?i?.after(a):r.before(a),Ce(a),a}pn(r)}return Ce(r),r}function un(e){e.textContent=``}function dn(){return!1}function fn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function pn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function mn(e){var t=W;if(t===null)return U.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;hn(e,t)}function hn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function gn(e){W===null&&(U===null&&Ie(e),Fe()),Un&&Pe(e)}function _n(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function vn(e,t){var n=W;n!==null&&n.f&8192&&(e|=x);var r={ctx:M,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};F?.register_created_effect(r);var i=r;if(e&4)At===null?Pt.ensure().schedule(r):At.push(r);else if(t!==null){try{dr(r)}catch(e){throw Nn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=T))}if(i!==null&&(i.parent=n,n!==null&&_n(i,n),U!==null&&U.f&2&&!(e&64))){var a=U;(a.effects??=[]).push(i)}return r}function yn(){return U!==null&&!Gn}function bn(e){let t=vn(8,null);return N(t,v),t.teardown=e,t}function xn(e){gn(`$effect`);var t=W.f;if(!U&&t&32&&M!==null&&!M.i){var n=M;(n.e??=[]).push(e)}else return Sn(e)}function Sn(e){return vn(4|ee,e)}function Cn(e){return gn(`$effect.pre`),vn(8|ee,e)}function wn(e){Pt.ensure();let t=vn(64|E,e);return(e={})=>new Promise(n=>{e.outro?In(t,()=>{Nn(t),n(void 0)}):(Nn(t),n(void 0))})}function Tn(e){return vn(4,e)}function En(e){return vn(re|E,e)}function Dn(e,t=0){return vn(8|t,e)}function H(e,t=[],n=[],r=[]){dt(r,t,n,t=>{vn(8,()=>{e(...t.map(G))})})}function On(e,t=0){return vn(16|t,e)}function kn(e){return vn(32|E,e)}function An(e){var t=e.teardown;if(t!==null){let n=Un,r=U;Wn(!0),Kn(null);try{t.call(null)}catch(t){hn(t,e.parent)}finally{Wn(n),Kn(r)}}}function jn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&<(()=>{e.abort(me)});var r=n.next;n.f&64?n.parent=null:Nn(n,t),n=r}}function Mn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Nn(t),t=n}}function Nn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Pn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,jn(e,t&&!n),ur(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();An(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Fn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Pn(e,t){for(;e!==null;){var n=e===t?null:ln(e);e.remove(),e=n}}function Fn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function In(e,t,n=!0){var r=[];e.f|=256,Ln(e,r,!0);var i=()=>{n&&Nn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Ln(e,t,n){if(!(e.f&8192)){e.f^=x;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Ln(i,t,o?n:!1)}i=a}}}function Rn(e){e.f&=-257,zn(e,!0)}function zn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(N(e,y),Pt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);zn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Bn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:ln(n);t.append(n),n=i}}var Vn=null,Hn=!1,Un=!1;function Wn(e){Un=e}var U=null,Gn=!1;function Kn(e){U=e}var W=null;function qn(e){W=e}var Jn=null;function Yn(e){U!==null&&(Jn??=new Set).add(e)}var Xn=null,Zn=0,Qn=null;function $n(e){Qn=e}var er=1,tr=0,nr=tr;function rr(e){nr=e}function ir(){return++er}function ar(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~D),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&Et===null&&N(e,v)}return!1}function or(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Jn!==null&&Jn.has(e)))for(var i=0;i{e.ac.abort(me)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=C;var f=cr(e);if(Ye()&&Qn!==null&&!Gn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Zn+Xn.length,r=0;r{s.ac.abort(me),s.ac=null,N(s,y)}),St(s),ur(s,0)}}function ur(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function wr(e,t,n,r,i){var a={capture:r,passive:i},o=Cr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&bn(()=>{t.removeEventListener(e,o,a)})}function Tr(e,t,n){(t[br]??={})[e]=n}function Er(e){for(var t=0;t{Or=!1,Dr=null}));var s=0,c=Dr===e&&e[br];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[br]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=U,f=W;Kn(null),qn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[br]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s{throw e});throw p}}finally{e[br]=t,delete e.currentTarget,Kn(d),qn(f)}}}var Ar=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function jr(e){return Ar?.createHTML(e)??e}function Mr(e){var t=fn(`template`);return t.innerHTML=jr(e.replaceAll(``,``)),t.content}function Nr(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(k)return Nr(A,null),A;i===void 0&&(i=Mr(a?e:``+e),n||(i=cn(i)));var t=r||nn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=cn(t),s=t.lastChild;Nr(o,s)}else Nr(t,t);return t}}function Pr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(k)return Nr(A,null),A;if(!o){var e=cn(Mr(a));if(i)for(o=document.createDocumentFragment();cn(e);)o.appendChild(cn(e));else o=cn(e)}var t=o.cloneNode(!0);if(i){var n=cn(t),r=t.lastChild;Nr(n,r)}else Nr(t,t);return t}}function Fr(e,t){return Pr(e,t,`svg`)}function Ir(){if(k)return Nr(A,null),A;var e=document.createDocumentFragment(),t=document.createComment(``),n=sn();return e.append(t,n),Nr(t,n),e}function q(e,t){if(k){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=A),we();return}e!==null&&e.before(t)}function Lr(){if(k&&A&&A.nodeType===8&&A.textContent?.startsWith(`$`)){let e=A.textContent.substring(1);return we(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Rr(e){let t=0,n=Gt(0),r;return()=>{yn()&&(G(n),Dn(()=>(t===0&&(r=hr(()=>e(()=>Xt(n)))),t+=1,()=>{Qe(()=>{--t,t===0&&(r?.(),r=void 0,Xt(n))})})))}}var zr=T|E;function Br(e,t,n,r){new Vr(e,t,n,r)}var Vr=class{parent;is_pending=!1;transform_error;#e;#t=k?A:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Rr(()=>(this.#m=Gt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=W;t.b=this,t.f|=128,n(e)},this.parent=W.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=On(()=>{if(k){let e=this.#t;we();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},zr),k&&(this.#e=A)}#g(){try{this.#a=kn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Qe(r),t&&(this.#s=kn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){xe();return}t=!0,n&&He(),this.#s!==null&&In(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){hn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=kn(()=>e(this.#e)),Qe(()=>{var e=this.#c=document.createDocumentFragment(),t=sn(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return kn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){hn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(F);return}this.#u===0&&(this.#e.before(e),this.#c=null,In(this.#o,()=>{this.#o=null}),this.#x(F))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=kn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Bn(this.#a,e);let t=this.#n.pending;this.#o=kn(()=>t(this.#e))}else this.#x(F)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){rt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=W,n=U,r=M;qn(this.#i),Kn(this.#i),Ge(this.#i.ctx);try{return Pt.ensure(),e()}finally{qn(t),Kn(n),Ge(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&In(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Qe(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),G(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;F?.is_fork?(this.#a&&F.skip_effect(this.#a),this.#o&&F.skip_effect(this.#o),this.#s&&F.skip_effect(this.#s),F.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(Nn(this.#a),null),this.#o&&=(Nn(this.#o),null),this.#s&&=(Nn(this.#s),null),k&&(Ce(this.#t),Te(),Ce(Ee()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return kn(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return hn(e,this.#i.parent),null}}))};Qe(()=>{var t;try{t=this.transform_error(e)}catch(e){hn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>hn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[fe]??=e.nodeValue)&&(e[fe]=n,e.nodeValue=`${n}`)}function Hr(e,t){return Wr(e,t)}var Ur=new Map;function Wr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){on();var l=void 0,u=wn(()=>{var s=n??t.appendChild(sn());Br(s,{pending:()=>{}},t=>{Ke({});var n=M;if(o&&(n.c=o),a&&(i.$$events=a),k&&Nr(t,null),l=e(t,i)||Je(),k&&(W.nodes.end=A,A===null||A.nodeType!==8||A.data!==`]`))throw ye(),ge;qe()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Ur.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,kr),r.delete(e),r.size===0&&Ur.delete(n)):r.set(e,i)}Sr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Gr.set(l,u),l}var Gr=new WeakMap,Kr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Rn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Rn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Nn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Bn(r,t),t.append(sn()),this.#n.set(e,{effect:r,fragment:t})}else Nn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),In(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Nn(n.effect),this.#n.delete(e))};ensure(e,t){var n=F,r=dn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=sn();i.append(a),this.#n.set(e,{effect:kn(()=>t(a)),fragment:i})}else this.#t.set(e,kn(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else k&&(this.anchor=A),this.#a(n)}};function Y(e,t,n=!1){var r;k&&(r=A,we());var i=new Kr(e),a=n?T:0;function o(e,t){if(k){var n=De(r);if(e!==parseInt(n.substring(1))){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,t),Se(!0);return}}i.ensure(e,t)}On(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var qr=Symbol(`NaN`);function Jr(e,t,n){k&&we();var r=new Kr(e),i=!Ye();On(()=>{var e=t();e!==e&&(e=qr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Yr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Xr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;un(d),d.append(u),e.items.clear()}Xr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Xr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,$r(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=te,ti(d,null,c)):Rn(d):In(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:On(()=>{p=G(f);var e=p.length;let t=!1;k&&De(c)===`[!`!=(e===0)&&(c=Ee(),Ce(c),Se(!1),t=!0);for(var r=new Set,u=F,v=dn(),y=0;ys(c)):(d=kn(()=>s(Zr??=sn())),d.f|=te)),e>r.size&&Ne(``,``,``),k&&e>0&&Ce(Ee()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&Se(!0),G(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,k&&(c=A)}function Qr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function $r(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Qr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var E=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function ei(e,t,n,r,i,a,o,s){var c=o&1?o&16?Gt(n):Kt(n,!1,!1):null,l=o&2?Gt(i):null;return{v:c,i:l,e:kn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ti(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=ln(r);if(a.before(r),r===i)return;r=o}}function ni(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ri(e,t,n){var r;k&&(r=A,we());var i=new Kr(e);On(()=>{var e=t()??null;if(k&&De(r)===`[`!=(e!==null)){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,e&&(t=>n(t,e))),Se(!0);return}i.ensure(e,e&&(t=>n(t,e)))},T)}var ii=[...` +\r\f\xA0\v`];function ai(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ii.includes(r[o-1]))&&(s===r.length||ii.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function oi(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function si(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ci(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(si)),i&&c.push(...Object.keys(i).map(si));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(vi)||(`__defaultValue`in e&&pi(e,!1),`__value`in e&&mi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),bn(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;ut(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),_i);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&_i(o)}n(a),e.__value=a,F!==null&&r.add(F)}),Tn(()=>{var a=t();if(e===document.activeElement){var o=F;if(r.has(o))return}if(mi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=_i(s),n(a))}e.__value=a,i=!1})}function _i(e){return`__value`in e?e.__value:e.value}function vi(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var yi=Symbol(`is custom element`),bi=Symbol(`is html`),xi=he?`link`:`LINK`;function Si(e){if(k){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[pe]=n,Qe(n),ct()}}function Q(e,t,n,r){var i=Ci(e);k&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===xi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ce]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[le]??={[yi]:e.nodeName.includes(`-`),[bi]:e.namespaceURI===_e}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function Ei(e,t,n=t){var r=new WeakSet;ut(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ai(e)?ji(a):a,n(a),F!==null&&r.add(F),await fr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(k&&e.defaultValue!==e.value||hr(t)==null&&e.value)&&(n(Ai(e)?ji(e.value):e.value),F!==null&&r.add(F)),Dn(()=>{var n=t();if(e===document.activeElement){var i=F;if(r.has(i))return}Ai(e)&&n===ji(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Di=new Set;function Oi(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),ut(n,`change`,()=>{var e=n.__value;a&&(e=ki(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Dn(()=>{var e=r();if(k&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=en(n.__value,e)}),bn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Di.has(o)||(Di.add(o),Qe(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Di.delete(o)})),Qe(()=>{if(s){var e=a?ki(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function ki(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Ni(e,t,n){var r=Mi.observe(e,()=>n(e[t]));Tn(()=>(hr(()=>n(e[t])),r))}function Pi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Dn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&bn(()=>{n.removeEventListener(t,a)})}function Fi(e=!1){let t=M,n=t.l.u;if(!n)return;let r=()=>gr(t.s);if(e){let e=0,n={},i=ht(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>G(i)}n.b.length&&Cn(()=>{Ii(t,r),m(n.b)}),xn(()=>{let e=hr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&xn(()=>{Ii(t,r),m(n.a)})}function Ii(e,t){if(e.l.s)for(let t of e.l.s)G(t);t()}var Li={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ae||t===se)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ri(...e){return new Proxy({props:e},Li)}function zi(e,t,n,r){var i=!Ue||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ht(r),G(u)):(l&&(l=!1,c=s?hr(r):r),c);let f;if(o){var p=ae in e||se in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=at(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Re(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?ht:vt)(()=>(v=!1,g()));o&&G(y);var b=W;return(function(e,t){if(arguments.length>0){let n=t?G(y):i&&o?Qt(e):e;return L(y,n),v=!0,c!==void 0&&(c=n),e}return Un&&v||b.f&16384?y.v:G(y)})}function Bi(e){M===null&&je(`onMount`),Ue&&M.l!==null?Vi(M).m.push(e):xn(()=>{let t=hr(e);if(typeof t==`function`)return t})}function Vi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Hi(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ui=new class{#e=I(Wi());get _loc(){return G(this.#e)}set _loc(e){L(this.#e,e)}#t=P(()=>this._loc.location);get _location(){return G(this.#t)}set _location(e){L(this.#t,e)}#n=P(()=>this._loc.querystring);get _querystring(){return G(this.#n)}set _querystring(e){L(this.#n,e)}#r=I(void 0);get _params(){return G(this.#r)}set _params(e){L(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=Wi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Wi(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function Gi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Ki(e,t){Ke(t,!0);let n=zi(t,`routes`,19,()=>({})),r=zi(t,`prefix`,3,``),i=zi(t,`restoreScrollState`,3,!1),a=zi(t,`onConditionsFailed`,3,()=>{}),o=zi(t,`onRouteLoaded`,3,()=>{}),s=zi(t,`onRouteLoading`,3,()=>{}),c=zi(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Hi(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=I(null),f=I(null),p=I({}),m=null,h=null;xn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),xn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await fr(),e(t)}xn(()=>{let e=Ui.loc,t=!1;return hr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Ir(),y=z(v),b=e=>{let t=P(()=>G(d));var n=Ir(),r=z(n),i=e=>{var n=Ir();ri(z(n),()=>G(t),(e,t)=>{t(e,Ri({get params(){return G(f)},get onRouteEvent(){return c()}},()=>G(p)))}),q(e,n)},a=e=>{var n=Ir();ri(z(n),()=>G(t),(e,t)=>{t(e,Ri({get onRouteEvent(){return c()}},()=>G(p)))}),q(e,n)};Y(r,e=>{G(f)?e(i):e(a,-1)}),q(e,n)};Y(y,e=>{G(d)&&e(b)}),q(e,v),qe()}var qi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`],Ji=`codexometer.web.preferences.v1`,Yi={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function Xi(){try{let e=JSON.parse(localStorage.getItem(Ji)||`null`);return!e||typeof e!=`object`?Yi:{tab:[`quota`,`sessions`,`usage`,`thresholds`].includes(e.tab)?e.tab:`quota`,view:qi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Yi}}var Zi=Qt(Xi());function Qi(){let e=JSON.stringify(Zi);try{localStorage.setItem(Ji,e)}catch{}}function $i(){return Zi.tab===`quota`?`/quota/`+Zi.view:`/`+Zi.tab}function ea(e){return Zi.layouts.find(t=>t.id===e)?.level??Zi.defaultDetail}function ta(e){Zi.defaultDetail=e,Zi.layouts=[]}function na(e,t){Zi.layouts=[...Zi.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Qt({data:null,connected:!1,error:``}),ra=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ia=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),aa=`codexometer.web.session`,oa=class extends Error{},sa;async function ca(e,t,n){if(!sa||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await sa(e,t,n)}function la(){let e=new AbortController,t,n=``;sa=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new oa(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(aa)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+$i()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem(aa,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(aa)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` + +`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{sa=void 0,e.abort(),clearTimeout(t),$.connected=!1}}var ua=Fr(` `,1),da=Fr(` `,1),fa=K(` `),pa=K(`
Quota observations
Observed atPeriod elapsedConsumedTrail segment
`),ma=K(`


Observed quota + path, not individual session usage. Gaps are not interpolated. Expand the + observation table for times, positions and gaps.

OBSERVATION TABLE
`,1),ha=K(`
CONSUMPTIONQUOTA PERIOD ELAPSED


`,1);function ga(e,t){let n=Lr();Ke(t,!0);let r=zi(t,`trail`,19,()=>[]),i=I(!1),a=[0,25,50,75,100],o=I(400),s=I(240),c=P(()=>G(o)-24),l=P(()=>G(s)-48),u=P(()=>Math.max(1,G(c)-48)),d=P(()=>Math.max(1,G(l)-20)),f=P(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*G(u)),p=P(()=>G(l)-Math.max(0,Math.min(100,t.used))/100*G(d)),m=P(()=>t.used-t.elapsed),h=P(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*G(u)} ${G(l)-e.used/100*G(d)}`).join(` `));var g=ha(),_=z(g),v=R(_),y=R(v),b=B(y),x=V(y),S=V(x);Z(S,17,()=>a,X,(e,t)=>{var n=ua(),r=z(n),i=V(r),a=V(i),o=B(a),s=V(a),f=B(s);H(()=>{Q(r,`x1`,48+G(t)/100*G(u)),Q(r,`x2`,48+G(t)/100*G(u)),Q(r,`y2`,G(l)),Q(i,`y1`,G(l)-G(t)/100*G(d)),Q(i,`x2`,G(c)),Q(i,`y2`,G(l)-G(t)/100*G(d)),Q(a,`x`,48+G(t)/100*G(u)),Q(a,`y`,G(l)+20),J(o,`${G(t)??``}%`),Q(s,`y`,G(l)+4-G(t)/100*G(d)),J(f,`${G(t)??``}%`)}),q(e,n)});var C=V(S),w=V(C),T=V(w),E=e=>{var t=da(),n=z(t),i=V(n),a=B(R(i));j(i),H(e=>{Q(n,`d`,G(h)),Q(i,`cx`,48+r()[0].elapsed/100*G(u)),Q(i,`cy`,G(l)-r()[0].used/100*G(d)),J(a,`First observation: ${e??``}`)},[()=>ia(r()[0].at)]),q(e,t)};Y(T,e=>{r().length&&e(E)});var ee=V(T,2),te=V(ee),D=V(te),ne=B(R(D));j(D),j(v),j(_);var re=V(_,2),ie=R(re),ae=B(V(ie,3),!0);j(re);var oe=V(re,2),se=e=>{var t=ma(),a=z(t),o=R(a);Te(2),j(a);var s=V(a,2),c=V(R(s),2),l=e=>{var t=pa(),n=R(t),i=V(R(n),2);Z(i,21,r,X,(e,t,n)=>{var r=fa(),i=R(r),a=R(i),o=B(a,!0);j(i);var s=V(i),c=B(s),l=V(s),u=B(l),d=B(V(l),!0);j(r),H((e,r)=>{Q(a,`datetime`,G(t).at),J(o,e),J(c,`${r??``}%`),J(u,`${G(t).used??``}%`),J(d,n===0?`First observation`:G(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ia(G(t).at),()=>G(t).elapsed.toFixed(1)]),q(e,r)}),j(i),j(n),j(t),q(e,t)};Y(c,e=>{G(i)&&e(l)}),j(s),H(e=>{Q(a,`id`,n+`-trail-summary`),J(o,`○ START ${e??``} // ${r().length??``} + ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>ia(r()[0].at)]),Pi(`open`,`toggle`,s,e=>L(i,e),()=>G(i)),q(e,t)};Y(oe,e=>{r().length&&e(se)}),H((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${G(o)} ${G(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,G(u)),Q(x,`height`,G(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${G(l)} H${G(c)}`),Q(w,`y1`,G(l)),Q(w,`x2`,G(c)),Q(ee,`x`,48+G(u)/2),Q(ee,`y`,G(s)-5),Q(te,`cx`,G(f)),Q(te,`cy`,G(p)),Q(D,`cx`,G(f)),Q(D,`cy`,G(p)),J(ne,`${t.used??``}% consumed // ${i??``}% of period elapsed`),J(ie,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),J(ae,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${G(m)>0?`Above`:G(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(G(m))<.05?`ON PACE`:G(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Ni(_,`clientWidth`,e=>L(o,e)),Ni(_,`clientHeight`,e=>L(s,e)),q(e,g),qe()}var _a=K(` `),va=K(`

Quota refresh failed. Values below are the last successful observation.

`),ya=K(`

Expiry details unavailable. No listed expiry does not mean no expiry.

`),ba=K(`

`),xa=K(`

Read-only preview. Use the terminal to redeem a reset.

The backend may return only some credits. This list does not establish + redemption order.

`),Sa=K(` `,1),Ca=Fr(``),wa=Fr(``),Ta=K(`
`),Ea=K(`

Cycle duration or reset date unavailable — position cannot be + plotted.

`),Da=K(`
−100 // OVER BUDGET+100 // HEADROOM

`,1),Oa=K(`

Cycle duration unavailable — pace cannot be calculated.

`),ka=K(`
EMPTYFULL
`),Aa=K(`

`,1),ja=K(`
`,1),Ma=K(`

`),Na=K(`

`),Pa=K(`

No quota windows reported yet.

`),Fa=K(`
`,1),Ia=K(`

All reported windows are shown. API-equivalent learning and quota status + scoring remain in the terminal for this first preview.

`,1),La=K(` `,1);function Ra(e,t){Ke(t,!0);let n=zi(t,`params`,19,()=>({})),r=qi,i=I(Qt(Date.now())),a=P(()=>r.includes(n().view||``)?n().view:`bars`);Bi(()=>{let e=setInterval(()=>L(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-G(i))/(e.duration*6e4))))}xn(()=>{Zi.view=G(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=La(),l=z(c);Z(l,21,()=>r,X,(e,t)=>{var n=_a();let r;var i=B(n,!0);H(e=>{Q(n,`href`,`#/quota/`+G(t)),Q(n,`aria-current`,G(a)===G(t)?`page`:void 0),r=li(n,1,``,null,r,{active:G(a)===G(t)}),J(i,e)},[()=>G(t)===`pace`?`CONSUMPTION PACE`:G(t)===`zone`?`CONSUMPTION ZONE`:G(t)===`fuel`?`FUEL TANK`:G(t).toUpperCase()]),q(e,n)}),j(l);var u=V(l,2),d=e=>{var t=Ia(),n=z(t),r=e=>{q(e,va())};Y(n,e=>{$.data.quotaError&&e(r)});var i=V(n,2),c=B(i),l=V(i,2),u=e=>{var t=xa(),n=R(t),r=B(n),i=V(n,4),a=e=>{q(e,ya())};Y(i,e=>{$.data.credits.length||e(a)}),Z(V(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=ba(),r=R(n),i=B(r),a=B(V(r,2),!0);j(n),H(e=>{J(i,`${(G(t).title||`Quota reset`)??``} // ${G(t).status??``}`),J(a,e)},[()=>G(t).expiryKnown?G(t).expires?`EXPIRES `+ia(G(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),Te(2),j(t),H(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},d=e=>{var t=Fa(),n=z(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=P(()=>o(G(t))),r=P(()=>G(n)===null?null:G(n)-G(t).used);var i=Na(),c=R(i),l=B(c,!0),u=V(c,2),d=R(u),f=e=>{var n=Sa(),r=z(n),i=B(r),a=B(V(r));H(()=>{J(i,`FREE ${100-G(t).used}%`),J(a,`USED ${G(t).used??``}%`)}),q(e,n)},p=e=>{var n=Sa(),r=z(n),i=B(r),a=B(V(r));H(()=>{J(i,`USED ${G(t).used??``}%`),J(a,`FREE ${100-G(t).used}%`)}),q(e,n)};Y(d,e=>{G(a)===`fuel`?e(f):e(p,-1)}),j(u);var m=V(u,2);let h;var g=R(m),_=e=>{var n=Ta(),r=R(n),i=V(R(r)),a=e=>{q(e,Ca())},o=e=>{var n=wa();H(e=>Q(n,`d`,e),[()=>s(G(t).used)]),q(e,n)};Y(i,e=>{G(t).used>=100?e(a):G(t).used>0&&e(o,1)}),j(r),j(n),H(()=>Q(r,`aria-label`,`${G(t).used}% quota used`)),q(e,n)},v=e=>{var r=Ir(),i=z(r),a=e=>{{let r=P(()=>G(t).trail||[]);ga(e,{get used(){return G(t).used},get elapsed(){return G(n)},get trail(){return G(r)}})}},o=e=>{q(e,Ea())};Y(i,e=>{G(n)===null?e(o,-1):e(a)}),q(e,r)},y=e=>{var t=Ir(),n=z(t),i=e=>{var t=Da(),n=z(t),i=V(R(n),2);let a;j(n);var o=V(n,4),s=R(o),c=B(V(s),!0);j(o),H(e=>{a=di(i,``,a,{left:`${(G(r)+100)/2}%`}),J(s,`${G(r)>=0?`+`:``}${e??``} PP `),J(c,G(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>G(r).toFixed(1)]),q(e,t)},a=e=>{q(e,Oa())};Y(n,e=>{G(r)===null?e(a,-1):e(i)}),q(e,t)},b=e=>{var r=ja(),i=z(r),o=R(i);let s;j(i);var c=V(i,2),l=e=>{q(e,ka())};Y(c,e=>{G(a)===`fuel`&&e(l)});var u=V(c,2),d=e=>{var t=Aa(),r=z(t),i=B(r),o=V(r,2),s=R(o);let c;j(o),H(e=>{J(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=di(s,``,c,{width:`${G(a)===`fuel`?100-G(n):G(n)}%`})},[()=>Math.floor(G(n))]),q(e,t)};Y(u,e=>{G(n)!==null&&e(d)}),H(()=>{Q(i,`aria-label`,G(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,G(a)===`fuel`?100-G(t).used:G(t).used),s=di(o,``,s,{width:`${G(a)===`fuel`?100-G(t).used:G(t).used}%`})}),q(e,r)};Y(g,e=>{G(a)===`pie`?e(_):G(a)===`zone`?e(v,1):G(a)===`pace`?e(y,2):e(b,-1)}),j(m);var x=V(m,2),S=B(x),C=V(x,2),w=e=>{var n=Ma(),r=B(n,!0);H(()=>J(r,G(t).details)),q(e,n)};Y(C,e=>{G(t).details&&e(w)}),j(i),H(e=>{J(l,G(t).name),h=li(m,1,`meter-graphic`,null,h,{"bar-graphic":G(a)===`bars`||G(a)===`fuel`}),J(S,`RESETS // ${e??``}`)},[()=>ia(G(t).reset)]),q(e,i)}),j(n);var i=V(n,2),c=e=>{q(e,Pa())};Y(i,e=>{$.data.meters.length||e(c)}),H(()=>r=li(n,1,`quota-grid`,null,r,{radial:G(a)===`pie`,zone:G(a)===`zone`})),q(e,t)};Y(l,e=>{G(a)===`resets`?e(u):e(d,-1)}),Te(2),H(e=>J(c,`QUOTA // OBSERVED ${e??``}`),[()=>ia($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),qe()}var za=K(`
`),Ba=K(`

`,1);function Va(e,t){Ke(t,!0);let n=zi(t,`values`,19,()=>[]),r=zi(t,`label`,3,`Token activity`),i=zi(t,`capacity`,3,0),a=P(()=>Math.max(0,...n())),o=P(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Ba(),c=z(s),l=B(c),u=V(c,2);Z(u,21,()=>G(o),X,(e,t)=>{var n=za();let r;H((e,t)=>{Q(n,`title`,e),r=di(n,``,r,{height:t})},[()=>G(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*G(t)/Math.max(1,G(a))}%`]),q(e,n)}),j(u),H((e,t)=>{J(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>G(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${G(a).toLocaleString(`en-GB`)} tokens.`]),q(e,s),qe()}var Ha=K(`

CURRENT PROFILE

MODEL / REASONING LEVEL / SPEED

 

PROPOSED PROFILE

MODEL / REASONING LEVEL / SPEED

 

Applied settings remain after Codexometer closes.

`,1),Ua=K(`

`),Wa=K(`

 
`,1),Ga=K(`

Command unavailable from this observation. Open Codex to inspect the + request.

`),Ka=K(`

Session controls temporarily unavailable. Check Codex for current state.

`),qa=K(`

Checking session controls…

`),Ja=K(`

`),Ya=K(`
About browser controls

Controls require a supported live request from a connected shared + app-server session. Local observations alone cannot provide them.

`),Xa=K(` `,1),Za=K(` `),Qa=K(`Grants permission beyond this one command. Check the scope + carefully.`),$a=K(``),eo=K(``),to=K(``),no=K(``),ro=K(` `,1),io=K(`
  • `),ao=K(`
    View fixed choices

    Type one of these choices exactly. Your answer stays masked.

      `),oo=K(` `,1),so=K(`

      `,1),co=K(``),lo=K(`

      `,1),uo=K(`

      `);function fo(e,t){Ke(t,!0);let n=[],r=zi(t,`observedCommand`,3,``),i=zi(t,`review`,3,``),a=zi(t,`suspended`,3,!1),o=zi(t,`onProtectedChange`,3,e=>{}),s=I(null),c=I(Qt([])),l=I(null),u=I(``),d=I(0),f=I(Qt(Date.now())),p=I(!1),m=I(``),h=I(!1),g=I(!1),_=I(``);xn(()=>(o()(G(p)||G(c).some(e=>e.length>0)),()=>o()(!1)));let v=P(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),y=P(()=>!$.connected||!!$.data?.sessionsError),b=P(()=>i()!==`profile`&&G(s)?.kind===`prompt`&&!G(s).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),x=P(()=>!G(y)&&!G(g)&&!!G(s)?.id&&G(s).kind===`approval`&&G(_)!==G(s).id),S=P(()=>G(x)?G(s).command:r()),C=P(()=>!!G(u)&&G(f)G(s)?.questions?.length?G(s).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),T=P(()=>G(s)?.kind===`approval`||G(s)?.kind===`profile`?G(l)!==null:G(c).length===G(w).length&&G(c).every((e,t)=>e.trim().length>0&&(G(w)[t].freeText||G(w)[t].options?.includes(e))));xn(()=>{(G(y)||a()||G(b)||G(f)>=G(d))&&L(u,``)});let E=new AbortController;Bi(()=>{let e,n=setInterval(()=>{L(f,Date.now(),!0)},1e3);async function r(){try{let e=await ca(`offer`,{session:t.session,...i()?{review:i()}:{}},E.signal);if(E.signal.aborted)return;L(g,!1),G(s)?.id!==e.id&&(L(u,``),L(l,null),L(c,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),L(s,e,!0),G(h)&&e.id&&e.id!==G(_)&&(L(m,``),L(h,!1))}catch{E.signal.aborted||(L(s,null),L(g,!0),L(u,``))}finally{E.signal.aborted||(e=setTimeout(r,2e3))}}return r(),()=>{E.abort(),clearTimeout(e),clearInterval(n)}});async function ee(){if(!G(s)?.id||G(p)||G(y)||a()||G(b)||!G(T))return;let e=G(s).id;L(p,!0),L(m,``),L(h,!1),L(u,``);try{let n=await ca(`prepare`,{session:t.session,...i()?{review:i()}:{},offer:e,...G(s).kind===`approval`||G(s).kind===`profile`?{choice:G(l)}:{answers:[...G(c)]}},E.signal);G(s)?.id===e&&!E.signal.aborted&&!G(y)&&!a()&&!G(b)&&(L(u,n.confirmation,!0),L(d,Date.parse(n.expires),!0))}catch(e){E.signal.aborted||L(m,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{L(p,!1)}}async function te(){if(!G(s)?.id||G(p)||a()||G(b)||!G(C))return;let e=G(s).id,n=G(s).kind,r=G(u);L(u,``),L(p,!0),L(_,e,!0);try{await ca(`commit`,{session:t.session,...i()?{review:i()}:{},offer:e,confirmation:r},E.signal),L(h,!0),L(m,n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){L(m,e instanceof oa?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{L(p,!1),L(c,[],!0),L(l,null)}}var D=Ir(),ne=z(D),re=e=>{var r=uo(),a=R(r),o=B(a,!0),b=V(a,2),E=e=>{var t=Ha(),n=z(t),r=B(n),i=V(n,6),a=B(i,!0),o=B(V(i,6),!0);Te(2),H(()=>{J(r,`Your ${G(s).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),J(a,G(s).profile.current),J(o,G(s).profile.proposed)}),q(e,t)};Y(b,e=>{G(s)?.profile&&!G(y)&&!G(g)&&e(E)});var D=V(b,2),ne=e=>{var t=Ua();let n;var r=B(t,!0);H(()=>{n=li(t,1,`svelte-1oupzfc`,null,n,{notice:!G(h),sent:G(h)}),J(r,G(m))}),q(e,t)};Y(D,e=>{G(m)&&e(ne)});var re=V(D,2),ie=e=>{var t=Wa(),n=z(t),r=B(n,!0),i=B(V(n,2),!0);H(()=>{J(r,G(x)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(i,G(S))}),q(e,t)},ae=e=>{q(e,Ga())};Y(re,e=>{G(S)?e(ie):i()!==`profile`&&G(v)===`APPROVAL NEEDED`&&!G(h)&&e(ae,1)});var oe=V(re,2),se=e=>{q(e,Ka())},ce=e=>{q(e,qa())},le=e=>{var t=Xa(),n=z(t),r=e=>{var t=Ja(),n=B(t,!0);H(e=>J(n,e),[()=>G(v)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(v)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(G(v)===`WORKING`||!G(h)&&!G(p))&&e(r)});var i=V(n,2),a=e=>{q(e,Ya())},o=P(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(v)||``)&&!G(h));Y(i,e=>{G(o)&&e(a)}),q(e,t)},ue=e=>{var r=lo(),a=z(r),o=B(a),m=V(a,2),h=R(m),g=B(h,!0),_=V(h,2),v=e=>{var r=Ir();Z(z(r),17,()=>G(s).choices||[],X,(e,r,a)=>{var o=$a(),s=R(o);Si(s),s.value=s.__value=a;var c=V(s),u=V(c),d=e=>{var t=Za(),n=B(t,!0);H(()=>J(n,G(r).detail)),q(e,t)};Y(u,e=>{G(r).detail&&e(d)});var f=V(u,2),p=e=>{q(e,Qa())};Y(f,e=>{G(r).persistent&&e(p)}),j(o),H(()=>{Q(s,`name`,`decision-`+t.session+`-`+i()),J(c,` ${G(r).label??``} `)}),Oi(n,[],s,()=>G(l),e=>L(l,e)),q(e,o)}),q(e,r)},b=e=>{var t=Ir();Z(z(t),17,()=>G(w),X,(e,t,n)=>{var r=oo(),i=z(r),a=R(i),o=V(a),s=e=>{var t=eo();Si(t),Ei(t,()=>G(c)[n],e=>G(c)[n]=e),q(e,t)},l=e=>{var r=no(),i=R(r);i.value=i.__value=``,Z(V(i),17,()=>G(t).options||[],X,(e,t)=>{var n=to(),r=B(n,!0),i={};H(()=>{J(r,G(t)),i!==(i=G(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),j(r),hi(r),gi(r,()=>G(c)[n],e=>G(c)[n]=e),q(e,r)},u=e=>{var r=ro(),i=z(r);ot(i);var a=V(i,2),o=e=>{var n=Ja(),r=B(n);H(e=>J(r,`Suggested answers: ${e??``}`),[()=>G(t).options.join(` · `)]),q(e,n)};Y(a,e=>{G(t).options?.length&&e(o)}),Ei(i,()=>G(c)[n],e=>G(c)[n]=e),q(e,r)};Y(o,e=>{G(t).secret?e(s):G(t).freeText?e(u,-1):e(l,1)}),j(i);var d=V(i,2),f=e=>{var n=ao(),r=V(R(n),4);Z(r,21,()=>G(t).options||[],X,(e,t)=>{var n=io(),r=B(n,!0);H(()=>J(r,G(t))),q(e,n)}),j(r),j(n),q(e,n)};Y(d,e=>{G(t).secret&&!G(t).freeText&&e(f)}),H(()=>J(a,`${G(t).text??``} `)),q(e,r)}),q(e,t)};Y(_,e=>{G(s).kind===`approval`||G(s).kind===`profile`?e(v):e(b,-1)}),j(m);var x=V(m,2),S=e=>{var t=so(),n=z(t),r=B(n),i=V(n,2),a=B(i),o=V(i,2);H(e=>{J(r,`Check the target and ${G(s).kind===`profile`?`profile above`:G(s).kind===`approval`?`exact command and permission scope`:`message above`}. This will send to Codex; it may start work + using your quota. Confirmation expires in ${e??``}s.`),i.disabled=G(p)||G(y),J(a,`CONFIRM ${(G(s).kind===`approval`||G(s).kind===`profile`?G(s).choices?.[G(l)]?.label:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((G(d)-G(f))/1e3))]),Tr(`click`,i,te),Tr(`click`,o,()=>{L(u,``)}),q(e,t)},E=e=>{var t=co(),n=B(t,!0);H(()=>{t.disabled=G(p)||G(y)||!G(T),J(n,G(p)?`SENDING…`:`REVIEW BEFORE SENDING`)}),Tr(`click`,t,ee),q(e,t)};Y(x,e=>{G(C)?e(S):e(E,-1)}),H(()=>{J(o,`TARGET // ${G(s).thread??``} // ${(G(s).directory||`Directory unavailable`)??``}`),m.disabled=G(p)||G(C)||G(y),J(g,G(s).kind===`approval`||G(s).kind===`profile`?`Choose a decision`:`Reply to this session`)}),q(e,r)};Y(oe,e=>{G(y)||G(g)?e(se):G(s)?G(s).id?G(_)!==G(s).id&&e(ue,3):e(le,2):e(ce,1)}),j(r),H(()=>J(o,i()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(ne,e=>{G(b)||e(re)}),q(e,D),qe()}Er([`click`]);var po=K(`
      `);function mo(e,t){Ke(t,!0);let n=zi(t,`active`,3,!1),r=P(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!t.session.text.trim()),i=I(!1),a=I(``),o=I(!1);xn(()=>{if(!G(o))return;let e=setTimeout(()=>{L(o,!1)},150);return()=>clearTimeout(e)}),xn(()=>{t.session.text,t.session.status,L(a,``)});async function s(){if(!G(r)||G(i))return;let e=t.session.text;L(i,!0),L(o,!0),L(a,``);try{await navigator.clipboard.writeText(e),t.session.text===e&&L(a,`Copied.`)}catch{t.session.text===e&&L(a,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{L(i,!1)}}function c(e){!n()||!G(r)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),s())}var l=Ir();wr(`keydown`,tn,c);var u=z(l),d=e=>{var t=po(),n=R(t),r=B(n,!0),c=V(n,2);let l;j(t),H(()=>{J(r,G(a)),c.disabled=G(i),l=li(c,1,`svelte-543j00`,null,l,{flashed:G(o)})}),Tr(`click`,c,s),q(e,t)};Y(u,e=>{G(r)&&e(d)}),q(e,l),qe()}Er([`click`]);var ho=K(`

      `),go=K(`

      `),_o=K(`
       
      `),vo=K(`

      Command unavailable from this observation. Open Codex to inspect the + request.

      `),yo=K(`

      `,1),bo=K(`

      `),xo=K(`
       
      `,1),So=K(`
      `),Co=K(`

      Session connection or refresh unavailable. Context and telemetry may be + stale.

      `),wo=K(`

      Some quota profile checks are unavailable. Only sessions with freshly + verified quota and settings can be updated; previous outcome notices remain + visible.

      `),To=K(` `),Eo=K(` `),Do=K(``),Oo=K(`

      Read only — reply or approve in Codex.

      `),ko=K(`

      `),Ao=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),jo=K(`
      `),Mo=K(`
      `),No=K(`

      This session is no longer in the current observation. Return to sessions.

      `),Po=K(`

      `),Fo=K(` `),Io=K(`

      `),Lo=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Ro=K(` `,1),zo=K(`

      `),Bo=K(`

      TOKEN ACTIVITY // 30 SECOND SAMPLES

      `),Vo=K(`

      TOKENS

      FULL DETAIL →
      `),Ho=K(`

      No locally observed sessions yet. Keep Codex running alongside + Codexometer.

      `),Uo=K(`

      ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

      `,1),Wo=K(`

      SESSION TOTALS

      `,1);function Go(e,t){Ke(t,!0);let n=(e,t=f,n,r)=>{let i=vt(()=>g(n?.(),!0)),a=vt(()=>g(r?.(),!1));var o=xo(),s=z(o),c=e=>{var n=ho();let r;var i=B(n,!0);H(e=>{r=li(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>b(t())]),q(e,n)},l=P(()=>b(t())&&(!G(a)||G(d)||t().status===`CHECK SESSION`));Y(s,e=>{G(l)&&e(c)});var u=V(s,2),p=e=>{var n=go(),r=B(n,!0);H(()=>J(r,t().contextKind||`LAST ACTIVITY`)),q(e,n)};Y(u,e=>{G(i)&&e(p)});var m=V(u,2),h=B(m,!0),_=V(m,2),v=e=>{var n=yo(),r=V(z(n),2),i=B(r,!0),a=V(r,2),o=e=>{var n=_o(),r=B(n,!0);H(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,vo())};Y(a,e=>{t().command?e(o):e(s,-1)}),H(()=>J(i,G(d)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(_,e=>{(!G(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(v)});var y=V(_,2),x=e=>{var n=bo(),r=B(n);H(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(y,e=>{G(a)||e(x)}),H(()=>J(h,t().text||`No session context available.`)),q(e,o)},r=zi(t,`params`,19,()=>({})),i=P(()=>$.data?.sessions||[]),a=P(()=>$.data?.control&&$.data.profiles||[]),o=I(!1);function s(e,t){if(r().id&&r().id!==t&&G(o)){e.preventDefault();return}h(t)}xn(()=>{let e=r().id;e&&hr(()=>{Zi.selected=e,na(e,2)})});let c=P(()=>G(i).find(e=>e.id===r().id)),l=P(()=>new URLSearchParams(Ui.querystring).get(`review`)===`profile`&&G(a).some(e=>e.session===r().id&&e.pending)),u=P(()=>G(i).some(e=>e.id===Zi.selected)?Zi.selected:G(i)[0]?.id),d=P(()=>!$.connected||!!$.data?.sessionsError),p=P(()=>[[`OBSERVED TOKENS`,ra(G(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,ra(G(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,G(d)?`—`:ra(G(i).filter(e=>e.status===t).length)])]),m=P(()=>G(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function h(e){Zi.selected=e,fr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function v(e,t){if(h(e),r().id){t<0&&(na(e,2),location.hash=`/sessions`);return}let n=ea(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):na(e,n)}function y(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),v(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||G(u)))e.preventDefault(),v(r().id||G(u),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&G(i).length){e.preventDefault();let t=G(i).findIndex(e=>e.id===G(u));h(G(i)[Math.max(0,Math.min(G(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function b(e){return G(d)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}var x=Wo();wr(`keydown`,tn,y);var S=z(x),C=B(V(R(S),2));j(S);var w=V(S,2);let T;Z(w,21,()=>G(p),X,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=So(),o=R(a),s=B(o,!0),c=B(V(o,2),!0);j(a),H(()=>{J(s,r()),J(c,i())}),q(e,a)}),j(w);var E=V(w,2),ee=B(E),te=V(E,2),D=e=>{q(e,Co())};Y(te,e=>{G(d)&&e(D)});var ne=V(te,2),re=e=>{q(e,wo())};Y(ne,e=>{$.data?.profileError&&e(re)});var ie=V(ne,2),ae=e=>{var t=Do(),n=R(t);Z(n,17,()=>G(m),X,(e,t)=>{var n=To();let r;var i=B(n);H(e=>{r=li(n,1,`button`,null,r,{approval:G(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),J(i,`${G(t).status??``} // ${(G(t).directory||G(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),Tr(`click`,n,()=>h(G(t).id)),q(e,n)}),Z(V(n,2),17,()=>G(a).filter(e=>e.pending&&G(i).some(t=>t.id===e.session)),X,(e,t)=>{var n=Eo(),a=B(n);H((e,i)=>{Q(n,`title`,r().id&&r().id!==G(t).session&&G(o)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(a,`QUOTA THRESHOLD // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session)+`?review=profile`,()=>G(i).find(e=>e.id===G(t).session)?.directory||G(t).session]),Tr(`click`,n,e=>s(e,G(t).session)),q(e,n)}),j(t),q(e,t)},oe=P(()=>(G(m).length||G(a).some(e=>e.pending))&&!G(d));Y(ie,e=>{G(oe)&&e(ae)});var se=V(ie,2),ce=e=>{var t=Ir(),i=z(t),s=e=>{var t=Mo(),i=R(t),s=R(i),u=R(s);let f;var p=V(u);j(s);var m=V(s,2);j(i);var g=V(i,2),_=B(g),v=V(g,2);let y;var b=R(v),x=R(b);n(x,()=>G(c),()=>!0,()=>!0),j(b);var S=V(b,2),C=e=>{var t=Ir();Jr(z(t),()=>G(c).id,e=>{fo(e,{get session(){return G(c).id},get observedCommand(){return G(c).command},get suspended(){return G(l)},onProtectedChange:e=>{L(o,e,!0)}})}),q(e,t)},w=e=>{q(e,Oo())};Y(S,e=>{$.data?.control?e(C):e(w,-1)}),j(v);var T=V(v,2);Z(T,17,()=>G(a).filter(e=>e.session===G(c).id),e=>e.session,(e,t)=>{var n=jo(),r=R(n),i=e=>{var n=ko(),r=B(n,!0);H(()=>J(r,G(t).notice)),q(e,n)};Y(r,e=>{G(t).notice&&e(i)});var a=V(r,2),o=e=>{fo(e,{get session(){return G(c).id},review:`profile`})},s=e=>{var t=Ao();H(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(c).id)+`?review=profile`]),q(e,t)};Y(a,e=>{G(t).pending&&G(l)?e(o):G(t).pending&&e(s,1)}),j(n),H(()=>Q(n,`id`,`quota-profile-`+G(c).id)),q(e,n)});var E=V(T,2),ee=e=>{var t=Ir();Jr(z(t),()=>G(c).id,e=>{mo(e,{get session(){return G(c)},active:!0})}),q(e,t)};Y(E,e=>{G(l)||e(ee)}),j(t),H(e=>{f=li(u,1,`lamp lit`,null,f,{working:G(c).status===`WORKING`&&!G(d)}),J(p,`${(G(d)?`STALE`:G(l)?`QUOTA THRESHOLD`:G(c).status)??``} // ${G(c).directory??``}`),J(_,`${e??``} TOKENS // ${G(c).id??``} // CONTEXT SOURCE // ${(G(c).source||`LOCAL`)??``}`),y=di(v,``,y,{display:G(l)?`none`:void 0})},[()=>ra(G(c).tokens)]),Tr(`click`,m,()=>{h(r().id),na(r().id,2)}),q(e,t)},u=e=>{q(e,No())};Y(i,e=>{G(c)?e(s):e(u,-1)}),q(e,t)},le=e=>{var t=Uo(),r=z(t),o=V(R(r),2),c=R(o),l=V(c,2);j(o),j(r);var f=V(r,2);Z(f,17,()=>G(i),e=>e.id,(e,t)=>{let r=P(()=>ea(G(t).id));var i=Vo();let o;var c=R(i),l=R(c),f=R(l);let p;var m=V(f,1,!0);j(l);var g=V(l,2),_=B(g,!0),y=V(g,2),b=R(y);Te(),j(y);var x=V(y,2),S=B(x),C=V(x,2),w=B(C),T=V(C,2),E=R(T),ee=V(E,2),te=B(ee,!0),D=V(ee,2);j(T);var ne=V(T,2),re=V(ne,2),ie=e=>{var n=Po(),r=B(n,!0);H(()=>J(r,G(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:G(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),q(e,n)},ae=P(()=>!G(d)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(G(t).status));Y(re,e=>{G(ae)&&e(ie)}),j(c);var oe=V(c,2),se=e=>{var r=zo(),i=R(r),o=R(i),c=B(o,!0),l=V(o,2),f=e=>{var n=Fo(),r=B(n,!0);H(e=>{Q(n,`href`,e),J(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),q(e,n)};Y(l,e=>{!G(d)&&G(t).status===`APPROVAL NEEDED`&&e(f)}),j(i);var p=V(i,2);n(p,()=>G(t),()=>!1);var m=V(p,2);Z(m,17,()=>G(a).filter(e=>e.session===G(t).id),X,(e,n)=>{var r=Ro(),i=z(r),a=e=>{var t=Io(),r=B(t,!0);H(()=>J(r,G(n).notice)),q(e,t)};Y(i,e=>{G(n).notice&&e(a)});var o=V(i,2),c=e=>{var n=Lo();H(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(t).id)+`?review=profile`]),Tr(`click`,n,e=>s(e,G(t).id)),q(e,n)};Y(o,e=>{G(n).pending&&e(c)}),q(e,r)});var h=V(m,2);{let e=P(()=>G(u)===G(t).id);mo(h,{get session(){return G(t)},get active(){return G(e)}})}j(r),H(()=>J(c,G(t).contextKind||`LAST ACTIVITY`)),q(e,r)};Y(oe,e=>{G(r)>0&&e(se)});var ce=V(oe,2),le=e=>{var n=Bo(),r=V(R(n),2);{let e=P(()=>(G(t).samples||[]).map(e=>e.tokens));Va(r,{get values(){return G(e)},capacity:120})}var i=B(V(r,2));j(n),H(()=>J(i,`LAST ${(G(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(ce,e=>{G(r)<2&&e(le)}),j(i),H((e,n,a)=>{o=li(i,1,`session-row`,null,o,{selected:G(u)===G(t).id,wide:G(r)===2,split:G(r)===1}),Q(i,`aria-label`,`Session `+(G(t).directory||G(t).id)),p=li(f,1,`lamp lit`,null,p,{working:G(t).status===`WORKING`&&!G(d)}),J(m,G(d)?`STALE`:G(t).status),Q(g,`aria-pressed`,G(u)===G(t).id),J(_,G(t).directory||G(t).id),J(b,`${e??``} `),J(S,`${G(t).agents??``} LINKED AGENTS`),J(w,`ACTIVE // ${n??``}`),E.disabled=G(r)===0,Q(ee,`aria-expanded`,G(r)>0),J(te,G(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ne,`href`,a)},[()=>ra(G(t).tokens),()=>ia(G(t).activity),()=>`#/sessions/`+encodeURIComponent(G(t).id)]),Tr(`click`,g,()=>h(G(t).id)),Tr(`click`,E,()=>v(G(t).id,-1)),Tr(`click`,ee,()=>{h(G(t).id),na(G(t).id,+!G(r))}),Tr(`click`,D,()=>v(G(t).id,1)),Tr(`click`,ne,()=>h(G(t).id)),q(e,i)});var p=V(f,2),m=e=>{q(e,Ho())};Y(p,e=>{G(i).length||e(m)}),Tr(`click`,c,()=>ta(1)),Tr(`click`,l,()=>ta(0)),q(e,t)};Y(se,e=>{r().id?e(ce):e(le,-1)}),H(e=>{J(C,`OBSERVED ${e??``}`),T=li(w,1,`session-totals`,null,T,{stale:G(d)}),J(ee,`${G(d)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens + observed since this server started for currently listed sessions; linked + agents are already included. Totals can decrease when a session leaves the + list. History samples every 30 seconds. Not account-wide totals.`)},[()=>ia($.data?.sessionsAt)]),q(e,x),qe()}Er([`click`]);var Ko=864e5;function qo(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Jo(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=qo(r,-t),a=new Date(i.getTime()+Ko);if(e===n)return{start:a,end:r};r=i}}var Yo=K(`

      History refresh failed. Any displayed history is the last successful + observation.

      `),Xo=K(``),Zo=K(`
      `),Qo=K(`

      LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

      `,1),$o=K(`
      `,1),es=K(` `),ts=K(`

      LIFETIME TOKENS

      PEAK DAY

      CURRENT STREAK

      DAYS

      Accessible data table
      Date (UTC)Tokens

      `,1),ns=K(`

      History unavailable or awaiting a matching account observation. Missing + history is not treated as zero usage.

      `),rs=K(`

      USAGE // ACCOUNT HISTORY

      Account-wide history reported by Codex, not the local Sessions counter. Dates + use UTC. Historical resets are not provided by this data.

      `,1);function is(e,t){Ke(t,!0);let n=I(`daily`),r=I(12),i=I(0),a=P(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Jo(new Date,G(r),G(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=P(()=>Math.max(1,...G(a).map(e=>e.tokens))),s=P(()=>G(a).length?new Date(G(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=P(()=>{if(G(n)===`monthly`){let e=new Map;for(let t of G(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return G(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=rs(),u=V(z(l),4),d=R(u),f=V(R(d)),p=R(f);p.value=p.__value=`daily`;var m=V(p);m.value=m.__value=`monthly`;var h=V(m);h.value=h.__value=`cumulative`,j(f),hi(f),j(d);var g=V(d),_=V(R(g)),v=R(_);v.value=v.__value=6;var y=V(v);y.value=y.__value=12,j(_),hi(_),j(g);var b=V(g),x=V(b);j(u);var S=V(u,2),C=e=>{q(e,Yo())};Y(S,e=>{$.data?.usageError&&e(C)});var w=V(S,2),T=e=>{var t=ts(),r=z(t),i=R(r),l=B(V(R(i),2),!0);j(i);var u=V(i,2),d=B(V(R(u),2),!0);j(u);var f=V(u,2),p=V(R(f),2),m=R(p);Te(),j(p),j(f),j(r);var h=V(r,2),g=R(h),_=B(g),v=V(g,2),y=e=>{var t=Qo(),n=z(t),r=R(n),i=R(r);Z(i,17,()=>Array(G(s)),X,(e,t)=>{q(e,Xo())}),Z(V(i,2),17,()=>G(a),X,(e,t)=>{var n=Zo();let r,i;H(e=>{r=li(n,1,`heat-cell`,null,r,{zero:G(t).tokens===0}),Q(n,`title`,e),i=di(n,``,i,{opacity:G(t).tokens?.25+.75*G(t).tokens/G(o):1})},[()=>`${G(t).date}: ${ra(G(t).tokens)} tokens`]),q(e,n)}),j(r),j(n),Te(2),q(e,t)},b=e=>{var t=$o(),r=z(t);{let e=P(()=>G(c).map(e=>e.tokens)),t=P(()=>G(n)+` usage`);Va(r,{get values(){return G(e)},get label(){return G(t)}})}var i=V(r,2),a=R(i),o=B(a,!0),s=B(V(a),!0);j(i),H(e=>{J(o,G(c)[0]?.date),J(s,e)},[()=>G(c).at(-1)?.date]),q(e,t)};Y(v,e=>{G(n)===`daily`?e(y):e(b,-1)});var x=V(v,2),S=V(R(x),2),C=R(S),w=V(R(C));Z(w,21,()=>G(n)===`daily`?G(a):G(c),X,(e,t)=>{var n=es(),r=R(n),i=B(r,!0),a=B(V(r),!0);j(n),H(e=>{J(i,G(t).date),J(a,e)},[()=>ra(G(t).tokens)]),q(e,n)}),j(w),j(C),j(S),j(x),j(h);var T=B(V(h,2));H((e,t,n,r,i)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${G(a)[0]?.date??``} — ${r??``}`),J(T,`OBSERVED ${i??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>ra($.data.usage.summary.lifetimeTokens),()=>ra($.data.usage.summary.peakDailyTokens),()=>ra($.data.usage.summary.currentStreakDays),()=>G(a).at(-1)?.date,()=>ia($.data.usageAt)]),q(e,t)},E=e=>{q(e,ns())};Y(w,e=>{$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(T):e(E,-1)}),H(()=>x.disabled=G(i)===0),gi(f,()=>G(n),e=>L(n,e)),Tr(`change`,_,()=>L(i,0)),gi(_,()=>G(r),e=>L(r,e)),Tr(`click`,b,()=>Yt(i)),Tr(`click`,x,()=>Yt(i,-1)),q(e,l),qe()}Er([`change`,`click`]),We();var as=K(`

      Quota refresh failed. Policy state is based on the last successful + observation.

      `),os=K(`

      `),ss=K(`

      The longest Codex quota window selects one active model profile. ASK + creates a per-session review; AUTO applies the profile on the next + eligible check.

      `,1),cs=K(`

      No threshold-based model steps were configured at launch.

      `);function ls(e,t){Ke(t,!1),Fi();var n=Ir(),r=z(n),i=e=>{var t=ss(),n=z(t),r=B(n),i=V(n,2),a=e=>{q(e,as())};Y(i,e=>{$.data.quotaError&&e(a)});var o=V(i,2),s=R(o),c=B(s),l=V(s,4);Z(l,5,()=>$.data.thresholds,X,(e,t)=>{var n=os();let r;var i=R(n),a=B(i),o=V(i,2),s=R(o),c=B(s,!0),l=B(V(s,2));j(o);var u=V(o,2),d=B(u,!0),f=B(V(u,2));j(n),H((e,i)=>{r=li(n,1,``,null,r,{active:G(t).state===`ACTIVE`,next:G(t).state===`NEXT`}),J(a,`${G(t).threshold??``}%`),J(c,G(t).model),J(l,`${e??``} REASONING // ${i??``} + SPEED`),J(d,G(t).mode),J(f,`${G(t).state??``}${G(t).state===`NEXT`?` // ${G(t).remaining||0} PP TO GO`:``}`)},[()=>G(t).effort.toUpperCase(),()=>G(t).speed.toUpperCase()]),q(e,n)}),j(l),j(o),H(e=>{J(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),J(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ia($.data.quotaAt)]),q(e,t)},a=e=>{q(e,cs())};Y(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),q(e,n),qe()}var us=K(`

      Page not found

      Return to Quota

      `,1);function ds(e){var t=us();Te(2),q(e,t)}var fs=K(` `),ps=K(`

      `),ms=K(`

      Connecting to your local Codexometer…

      `),hs=K(``),gs=K(`
      CODEXOMETER

      Your quota. Your sessions. Your command centre.

      `);function _s(e,t){Ke(t,!0);let n={"/":Ra,"/quota/:view?":Ra,"/sessions/:id?":Go,"/usage":is,"/thresholds":ls,"*":ds},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=P(()=>$.data?.thresholds?.length?{quota:r.quota,thresholds:/^\/thresholds\/?$/,sessions:r.sessions,usage:r.usage}:r),a=I(`hacker`),o=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];xn(()=>{Qi()}),xn(()=>{if($.data){if(/^\/thresholds\/?$/.test(Ui.location)&&!$.data.thresholds?.length){location.hash=`#/quota/`+Zi.view;return}for(let[e,t]of Object.entries(G(i)))t.test(Ui.location)&&(Zi.tab=e)}}),Bi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&o.includes(e)&&L(a,e,!0)}catch{}return la()});function s(){try{localStorage.setItem(`codexometer.web.theme`,G(a))}catch{}}var c=gs(),l=R(c),u=V(R(l),2),d=R(u);let f;var p=V(d,1,!0),m=B(V(p));j(u),j(l);var h=V(l,2);Z(h,21,()=>Object.entries(G(i)),X,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1],a=P(()=>i().test(Ui.location));var o=fs();let s;var c=B(o,!0);H(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+Zi.view:`#/`+r()),Q(o,`aria-current`,G(a)?`page`:void 0),s=li(o,1,``,null,s,{active:G(a)}),J(c,e)},[()=>r().toUpperCase()]),q(e,o)}),j(h);var g=V(h,2),v=R(g),y=e=>{var t=ps(),n=B(t,!0);H(()=>J(n,$.error)),q(e,t)};Y(v,e=>{$.error&&e(y)});var b=V(v,2),x=e=>{Ki(e,{get routes(){return n}})},S=e=>{q(e,ms())};Y(b,e=>{$.data?e(x):$.error||e(S,1)}),j(g);var C=V(g,2),w=R(C),T=B(w),E=V(w,2),ee=B(E,!0),te=V(E,2),D=V(R(te));Z(D,21,()=>o,X,(e,t)=>{var n=hs(),r=B(n,!0),i={};H(e=>{J(r,e),i!==(i=G(t))&&(n.value=(n.__value=i)??``)},[()=>G(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),j(D),hi(D),j(te),j(C),j(c),H(()=>{Q(c,`data-theme`,G(a)),f=li(d,1,`lamp`,null,f,{lit:$.connected}),J(p,$.connected?`CONNECTED`:`OFFLINE`),J(m,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),J(T,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(ee,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),Tr(`change`,D,s),gi(D,()=>G(a),e=>L(a,e)),q(e,c),qe()}Er([`change`]),Hr(_s,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-S94ToOzX.js b/internal/web/dist/assets/index-S94ToOzX.js deleted file mode 100644 index 2b6de6f..0000000 --- a/internal/web/dist/assets/index-S94ToOzX.js +++ /dev/null @@ -1,26 +0,0 @@ -(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 e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function h(e,t,n=!1){return e===void 0?n?t():t:e}function g(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var _=1024,v=2048,y=4096,b=8192,x=16384,S=32768,C=1<<25,w=65536,T=1<<19,E=1<<20,ee=1<<25,te=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`component`),se=Symbol(`legacy props`),ce=Symbol(``),le=Symbol(`attributes`),ue=Symbol(`class`),de=Symbol(`style`),fe=Symbol(`text`),pe=Symbol(`form reset`),me=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},he=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ge={},D=Symbol(`uninitialized`),_e=`http://www.w3.org/1999/xhtml`;function ve(){console.warn(`https://svelte.dev/e/derived_inert`)}function ye(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function be(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function xe(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var O=!1;function Se(e){O=e}var k;function Ce(e){if(e===null)throw ye(),ge;return k=e}function we(){return Ce(ln(k))}function A(e){if(O){if(ln(k)!==null)throw ye(),ge;k=e}}function Te(e=1){if(O){for(var t=e,n=k;t--;)n=ln(n);k=n}}function Ee(e=!0){for(var t=0,n=k;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=ln(n);e&&n.remove(),n=i}}function De(e){if(!e||e.nodeType!==8)throw ye(),ge;return e.data}function Oe(e){return e===this.v}function ke(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ae(e){return!ke(e,this.v)}function je(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Me(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Ne(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Pe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Fe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ie(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Le(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Re(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ze(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Be(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ve(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function He(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ue=!1;function We(){Ue=!0}var j=null;function Ge(e){j=e}function Ke(e,t=!1,n){j={p:j,i:!1,c:null,e:null,s:e,x:null,r:U,l:Ue&&!t?{s:null,u:null,$:[]}:null}}function qe(e){var t=j,n=t.e;if(n!==null){t.e=null;for(var r of n)Sn(r)}return e!==void 0&&(t.x=e),t.i=!0,j=t.p,Je(e)}function Je(e={}){return i(e,oe,{value:!0}),e}function Ye(){return!Ue||j!==null&&j.l===null}var Xe=[];function Ze(){var e=Xe;Xe=[],p(e)}function Qe(e){if(Xe.length===0&&!Ot){var t=Xe;queueMicrotask(()=>{t===Xe&&Ze()})}Xe.push(e)}function $e(){for(;Xe.length>0;)Ze()}var et=~(v|y|_);function M(e,t){e.f=e.f&et|t}function tt(e){e.f&512||e.deps===null?M(e,_):M(e,y)}function nt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=te,nt(t.deps))}function rt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),nt(e.deps),M(e,_)}var it=!1;function at(e){var t=it;try{return it=!1,[e(),it]}finally{it=t}}function ot(e){O&&cn(e)!==null&&un(e)}var st=!1;function ct(){st||(st=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[pe]?.()})},{capture:!0}))}function lt(e){var t=H,n=U;Gn(null),Kn(null);try{return e()}finally{Gn(t),Kn(n)}}function ut(e,t,n,r=n){e.addEventListener(t,()=>lt(n));let i=e[pe];e[pe]=i?()=>{i(),r(!0)}:()=>r(!0),ct()}function dt(e,t,n,r){let i=Ye()?ht:vt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=U,c=ft(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){hn(e,s)}pt()}}var d=mt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>_t(e))).then(u).catch(e=>hn(e,s)).finally(d)}l?l.then(()=>{c(),f(),pt()}):f()}function ft(){var e=U,t=H,n=j,r=P;return function(i=!0){Kn(e),Gn(t),Ge(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function pt(e=!0){Kn(null),Gn(null),Ge(null),e&&P?.deactivate()}function mt(){var e=U,t=e.b,n=P,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ht(e){var t=2|v;return U!==null&&(U.f|=T),{ctx:j,deps:null,effects:null,equals:Oe,f:t,fn:e,reactions:null,rv:0,v:D,wv:0,parent:U,ac:null}}var gt=Symbol(`obsolete`);function _t(e,t,n){let r=U;r===null&&Me();var i=void 0,a=Gt(D),o=!H,s=new Set;return Tn(()=>{var t=U,n=m();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==me&&n.reject(e)}).finally(pt)}catch(e){n.reject(e),pt()}var c=P;if(o){if(t.f&32768)var l=mt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(gt);else for(let e of s.values())e.reject(gt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==gt&&(c.activate(),t?(a.f|=ie,qt(a,t)):(a.f&8388608&&(a.f^=ie),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),bn(()=>{for(let e of s)e.reject(gt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function N(e){let t=ht(e);return Jn(t),t}function vt(e){let t=ht(e);return t.equals=Ae,t}function yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(me),t.ac=null}),t.fn!==null&&(t.teardown=f),lr(t,0),An(t))}function Ct(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&ur(t)}var wt=null,P=null,Tt=null,Et=null,Dt=null,Ot=!1,kt=!1,At=null,jt=null,Mt=0,Nt=1,Pt=class e{id=Nt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){wt===null?wt=this:(wt.#n=this,this.#t=wt),wt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)M(r,v),t(r);for(r of n.m)M(r,y),t(r)}this.#p.add(e)}#g(){this.#e=!0,Mt++>1e3&&(this.#x(),It());for(let e of this.#u)this.#d.delete(e),M(e,v),this.schedule(e);for(let e of this.#d)M(e,y),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=At=[],r=[],i=jt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Vt(e),this.#h()||this.discard(),t}if(P=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(At=null,jt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Bt(e,t);i.length>0&&P.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Tt=this,Rt(r),Rt(n),Tt=null,this.#s?.resolve();var s=P;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Ut.clear(),s.#g())}#_(e,t,n){e.f^=_;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=_:i&4?t.push(r):ir(r)&&(i&16&&this.#d.add(r),ur(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),M(i,v),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),P=this,this.#g()}#b(e){for(var t=0;t{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=m()).promise}static ensure(){if(P===null){let t=P=new e;!kt&&!Ot&&Qe(()=>{t.#e||t.flush()})}return P}apply(){Et=null}schedule(e){if(Dt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(At!==null&&t===U&&(H===null||!(H.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=_}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?wt=e:t.#t=e,this.linked=!1}}};function Ft(e){var t=Ot;Ot=!0;try{var n;for(e&&(P!==null&&!P.is_fork&&P.flush(),n=e());;){if($e(),P===null)return n;P.flush()}}finally{Ot=t}}function It(){try{Le()}catch(e){hn(e,Dt)}}var Lt=null;function Rt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Ut.clear();for(let e of Lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Lt.has(n)&&(Lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||ur(n)}}Lt.clear()}}Lt=null}}function zt(e){P.schedule(e)}function Bt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),M(e,_);for(var n=e.first;n!==null;)Bt(n,t),n=n.next}}function Vt(e){M(e,_);for(var t=e.first;t!==null;)Vt(t),t=t.next}var Ht=new Set,Ut=new Map,Wt=!1;function Gt(e,t){return{f:0,v:e,reactions:null,equals:Oe,rv:0,wv:0}}function F(e,t){let n=Gt(e,t);return Jn(n),n}function Kt(e,t=!1,n=!0){let r=Gt(e);return t||(r.equals=Ae),Ue&&n&&j!==null&&j.l!==null&&(j.l.s??=[]).push(r),r}function I(e,t,n=!1){return H!==null&&(!Wn||H.f&131072)&&Ye()&&H.f&4325394&&(qn===null||!qn.has(e))&&Ve(),qt(e,n?Qt(t):t,jt)}function qt(e,t,n=null){if(!e.equals(t)){Hn?Ut.set(e,t):Ut.has(e)||Ut.set(e,e.v);var r=Pt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&bt(t),Et===null&&tt(t)}e.wv=rr(),Zt(e,v,n),Ye()&&U!==null&&U.f&1024&&!(U.f&96)&&(Zn===null?Qn([e]):Zn.push(e)),!r.is_fork&&Ht.size>0&&!Wt&&Jt()}return t}function Jt(){Wt=!1;for(let e of Ht){e.f&1024&&M(e,y);let t;try{t=ir(e)}catch{t=!0}t&&ur(e)}Ht.clear()}function Yt(e,t=1){var n=W(e),r=t===1?n++:n--;return I(e,n),r}function Xt(e){I(e,e.v+1)}function Zt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ye(),a=r.length,o=0;o{if(tr===d)return e();var t=H,n=tr;Gn(null),nr(d);var r=e();return Gn(t),nr(n),r};return i&&r.set(`length`,F(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ze();var i=r.get(t);return i===void 0?f(()=>{var e=F(n.value,u);return r.set(t,e),e}):I(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>F(D,u));r.set(t,e),Xt(o)}}else I(n,D),Xt(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>F(Qt(s?e[n]:D),u)),r.set(n,o)),o!==void 0){var c=W(o);return c===D?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=W(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==D)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==D||Reflect.has(e,t);return(n!==void 0||U!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>F(i?Qt(e[t]):D,u)),r.set(t,n)),W(n)===D)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dF(D,u)),r.set(d+``,p)):I(p,D)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>F(void 0,u)),I(c,Qt(n)),r.set(t,c));else{l=c.v!==D;var m=f(()=>Qt(n));I(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&I(g,_+1)}Xt(o)}return!0},ownKeys(e){W(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==D});for(var[n,i]of r)i.v!==D&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Be()}})}function $t(e){try{if(typeof e==`object`&&e&&ae in e)return e[ae]}catch{}return e}function en(e,t){return Object.is($t(e),$t(t))}var tn,nn,rn,an;function on(){if(tn===void 0){tn=window,nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;rn=a(t,`firstChild`).get,an=a(t,`nextSibling`).get,u(e)&&(e[ue]=void 0,e[le]=null,e[de]=void 0,e.__e=void 0),u(n)&&(n[fe]=void 0)}}function sn(e=``){return document.createTextNode(e)}function cn(e){return rn.call(e)}function ln(e){return an.call(e)}function L(e,t){if(!O)return cn(e);var n=cn(k);if(n===null)n=k.appendChild(sn());else if(t&&n.nodeType!==3){var r=sn();return n?.before(r),Ce(r),r}return t&&pn(n),Ce(n),n}function R(e,t=!1){if(!O){var n=cn(e);return n instanceof Comment&&n.data===``?ln(n):n}if(t){if(k?.nodeType!==3){var r=sn();return k?.before(r),Ce(r),r}pn(k)}return k}function z(e,t=!1){if(!O)return cn(e);var n=L(e,t);return A(e),n}function B(e,t=1,n=!1){let r=O?k:e;for(var i;t--;)i=r,r=ln(r);if(!O)return r;if(n){if(r?.nodeType!==3){var a=sn();return r===null?i?.after(a):r.before(a),Ce(a),a}pn(r)}return Ce(r),r}function un(e){e.textContent=``}function dn(){return!1}function fn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function pn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function mn(e){var t=U;if(t===null)return H.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;hn(e,t)}function hn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function gn(e){U===null&&(H===null&&Ie(e),Fe()),Hn&&Pe(e)}function _n(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function vn(e,t){var n=U;n!==null&&n.f&8192&&(e|=b);var r={ctx:j,deps:null,nodes:null,f:e|v|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};P?.register_created_effect(r);var i=r;if(e&4)At===null?Pt.ensure().schedule(r):At.push(r);else if(t!==null){try{ur(r)}catch(e){throw Mn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=w))}if(i!==null&&(i.parent=n,n!==null&&_n(i,n),H!==null&&H.f&2&&!(e&64))){var a=H;(a.effects??=[]).push(i)}return r}function yn(){return H!==null&&!Wn}function bn(e){let t=vn(8,null);return M(t,_),t.teardown=e,t}function xn(e){gn(`$effect`);var t=U.f;if(!H&&t&32&&j!==null&&!j.i){var n=j;(n.e??=[]).push(e)}else return Sn(e)}function Sn(e){return vn(4|E,e)}function Cn(e){Pt.ensure();let t=vn(64|T,e);return(e={})=>new Promise(n=>{e.outro?Fn(t,()=>{Mn(t),n(void 0)}):(Mn(t),n(void 0))})}function wn(e){return vn(4,e)}function Tn(e){return vn(re|T,e)}function En(e,t=0){return vn(8|t,e)}function V(e,t=[],n=[],r=[]){dt(r,t,n,t=>{vn(8,()=>{e(...t.map(W))})})}function Dn(e,t=0){return vn(16|t,e)}function On(e){return vn(32|T,e)}function kn(e){var t=e.teardown;if(t!==null){let n=Hn,r=H;Un(!0),Gn(null);try{t.call(null)}catch(t){hn(t,e.parent)}finally{Un(n),Gn(r)}}}function An(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&<(()=>{e.abort(me)});var r=n.next;n.f&64?n.parent=null:Mn(n,t),n=r}}function jn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Mn(t),t=n}}function Mn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Nn(e.nodes.start,e.nodes.end),n=!0),e.f|=C,An(e,t&&!n),lr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();kn(e),e.f^=C,e.f|=x;var i=e.parent;i!==null&&i.first!==null&&Pn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Nn(e,t){for(;e!==null;){var n=e===t?null:ln(e);e.remove(),e=n}}function Pn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Fn(e,t,n=!0){var r=[];e.f|=256,In(e,r,!0);var i=()=>{n&&Mn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function In(e,t,n){if(!(e.f&8192)){e.f^=b;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);In(i,t,o?n:!1)}i=a}}}function Ln(e){e.f&=-257,Rn(e,!0)}function Rn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=b,e.f&1024||(M(e,v),Pt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Rn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function zn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:ln(n);t.append(n),n=i}}var Bn=null,Vn=!1,Hn=!1;function Un(e){Hn=e}var H=null,Wn=!1;function Gn(e){H=e}var U=null;function Kn(e){U=e}var qn=null;function Jn(e){H!==null&&(qn??=new Set).add(e)}var Yn=null,Xn=0,Zn=null;function Qn(e){Zn=e}var $n=1,er=0,tr=er;function nr(e){tr=e}function rr(){return++$n}function ir(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~te),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&Et===null&&M(e,_)}return!1}function ar(e,t,n=!0){var r=e.reactions;if(r!==null&&!(qn!==null&&qn.has(e)))for(var i=0;i{e.ac.abort(me)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=S;var f=sr(e);if(Ye()&&Zn!==null&&!Wn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Xn+Yn.length,r=0;r{s.ac.abort(me),s.ac=null,M(s,v)}),St(s),lr(s,0)}}function lr(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function xr(e,t,n,r,i){var a={capture:r,passive:i},o=br(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&bn(()=>{t.removeEventListener(e,o,a)})}function G(e,t,n){(t[_r]??={})[e]=n}function Sr(e){for(var t=0;t{wr=!1,Cr=null}));var s=0,c=Cr===e&&e[_r];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[_r]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=H,f=U;Gn(null),Kn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[_r]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s{throw e});throw p}}finally{e[_r]=t,delete e.currentTarget,Gn(d),Kn(f)}}}var Er=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Dr(e){return Er?.createHTML(e)??e}function Or(e){var t=fn(`template`);return t.innerHTML=Dr(e.replaceAll(``,``)),t.content}function kr(e,t){var n=U;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(O)return kr(k,null),k;i===void 0&&(i=Or(a?e:``+e),n||(i=cn(i)));var t=r||nn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=cn(t),s=t.lastChild;kr(o,s)}else kr(t,t);return t}}function Ar(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(O)return kr(k,null),k;if(!o){var e=cn(Or(a));if(i)for(o=document.createDocumentFragment();cn(e);)o.appendChild(cn(e));else o=cn(e)}var t=o.cloneNode(!0);if(i){var n=cn(t),r=t.lastChild;kr(n,r)}else kr(t,t);return t}}function jr(e,t){return Ar(e,t,`svg`)}function Mr(){if(O)return kr(k,null),k;var e=document.createDocumentFragment(),t=document.createComment(``),n=sn();return e.append(t,n),kr(t,n),e}function q(e,t){if(O){var n=U;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=k),we();return}e!==null&&e.before(t)}function Nr(){if(O&&k&&k.nodeType===8&&k.textContent?.startsWith(`$`)){let e=k.textContent.substring(1);return we(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Pr(e){let t=0,n=Gt(0),r;return()=>{yn()&&(W(n),En(()=>(t===0&&(r=mr(()=>e(()=>Xt(n)))),t+=1,()=>{Qe(()=>{--t,t===0&&(r?.(),r=void 0,Xt(n))})})))}}var Fr=w|T;function Ir(e,t,n,r){new Lr(e,t,n,r)}var Lr=class{parent;is_pending=!1;transform_error;#e;#t=O?k:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Pr(()=>(this.#m=Gt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=U;t.b=this,t.f|=128,n(e)},this.parent=U.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Dn(()=>{if(O){let e=this.#t;we();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},Fr),O&&(this.#e=k)}#g(){try{this.#a=On(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Qe(r),t&&(this.#s=On(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){xe();return}t=!0,n&&He(),this.#s!==null&&Fn(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){hn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=On(()=>e(this.#e)),Qe(()=>{var e=this.#c=document.createDocumentFragment(),t=sn(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return On(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){hn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(P);return}this.#u===0&&(this.#e.before(e),this.#c=null,Fn(this.#o,()=>{this.#o=null}),this.#x(P))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=On(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();zn(this.#a,e);let t=this.#n.pending;this.#o=On(()=>t(this.#e))}else this.#x(P)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){rt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=U,n=H,r=j;Kn(this.#i),Gn(this.#i),Ge(this.#i.ctx);try{return Pt.ensure(),e()}finally{Kn(t),Gn(n),Ge(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Fn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Qe(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;P?.is_fork?(this.#a&&P.skip_effect(this.#a),this.#o&&P.skip_effect(this.#o),this.#s&&P.skip_effect(this.#s),P.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(Mn(this.#a),null),this.#o&&=(Mn(this.#o),null),this.#s&&=(Mn(this.#s),null),O&&(Ce(this.#t),Te(),Ce(Ee()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return On(()=>{var r=U;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return hn(e,this.#i.parent),null}}))};Qe(()=>{var t;try{t=this.transform_error(e)}catch(e){hn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>hn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[fe]??=e.nodeValue)&&(e[fe]=n,e.nodeValue=`${n}`)}function Rr(e,t){return Br(e,t)}var zr=new Map;function Br(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){on();var l=void 0,u=Cn(()=>{var s=n??t.appendChild(sn());Ir(s,{pending:()=>{}},t=>{Ke({});var n=j;if(o&&(n.c=o),a&&(i.$$events=a),O&&kr(t,null),l=e(t,i)||Je(),O&&(U.nodes.end=k,k===null||k.nodeType!==8||k.data!==`]`))throw ye(),ge;qe()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=zr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Tr),r.delete(e),r.size===0&&zr.delete(n)):r.set(e,i)}yr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Vr.set(l,u),l}var Vr=new WeakMap,Hr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Ln(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Ln(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Mn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();zn(r,t),t.append(sn()),this.#n.set(e,{effect:r,fragment:t})}else Mn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Fn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Mn(n.effect),this.#n.delete(e))};ensure(e,t){var n=P,r=dn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=sn();i.append(a),this.#n.set(e,{effect:On(()=>t(a)),fragment:i})}else this.#t.set(e,On(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else O&&(this.anchor=k),this.#a(n)}};function Y(e,t,n=!1){var r;O&&(r=k,we());var i=new Hr(e),a=n?w:0;function o(e,t){if(O){var n=De(r);if(e!==parseInt(n.substring(1))){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,t),Se(!0);return}}i.ensure(e,t)}Dn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Ur=Symbol(`NaN`);function Wr(e,t,n){O&&we();var r=new Hr(e),i=!Ye();Dn(()=>{var e=t();e!==e&&(e=Ur),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Gr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Kr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;un(d),d.append(u),e.items.clear()}Kr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Kr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Yr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ee,Zr(d,null,c)):Ln(d):Fn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Dn(()=>{p=W(f);var e=p.length;let t=!1;O&&De(c)===`[!`!=(e===0)&&(c=Ee(),Ce(c),Se(!1),t=!0);for(var r=new Set,u=P,v=dn(),y=0;ys(c)):(d=On(()=>s(qr??=sn())),d.f|=ee)),e>r.size&&Ne(``,``,``),O&&e>0&&Ce(Ee()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&Se(!0),W(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,O&&(c=k)}function Jr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Yr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Jr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var E=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Xr(e,t,n,r,i,a,o,s){var c=o&1?o&16?Gt(n):Kt(n,!1,!1):null,l=o&2?Gt(i):null;return{v:c,i:l,e:On(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Zr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=ln(r);if(a.before(r),r===i)return;r=o}}function Qr(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function $r(e,t,n){var r;O&&(r=k,we());var i=new Hr(e);Dn(()=>{var e=t()??null;if(O&&De(r)===`[`!=(e!==null)){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,e&&(t=>n(t,e))),Se(!0);return}i.ensure(e,e&&(t=>n(t,e)))},w)}var ei=[...` -\r\f\xA0\v`];function ti(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ei.includes(r[o-1]))&&(s===r.length||ei.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ni(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function ri(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ii(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(ri)),i&&c.push(...Object.keys(i).map(ri));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(mi)||(`__defaultValue`in e&&li(e,!1),`__value`in e&&ui(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),bn(()=>{t.disconnect()})}function fi(e,t,n=t){var r=new WeakSet,i=!0;ut(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),pi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&pi(o)}n(a),e.__value=a,P!==null&&r.add(P)}),wn(()=>{var a=t();if(e===document.activeElement){var o=P;if(r.has(o))return}if(ui(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=pi(s),n(a))}e.__value=a,i=!1})}function pi(e){return`__value`in e?e.__value:e.value}function mi(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var hi=Symbol(`is custom element`),gi=Symbol(`is html`),_i=he?`link`:`LINK`;function vi(e){if(O){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[pe]=n,Qe(n),ct()}}function Q(e,t,n,r){var i=yi(e);O&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===_i)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ce]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&xi(e).has(t)?e[t]=n:e.setAttribute(t,n))}function yi(e){return e[le]??={[hi]:e.nodeName.includes(`-`),[gi]:e.namespaceURI===_e}}var bi=new Map;function xi(e){var t=e.getAttribute(`is`)||e.nodeName,n=bi.get(t);if(n)return n;bi.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function Si(e,t,n=t){var r=new WeakSet;ut(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ei(e)?Di(a):a,n(a),P!==null&&r.add(P),await dr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(O&&e.defaultValue!==e.value||mr(t)==null&&e.value)&&(n(Ei(e)?Di(e.value):e.value),P!==null&&r.add(P)),En(()=>{var n=t();if(e===document.activeElement){var i=P;if(r.has(i))return}Ei(e)&&n===Di(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Ci=new Set;function wi(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),ut(n,`change`,()=>{var e=n.__value;a&&(e=Ti(o,e,n.checked)),i(e)},()=>i(a?[]:null)),En(()=>{var e=r();if(O&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=en(n.__value,e)}),bn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Ci.has(o)||(Ci.add(o),Qe(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Ci.delete(o)})),Qe(()=>{if(s){var e=a?Ti(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Ti(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function ki(e,t,n){var r=Oi.observe(e,()=>n(e[t]));wn(()=>(mr(()=>n(e[t])),r))}function Ai(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?En(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&bn(()=>{n.removeEventListener(t,a)})}var ji={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ae||t===se)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Mi(...e){return new Proxy({props:e},ji)}function Ni(e,t,n,r){var i=!Ue||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ht(r),W(u)):(l&&(l=!1,c=s?mr(r):r),c);let f;if(o){var p=ae in e||se in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=at(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Re(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?ht:vt)(()=>(v=!1,g()));o&&W(y);var b=U;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&o?Qt(e):e;return I(y,n),v=!0,c!==void 0&&(c=n),e}return Hn&&v||b.f&16384?y.v:W(y)})}function Pi(e){j===null&&je(`onMount`),Ue&&j.l!==null?Fi(j).m.push(e):xn(()=>{let t=mr(e);if(typeof t==`function`)return t})}function Fi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Ii(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Li=new class{#e=F(Ri());get _loc(){return W(this.#e)}set _loc(e){I(this.#e,e)}#t=N(()=>this._loc.location);get _location(){return W(this.#t)}set _location(e){I(this.#t,e)}#n=N(()=>this._loc.querystring);get _querystring(){return W(this.#n)}set _querystring(e){I(this.#n,e)}#r=F(void 0);get _params(){return W(this.#r)}set _params(e){I(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=Ri()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Ri(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function zi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Bi(e,t){Ke(t,!0);let n=Ni(t,`routes`,19,()=>({})),r=Ni(t,`prefix`,3,``),i=Ni(t,`restoreScrollState`,3,!1),a=Ni(t,`onConditionsFailed`,3,()=>{}),o=Ni(t,`onRouteLoaded`,3,()=>{}),s=Ni(t,`onRouteLoading`,3,()=>{}),c=Ni(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Ii(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=F(null),f=F(null),p=F({}),m=null,h=null;xn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),xn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await dr(),e(t)}xn(()=>{let e=Li.loc,t=!1;return mr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Mr(),y=R(v),b=e=>{let t=N(()=>W(d));var n=Mr(),r=R(n),i=e=>{var n=Mr();$r(R(n),()=>W(t),(e,t)=>{t(e,Mi({get params(){return W(f)},get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)},a=e=>{var n=Mr();$r(R(n),()=>W(t),(e,t)=>{t(e,Mi({get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)};Y(r,e=>{W(f)?e(i):e(a,-1)}),q(e,n)};Y(y,e=>{W(d)&&e(b)}),q(e,v),qe()}var Vi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`],Hi=`codexometer.web.preferences.v1`,Ui={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function Wi(){try{let e=JSON.parse(localStorage.getItem(Hi)||`null`);return!e||typeof e!=`object`?Ui:{tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:Vi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Ui}}var Gi=Qt(Wi());function Ki(){let e=JSON.stringify(Gi);try{localStorage.setItem(Hi,e)}catch{}}function qi(){return Gi.tab===`quota`?`/quota/`+Gi.view:`/`+Gi.tab}function Ji(e){return Gi.layouts.find(t=>t.id===e)?.level??Gi.defaultDetail}function Yi(e){Gi.defaultDetail=e,Gi.layouts=[]}function Xi(e,t){Gi.layouts=[...Gi.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Qt({data:null,connected:!1,error:``}),Zi=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),Qi=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),$i=`codexometer.web.session`,ea=class extends Error{},ta;async function na(e,t,n){if(!ta||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await ta(e,t,n)}function ra(){let e=new AbortController,t,n=``;ta=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new ea(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem($i)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+qi()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem($i,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem($i)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` - -`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{ta=void 0,e.abort(),clearTimeout(t),$.connected=!1}}var ia=jr(` `,1),aa=jr(` `,1),oa=K(` `),sa=K(`
      Quota observations
      Observed atPeriod elapsedConsumedTrail segment
      `),ca=K(`


      Observed quota - path, not individual session usage. Gaps are not interpolated. Expand the - observation table for times, positions and gaps.

      OBSERVATION TABLE
      `,1),la=K(`
      CONSUMPTIONQUOTA PERIOD ELAPSED


      `,1);function ua(e,t){let n=Nr();Ke(t,!0);let r=Ni(t,`trail`,19,()=>[]),i=F(!1),a=[0,25,50,75,100],o=F(400),s=F(240),c=N(()=>W(o)-24),l=N(()=>W(s)-48),u=N(()=>Math.max(1,W(c)-48)),d=N(()=>Math.max(1,W(l)-20)),f=N(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*W(u)),p=N(()=>W(l)-Math.max(0,Math.min(100,t.used))/100*W(d)),m=N(()=>t.used-t.elapsed),h=N(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*W(u)} ${W(l)-e.used/100*W(d)}`).join(` `));var g=la(),_=R(g),v=L(_),y=L(v),b=z(y),x=B(y),S=B(x);Z(S,17,()=>a,X,(e,t)=>{var n=ia(),r=R(n),i=B(r),a=B(i),o=z(a),s=B(a),f=z(s);V(()=>{Q(r,`x1`,48+W(t)/100*W(u)),Q(r,`x2`,48+W(t)/100*W(u)),Q(r,`y2`,W(l)),Q(i,`y1`,W(l)-W(t)/100*W(d)),Q(i,`x2`,W(c)),Q(i,`y2`,W(l)-W(t)/100*W(d)),Q(a,`x`,48+W(t)/100*W(u)),Q(a,`y`,W(l)+20),J(o,`${W(t)??``}%`),Q(s,`y`,W(l)+4-W(t)/100*W(d)),J(f,`${W(t)??``}%`)}),q(e,n)});var C=B(S),w=B(C),T=B(w),E=e=>{var t=aa(),n=R(t),i=B(n),a=z(L(i));A(i),V(e=>{Q(n,`d`,W(h)),Q(i,`cx`,48+r()[0].elapsed/100*W(u)),Q(i,`cy`,W(l)-r()[0].used/100*W(d)),J(a,`First observation: ${e??``}`)},[()=>Qi(r()[0].at)]),q(e,t)};Y(T,e=>{r().length&&e(E)});var ee=B(T,2),te=B(ee),ne=B(te),re=z(L(ne));A(ne),A(v),A(_);var ie=B(_,2),ae=L(ie),oe=z(B(ae,3),!0);A(ie);var se=B(ie,2),ce=e=>{var t=ca(),a=R(t),o=L(a);Te(2),A(a);var s=B(a,2),c=B(L(s),2),l=e=>{var t=sa(),n=L(t),i=B(L(n),2);Z(i,21,r,X,(e,t,n)=>{var r=oa(),i=L(r),a=L(i),o=z(a,!0);A(i);var s=B(i),c=z(s),l=B(s),u=z(l),d=z(B(l),!0);A(r),V((e,r)=>{Q(a,`datetime`,W(t).at),J(o,e),J(c,`${r??``}%`),J(u,`${W(t).used??``}%`),J(d,n===0?`First observation`:W(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>Qi(W(t).at),()=>W(t).elapsed.toFixed(1)]),q(e,r)}),A(i),A(n),A(t),q(e,t)};Y(c,e=>{W(i)&&e(l)}),A(s),V(e=>{Q(a,`id`,n+`-trail-summary`),J(o,`○ START ${e??``} // ${r().length??``} - ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>Qi(r()[0].at)]),Ai(`open`,`toggle`,s,e=>I(i,e),()=>W(i)),q(e,t)};Y(se,e=>{r().length&&e(ce)}),V((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${W(o)} ${W(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,W(u)),Q(x,`height`,W(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${W(l)} H${W(c)}`),Q(w,`y1`,W(l)),Q(w,`x2`,W(c)),Q(ee,`x`,48+W(u)/2),Q(ee,`y`,W(s)-5),Q(te,`cx`,W(f)),Q(te,`cy`,W(p)),Q(ne,`cx`,W(f)),Q(ne,`cy`,W(p)),J(re,`${t.used??``}% consumed // ${i??``}% of period elapsed`),J(ae,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),J(oe,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${W(m)>0?`Above`:W(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(W(m))<.05?`ON PACE`:W(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),ki(_,`clientWidth`,e=>I(o,e)),ki(_,`clientHeight`,e=>I(s,e)),q(e,g),qe()}var da=K(` `),fa=K(`

      Quota refresh failed. Values below are the last successful observation.

      `),pa=K(`

      Expiry details unavailable. No listed expiry does not mean no expiry.

      `),ma=K(`

      `),ha=K(`

      Read-only preview. Use the terminal to redeem a reset.

      The backend may return only some credits. This list does not establish - redemption order.

      `),ga=K(` `,1),_a=jr(``),va=jr(``),ya=K(`
      `),ba=K(`

      Cycle duration or reset date unavailable — position cannot be - plotted.

      `),xa=K(`
      −100 // OVER BUDGET+100 // HEADROOM

      `,1),Sa=K(`

      Cycle duration unavailable — pace cannot be calculated.

      `),Ca=K(`
      EMPTYFULL
      `),wa=K(`

      `,1),Ta=K(`
      `,1),Ea=K(`

      `),Da=K(`

      `),Oa=K(`

      No quota windows reported yet.

      `),ka=K(`
      `,1),Aa=K(`

      All reported windows are shown. API-equivalent learning and quota status - scoring remain in the terminal for this first preview.

      `,1),ja=K(` `,1);function Ma(e,t){Ke(t,!0);let n=Ni(t,`params`,19,()=>({})),r=Vi,i=F(Qt(Date.now())),a=N(()=>r.includes(n().view||``)?n().view:`bars`);Pi(()=>{let e=setInterval(()=>I(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-W(i))/(e.duration*6e4))))}xn(()=>{Gi.view=W(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=ja(),l=R(c);Z(l,21,()=>r,X,(e,t)=>{var n=da();let r;var i=z(n,!0);V(e=>{Q(n,`href`,`#/quota/`+W(t)),Q(n,`aria-current`,W(a)===W(t)?`page`:void 0),r=ai(n,1,``,null,r,{active:W(a)===W(t)}),J(i,e)},[()=>W(t)===`pace`?`CONSUMPTION PACE`:W(t)===`zone`?`CONSUMPTION ZONE`:W(t)===`fuel`?`FUEL TANK`:W(t).toUpperCase()]),q(e,n)}),A(l);var u=B(l,2),d=e=>{var t=Aa(),n=R(t),r=e=>{q(e,fa())};Y(n,e=>{$.data.quotaError&&e(r)});var i=B(n,2),c=z(i),l=B(i,2),u=e=>{var t=ha(),n=L(t),r=z(n),i=B(n,4),a=e=>{q(e,pa())};Y(i,e=>{$.data.credits.length||e(a)}),Z(B(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=ma(),r=L(n),i=z(r),a=z(B(r,2),!0);A(n),V(e=>{J(i,`${(W(t).title||`Quota reset`)??``} // ${W(t).status??``}`),J(a,e)},[()=>W(t).expiryKnown?W(t).expires?`EXPIRES `+Qi(W(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),Te(2),A(t),V(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},d=e=>{var t=ka(),n=R(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=N(()=>o(W(t))),r=N(()=>W(n)===null?null:W(n)-W(t).used);var i=Da(),c=L(i),l=z(c,!0),u=B(c,2),d=L(u),f=e=>{var n=ga(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`FREE ${100-W(t).used}%`),J(a,`USED ${W(t).used??``}%`)}),q(e,n)},p=e=>{var n=ga(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`USED ${W(t).used??``}%`),J(a,`FREE ${100-W(t).used}%`)}),q(e,n)};Y(d,e=>{W(a)===`fuel`?e(f):e(p,-1)}),A(u);var m=B(u,2);let h;var g=L(m),_=e=>{var n=ya(),r=L(n),i=B(L(r)),a=e=>{q(e,_a())},o=e=>{var n=va();V(e=>Q(n,`d`,e),[()=>s(W(t).used)]),q(e,n)};Y(i,e=>{W(t).used>=100?e(a):W(t).used>0&&e(o,1)}),A(r),A(n),V(()=>Q(r,`aria-label`,`${W(t).used}% quota used`)),q(e,n)},v=e=>{var r=Mr(),i=R(r),a=e=>{{let r=N(()=>W(t).trail||[]);ua(e,{get used(){return W(t).used},get elapsed(){return W(n)},get trail(){return W(r)}})}},o=e=>{q(e,ba())};Y(i,e=>{W(n)===null?e(o,-1):e(a)}),q(e,r)},y=e=>{var t=Mr(),n=R(t),i=e=>{var t=xa(),n=R(t),i=B(L(n),2);let a;A(n);var o=B(n,4),s=L(o),c=z(B(s),!0);A(o),V(e=>{a=si(i,``,a,{left:`${(W(r)+100)/2}%`}),J(s,`${W(r)>=0?`+`:``}${e??``} PP `),J(c,W(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>W(r).toFixed(1)]),q(e,t)},a=e=>{q(e,Sa())};Y(n,e=>{W(r)===null?e(a,-1):e(i)}),q(e,t)},b=e=>{var r=Ta(),i=R(r),o=L(i);let s;A(i);var c=B(i,2),l=e=>{q(e,Ca())};Y(c,e=>{W(a)===`fuel`&&e(l)});var u=B(c,2),d=e=>{var t=wa(),r=R(t),i=z(r),o=B(r,2),s=L(o);let c;A(o),V(e=>{J(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=si(s,``,c,{width:`${W(a)===`fuel`?100-W(n):W(n)}%`})},[()=>Math.floor(W(n))]),q(e,t)};Y(u,e=>{W(n)!==null&&e(d)}),V(()=>{Q(i,`aria-label`,W(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,W(a)===`fuel`?100-W(t).used:W(t).used),s=si(o,``,s,{width:`${W(a)===`fuel`?100-W(t).used:W(t).used}%`})}),q(e,r)};Y(g,e=>{W(a)===`pie`?e(_):W(a)===`zone`?e(v,1):W(a)===`pace`?e(y,2):e(b,-1)}),A(m);var x=B(m,2),S=z(x),C=B(x,2),w=e=>{var n=Ea(),r=z(n,!0);V(()=>J(r,W(t).details)),q(e,n)};Y(C,e=>{W(t).details&&e(w)}),A(i),V(e=>{J(l,W(t).name),h=ai(m,1,`meter-graphic`,null,h,{"bar-graphic":W(a)===`bars`||W(a)===`fuel`}),J(S,`RESETS // ${e??``}`)},[()=>Qi(W(t).reset)]),q(e,i)}),A(n);var i=B(n,2),c=e=>{q(e,Oa())};Y(i,e=>{$.data.meters.length||e(c)}),V(()=>r=ai(n,1,`quota-grid`,null,r,{radial:W(a)===`pie`,zone:W(a)===`zone`})),q(e,t)};Y(l,e=>{W(a)===`resets`?e(u):e(d,-1)}),Te(2),V(e=>J(c,`QUOTA // OBSERVED ${e??``}`),[()=>Qi($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),qe()}var Na=K(`
      `),Pa=K(`

      `,1);function Fa(e,t){Ke(t,!0);let n=Ni(t,`values`,19,()=>[]),r=Ni(t,`label`,3,`Token activity`),i=Ni(t,`capacity`,3,0),a=N(()=>Math.max(0,...n())),o=N(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Pa(),c=R(s),l=z(c),u=B(c,2);Z(u,21,()=>W(o),X,(e,t)=>{var n=Na();let r;V((e,t)=>{Q(n,`title`,e),r=si(n,``,r,{height:t})},[()=>W(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*W(t)/Math.max(1,W(a))}%`]),q(e,n)}),A(u),V((e,t)=>{J(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>W(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${W(a).toLocaleString(`en-GB`)} tokens.`]),q(e,s),qe()}var Ia=K(`

      CURRENT PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      PROPOSED PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      Applied settings remain after Codexometer closes.

      `,1),La=K(`

      `),Ra=K(`

       
      `,1),za=K(`

      Command unavailable from this observation. Open Codex to inspect the - request.

      `),Ba=K(`

      Session controls temporarily unavailable. Check Codex for current state.

      `),Va=K(`

      Checking session controls…

      `),Ha=K(`

      `),Ua=K(`
      About browser controls

      Controls require a supported live request from a connected shared - app-server session. Local observations alone cannot provide them.

      `),Wa=K(` `,1),Ga=K(` `),Ka=K(`Grants permission beyond this one command. Check the scope - carefully.`),qa=K(``),Ja=K(``),Ya=K(``),Xa=K(``),Za=K(` `,1),Qa=K(`
    • `),$a=K(`
      View fixed choices

      Type one of these choices exactly. Your answer stays masked.

        `),eo=K(` `,1),to=K(`

        `,1),no=K(``),ro=K(`

        `,1),io=K(`

        `);function ao(e,t){Ke(t,!0);let n=[],r=Ni(t,`observedCommand`,3,``),i=Ni(t,`review`,3,``),a=Ni(t,`suspended`,3,!1),o=Ni(t,`onProtectedChange`,3,e=>{}),s=F(null),c=F(Qt([])),l=F(null),u=F(``),d=F(0),f=F(Qt(Date.now())),p=F(!1),m=F(``),h=F(!1),g=F(!1),_=F(``);xn(()=>(o()(W(p)||W(c).some(e=>e.length>0)),()=>o()(!1)));let v=N(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),y=N(()=>!$.connected||!!$.data?.sessionsError),b=N(()=>i()!==`profile`&&W(s)?.kind===`prompt`&&!W(s).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),x=N(()=>!W(y)&&!W(g)&&!!W(s)?.id&&W(s).kind===`approval`&&W(_)!==W(s).id),S=N(()=>W(x)?W(s).command:r()),C=N(()=>!!W(u)&&W(f)W(s)?.questions?.length?W(s).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),T=N(()=>W(s)?.kind===`approval`||W(s)?.kind===`profile`?W(l)!==null:W(c).length===W(w).length&&W(c).every((e,t)=>e.trim().length>0&&(W(w)[t].freeText||W(w)[t].options?.includes(e))));xn(()=>{(W(y)||a()||W(b)||W(f)>=W(d))&&I(u,``)});let E=new AbortController;Pi(()=>{let e,n=setInterval(()=>{I(f,Date.now(),!0)},1e3);async function r(){try{let e=await na(`offer`,{session:t.session,...i()?{review:i()}:{}},E.signal);if(E.signal.aborted)return;I(g,!1),W(s)?.id!==e.id&&(I(u,``),I(l,null),I(c,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),I(s,e,!0),W(h)&&e.id&&e.id!==W(_)&&(I(m,``),I(h,!1))}catch{E.signal.aborted||(I(s,null),I(g,!0),I(u,``))}finally{E.signal.aborted||(e=setTimeout(r,2e3))}}return r(),()=>{E.abort(),clearTimeout(e),clearInterval(n)}});async function ee(){if(!W(s)?.id||W(p)||W(y)||a()||W(b)||!W(T))return;let e=W(s).id;I(p,!0),I(m,``),I(h,!1),I(u,``);try{let n=await na(`prepare`,{session:t.session,...i()?{review:i()}:{},offer:e,...W(s).kind===`approval`||W(s).kind===`profile`?{choice:W(l)}:{answers:[...W(c)]}},E.signal);W(s)?.id===e&&!E.signal.aborted&&!W(y)&&!a()&&!W(b)&&(I(u,n.confirmation,!0),I(d,Date.parse(n.expires),!0))}catch(e){E.signal.aborted||I(m,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{I(p,!1)}}async function te(){if(!W(s)?.id||W(p)||a()||W(b)||!W(C))return;let e=W(s).id,n=W(s).kind,r=W(u);I(u,``),I(p,!0),I(_,e,!0);try{await na(`commit`,{session:t.session,...i()?{review:i()}:{},offer:e,confirmation:r},E.signal),I(h,!0),I(m,n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){I(m,e instanceof ea?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{I(p,!1),I(c,[],!0),I(l,null)}}var ne=Mr(),re=R(ne),ie=e=>{var r=io(),a=L(r),o=z(a,!0),b=B(a,2),E=e=>{var t=Ia(),n=R(t),r=z(n),i=B(n,6),a=z(i,!0),o=z(B(i,6),!0);Te(2),V(()=>{J(r,`Your ${W(s).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),J(a,W(s).profile.current),J(o,W(s).profile.proposed)}),q(e,t)};Y(b,e=>{W(s)?.profile&&!W(y)&&!W(g)&&e(E)});var ne=B(b,2),re=e=>{var t=La();let n;var r=z(t,!0);V(()=>{n=ai(t,1,`svelte-1oupzfc`,null,n,{notice:!W(h),sent:W(h)}),J(r,W(m))}),q(e,t)};Y(ne,e=>{W(m)&&e(re)});var ie=B(ne,2),ae=e=>{var t=Ra(),n=R(t),r=z(n,!0),i=z(B(n,2),!0);V(()=>{J(r,W(x)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(i,W(S))}),q(e,t)},oe=e=>{q(e,za())};Y(ie,e=>{W(S)?e(ae):i()!==`profile`&&W(v)===`APPROVAL NEEDED`&&!W(h)&&e(oe,1)});var se=B(ie,2),ce=e=>{q(e,Ba())},le=e=>{q(e,Va())},ue=e=>{var t=Wa(),n=R(t),r=e=>{var t=Ha(),n=z(t,!0);V(e=>J(n,e),[()=>W(v)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(v)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(W(v)===`WORKING`||!W(h)&&!W(p))&&e(r)});var i=B(n,2),a=e=>{q(e,Ua())},o=N(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(v)||``)&&!W(h));Y(i,e=>{W(o)&&e(a)}),q(e,t)},de=e=>{var r=ro(),a=R(r),o=z(a),m=B(a,2),h=L(m),g=z(h,!0),_=B(h,2),v=e=>{var r=Mr();Z(R(r),17,()=>W(s).choices||[],X,(e,r,a)=>{var o=qa(),s=L(o);vi(s),s.value=s.__value=a;var c=B(s),u=B(c),d=e=>{var t=Ga(),n=z(t,!0);V(()=>J(n,W(r).detail)),q(e,t)};Y(u,e=>{W(r).detail&&e(d)});var f=B(u,2),p=e=>{q(e,Ka())};Y(f,e=>{W(r).persistent&&e(p)}),A(o),V(()=>{Q(s,`name`,`decision-`+t.session+`-`+i()),J(c,` ${W(r).label??``} `)}),wi(n,[],s,()=>W(l),e=>I(l,e)),q(e,o)}),q(e,r)},b=e=>{var t=Mr();Z(R(t),17,()=>W(w),X,(e,t,n)=>{var r=eo(),i=R(r),a=L(i),o=B(a),s=e=>{var t=Ja();vi(t),Si(t,()=>W(c)[n],e=>W(c)[n]=e),q(e,t)},l=e=>{var r=Xa(),i=L(r);i.value=i.__value=``,Z(B(i),17,()=>W(t).options||[],X,(e,t)=>{var n=Ya(),r=z(n,!0),i={};V(()=>{J(r,W(t)),i!==(i=W(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),A(r),di(r),fi(r,()=>W(c)[n],e=>W(c)[n]=e),q(e,r)},u=e=>{var r=Za(),i=R(r);ot(i);var a=B(i,2),o=e=>{var n=Ha(),r=z(n);V(e=>J(r,`Suggested answers: ${e??``}`),[()=>W(t).options.join(` · `)]),q(e,n)};Y(a,e=>{W(t).options?.length&&e(o)}),Si(i,()=>W(c)[n],e=>W(c)[n]=e),q(e,r)};Y(o,e=>{W(t).secret?e(s):W(t).freeText?e(u,-1):e(l,1)}),A(i);var d=B(i,2),f=e=>{var n=$a(),r=B(L(n),4);Z(r,21,()=>W(t).options||[],X,(e,t)=>{var n=Qa(),r=z(n,!0);V(()=>J(r,W(t))),q(e,n)}),A(r),A(n),q(e,n)};Y(d,e=>{W(t).secret&&!W(t).freeText&&e(f)}),V(()=>J(a,`${W(t).text??``} `)),q(e,r)}),q(e,t)};Y(_,e=>{W(s).kind===`approval`||W(s).kind===`profile`?e(v):e(b,-1)}),A(m);var x=B(m,2),S=e=>{var t=to(),n=R(t),r=z(n),i=B(n,2),a=z(i),o=B(i,2);V(e=>{J(r,`Check the target and ${W(s).kind===`profile`?`profile above`:W(s).kind===`approval`?`exact command and permission scope`:`message above`}. This will send to Codex; it may start work - using your quota. Confirmation expires in ${e??``}s.`),i.disabled=W(p)||W(y),J(a,`CONFIRM ${(W(s).kind===`approval`||W(s).kind===`profile`?W(s).choices?.[W(l)]?.label:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((W(d)-W(f))/1e3))]),G(`click`,i,te),G(`click`,o,()=>{I(u,``)}),q(e,t)},E=e=>{var t=no(),n=z(t,!0);V(()=>{t.disabled=W(p)||W(y)||!W(T),J(n,W(p)?`SENDING…`:`REVIEW BEFORE SENDING`)}),G(`click`,t,ee),q(e,t)};Y(x,e=>{W(C)?e(S):e(E,-1)}),V(()=>{J(o,`TARGET // ${W(s).thread??``} // ${(W(s).directory||`Directory unavailable`)??``}`),m.disabled=W(p)||W(C)||W(y),J(g,W(s).kind===`approval`||W(s).kind===`profile`?`Choose a decision`:`Reply to this session`)}),q(e,r)};Y(se,e=>{W(y)||W(g)?e(ce):W(s)?W(s).id?W(_)!==W(s).id&&e(de,3):e(ue,2):e(le,1)}),A(r),V(()=>J(o,i()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(re,e=>{W(b)||e(ie)}),q(e,ne),qe()}Sr([`click`]);var oo=K(`
        `);function so(e,t){Ke(t,!0);let n=Ni(t,`active`,3,!1),r=N(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!t.session.text.trim()),i=F(!1),a=F(``),o=F(!1);xn(()=>{if(!W(o))return;let e=setTimeout(()=>{I(o,!1)},150);return()=>clearTimeout(e)}),xn(()=>{t.session.text,t.session.status,I(a,``)});async function s(){if(!W(r)||W(i))return;let e=t.session.text;I(i,!0),I(o,!0),I(a,``);try{await navigator.clipboard.writeText(e),t.session.text===e&&I(a,`Copied.`)}catch{t.session.text===e&&I(a,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{I(i,!1)}}function c(e){!n()||!W(r)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),s())}var l=Mr();xr(`keydown`,tn,c);var u=R(l),d=e=>{var t=oo(),n=L(t),r=z(n,!0),c=B(n,2);let l;A(t),V(()=>{J(r,W(a)),c.disabled=W(i),l=ai(c,1,`svelte-543j00`,null,l,{flashed:W(o)})}),G(`click`,c,s),q(e,t)};Y(u,e=>{W(r)&&e(d)}),q(e,l),qe()}Sr([`click`]);var co=K(`

        `),lo=K(`

        `),uo=K(`
         
        `),fo=K(`

        Command unavailable from this observation. Open Codex to inspect the - request.

        `),po=K(`

        `,1),mo=K(`

        `),ho=K(`
         
        `,1),go=K(`
        `),_o=K(`

        Session connection or refresh unavailable. Context and telemetry may be - stale.

        `),vo=K(`

        Some quota profile checks are unavailable. Only sessions with freshly - verified quota and settings can be updated; previous outcome notices remain - visible.

        `),yo=K(` `),bo=K(` `),xo=K(``),So=K(`

        Read only — reply or approve in Codex.

        `),Co=K(`

        `),wo=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),To=K(`
        `),Eo=K(`
        `),Do=K(`

        This session is no longer in the current observation. Return to sessions.

        `),Oo=K(`

        `),ko=K(` `),Ao=K(`

        `),jo=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Mo=K(` `,1),No=K(`

        `),Po=K(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),Fo=K(`

        TOKENS

        FULL DETAIL →
        `),Io=K(`

        No locally observed sessions yet. Keep Codex running alongside - Codexometer.

        `),Lo=K(`

        ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

        `,1),Ro=K(`

        SESSION TOTALS

        `,1);function zo(e,t){Ke(t,!0);let n=(e,t=f,n,r)=>{let i=vt(()=>h(n?.(),!0)),a=vt(()=>h(r?.(),!1));var o=ho(),s=R(o),c=e=>{var n=co();let r;var i=z(n,!0);V(e=>{r=ai(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>b(t())]),q(e,n)},l=N(()=>b(t())&&(!W(a)||W(d)||t().status===`CHECK SESSION`));Y(s,e=>{W(l)&&e(c)});var u=B(s,2),p=e=>{var n=lo(),r=z(n,!0);V(()=>J(r,t().contextKind||`LAST ACTIVITY`)),q(e,n)};Y(u,e=>{W(i)&&e(p)});var m=B(u,2),g=z(m,!0),_=B(m,2),v=e=>{var n=po(),r=B(R(n),2),i=z(r,!0),a=B(r,2),o=e=>{var n=uo(),r=z(n,!0);V(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,fo())};Y(a,e=>{t().command?e(o):e(s,-1)}),V(()=>J(i,W(d)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(_,e=>{(!W(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(v)});var y=B(_,2),x=e=>{var n=mo(),r=z(n);V(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(y,e=>{W(a)||e(x)}),V(()=>J(g,t().text||`No session context available.`)),q(e,o)},r=Ni(t,`params`,19,()=>({})),i=N(()=>$.data?.sessions||[]),a=N(()=>$.data?.control&&$.data.profiles||[]),o=F(!1);function s(e,t){if(r().id&&r().id!==t&&W(o)){e.preventDefault();return}_(t)}xn(()=>{let e=r().id;e&&mr(()=>{Gi.selected=e,Xi(e,2)})});let c=N(()=>W(i).find(e=>e.id===r().id)),l=N(()=>new URLSearchParams(Li.querystring).get(`review`)===`profile`&&W(a).some(e=>e.session===r().id&&e.pending)),u=N(()=>W(i).some(e=>e.id===Gi.selected)?Gi.selected:W(i)[0]?.id),d=N(()=>!$.connected||!!$.data?.sessionsError),p=N(()=>[[`OBSERVED TOKENS`,Zi(W(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,Zi(W(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,W(d)?`—`:Zi(W(i).filter(e=>e.status===t).length)])]),m=N(()=>W(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function _(e){Gi.selected=e,dr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function v(e,t){if(_(e),r().id){t<0&&(Xi(e,2),location.hash=`/sessions`);return}let n=Ji(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):Xi(e,n)}function y(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),v(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||W(u)))e.preventDefault(),v(r().id||W(u),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&W(i).length){e.preventDefault();let t=W(i).findIndex(e=>e.id===W(u));_(W(i)[Math.max(0,Math.min(W(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function b(e){return W(d)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}var x=Ro();xr(`keydown`,tn,y);var S=R(x),C=z(B(L(S),2));A(S);var w=B(S,2);let T;Z(w,21,()=>W(p),X,(e,t)=>{var n=N(()=>g(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=go(),o=L(a),s=z(o,!0),c=z(B(o,2),!0);A(a),V(()=>{J(s,r()),J(c,i())}),q(e,a)}),A(w);var E=B(w,2),ee=z(E),te=B(E,2),ne=e=>{q(e,_o())};Y(te,e=>{W(d)&&e(ne)});var re=B(te,2),ie=e=>{q(e,vo())};Y(re,e=>{$.data?.profileError&&e(ie)});var ae=B(re,2),oe=e=>{var t=xo(),n=L(t);Z(n,17,()=>W(m),X,(e,t)=>{var n=yo();let r;var i=z(n);V(e=>{r=ai(n,1,`button`,null,r,{approval:W(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),J(i,`${W(t).status??``} // ${(W(t).directory||W(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,n,()=>_(W(t).id)),q(e,n)}),Z(B(n,2),17,()=>W(a).filter(e=>e.pending&&W(i).some(t=>t.id===e.session)),X,(e,t)=>{var n=bo(),a=z(n);V((e,i)=>{Q(n,`title`,r().id&&r().id!==W(t).session&&W(o)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(a,`QUOTA THRESHOLD // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session)+`?review=profile`,()=>W(i).find(e=>e.id===W(t).session)?.directory||W(t).session]),G(`click`,n,e=>s(e,W(t).session)),q(e,n)}),A(t),q(e,t)},se=N(()=>(W(m).length||W(a).some(e=>e.pending))&&!W(d));Y(ae,e=>{W(se)&&e(oe)});var ce=B(ae,2),le=e=>{var t=Mr(),i=R(t),s=e=>{var t=Eo(),i=L(t),s=L(i),u=L(s);let f;var p=B(u);A(s);var m=B(s,2);A(i);var h=B(i,2),g=z(h),v=B(h,2);let y;var b=L(v),x=L(b);n(x,()=>W(c),()=>!0,()=>!0),A(b);var S=B(b,2),C=e=>{var t=Mr();Wr(R(t),()=>W(c).id,e=>{ao(e,{get session(){return W(c).id},get observedCommand(){return W(c).command},get suspended(){return W(l)},onProtectedChange:e=>{I(o,e,!0)}})}),q(e,t)},w=e=>{q(e,So())};Y(S,e=>{$.data?.control?e(C):e(w,-1)}),A(v);var T=B(v,2);Z(T,17,()=>W(a).filter(e=>e.session===W(c).id),e=>e.session,(e,t)=>{var n=To(),r=L(n),i=e=>{var n=Co(),r=z(n,!0);V(()=>J(r,W(t).notice)),q(e,n)};Y(r,e=>{W(t).notice&&e(i)});var a=B(r,2),o=e=>{ao(e,{get session(){return W(c).id},review:`profile`})},s=e=>{var t=wo();V(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(c).id)+`?review=profile`]),q(e,t)};Y(a,e=>{W(t).pending&&W(l)?e(o):W(t).pending&&e(s,1)}),A(n),V(()=>Q(n,`id`,`quota-profile-`+W(c).id)),q(e,n)});var E=B(T,2),ee=e=>{var t=Mr();Wr(R(t),()=>W(c).id,e=>{so(e,{get session(){return W(c)},active:!0})}),q(e,t)};Y(E,e=>{W(l)||e(ee)}),A(t),V(e=>{f=ai(u,1,`lamp lit`,null,f,{working:W(c).status===`WORKING`&&!W(d)}),J(p,`${(W(d)?`STALE`:W(l)?`QUOTA THRESHOLD`:W(c).status)??``} // ${W(c).directory??``}`),J(g,`${e??``} TOKENS // ${W(c).id??``} // CONTEXT SOURCE // ${(W(c).source||`LOCAL`)??``}`),y=si(v,``,y,{display:W(l)?`none`:void 0})},[()=>Zi(W(c).tokens)]),G(`click`,m,()=>{_(r().id),Xi(r().id,2)}),q(e,t)},u=e=>{q(e,Do())};Y(i,e=>{W(c)?e(s):e(u,-1)}),q(e,t)},ue=e=>{var t=Lo(),r=R(t),o=B(L(r),2),c=L(o),l=B(c,2);A(o),A(r);var f=B(r,2);Z(f,17,()=>W(i),e=>e.id,(e,t)=>{let r=N(()=>Ji(W(t).id));var i=Fo();let o;var c=L(i),l=L(c),f=L(l);let p;var m=B(f,1,!0);A(l);var h=B(l,2),g=z(h,!0),y=B(h,2),b=L(y);Te(),A(y);var x=B(y,2),S=z(x),C=B(x,2),w=z(C),T=B(C,2),E=L(T),ee=B(E,2),te=z(ee,!0),ne=B(ee,2);A(T);var re=B(T,2),ie=B(re,2),ae=e=>{var n=Oo(),r=z(n,!0);V(()=>J(r,W(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:W(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),q(e,n)},oe=N(()=>!W(d)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(W(t).status));Y(ie,e=>{W(oe)&&e(ae)}),A(c);var se=B(c,2),ce=e=>{var r=No(),i=L(r),o=L(i),c=z(o,!0),l=B(o,2),f=e=>{var n=ko(),r=z(n,!0);V(e=>{Q(n,`href`,e),J(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id)]),q(e,n)};Y(l,e=>{!W(d)&&W(t).status===`APPROVAL NEEDED`&&e(f)}),A(i);var p=B(i,2);n(p,()=>W(t),()=>!1);var m=B(p,2);Z(m,17,()=>W(a).filter(e=>e.session===W(t).id),X,(e,n)=>{var r=Mo(),i=R(r),a=e=>{var t=Ao(),r=z(t,!0);V(()=>J(r,W(n).notice)),q(e,t)};Y(i,e=>{W(n).notice&&e(a)});var o=B(i,2),c=e=>{var n=jo();V(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(t).id)+`?review=profile`]),G(`click`,n,e=>s(e,W(t).id)),q(e,n)};Y(o,e=>{W(n).pending&&e(c)}),q(e,r)});var h=B(m,2);{let e=N(()=>W(u)===W(t).id);so(h,{get session(){return W(t)},get active(){return W(e)}})}A(r),V(()=>J(c,W(t).contextKind||`LAST ACTIVITY`)),q(e,r)};Y(se,e=>{W(r)>0&&e(ce)});var le=B(se,2),ue=e=>{var n=Po(),r=B(L(n),2);{let e=N(()=>(W(t).samples||[]).map(e=>e.tokens));Fa(r,{get values(){return W(e)},capacity:120})}var i=z(B(r,2));A(n),V(()=>J(i,`LAST ${(W(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(le,e=>{W(r)<2&&e(ue)}),A(i),V((e,n,a)=>{o=ai(i,1,`session-row`,null,o,{selected:W(u)===W(t).id,wide:W(r)===2,split:W(r)===1}),Q(i,`aria-label`,`Session `+(W(t).directory||W(t).id)),p=ai(f,1,`lamp lit`,null,p,{working:W(t).status===`WORKING`&&!W(d)}),J(m,W(d)?`STALE`:W(t).status),Q(h,`aria-pressed`,W(u)===W(t).id),J(g,W(t).directory||W(t).id),J(b,`${e??``} `),J(S,`${W(t).agents??``} LINKED AGENTS`),J(w,`ACTIVE // ${n??``}`),E.disabled=W(r)===0,Q(ee,`aria-expanded`,W(r)>0),J(te,W(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(re,`href`,a)},[()=>Zi(W(t).tokens),()=>Qi(W(t).activity),()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,h,()=>_(W(t).id)),G(`click`,E,()=>v(W(t).id,-1)),G(`click`,ee,()=>{_(W(t).id),Xi(W(t).id,+!W(r))}),G(`click`,ne,()=>v(W(t).id,1)),G(`click`,re,()=>_(W(t).id)),q(e,i)});var p=B(f,2),m=e=>{q(e,Io())};Y(p,e=>{W(i).length||e(m)}),G(`click`,c,()=>Yi(1)),G(`click`,l,()=>Yi(0)),q(e,t)};Y(ce,e=>{r().id?e(le):e(ue,-1)}),V(e=>{J(C,`OBSERVED ${e??``}`),T=ai(w,1,`session-totals`,null,T,{stale:W(d)}),J(ee,`${W(d)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens - observed since this server started for currently listed sessions; linked - agents are already included. Totals can decrease when a session leaves the - list. History samples every 30 seconds. Not account-wide totals.`)},[()=>Qi($.data?.sessionsAt)]),q(e,x),qe()}Sr([`click`]);var Bo=864e5;function Vo(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Ho(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Vo(r,-t),a=new Date(i.getTime()+Bo);if(e===n)return{start:a,end:r};r=i}}var Uo=K(`

        History refresh failed. Any displayed history is the last successful - observation.

        `),Wo=K(``),Go=K(`
        `),Ko=K(`

        LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

        `,1),qo=K(`
        `,1),Jo=K(` `),Yo=K(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        Accessible data table
        Date (UTC)Tokens

        `,1),Xo=K(`

        History unavailable or awaiting a matching account observation. Missing - history is not treated as zero usage.

        `),Zo=K(`

        USAGE // ACCOUNT HISTORY

        Account-wide history reported by Codex, not the local Sessions counter. Dates - use UTC. Historical resets are not provided by this data.

        `,1);function Qo(e,t){Ke(t,!0);let n=F(`daily`),r=F(12),i=F(0),a=N(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Ho(new Date,W(r),W(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=N(()=>Math.max(1,...W(a).map(e=>e.tokens))),s=N(()=>W(a).length?new Date(W(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=N(()=>{if(W(n)===`monthly`){let e=new Map;for(let t of W(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return W(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Zo(),u=B(R(l),4),d=L(u),f=B(L(d)),p=L(f);p.value=p.__value=`daily`;var m=B(p);m.value=m.__value=`monthly`;var h=B(m);h.value=h.__value=`cumulative`,A(f),di(f),A(d);var g=B(d),_=B(L(g)),v=L(_);v.value=v.__value=6;var y=B(v);y.value=y.__value=12,A(_),di(_),A(g);var b=B(g),x=B(b);A(u);var S=B(u,2),C=e=>{q(e,Uo())};Y(S,e=>{$.data?.usageError&&e(C)});var w=B(S,2),T=e=>{var t=Yo(),r=R(t),i=L(r),l=z(B(L(i),2),!0);A(i);var u=B(i,2),d=z(B(L(u),2),!0);A(u);var f=B(u,2),p=B(L(f),2),m=L(p);Te(),A(p),A(f),A(r);var h=B(r,2),g=L(h),_=z(g),v=B(g,2),y=e=>{var t=Ko(),n=R(t),r=L(n),i=L(r);Z(i,17,()=>Array(W(s)),X,(e,t)=>{q(e,Wo())}),Z(B(i,2),17,()=>W(a),X,(e,t)=>{var n=Go();let r,i;V(e=>{r=ai(n,1,`heat-cell`,null,r,{zero:W(t).tokens===0}),Q(n,`title`,e),i=si(n,``,i,{opacity:W(t).tokens?.25+.75*W(t).tokens/W(o):1})},[()=>`${W(t).date}: ${Zi(W(t).tokens)} tokens`]),q(e,n)}),A(r),A(n),Te(2),q(e,t)},b=e=>{var t=qo(),r=R(t);{let e=N(()=>W(c).map(e=>e.tokens)),t=N(()=>W(n)+` usage`);Fa(r,{get values(){return W(e)},get label(){return W(t)}})}var i=B(r,2),a=L(i),o=z(a,!0),s=z(B(a),!0);A(i),V(e=>{J(o,W(c)[0]?.date),J(s,e)},[()=>W(c).at(-1)?.date]),q(e,t)};Y(v,e=>{W(n)===`daily`?e(y):e(b,-1)});var x=B(v,2),S=B(L(x),2),C=L(S),w=B(L(C));Z(w,21,()=>W(n)===`daily`?W(a):W(c),X,(e,t)=>{var n=Jo(),r=L(n),i=z(r,!0),a=z(B(r),!0);A(n),V(e=>{J(i,W(t).date),J(a,e)},[()=>Zi(W(t).tokens)]),q(e,n)}),A(w),A(C),A(S),A(x),A(h);var T=z(B(h,2));V((e,t,n,r,i)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${W(a)[0]?.date??``} — ${r??``}`),J(T,`OBSERVED ${i??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>Zi($.data.usage.summary.lifetimeTokens),()=>Zi($.data.usage.summary.peakDailyTokens),()=>Zi($.data.usage.summary.currentStreakDays),()=>W(a).at(-1)?.date,()=>Qi($.data.usageAt)]),q(e,t)},E=e=>{q(e,Xo())};Y(w,e=>{$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(T):e(E,-1)}),V(()=>x.disabled=W(i)===0),fi(f,()=>W(n),e=>I(n,e)),G(`change`,_,()=>I(i,0)),fi(_,()=>W(r),e=>I(r,e)),G(`click`,b,()=>Yt(i)),G(`click`,x,()=>Yt(i,-1)),q(e,l),qe()}Sr([`change`,`click`]),We();var $o=K(`

        Page not found

        Return to Quota

        `,1);function es(e){var t=$o();Te(2),q(e,t)}var ts=K(` `),ns=K(`

        `),rs=K(`

        Connecting to your local Codexometer…

        `),is=K(``),as=K(`
        CODEXOMETER

        Your quota. Your sessions. Your command centre.

        `);function os(e,t){Ke(t,!0);let n={"/":Ma,"/quota/:view?":Ma,"/sessions/:id?":zo,"/usage":Qo,"*":es},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=F(`hacker`),a=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];xn(()=>{Ki()}),xn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Li.location)&&(Gi.tab=e)}),Pi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&a.includes(e)&&I(i,e,!0)}catch{}return ra()});function o(){try{localStorage.setItem(`codexometer.web.theme`,W(i))}catch{}}var s=as(),c=L(s),l=B(L(c),2),u=L(l);let d;var f=B(u,1,!0),p=z(B(f));A(l),A(c);var m=B(c,2);Z(m,21,()=>Object.entries(r),X,(e,t)=>{var n=N(()=>g(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1],a=N(()=>i().test(Li.location));var o=ts();let s;var c=z(o,!0);V(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+Gi.view:`#/`+r()),Q(o,`aria-current`,W(a)?`page`:void 0),s=ai(o,1,``,null,s,{active:W(a)}),J(c,e)},[()=>r().toUpperCase()]),q(e,o)}),A(m);var h=B(m,2),_=L(h),v=e=>{var t=ns(),n=z(t,!0);V(()=>J(n,$.error)),q(e,t)};Y(_,e=>{$.error&&e(v)});var y=B(_,2),b=e=>{Bi(e,{get routes(){return n}})},x=e=>{q(e,rs())};Y(y,e=>{$.data?e(b):$.error||e(x,1)}),A(h);var S=B(h,2),C=L(S),w=z(C),T=B(C,2),E=z(T,!0),ee=B(T,2),te=B(L(ee));Z(te,21,()=>a,X,(e,t)=>{var n=is(),r=z(n,!0),i={};V(e=>{J(r,e),i!==(i=W(t))&&(n.value=(n.__value=i)??``)},[()=>W(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),A(te),di(te),A(ee),A(S),A(s),V(()=>{Q(s,`data-theme`,W(i)),d=ai(u,1,`lamp`,null,d,{lit:$.connected}),J(f,$.connected?`CONNECTED`:`OFFLINE`),J(p,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),J(w,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(E,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),G(`change`,te,o),fi(te,()=>W(i),e=>I(i,e)),q(e,s),qe()}Sr([`change`]),Rr(os,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/index.html b/internal/web/dist/index.html index a58492a..1ef6117 100644 --- a/internal/web/dist/index.html +++ b/internal/web/dist/index.html @@ -5,8 +5,8 @@ Codexometer // Experimental web - - + +
        diff --git a/internal/web/server.go b/internal/web/server.go index 6d28e0e..4d6bb13 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -17,6 +17,8 @@ import ( "strings" "sync" "time" + + "github.com/merefield/codexometer/internal/codex" ) // Assets are checked in so go install and terminal-only builds need no Node. @@ -47,6 +49,9 @@ func Run(ctx context.Context, source Source, refresh time.Duration, port int, ou } defer listener.Close() s := &server{store: newStore(), host: loopbackAuthority(listener.Addr().String()), pairSecret: rand.Text(), pairUntil: time.Now().Add(5 * time.Minute), streams: make(chan struct{}, 16)} + if policy, ok := source.(codex.QuotaStepPolicyProvider); ok { + s.store.configureThresholds(policy.QuotaStepPolicy()) + } mode := "READ ONLY" if writable { s.control = newControl(source, s.store) diff --git a/internal/web/state.go b/internal/web/state.go index fd9a09d..7c83592 100644 --- a/internal/web/state.go +++ b/internal/web/state.go @@ -97,8 +97,19 @@ type credit struct { ExpiryKnown bool `json:"expiryKnown"` } +type quotaThreshold struct { + Threshold int `json:"threshold"` + Model string `json:"model"` + Effort string `json:"effort"` + Speed string `json:"speed"` + Mode string `json:"mode"` + State string `json:"state"` + Remaining int `json:"remaining,omitempty"` +} + type state struct { Profiles []profileReview `json:"profiles,omitempty"` + Thresholds []quotaThreshold `json:"thresholds,omitempty"` ProfileError bool `json:"profileError,omitempty"` Control bool `json:"control"` Version string `json:"version"` @@ -125,6 +136,7 @@ type store struct { state state account string history codex.AccountUsage + thresholdPolicy []codex.QuotaStep previous map[string]int64 samples map[string][]sample nextSample time.Time @@ -138,6 +150,36 @@ func newStore() *store { return s } +func (s *store) configureThresholds(steps []codex.QuotaStep) { + s.mu.Lock() + defer s.mu.Unlock() + s.thresholdPolicy = append([]codex.QuotaStep(nil), steps...) + s.refreshThresholds(codex.Snapshot{}) + s.publish() +} + +// refreshThresholds projects the configured policy without exposing session +// control internals. Call with the store lock held. +func (s *store) refreshThresholds(snapshot codex.Snapshot) { + s.state.Thresholds = nil + statuses, _ := codex.QuotaStepStatuses(snapshot, s.thresholdPolicy) + for _, status := range statuses { + step := status.Step + speed, mode := step.ServiceTier, "ASK" + if speed == "" { + speed = "UNCHANGED" + } + if step.Mode == "auto" { + mode = "AUTO" + } + s.state.Thresholds = append(s.state.Thresholds, quotaThreshold{ + Threshold: step.Threshold, Model: codex.SanitizeSessionContext(step.Model), + Effort: codex.SanitizeSessionContext(step.Effort), Speed: codex.SanitizeSessionContext(speed), + Mode: mode, State: string(status.Stage), Remaining: status.Remaining, + }) + } +} + // Called with mu held (except initialization); published byte slices are immutable. func (s *store) publish() { s.data, _ = json.Marshal(s.state) @@ -187,6 +229,7 @@ func (s *store) quota(q codex.Snapshot, err error, now time.Time) { } s.state.CreditCount = 0 s.state.Credits = []credit{} + s.refreshThresholds(q) if q.RateLimitResetCredits != nil { s.state.CreditCount = q.RateLimitResetCredits.AvailableCount for _, c := range q.RateLimitResetCredits.Credits { diff --git a/internal/web/thresholds_test.go b/internal/web/thresholds_test.go new file mode 100644 index 0000000..6122209 --- /dev/null +++ b/internal/web/thresholds_test.go @@ -0,0 +1,31 @@ +package web + +import ( + "testing" + "time" + + "github.com/merefield/codexometer/internal/codex" +) + +func TestThresholdPolicyProjectionIsSortedAndTracksQuota(t *testing.T) { + s := newStore() + s.configureThresholds([]codex.QuotaStep{ + {Threshold: 80, Model: "small", Effort: "low", Mode: "auto"}, + {Threshold: 50, Model: "medium", Effort: "medium", ServiceTier: "fast"}, + }) + if len(s.state.Thresholds) != 2 || s.state.Thresholds[0].Threshold != 50 || s.state.Thresholds[0].State != "CONFIGURED" { + t.Fatalf("configured thresholds = %#v", s.state.Thresholds) + } + + snapshot := codex.DemoSnapshot() + snapshot.AccountFingerprint = "account" + snapshot.RateLimits.Secondary.UsedPercent = 65 + s.quota(snapshot, nil, time.Now()) + got := s.state.Thresholds + if got[0].State != "ACTIVE" || got[0].Speed != "fast" || got[0].Mode != "ASK" { + t.Fatalf("active threshold = %#v", got[0]) + } + if got[1].State != "NEXT" || got[1].Remaining != 15 || got[1].Mode != "AUTO" || got[1].Speed != "UNCHANGED" { + t.Fatalf("next threshold = %#v", got[1]) + } +} diff --git a/intro-post.md b/intro-post.md index cf24388..aed19a0 100644 --- a/intro-post.md +++ b/intro-post.md @@ -51,6 +51,9 @@ keep priority. These shortcuts navigate only; they never approve or send for you Optional quota step-down profiles also join the session command centre in the terminal and writable web interface: configure `--quota-step-down PERCENT:MODEL:EFFORT[:SPEED[:ask|auto]]`, then follow a **QUOTA THRESHOLD** pill to review the proposed settings for that session. +Configuring any steps also reveals a dedicated **Thresholds** tab in the terminal +and web dashboards, giving you a compact overview of every trigger and clearly +marking the active and next model profile. It stays hidden on normal launches. Apply and confirm individually, or skip. A session can have separate pills for its Codex request and quota review; each opens the corresponding detail, with Codex requests ordered first. Completion pills wait until outstanding reviews diff --git a/web/src/App.svelte b/web/src/App.svelte index d4a00f6..69d47dd 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -5,6 +5,7 @@ import Quota from './Quota.svelte'; import Sessions from './Sessions.svelte'; import Usage from './Usage.svelte'; + import Thresholds from './Thresholds.svelte'; import Missing from './Missing.svelte'; import { preferences, savePreferences } from './preferences.svelte'; @@ -13,13 +14,24 @@ '/quota/:view?': Quota, '/sessions/:id?': Sessions, '/usage': Usage, + '/thresholds': Thresholds, '*': Missing, }; - const tabPaths = { + const baseTabPaths = { quota: /^(?:\/|\/quota(?:\/[^/]+)?\/?)$/, sessions: /^\/sessions(?:\/[^/]+)?\/?$/, usage: /^\/usage\/?$/, }; + let tabPaths = $derived( + live.data?.thresholds?.length + ? { + quota: baseTabPaths.quota, + thresholds: /^\/thresholds\/?$/, + sessions: baseTabPaths.sessions, + usage: baseTabPaths.usage, + } + : baseTabPaths, + ); let theme = $state('hacker'); const themes = ['hacker', 'rust', 'blue-steel', 'ultraviolet', 'nightshade']; $effect(() => { @@ -27,6 +39,13 @@ }); $effect(() => { if (!live.data) return; + if ( + /^\/thresholds\/?$/.test(router.location) && + !live.data.thresholds?.length + ) { + location.hash = '#/quota/' + preferences.view; + return; + } for (const [tab, pattern] of Object.entries(tabPaths)) { if (pattern.test(router.location)) preferences.tab = tab as typeof preferences.tab; diff --git a/web/src/Thresholds.svelte b/web/src/Thresholds.svelte new file mode 100644 index 0000000..b8266c3 --- /dev/null +++ b/web/src/Thresholds.svelte @@ -0,0 +1,44 @@ + + +{#if live.data?.thresholds?.length} +

        MODEL STEP POLICY // OBSERVED {date(live.data.quotaAt)}

        + {#if live.data.quotaError}

        + Quota refresh failed. Policy state is based on the last successful + observation. +

        {/if} +
        +

        THRESHOLDS // {live.data.thresholds.length} CONFIGURED

        +

        + The longest Codex quota window selects one active model profile. ASK + creates a per-session review; AUTO applies the profile on the next + eligible check. +

        +
        + {#each live.data.thresholds as threshold} +
        +
        {threshold.threshold}%
        +
        + {threshold.model} +

        + {threshold.effort.toUpperCase()} REASONING // {threshold.speed.toUpperCase()} + SPEED +

        +
        +
        {threshold.mode}
        +
        + {threshold.state}{threshold.state === 'NEXT' + ? ` // ${threshold.remaining || 0} PP TO GO` + : ''} +
        +
        + {/each} +
        +
        +{:else} +

        No threshold-based model steps were configured at launch.

        +{/if} diff --git a/web/src/preferences.svelte.ts b/web/src/preferences.svelte.ts index 3c65d88..58ed29c 100644 --- a/web/src/preferences.svelte.ts +++ b/web/src/preferences.svelte.ts @@ -1,7 +1,7 @@ export const quotaViews = ['bars', 'pace', 'zone', 'pie', 'fuel', 'resets']; const key = 'codexometer.web.preferences.v1'; interface Preferences { - tab: 'quota' | 'sessions' | 'usage'; + tab: 'quota' | 'sessions' | 'usage' | 'thresholds'; view: string; selected: string; defaultDetail: number; @@ -19,7 +19,7 @@ function read(): Preferences { const value = JSON.parse(localStorage.getItem(key) || 'null'); if (!value || typeof value !== 'object') return defaults; return { - tab: ['quota', 'sessions', 'usage'].includes(value.tab) + tab: ['quota', 'sessions', 'usage', 'thresholds'].includes(value.tab) ? value.tab : 'quota', view: quotaViews.includes(value.view) ? value.view : 'bars', diff --git a/web/src/state.svelte.ts b/web/src/state.svelte.ts index 554edd4..9158aea 100644 --- a/web/src/state.svelte.ts +++ b/web/src/state.svelte.ts @@ -38,6 +38,15 @@ export interface Usage { }; dailyUsageBuckets: { startDate: string; tokens: number }[] | null; } +export interface Threshold { + threshold: number; + model: string; + effort: string; + speed: string; + mode: string; + state: string; + remaining?: number; +} export interface Snapshot { profiles?: { session: string; @@ -48,6 +57,7 @@ export interface Snapshot { notice?: string; }[]; profileError?: boolean; + thresholds?: Threshold[]; control?: boolean; version: string; meters: Meter[]; diff --git a/web/src/style.css b/web/src/style.css index 59d0794..0c66a41 100644 --- a/web/src/style.css +++ b/web/src/style.css @@ -531,6 +531,57 @@ hr { gap: 16px; margin: 20px 0; } +.thresholds-panel { + padding: clamp(14px, 2vw, 22px); +} +.thresholds-panel h1 { + margin-top: 0; +} +.threshold-list { + display: grid; + gap: 8px; + margin-top: 16px; +} +.threshold-list article { + display: grid; + grid-template-columns: + minmax(64px, 0.5fr) minmax(220px, 3fr) minmax(64px, 0.6fr) + minmax(120px, 1.2fr); + align-items: center; + gap: 12px; + border: 1px solid var(--edge); + padding: 10px 12px; +} +.threshold-list article.active { + border-color: var(--accent); + box-shadow: inset 3px 0 0 var(--accent); +} +.threshold-list article.next { + border-color: var(--approval); + box-shadow: inset 3px 0 0 var(--approval); +} +.threshold-list p { + margin: 3px 0 0; + color: var(--muted); + font-size: 12px; +} +.threshold-trigger { + color: var(--accent); + font-size: 22px; + font-weight: 800; +} +.threshold-mode, +.threshold-state { + color: var(--muted); + font-size: 12px; + font-weight: 700; +} +.threshold-list article.active .threshold-state { + color: var(--accent); +} +.threshold-list article.next .threshold-state { + color: var(--approval); +} .heat-scroll { overflow-x: auto; } @@ -591,6 +642,13 @@ footer select { .connection { text-align: left; } + .threshold-list article { + grid-template-columns: 64px minmax(0, 1fr); + } + .threshold-mode, + .threshold-state { + grid-column: 2; + } } @media (prefers-reduced-motion: reduce) { *, diff --git a/web/tests/browser.spec.ts b/web/tests/browser.spec.ts index 6336d3b..fe686ae 100644 --- a/web/tests/browser.spec.ts +++ b/web/tests/browser.spec.ts @@ -104,6 +104,17 @@ test.describe('quota profile reviews', () => { pairingURL, }) => { await page.goto(pairingURL); + const thresholds = page.getByRole('link', { + name: 'THRESHOLDS', + exact: true, + }); + await expect(thresholds).toBeVisible(); + await thresholds.click(); + await expect( + page.getByRole('heading', { name: /THRESHOLDS/ }), + ).toBeVisible(); + await expect(page.locator('.threshold-list')).toContainText('gpt-5.6-luna'); + await expect(page.locator('.threshold-list')).toContainText('ASK'); await page.getByRole('link', { name: 'SESSIONS', exact: true }).click(); const pill = page.getByRole('link', { name: /QUOTA THRESHOLD/ }).first(); await expect(pill).toBeVisible({ timeout: 15000 }); @@ -171,6 +182,16 @@ test.describe('quota profile reviews', () => { }); }); +test('Thresholds navigation stays hidden without a launch policy', async ({ + page, + pairingURL, +}) => { + await page.goto(pairingURL); + await expect( + page.getByRole('link', { name: 'THRESHOLDS', exact: true }), + ).toHaveCount(0); +}); + test('read-only session copy captures working prose in every detail level without server writes', async ({ page, pairingURL, From fc9accd4a9c07d4e8c697981f10c447fe1e9154c Mon Sep 17 00:00:00 2001 From: merefield Date: Sat, 19 Sep 2026 13:58:47 +0100 Subject: [PATCH 2/3] UX: move Thresholds after Resets within Quota --- README.md | 6 +-- internal/ui/model.go | 2 +- internal/ui/preferences.go | 6 +-- internal/ui/preferences_test.go | 15 +++++-- internal/ui/tabs.go | 51 ++++++++-------------- internal/ui/tabs_test.go | 39 +++++++++++------ internal/ui/theme.go | 8 +++- internal/ui/thresholds_test.go | 7 ++- internal/ui/view.go | 4 +- internal/web/dist/assets/index-11iTtNNT.js | 30 +++++++++++++ internal/web/dist/assets/index-CCAs5nbB.js | 30 ------------- internal/web/dist/index.html | 2 +- intro-post.md | 2 +- web/src/App.svelte | 21 +-------- web/src/Quota.svelte | 11 ++++- web/src/preferences.svelte.ts | 14 ++++-- web/tests/browser.spec.ts | 11 +++++ 17 files changed, 137 insertions(+), 122 deletions(-) create mode 100644 internal/web/dist/assets/index-11iTtNNT.js delete mode 100644 internal/web/dist/assets/index-CCAs5nbB.js diff --git a/README.md b/README.md index 247dfa7..ff632c1 100644 --- a/README.md +++ b/README.md @@ -2082,12 +2082,12 @@ are rejected before changing settings. `standard` clears an explicit tier; omitting speed leaves the session's current tier intact. Codexometer ships no enabled profile and does not infer which model is cheaper. -When one or more steps are configured, Codexometer adds a primary -**Thresholds** tab in both the terminal and experimental web interface. It keeps +When one or more steps are configured, Codexometer adds a **Thresholds** view +after **Resets** within **Quota**, in both the terminal and experimental web interface. It keeps the complete policy visible in trigger order, including model, reasoning level, speed and `ask`/`auto` behavior, and marks the active and next steps against the longest Codex quota window. The tab is omitted entirely on ordinary launches; -saved navigation also falls back to the last Quota view when no policy is +saved Thresholds navigation falls back to Bars when no policy is configured. Approvals remain attached to their individual sessions in **Sessions** rather than being actioned from the policy overview. `ACTIVE` identifies the selected policy, not confirmation that every session has diff --git a/internal/ui/model.go b/internal/ui/model.go index 2540d1c..8fab125 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -1328,7 +1328,7 @@ func (m Model) activateFooterButton(button footerButtonID) (Model, tea.Cmd) { m.persistPreferences() case footerButtonView: if m.meterView.isQuota() { - m.meterView = m.meterView.nextQuota() + m.meterView = m.meterView.nextQuota(len(m.quotaSteps) > 0) m.quotaMeterView = m.meterView m.persistPreferences() } diff --git a/internal/ui/preferences.go b/internal/ui/preferences.go index 59d9f75..73a5ec0 100644 --- a/internal/ui/preferences.go +++ b/internal/ui/preferences.go @@ -81,7 +81,7 @@ func (m *Model) applyPreferences(preferences Preferences) { if theme, ok := themePreferenceIDs[preferences.Theme]; ok { m.theme = theme } - if view, ok := quotaViewPreferenceIDs[preferences.QuotaView]; ok { + if view, ok := quotaViewPreferenceIDs[preferences.QuotaView]; ok && (view != viewThresholds || len(m.quotaSteps) > 0) { m.meterView = view m.quotaMeterView = view } @@ -120,7 +120,7 @@ func (m Model) persistPreferences() { } var mainTabPreferenceNames = map[mainTabID]string{ - mainTabQuota: "quota", mainTabMonitor: "monitor", mainTabUsage: "usage", mainTabBenchmark: "benchmark", mainTabThresholds: "thresholds", + mainTabQuota: "quota", mainTabMonitor: "monitor", mainTabUsage: "usage", mainTabBenchmark: "benchmark", } var themePreferenceNames = map[themeID]string{ @@ -139,7 +139,7 @@ func reverseThemePreferences(values map[themeID]string) map[string]themeID { } var quotaViewPreferenceNames = map[meterViewID]string{ - viewBars: "bars", viewPie: "pie", viewConsumptionPace: "consumption-pace", viewFuel: "fuel-tank", viewResets: "resets", + viewBars: "bars", viewPie: "pie", viewConsumptionPace: "consumption-pace", viewFuel: "fuel-tank", viewResets: "resets", viewThresholds: "thresholds", } var quotaViewPreferenceIDs = reverseViewPreferences(quotaViewPreferenceNames) diff --git a/internal/ui/preferences_test.go b/internal/ui/preferences_test.go index 9894b68..2287901 100644 --- a/internal/ui/preferences_test.go +++ b/internal/ui/preferences_test.go @@ -84,9 +84,6 @@ func TestPreferencesRememberMainTabSeparatelyFromQuotaView(t *testing.T) { t.Run(name, func(t *testing.T) { store := &memoryPreferenceStore{preferences: Preferences{QuotaView: "fuel-tank"}} var fetcher Fetcher - if tab == mainTabThresholds { - fetcher = "aStepTestFetcher{steps: []codex.QuotaStep{{Threshold: 80, Model: "small", Effort: "medium"}}} - } m := NewWithPreferences(fetcher, time.Minute, store) next, _ := m.pressMainTab(tab) m = next.(Model) @@ -118,6 +115,18 @@ func TestPreferencesRememberMainTabSeparatelyFromQuotaView(t *testing.T) { } } +func TestThresholdQuotaPreferenceRequiresPolicy(t *testing.T) { + s := &memoryPreferenceStore{preferences: Preferences{MainTab: "quota", QuotaView: "thresholds"}} + m := NewWithPreferences("aStepTestFetcher{steps: []codex.QuotaStep{{Threshold: 80}}}, time.Minute, s) + if m.meterView != viewThresholds || m.currentMainTab() != mainTabQuota { + t.Fatal("Thresholds quota view was not restored") + } + m = NewWithPreferences(nil, time.Minute, s) + if m.meterView != viewBars { + t.Fatal("unavailable Thresholds did not fall back to Bars") + } +} + func TestRestoredTabsLoadDataWithoutStartingBenchmark(t *testing.T) { tasks := make(chan []codex.BenchmarkTaskID, 1) m := NewWithPreferences(benchmarkCaptureFetcher{tasks: tasks}, time.Minute, &memoryPreferenceStore{preferences: Preferences{MainTab: "benchmark"}}) diff --git a/internal/ui/tabs.go b/internal/ui/tabs.go index 0b38dd6..ec10a9a 100644 --- a/internal/ui/tabs.go +++ b/internal/ui/tabs.go @@ -17,7 +17,6 @@ const ( mainTabMonitor mainTabUsage mainTabBenchmark - mainTabThresholds mainTabCount ) @@ -58,10 +57,6 @@ func responsiveTabLabels(width int, tiers [][]string) ([]string, string) { } func mainTabLayout(width int, showMonitorLight bool) ([]mainTab, string) { - return mainTabLayoutFor(width, showMonitorLight, false) -} - -func mainTabLayoutFor(width int, showMonitorLight, showThresholds bool) ([]mainTab, string) { monitorFull := i18n.Text("╭ SESSIONS ╮") monitorCompact := "╭SES╮" monitorMinimal := "[S]" @@ -79,15 +74,6 @@ func mainTabLayoutFor(width int, showMonitorLight, showThresholds bool) ([]mainT {"[Q]", monitorMinimal, "[U]", "[B]"}, {"Q", microMonitor, "U", "B"}, } - if showThresholds { - ids = []mainTabID{mainTabQuota, mainTabThresholds, mainTabMonitor, mainTabUsage, mainTabBenchmark} - tiers = [][]string{ - {i18n.Text("╭ QUOTA ╮"), "╭ " + i18n.Text("THRESHOLDS") + " ╮", monitorFull, i18n.Text("╭ USAGE ╮"), i18n.Text("╭ BENCHMARK ╮")}, - {"╭QTA╮", "╭STEP╮", monitorCompact, "╭USE╮", "╭TEST╮"}, - {"[Q]", "[T]", monitorMinimal, "[U]", "[B]"}, - {"Q", "T", microMonitor, "U", "B"}, - } - } labels, separator := responsiveTabLabels(width, tiers) tabs := make([]mainTab, 0, len(ids)) @@ -103,13 +89,22 @@ func mainTabLayoutFor(width int, showMonitorLight, showThresholds bool) ([]mainT return tabs, separator } -func quotaViewTabLayout(width int) ([]viewTab, string) { - labels, separator := responsiveTabLabels(width, [][]string{ +func quotaViewTabLayout(width int, thresholds ...bool) ([]viewTab, string) { + order := append([]meterViewID(nil), quotaViewOrder[:]...) + tiers := [][]string{ {i18n.Text("╭ BARS ╮"), i18n.Text("╭ CONSUMPTION PACE ╮"), i18n.Text("╭ PIE ╮"), i18n.Text("╭ FUEL TANK ╮"), i18n.Text("╭ RESETS ╮")}, {"╭BAR╮", "╭PACE╮", "╭PIE╮", "╭FUEL╮", "╭RST╮"}, {"[B]", "[C]", "[P]", "[F]", "[R]"}, {"B", "C", "P", "F", "R"}, - }) + } + if len(thresholds) > 0 && thresholds[0] { + order = append(order, viewThresholds) + labels := []string{"╭ " + i18n.Text("THRESHOLDS") + " ╮", "╭STEP╮", "[T]", "T"} + for i := range tiers { + tiers[i] = append(tiers[i], labels[i]) + } + } + labels, separator := responsiveTabLabels(width, tiers) tabs := make([]viewTab, 0, len(quotaViewOrder)) x := 0 @@ -118,7 +113,7 @@ func quotaViewTabLayout(width int) ([]viewTab, string) { if x+tabWidth > width { break } - tabs = append(tabs, viewTab{view: quotaViewOrder[index], label: label, x: x, width: tabWidth}) + tabs = append(tabs, viewTab{view: order[index], label: label, x: x, width: tabWidth}) x += tabWidth + len(separator) } return tabs, separator @@ -132,8 +127,6 @@ func (m Model) currentMainTab() mainTabID { return mainTabMonitor case viewBenchmark: return mainTabBenchmark - case viewThresholds: - return mainTabThresholds default: return mainTabQuota } @@ -162,11 +155,6 @@ func (m Model) pressMainTab(tab mainTabID) (tea.Model, tea.Cmd) { return m.pressViewTab(viewUsage) case mainTabBenchmark: return m.pressViewTab(viewBenchmark) - case mainTabThresholds: - if len(m.quotaSteps) > 0 { - return m.pressViewTab(viewThresholds) - } - return m, nil default: return m, nil } @@ -180,8 +168,6 @@ func mainTabForView(view meterViewID) mainTabID { return mainTabMonitor case viewBenchmark: return mainTabBenchmark - case viewThresholds: - return mainTabThresholds default: return mainTabQuota } @@ -189,7 +175,7 @@ func mainTabForView(view meterViewID) mainTabID { func (m Model) renderMainTabs(width int, colors palette) string { tabWidth, _ := m.resetLayout(width) - tabs, separator := mainTabLayoutFor(tabWidth, true, len(m.quotaSteps) > 0) + tabs, separator := mainTabLayout(tabWidth, true) parts := make([]string, 0, len(tabs)) used := 0 for _, tab := range tabs { @@ -207,7 +193,7 @@ func (m Model) renderMainTabs(width int, colors palette) string { } func (m Model) renderQuotaViewTabs(width int, colors palette) string { - tabs, separator := quotaViewTabLayout(width) + tabs, separator := quotaViewTabLayout(width, len(m.quotaSteps) > 0) parts := make([]string, 0, len(tabs)) used := 0 for _, tab := range tabs { @@ -286,7 +272,7 @@ func (m Model) mainTabAt(x, y int) (mainTabID, bool) { } localX := x - 2 tabWidth, _ := m.resetLayout(layout.contentWidth) - tabs, _ := mainTabLayoutFor(tabWidth, true, len(m.quotaSteps) > 0) + tabs, _ := mainTabLayout(tabWidth, true) for _, tab := range tabs { if localX >= tab.x && localX < tab.x+tab.width { return tab.tab, true @@ -297,9 +283,6 @@ func (m Model) mainTabAt(x, y int) (mainTabID, bool) { func (m Model) adjacentMainTab(direction int) mainTabID { tabs := []mainTabID{mainTabQuota, mainTabMonitor, mainTabUsage, mainTabBenchmark} - if len(m.quotaSteps) > 0 { - tabs = []mainTabID{mainTabQuota, mainTabThresholds, mainTabMonitor, mainTabUsage, mainTabBenchmark} - } current := m.currentMainTab() for index, tab := range tabs { if tab == current { @@ -318,7 +301,7 @@ func (m Model) quotaViewTabAt(x, y int) (meterViewID, bool) { return viewBars, false } localX := x - 2 - tabs, _ := quotaViewTabLayout(layout.contentWidth) + tabs, _ := quotaViewTabLayout(layout.contentWidth, len(m.quotaSteps) > 0) for _, tab := range tabs { if localX >= tab.x && localX < tab.x+tab.width { return tab.view, true diff --git a/internal/ui/tabs_test.go b/internal/ui/tabs_test.go index 377f1f0..82bbe7d 100644 --- a/internal/ui/tabs_test.go +++ b/internal/ui/tabs_test.go @@ -24,8 +24,8 @@ func TestMainTabsChooseResponsiveLabels(t *testing.T) { } { t.Run(test.want, func(t *testing.T) { tabs, _ := mainTabLayout(test.width, true) - if len(tabs) != int(mainTabCount)-1 { - t.Fatalf("width %d displayed %d main tabs, want %d", test.width, len(tabs), mainTabCount-1) + if len(tabs) != int(mainTabCount) { + t.Fatalf("width %d displayed %d main tabs, want %d", test.width, len(tabs), mainTabCount) } var labels strings.Builder for _, tab := range tabs { @@ -42,18 +42,29 @@ func TestMainTabsChooseResponsiveLabels(t *testing.T) { } func TestThresholdTabOnlyAppearsWithConfiguredSteps(t *testing.T) { - without, _ := mainTabLayoutFor(100, true, false) - with, _ := mainTabLayoutFor(100, true, true) - if len(without) != 4 || len(with) != 5 || with[1].tab != mainTabThresholds || !strings.Contains(with[1].label, "THRESHOLDS") { - t.Fatalf("conditional tab layout: without=%#v with=%#v", without, with) - } - m := Model{meterView: viewBars} - if got := m.adjacentMainTab(1); got != mainTabMonitor { - t.Fatalf("next tab without policy = %d", got) - } - m.quotaSteps = []codex.QuotaStep{{Threshold: 80}} - if got := m.adjacentMainTab(1); got != mainTabThresholds { - t.Fatalf("next tab with policy = %d", got) + without, _ := quotaViewTabLayout(160, false) + with, _ := quotaViewTabLayout(160, true) + if len(without) != 5 || len(with) != 6 || with[5].view != viewThresholds || with[4].view != viewResets { + t.Fatal("Thresholds must follow Resets only when configured") + } + m := Model{meterView: viewResets, quotaSteps: []codex.QuotaStep{{Threshold: 80}}} + updated, _ := m.Update(key('v')) + m = updated.(Model) + if m.meterView != viewThresholds || m.currentMainTab() != mainTabQuota { + t.Fatal("V did not enter Quota Thresholds") + } + updated, _ = m.Update(specialKey(tea.KeyTab)) + m = updated.(Model) + if m.meterView != viewMonitor { + t.Fatal("Tab did not enter Sessions") + } + updated, _ = m.pressMainTab(mainTabQuota) + if updated.(Model).meterView != viewThresholds { + t.Fatal("Quota lost Thresholds selection") + } + updated, _ = updated.(Model).Update(key('v')) + if updated.(Model).meterView != viewBars { + t.Fatal("V did not wrap to Bars") } } diff --git a/internal/ui/theme.go b/internal/ui/theme.go index 9f67142..d54af83 100644 --- a/internal/ui/theme.go +++ b/internal/ui/theme.go @@ -47,6 +47,9 @@ var quotaViewOrder = [...]meterViewID{ } func (s meterViewID) isQuota() bool { + if s == viewThresholds { + return true + } for _, view := range quotaViewOrder { if s == view { return true @@ -55,7 +58,10 @@ func (s meterViewID) isQuota() bool { return false } -func (s meterViewID) nextQuota() meterViewID { +func (s meterViewID) nextQuota(thresholds ...bool) meterViewID { + if s == viewResets && len(thresholds) > 0 && thresholds[0] { + return viewThresholds + } for index, view := range quotaViewOrder { if s == view { return quotaViewOrder[(index+1)%len(quotaViewOrder)] diff --git a/internal/ui/thresholds_test.go b/internal/ui/thresholds_test.go index c7693ef..10ef615 100644 --- a/internal/ui/thresholds_test.go +++ b/internal/ui/thresholds_test.go @@ -30,12 +30,11 @@ func TestThresholdNavigationHitboxesAndScroll(t *testing.T) { for _, width := range []int{20, 40, 80, 120} { m := Model{width: width, height: 16, snapshot: codex.DemoSnapshot(), quotaSteps: []codex.QuotaStep{{Threshold: 80, Model: "small", Effort: "low"}}} g := m.dashboardLayout() - tabWidth, _ := m.resetLayout(g.contentWidth) - tabs, _ := mainTabLayoutFor(tabWidth, true, true) + tabs, _ := quotaViewTabLayout(g.contentWidth, true) for _, tab := range tabs { for x := tab.x; x < tab.x+tab.width; x++ { - if got, ok := m.mainTabAt(x+2, g.tabsY); !ok || got != tab.tab { - t.Fatalf("width %d: tab %d hitbox mismatch at %d", width, tab.tab, x) + if got, ok := m.quotaViewTabAt(x+2, g.quotaTabsY); !ok || got != tab.view { + t.Fatalf("width %d: tab %d hitbox mismatch at %d", width, tab.view, x) } } } diff --git a/internal/ui/view.go b/internal/ui/view.go index e833d19..ff22df8 100644 --- a/internal/ui/view.go +++ b/internal/ui/view.go @@ -52,7 +52,7 @@ func (m Model) render() string { parts = append(parts, m.renderResetNotice(contentWidth)) } meters := m.snapshot.Meters() - if m.meterView.isQuota() && m.meterView != viewResets { + if m.meterView.isQuota() && m.meterView != viewResets && m.meterView != viewThresholds { meters = m.quotaMetersWithInsights(contentWidth) } if len(meters) == 0 && m.meterView != viewUsage && m.meterView != viewResets && m.meterView != viewThresholds { @@ -183,7 +183,7 @@ func (m Model) renderFooter(width int, colors palette) string { status = joinRight(status, colors.dimmed().Render(hint), width) } } - if m.meterView == viewBenchmark || (m.meterView.isQuota() && m.meterView != viewResets) { + if m.meterView == viewBenchmark || (m.meterView.isQuota() && m.meterView != viewResets && m.meterView != viewThresholds) { status = renderPricingFooter(status, width, colors) } buttons, separator := footerButtonLayoutWithTheme(width, colors.name, m.meterView.isQuota()) diff --git a/internal/web/dist/assets/index-11iTtNNT.js b/internal/web/dist/assets/index-11iTtNNT.js new file mode 100644 index 0000000..c85fa4b --- /dev/null +++ b/internal/web/dist/assets/index-11iTtNNT.js @@ -0,0 +1,30 @@ +(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 e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return e()}function m(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function g(e,t,n=!1){return e===void 0?n?t():t:e}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,ee=1<<20,te=1<<25,ne=65536,re=1<<21,ie=1<<22,ae=1<<23,oe=Symbol(`$state`),se=Symbol(`component`),ce=Symbol(`legacy props`),le=Symbol(``),ue=Symbol(`attributes`),de=Symbol(`class`),fe=Symbol(`style`),pe=Symbol(`text`),me=Symbol(`form reset`),he=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ge=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),_e={},D=Symbol(`uninitialized`),ve=`http://www.w3.org/1999/xhtml`;function ye(){console.warn(`https://svelte.dev/e/derived_inert`)}function be(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function xe(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Se(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var O=!1;function Ce(e){O=e}var k;function we(e){if(e===null)throw be(),_e;return k=e}function Te(){return we(un(k))}function A(e){if(O){if(un(k)!==null)throw be(),_e;k=e}}function Ee(e=1){if(O){for(var t=e,n=k;t--;)n=un(n);k=n}}function De(e=!0){for(var t=0,n=k;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=un(n);e&&n.remove(),n=i}}function Oe(e){if(!e||e.nodeType!==8)throw be(),_e;return e.data}function ke(e){return e===this.v}function Ae(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function je(e){return!Ae(e,this.v)}function Me(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Ne(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Pe(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Fe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ie(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Le(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Re(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function ze(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Be(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ve(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function He(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ue(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var We=!1;function Ge(){We=!0}var j=null;function Ke(e){j=e}function qe(e,t=!1,n){j={p:j,i:!1,c:null,e:null,s:e,x:null,r:U,l:We&&!t?{s:null,u:null,$:[]}:null}}function Je(e){var t=j,n=t.e;if(n!==null){t.e=null;for(var r of n)Cn(r)}return e!==void 0&&(t.x=e),t.i=!0,j=t.p,Ye(e)}function Ye(e={}){return i(e,se,{value:!0}),e}function Xe(){return!We||j!==null&&j.l===null}var Ze=[];function Qe(){var e=Ze;Ze=[],m(e)}function $e(e){if(Ze.length===0&&!kt){var t=Ze;queueMicrotask(()=>{t===Ze&&Qe()})}Ze.push(e)}function et(){for(;Ze.length>0;)Qe()}var tt=~(y|b|v);function M(e,t){e.f=e.f&tt|t}function nt(e){e.f&512||e.deps===null?M(e,v):M(e,b)}function rt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=ne,rt(t.deps))}function it(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),rt(e.deps),M(e,v)}var at=!1;function ot(e){var t=at;try{return at=!1,[e(),at]}finally{at=t}}function st(e){O&&ln(e)!==null&&dn(e)}var ct=!1;function lt(){ct||(ct=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[me]?.()})},{capture:!0}))}function ut(e){var t=H,n=U;qn(null),Jn(null);try{return e()}finally{qn(t),Jn(n)}}function dt(e,t,n,r=n){e.addEventListener(t,()=>ut(n));let i=e[me];e[me]=i?()=>{i(),r(!0)}:()=>r(!0),lt()}function ft(e,t,n,r){let i=Xe()?gt:yt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=U,c=pt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){gn(e,s)}mt()}}var d=ht();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>vt(e))).then(u).catch(e=>gn(e,s)).finally(d)}l?l.then(()=>{c(),f(),mt()}):f()}function pt(){var e=U,t=H,n=j,r=P;return function(i=!0){Jn(e),qn(t),Ke(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function mt(e=!0){Jn(null),qn(null),Ke(null),e&&P?.deactivate()}function ht(){var e=U,t=e.b,n=P,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function gt(e){var t=2|y;return U!==null&&(U.f|=E),{ctx:j,deps:null,effects:null,equals:ke,f:t,fn:e,reactions:null,rv:0,v:D,wv:0,parent:U,ac:null}}var _t=Symbol(`obsolete`);function vt(e,t,n){let r=U;r===null&&Ne();var i=void 0,a=Kt(D),o=!H,s=new Set;return Dn(()=>{var t=U,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==he&&n.reject(e)}).finally(mt)}catch(e){n.reject(e),mt()}var c=P;if(o){if(t.f&32768)var l=ht();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(_t);else for(let e of s.values())e.reject(_t);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==_t&&(c.activate(),t?(a.f|=ae,Jt(a,t)):(a.f&8388608&&(a.f^=ae),Jt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),xn(()=>{for(let e of s)e.reject(_t)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function N(e){let t=gt(e);return Xn(t),t}function yt(e){let t=gt(e);return t.equals=je,t}function bt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(he),t.ac=null}),t.fn!==null&&(t.teardown=f),dr(t,0),Mn(t))}function wt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&fr(t)}var Tt=null,P=null,Et=null,Dt=null,Ot=null,kt=!1,At=!1,jt=null,Mt=null,Nt=0,Pt=1,Ft=class e{id=Pt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){Tt===null?Tt=this:(Tt.#n=this,this.#t=Tt),Tt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)M(r,y),t(r);for(r of n.m)M(r,b),t(r)}this.#p.add(e)}#g(){this.#e=!0,Nt++>1e3&&(this.#x(),Lt());for(let e of this.#u)this.#d.delete(e),M(e,y),this.schedule(e);for(let e of this.#d)M(e,b),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=jt=[],r=[],i=Mt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Ht(e),this.#h()||this.discard(),t}if(P=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(jt=null,Mt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Vt(e,t);i.length>0&&P.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Et=this,zt(r),zt(n),Et=null,this.#s?.resolve();var s=P;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Wt.clear(),s.#g())}#_(e,t,n){e.f^=v;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=v:i&4?t.push(r):or(r)&&(i&16&&this.#d.add(r),fr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),M(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),P=this,this.#g()}#b(e){for(var t=0;t{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=h()).promise}static ensure(){if(P===null){let t=P=new e;!At&&!kt&&$e(()=>{t.#e||t.flush()})}return P}apply(){Dt=null}schedule(e){if(Ot=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(jt!==null&&t===U&&(H===null||!(H.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?Tt=e:t.#t=e,this.linked=!1}}};function It(e){var t=kt;kt=!0;try{var n;for(e&&(P!==null&&!P.is_fork&&P.flush(),n=e());;){if(et(),P===null)return n;P.flush()}}finally{kt=t}}function Lt(){try{Re()}catch(e){gn(e,Ot)}}var Rt=null;function zt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Wt.clear();for(let e of Rt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Rt.has(n)&&(Rt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||fr(n)}}Rt.clear()}}Rt=null}}function Bt(e){P.schedule(e)}function Vt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),M(e,v);for(var n=e.first;n!==null;)Vt(n,t),n=n.next}}function Ht(e){M(e,v);for(var t=e.first;t!==null;)Ht(t),t=t.next}var Ut=new Set,Wt=new Map,Gt=!1;function Kt(e,t){return{f:0,v:e,reactions:null,equals:ke,rv:0,wv:0}}function F(e,t){let n=Kt(e,t);return Xn(n),n}function qt(e,t=!1,n=!0){let r=Kt(e);return t||(r.equals=je),We&&n&&j!==null&&j.l!==null&&(j.l.s??=[]).push(r),r}function I(e,t,n=!1){return H!==null&&(!Kn||H.f&131072)&&Xe()&&H.f&4325394&&(Yn===null||!Yn.has(e))&&He(),Jt(e,n?$t(t):t,Mt)}function Jt(e,t,n=null){if(!e.equals(t)){Wn?Wt.set(e,t):Wt.has(e)||Wt.set(e,e.v);var r=Ft.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&xt(t),Dt===null&&nt(t)}e.wv=ar(),Qt(e,y,n),Xe()&&U!==null&&U.f&1024&&!(U.f&96)&&($n===null?er([e]):$n.push(e)),!r.is_fork&&Ut.size>0&&!Gt&&Yt()}return t}function Yt(){Gt=!1;for(let e of Ut){e.f&1024&&M(e,b);let t;try{t=or(e)}catch{t=!0}t&&fr(e)}Ut.clear()}function Xt(e,t=1){var n=W(e),r=t===1?n++:n--;return I(e,n),r}function Zt(e){I(e,e.v+1)}function Qt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Xe(),a=r.length,o=0;o{if(rr===d)return e();var t=H,n=rr;qn(null),ir(d);var r=e();return qn(t),ir(n),r};return i&&r.set(`length`,F(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Be();var i=r.get(t);return i===void 0?f(()=>{var e=F(n.value,u);return r.set(t,e),e}):I(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>F(D,u));r.set(t,e),Zt(o)}}else I(n,D),Zt(o);return!0},get(e,n,i){if(n===oe)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>F($t(s?e[n]:D),u)),r.set(n,o)),o!==void 0){var c=W(o);return c===D?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=W(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==D)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===oe)return!0;var n=r.get(t),i=n!==void 0&&n.v!==D||Reflect.has(e,t);return(n!==void 0||U!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>F(i?$t(e[t]):D,u)),r.set(t,n)),W(n)===D)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dF(D,u)),r.set(d+``,p)):I(p,D)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>F(void 0,u)),I(c,$t(n)),r.set(t,c));else{l=c.v!==D;var m=f(()=>$t(n));I(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&I(g,_+1)}Zt(o)}return!0},ownKeys(e){W(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==D});for(var[n,i]of r)i.v!==D&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ve()}})}function en(e){try{if(typeof e==`object`&&e&&oe in e)return e[oe]}catch{}return e}function tn(e,t){return Object.is(en(e),en(t))}var nn,rn,an,on;function sn(){if(nn===void 0){nn=window,rn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;an=a(t,`firstChild`).get,on=a(t,`nextSibling`).get,u(e)&&(e[de]=void 0,e[ue]=null,e[fe]=void 0,e.__e=void 0),u(n)&&(n[pe]=void 0)}}function cn(e=``){return document.createTextNode(e)}function ln(e){return an.call(e)}function un(e){return on.call(e)}function L(e,t){if(!O)return ln(e);var n=ln(k);if(n===null)n=k.appendChild(cn());else if(t&&n.nodeType!==3){var r=cn();return n?.before(r),we(r),r}return t&&mn(n),we(n),n}function R(e,t=!1){if(!O){var n=ln(e);return n instanceof Comment&&n.data===``?un(n):n}if(t){if(k?.nodeType!==3){var r=cn();return k?.before(r),we(r),r}mn(k)}return k}function z(e,t=!1){if(!O)return ln(e);var n=L(e,t);return A(e),n}function B(e,t=1,n=!1){let r=O?k:e;for(var i;t--;)i=r,r=un(r);if(!O)return r;if(n){if(r?.nodeType!==3){var a=cn();return r===null?i?.after(a):r.before(a),we(a),a}mn(r)}return we(r),r}function dn(e){e.textContent=``}function fn(){return!1}function pn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function mn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function hn(e){var t=U;if(t===null)return H.f|=ae,e;if(!(t.f&32768)&&!(t.f&4))throw e;gn(e,t)}function gn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function _n(e){U===null&&(H===null&&Le(e),Ie()),Wn&&Fe(e)}function vn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function yn(e,t){var n=U;n!==null&&n.f&8192&&(e|=x);var r={ctx:j,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};P?.register_created_effect(r);var i=r;if(e&4)jt===null?Ft.ensure().schedule(r):jt.push(r);else if(t!==null){try{fr(r)}catch(e){throw Pn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=T))}if(i!==null&&(i.parent=n,n!==null&&vn(i,n),H!==null&&H.f&2&&!(e&64))){var a=H;(a.effects??=[]).push(i)}return r}function bn(){return H!==null&&!Kn}function xn(e){let t=yn(8,null);return M(t,v),t.teardown=e,t}function Sn(e){_n(`$effect`);var t=U.f;if(!H&&t&32&&j!==null&&!j.i){var n=j;(n.e??=[]).push(e)}else return Cn(e)}function Cn(e){return yn(4|ee,e)}function wn(e){return _n(`$effect.pre`),yn(8|ee,e)}function Tn(e){Ft.ensure();let t=yn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Ln(t,()=>{Pn(t),n(void 0)}):(Pn(t),n(void 0))})}function En(e){return yn(4,e)}function Dn(e){return yn(ie|E,e)}function On(e,t=0){return yn(8|t,e)}function V(e,t=[],n=[],r=[]){ft(r,t,n,t=>{yn(8,()=>{e(...t.map(W))})})}function kn(e,t=0){return yn(16|t,e)}function An(e){return yn(32|E,e)}function jn(e){var t=e.teardown;if(t!==null){let n=Wn,r=H;Gn(!0),qn(null);try{t.call(null)}catch(t){gn(t,e.parent)}finally{Gn(n),qn(r)}}}function Mn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&ut(()=>{e.abort(he)});var r=n.next;n.f&64?n.parent=null:Pn(n,t),n=r}}function Nn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Pn(t),t=n}}function Pn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Fn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,Mn(e,t&&!n),dr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();jn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&In(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Fn(e,t){for(;e!==null;){var n=e===t?null:un(e);e.remove(),e=n}}function In(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Ln(e,t,n=!0){var r=[];e.f|=256,Rn(e,r,!0);var i=()=>{n&&Pn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Rn(e,t,n){if(!(e.f&8192)){e.f^=x;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Rn(i,t,o?n:!1)}i=a}}}function zn(e){e.f&=-257,Bn(e,!0)}function Bn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(M(e,y),Ft.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Bn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Vn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:un(n);t.append(n),n=i}}var Hn=null,Un=!1,Wn=!1;function Gn(e){Wn=e}var H=null,Kn=!1;function qn(e){H=e}var U=null;function Jn(e){U=e}var Yn=null;function Xn(e){H!==null&&(Yn??=new Set).add(e)}var Zn=null,Qn=0,$n=null;function er(e){$n=e}var tr=1,nr=0,rr=nr;function ir(e){rr=e}function ar(){return++tr}function or(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~ne),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&Dt===null&&M(e,v)}return!1}function sr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Yn!==null&&Yn.has(e)))for(var i=0;i{e.ac.abort(he)}),e.ac=null);try{e.f|=re;var u=e.fn,d=u();e.f|=C;var f=lr(e);if(Xe()&&$n!==null&&!Kn&&f!==null&&!(e.f&6146))for(var p=0;p<$n.length;p++)sr($n[p],e);if(i!==null&&i!==e){if(nr++,i.deps!==null)for(let e=0;e0)for(t.length=Qn+Zn.length,r=0;r{s.ac.abort(he),s.ac=null,M(s,y)}),Ct(s),dr(s,0)}}function dr(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?$e(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Tr(e,t,n,r,i){var a={capture:r,passive:i},o=wr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&xn(()=>{t.removeEventListener(e,o,a)})}function G(e,t,n){(t[xr]??={})[e]=n}function Er(e){for(var t=0;t{Or=!1,Dr=null}));var s=0,c=Dr===e&&e[xr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[xr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=H,f=U;qn(null),Jn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[xr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s{throw e});throw p}}finally{e[xr]=t,delete e.currentTarget,qn(d),Jn(f)}}}var Ar=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function jr(e){return Ar?.createHTML(e)??e}function Mr(e){var t=pn(`template`);return t.innerHTML=jr(e.replaceAll(``,``)),t.content}function Nr(e,t){var n=U;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(O)return Nr(k,null),k;i===void 0&&(i=Mr(a?e:``+e),n||(i=ln(i)));var t=r||rn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=ln(t),s=t.lastChild;Nr(o,s)}else Nr(t,t);return t}}function Pr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(O)return Nr(k,null),k;if(!o){var e=ln(Mr(a));if(i)for(o=document.createDocumentFragment();ln(e);)o.appendChild(ln(e));else o=ln(e)}var t=o.cloneNode(!0);if(i){var n=ln(t),r=t.lastChild;Nr(n,r)}else Nr(t,t);return t}}function Fr(e,t){return Pr(e,t,`svg`)}function Ir(){if(O)return Nr(k,null),k;var e=document.createDocumentFragment(),t=document.createComment(``),n=cn();return e.append(t,n),Nr(t,n),e}function q(e,t){if(O){var n=U;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=k),Te();return}e!==null&&e.before(t)}function Lr(){if(O&&k&&k.nodeType===8&&k.textContent?.startsWith(`$`)){let e=k.textContent.substring(1);return Te(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Rr(e){let t=0,n=Kt(0),r;return()=>{bn()&&(W(n),On(()=>(t===0&&(r=gr(()=>e(()=>Zt(n)))),t+=1,()=>{$e(()=>{--t,t===0&&(r?.(),r=void 0,Zt(n))})})))}}var zr=T|E;function Br(e,t,n,r){new Vr(e,t,n,r)}var Vr=class{parent;is_pending=!1;transform_error;#e;#t=O?k:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Rr(()=>(this.#m=Kt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=U;t.b=this,t.f|=128,n(e)},this.parent=U.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=kn(()=>{if(O){let e=this.#t;Te();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},zr),O&&(this.#e=k)}#g(){try{this.#a=An(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);$e(r),t&&(this.#s=An(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){Se();return}t=!0,n&&Ue(),this.#s!==null&&Ln(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){gn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=An(()=>e(this.#e)),$e(()=>{var e=this.#c=document.createDocumentFragment(),t=cn(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return An(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){gn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(P);return}this.#u===0&&(this.#e.before(e),this.#c=null,Ln(this.#o,()=>{this.#o=null}),this.#x(P))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=An(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Vn(this.#a,e);let t=this.#n.pending;this.#o=An(()=>t(this.#e))}else this.#x(P)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){it(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=U,n=H,r=j;Jn(this.#i),qn(this.#i),Ke(this.#i.ctx);try{return Ft.ensure(),e()}finally{Jn(t),qn(n),Ke(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Ln(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,$e(()=>{this.#d=!1,this.#m&&Jt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;P?.is_fork?(this.#a&&P.skip_effect(this.#a),this.#o&&P.skip_effect(this.#o),this.#s&&P.skip_effect(this.#s),P.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(Pn(this.#a),null),this.#o&&=(Pn(this.#o),null),this.#s&&=(Pn(this.#s),null),O&&(we(this.#t),Ee(),we(De()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return An(()=>{var r=U;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return gn(e,this.#i.parent),null}}))};$e(()=>{var t;try{t=this.transform_error(e)}catch(e){gn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>gn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[pe]??=e.nodeValue)&&(e[pe]=n,e.nodeValue=`${n}`)}function Hr(e,t){return Wr(e,t)}var Ur=new Map;function Wr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){sn();var l=void 0,u=Tn(()=>{var s=n??t.appendChild(cn());Br(s,{pending:()=>{}},t=>{qe({});var n=j;if(o&&(n.c=o),a&&(i.$$events=a),O&&Nr(t,null),l=e(t,i)||Ye(),O&&(U.nodes.end=k,k===null||k.nodeType!==8||k.data!==`]`))throw be(),_e;Je()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Ur.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,kr),r.delete(e),r.size===0&&Ur.delete(n)):r.set(e,i)}Cr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Gr.set(l,u),l}var Gr=new WeakMap,Kr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)zn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(zn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Pn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Vn(r,t),t.append(cn()),this.#n.set(e,{effect:r,fragment:t})}else Pn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Ln(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Pn(n.effect),this.#n.delete(e))};ensure(e,t){var n=P,r=fn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=cn();i.append(a),this.#n.set(e,{effect:An(()=>t(a)),fragment:i})}else this.#t.set(e,An(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else O&&(this.anchor=k),this.#a(n)}};function Y(e,t,n=!1){var r;O&&(r=k,Te());var i=new Kr(e),a=n?T:0;function o(e,t){if(O){var n=Oe(r);if(e!==parseInt(n.substring(1))){var a=De();we(a),i.anchor=a,Ce(!1),i.ensure(e,t),Ce(!0);return}}i.ensure(e,t)}kn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var qr=Symbol(`NaN`);function Jr(e,t,n){O&&Te();var r=new Kr(e),i=!Xe();kn(()=>{var e=t();e!==e&&(e=qr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Yr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Xr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;dn(d),d.append(u),e.items.clear()}Xr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Xr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,$r(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=te,ti(d,null,c)):zn(d):Ln(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:kn(()=>{p=W(f);var e=p.length;let t=!1;O&&Oe(c)===`[!`!=(e===0)&&(c=De(),we(c),Ce(!1),t=!0);for(var r=new Set,u=P,v=fn(),y=0;ys(c)):(d=An(()=>s(Zr??=cn())),d.f|=te)),e>r.size&&Pe(``,``,``),O&&e>0&&we(De()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&Ce(!0),W(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,O&&(c=k)}function Qr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function $r(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Qr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var E=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function ei(e,t,n,r,i,a,o,s){var c=o&1?o&16?Kt(n):qt(n,!1,!1):null,l=o&2?Kt(i):null;return{v:c,i:l,e:An(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ti(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=un(r);if(a.before(r),r===i)return;r=o}}function ni(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ri(e,t,n){var r;O&&(r=k,Te());var i=new Kr(e);kn(()=>{var e=t()??null;if(O&&Oe(r)===`[`!=(e!==null)){var a=De();we(a),i.anchor=a,Ce(!1),i.ensure(e,e&&(t=>n(t,e))),Ce(!0);return}i.ensure(e,e&&(t=>n(t,e)))},T)}var ii=[...` +\r\f\xA0\v`];function ai(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ii.includes(r[o-1]))&&(s===r.length||ii.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function oi(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function si(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ci(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(si)),i&&c.push(...Object.keys(i).map(si));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(vi)||(`__defaultValue`in e&&pi(e,!1),`__value`in e&&mi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),xn(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;dt(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),_i);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&_i(o)}n(a),e.__value=a,P!==null&&r.add(P)}),En(()=>{var a=t();if(e===document.activeElement){var o=P;if(r.has(o))return}if(mi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=_i(s),n(a))}e.__value=a,i=!1})}function _i(e){return`__value`in e?e.__value:e.value}function vi(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var yi=Symbol(`is custom element`),bi=Symbol(`is html`),xi=ge?`link`:`LINK`;function Si(e){if(O){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[me]=n,$e(n),lt()}}function Q(e,t,n,r){var i=Ci(e);O&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===xi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[le]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[ue]??={[yi]:e.nodeName.includes(`-`),[bi]:e.namespaceURI===ve}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function Ei(e,t,n=t){var r=new WeakSet;dt(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ai(e)?ji(a):a,n(a),P!==null&&r.add(P),await pr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(O&&e.defaultValue!==e.value||gr(t)==null&&e.value)&&(n(Ai(e)?ji(e.value):e.value),P!==null&&r.add(P)),On(()=>{var n=t();if(e===document.activeElement){var i=P;if(r.has(i))return}Ai(e)&&n===ji(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Di=new Set;function Oi(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),dt(n,`change`,()=>{var e=n.__value;a&&(e=ki(o,e,n.checked)),i(e)},()=>i(a?[]:null)),On(()=>{var e=r();if(O&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=tn(n.__value,e)}),xn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Di.has(o)||(Di.add(o),$e(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Di.delete(o)})),$e(()=>{if(s){var e=a?ki(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function ki(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Ni(e,t,n){var r=Mi.observe(e,()=>n(e[t]));En(()=>(gr(()=>n(e[t])),r))}function Pi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?On(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&xn(()=>{n.removeEventListener(t,a)})}function Fi(e=!1){let t=j,n=t.l.u;if(!n)return;let r=()=>_r(t.s);if(e){let e=0,n={},i=gt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>W(i)}n.b.length&&wn(()=>{Ii(t,r),m(n.b)}),Sn(()=>{let e=gr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&Sn(()=>{Ii(t,r),m(n.a)})}function Ii(e,t){if(e.l.s)for(let t of e.l.s)W(t);t()}var Li={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===oe||t===ce)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ri(...e){return new Proxy({props:e},Li)}function zi(e,t,n,r){var i=!We||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=gt(r),W(u)):(l&&(l=!1,c=s?gr(r):r),c);let f;if(o){var p=oe in e||ce in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=ot(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&ze(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?gt:yt)(()=>(v=!1,g()));o&&W(y);var b=U;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&o?$t(e):e;return I(y,n),v=!0,c!==void 0&&(c=n),e}return Wn&&v||b.f&16384?y.v:W(y)})}function Bi(e){j===null&&Me(`onMount`),We&&j.l!==null?Vi(j).m.push(e):Sn(()=>{let t=gr(e);if(typeof t==`function`)return t})}function Vi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Hi(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ui=new class{#e=F(Wi());get _loc(){return W(this.#e)}set _loc(e){I(this.#e,e)}#t=N(()=>this._loc.location);get _location(){return W(this.#t)}set _location(e){I(this.#t,e)}#n=N(()=>this._loc.querystring);get _querystring(){return W(this.#n)}set _querystring(e){I(this.#n,e)}#r=F(void 0);get _params(){return W(this.#r)}set _params(e){I(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=Wi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Wi(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function Gi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Ki(e,t){qe(t,!0);let n=zi(t,`routes`,19,()=>({})),r=zi(t,`prefix`,3,``),i=zi(t,`restoreScrollState`,3,!1),a=zi(t,`onConditionsFailed`,3,()=>{}),o=zi(t,`onRouteLoaded`,3,()=>{}),s=zi(t,`onRouteLoading`,3,()=>{}),c=zi(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Hi(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=F(null),f=F(null),p=F({}),m=null,h=null;Sn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),Sn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await pr(),e(t)}Sn(()=>{let e=Ui.loc,t=!1;return gr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Ir(),y=R(v),b=e=>{let t=N(()=>W(d));var n=Ir(),r=R(n),i=e=>{var n=Ir();ri(R(n),()=>W(t),(e,t)=>{t(e,Ri({get params(){return W(f)},get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)},a=e=>{var n=Ir();ri(R(n),()=>W(t),(e,t)=>{t(e,Ri({get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)};Y(r,e=>{W(f)?e(i):e(a,-1)}),q(e,n)};Y(y,e=>{W(d)&&e(b)}),q(e,v),Je()}var qi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`,`thresholds`],Ji=`codexometer.web.preferences.v1`,Yi={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function Xi(){try{let e=JSON.parse(localStorage.getItem(Ji)||`null`);return!e||typeof e!=`object`?Yi:{tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:qi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Yi}}var Zi=$t(Xi());function Qi(){let e=JSON.stringify(Zi);try{localStorage.setItem(Ji,e)}catch{}}function $i(){return Zi.tab===`quota`?`/quota/`+Zi.view:`/`+Zi.tab}function ea(e){return Zi.layouts.find(t=>t.id===e)?.level??Zi.defaultDetail}function ta(e){Zi.defaultDetail=e,Zi.layouts=[]}function na(e,t){Zi.layouts=[...Zi.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=$t({data:null,connected:!1,error:``}),ra=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ia=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),aa=`codexometer.web.session`,oa=class extends Error{},sa;async function ca(e,t,n){if(!sa||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await sa(e,t,n)}function la(){let e=new AbortController,t,n=``;sa=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new oa(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(aa)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+$i()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem(aa,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(aa)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` + +`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{sa=void 0,e.abort(),clearTimeout(t),$.connected=!1}}Ge();var ua=K(`

        Quota refresh failed. Policy state is based on the last successful + observation.

        `),da=K(`

        `),fa=K(`

        The longest Codex quota window selects one active model profile. ASK + creates a per-session review; AUTO applies the profile on the next + eligible check.

        `,1),pa=K(`

        No threshold-based model steps were configured at launch.

        `);function ma(e,t){qe(t,!1),Fi();var n=Ir(),r=R(n),i=e=>{var t=fa(),n=R(t),r=z(n),i=B(n,2),a=e=>{q(e,ua())};Y(i,e=>{$.data.quotaError&&e(a)});var o=B(i,2),s=L(o),c=z(s),l=B(s,4);Z(l,5,()=>$.data.thresholds,X,(e,t)=>{var n=da();let r;var i=L(n),a=z(i),o=B(i,2),s=L(o),c=z(s,!0),l=z(B(s,2));A(o);var u=B(o,2),d=z(u,!0),f=z(B(u,2));A(n),V((e,i)=>{r=li(n,1,``,null,r,{active:W(t).state===`ACTIVE`,next:W(t).state===`NEXT`}),J(a,`${W(t).threshold??``}%`),J(c,W(t).model),J(l,`${e??``} REASONING // ${i??``} + SPEED`),J(d,W(t).mode),J(f,`${W(t).state??``}${W(t).state===`NEXT`?` // ${W(t).remaining||0} PP TO GO`:``}`)},[()=>W(t).effort.toUpperCase(),()=>W(t).speed.toUpperCase()]),q(e,n)}),A(l),A(o),V(e=>{J(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),J(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ia($.data.quotaAt)]),q(e,t)},a=e=>{q(e,pa())};Y(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),q(e,n),Je()}var ha=Fr(` `,1),ga=Fr(` `,1),_a=K(` `),va=K(`
        Quota observations
        Observed atPeriod elapsedConsumedTrail segment
        `),ya=K(`


        Observed quota + path, not individual session usage. Gaps are not interpolated. Expand the + observation table for times, positions and gaps.

        OBSERVATION TABLE
        `,1),ba=K(`
        CONSUMPTIONQUOTA PERIOD ELAPSED


        `,1);function xa(e,t){let n=Lr();qe(t,!0);let r=zi(t,`trail`,19,()=>[]),i=F(!1),a=[0,25,50,75,100],o=F(400),s=F(240),c=N(()=>W(o)-24),l=N(()=>W(s)-48),u=N(()=>Math.max(1,W(c)-48)),d=N(()=>Math.max(1,W(l)-20)),f=N(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*W(u)),p=N(()=>W(l)-Math.max(0,Math.min(100,t.used))/100*W(d)),m=N(()=>t.used-t.elapsed),h=N(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*W(u)} ${W(l)-e.used/100*W(d)}`).join(` `));var g=ba(),_=R(g),v=L(_),y=L(v),b=z(y),x=B(y),S=B(x);Z(S,17,()=>a,X,(e,t)=>{var n=ha(),r=R(n),i=B(r),a=B(i),o=z(a),s=B(a),f=z(s);V(()=>{Q(r,`x1`,48+W(t)/100*W(u)),Q(r,`x2`,48+W(t)/100*W(u)),Q(r,`y2`,W(l)),Q(i,`y1`,W(l)-W(t)/100*W(d)),Q(i,`x2`,W(c)),Q(i,`y2`,W(l)-W(t)/100*W(d)),Q(a,`x`,48+W(t)/100*W(u)),Q(a,`y`,W(l)+20),J(o,`${W(t)??``}%`),Q(s,`y`,W(l)+4-W(t)/100*W(d)),J(f,`${W(t)??``}%`)}),q(e,n)});var C=B(S),w=B(C),T=B(w),E=e=>{var t=ga(),n=R(t),i=B(n),a=z(L(i));A(i),V(e=>{Q(n,`d`,W(h)),Q(i,`cx`,48+r()[0].elapsed/100*W(u)),Q(i,`cy`,W(l)-r()[0].used/100*W(d)),J(a,`First observation: ${e??``}`)},[()=>ia(r()[0].at)]),q(e,t)};Y(T,e=>{r().length&&e(E)});var ee=B(T,2),te=B(ee),ne=B(te),re=z(L(ne));A(ne),A(v),A(_);var ie=B(_,2),ae=L(ie),oe=z(B(ae,3),!0);A(ie);var se=B(ie,2),ce=e=>{var t=ya(),a=R(t),o=L(a);Ee(2),A(a);var s=B(a,2),c=B(L(s),2),l=e=>{var t=va(),n=L(t),i=B(L(n),2);Z(i,21,r,X,(e,t,n)=>{var r=_a(),i=L(r),a=L(i),o=z(a,!0);A(i);var s=B(i),c=z(s),l=B(s),u=z(l),d=z(B(l),!0);A(r),V((e,r)=>{Q(a,`datetime`,W(t).at),J(o,e),J(c,`${r??``}%`),J(u,`${W(t).used??``}%`),J(d,n===0?`First observation`:W(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ia(W(t).at),()=>W(t).elapsed.toFixed(1)]),q(e,r)}),A(i),A(n),A(t),q(e,t)};Y(c,e=>{W(i)&&e(l)}),A(s),V(e=>{Q(a,`id`,n+`-trail-summary`),J(o,`○ START ${e??``} // ${r().length??``} + ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>ia(r()[0].at)]),Pi(`open`,`toggle`,s,e=>I(i,e),()=>W(i)),q(e,t)};Y(se,e=>{r().length&&e(ce)}),V((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${W(o)} ${W(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,W(u)),Q(x,`height`,W(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${W(l)} H${W(c)}`),Q(w,`y1`,W(l)),Q(w,`x2`,W(c)),Q(ee,`x`,48+W(u)/2),Q(ee,`y`,W(s)-5),Q(te,`cx`,W(f)),Q(te,`cy`,W(p)),Q(ne,`cx`,W(f)),Q(ne,`cy`,W(p)),J(re,`${t.used??``}% consumed // ${i??``}% of period elapsed`),J(ae,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),J(oe,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${W(m)>0?`Above`:W(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(W(m))<.05?`ON PACE`:W(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Ni(_,`clientWidth`,e=>I(o,e)),Ni(_,`clientHeight`,e=>I(s,e)),q(e,g),Je()}var Sa=K(` `),Ca=K(`

        Quota refresh failed. Values below are the last successful observation.

        `),wa=K(`

        Expiry details unavailable. No listed expiry does not mean no expiry.

        `),Ta=K(`

        `),Ea=K(`

        Read-only preview. Use the terminal to redeem a reset.

        The backend may return only some credits. This list does not establish + redemption order.

        `),Da=K(` `,1),Oa=Fr(``),ka=Fr(``),Aa=K(`
        `),ja=K(`

        Cycle duration or reset date unavailable — position cannot be + plotted.

        `),Ma=K(`
        −100 // OVER BUDGET+100 // HEADROOM

        `,1),Na=K(`

        Cycle duration unavailable — pace cannot be calculated.

        `),Pa=K(`
        EMPTYFULL
        `),Fa=K(`

        `,1),Ia=K(`
        `,1),La=K(`

        `),Ra=K(`

        `),za=K(`

        No quota windows reported yet.

        `),Ba=K(`
        `,1),Va=K(`

        All reported windows are shown. API-equivalent learning and quota status + scoring remain in the terminal for this first preview.

        `,1),Ha=K(` `,1);function Ua(e,t){qe(t,!0);let n=zi(t,`params`,19,()=>({})),r=N(()=>qi.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=F($t(Date.now())),a=N(()=>W(r).includes(n().view||``)?n().view:`bars`);Bi(()=>{let e=setInterval(()=>I(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-W(i))/(e.duration*6e4))))}Sn(()=>{Zi.view=W(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=Ha(),l=R(c);Z(l,21,()=>W(r),X,(e,t)=>{var n=Sa();let r;var i=z(n,!0);V(e=>{Q(n,`href`,`#/quota/`+W(t)),Q(n,`aria-current`,W(a)===W(t)?`page`:void 0),r=li(n,1,``,null,r,{active:W(a)===W(t)}),J(i,e)},[()=>W(t)===`pace`?`CONSUMPTION PACE`:W(t)===`zone`?`CONSUMPTION ZONE`:W(t)===`fuel`?`FUEL TANK`:W(t).toUpperCase()]),q(e,n)}),A(l);var u=B(l,2),d=e=>{var t=Va(),n=R(t),r=e=>{q(e,Ca())};Y(n,e=>{$.data.quotaError&&e(r)});var i=B(n,2),c=z(i),l=B(i,2),u=e=>{ma(e,{})},d=e=>{var t=Ea(),n=L(t),r=z(n),i=B(n,4),a=e=>{q(e,wa())};Y(i,e=>{$.data.credits.length||e(a)}),Z(B(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=Ta(),r=L(n),i=z(r),a=z(B(r,2),!0);A(n),V(e=>{J(i,`${(W(t).title||`Quota reset`)??``} // ${W(t).status??``}`),J(a,e)},[()=>W(t).expiryKnown?W(t).expires?`EXPIRES `+ia(W(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),Ee(2),A(t),V(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},f=e=>{var t=Ba(),n=R(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=N(()=>o(W(t))),r=N(()=>W(n)===null?null:W(n)-W(t).used);var i=Ra(),c=L(i),l=z(c,!0),u=B(c,2),d=L(u),f=e=>{var n=Da(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`FREE ${100-W(t).used}%`),J(a,`USED ${W(t).used??``}%`)}),q(e,n)},p=e=>{var n=Da(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`USED ${W(t).used??``}%`),J(a,`FREE ${100-W(t).used}%`)}),q(e,n)};Y(d,e=>{W(a)===`fuel`?e(f):e(p,-1)}),A(u);var m=B(u,2);let h;var g=L(m),_=e=>{var n=Aa(),r=L(n),i=B(L(r)),a=e=>{q(e,Oa())},o=e=>{var n=ka();V(e=>Q(n,`d`,e),[()=>s(W(t).used)]),q(e,n)};Y(i,e=>{W(t).used>=100?e(a):W(t).used>0&&e(o,1)}),A(r),A(n),V(()=>Q(r,`aria-label`,`${W(t).used}% quota used`)),q(e,n)},v=e=>{var r=Ir(),i=R(r),a=e=>{{let r=N(()=>W(t).trail||[]);xa(e,{get used(){return W(t).used},get elapsed(){return W(n)},get trail(){return W(r)}})}},o=e=>{q(e,ja())};Y(i,e=>{W(n)===null?e(o,-1):e(a)}),q(e,r)},y=e=>{var t=Ir(),n=R(t),i=e=>{var t=Ma(),n=R(t),i=B(L(n),2);let a;A(n);var o=B(n,4),s=L(o),c=z(B(s),!0);A(o),V(e=>{a=di(i,``,a,{left:`${(W(r)+100)/2}%`}),J(s,`${W(r)>=0?`+`:``}${e??``} PP `),J(c,W(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>W(r).toFixed(1)]),q(e,t)},a=e=>{q(e,Na())};Y(n,e=>{W(r)===null?e(a,-1):e(i)}),q(e,t)},b=e=>{var r=Ia(),i=R(r),o=L(i);let s;A(i);var c=B(i,2),l=e=>{q(e,Pa())};Y(c,e=>{W(a)===`fuel`&&e(l)});var u=B(c,2),d=e=>{var t=Fa(),r=R(t),i=z(r),o=B(r,2),s=L(o);let c;A(o),V(e=>{J(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=di(s,``,c,{width:`${W(a)===`fuel`?100-W(n):W(n)}%`})},[()=>Math.floor(W(n))]),q(e,t)};Y(u,e=>{W(n)!==null&&e(d)}),V(()=>{Q(i,`aria-label`,W(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,W(a)===`fuel`?100-W(t).used:W(t).used),s=di(o,``,s,{width:`${W(a)===`fuel`?100-W(t).used:W(t).used}%`})}),q(e,r)};Y(g,e=>{W(a)===`pie`?e(_):W(a)===`zone`?e(v,1):W(a)===`pace`?e(y,2):e(b,-1)}),A(m);var x=B(m,2),S=z(x),C=B(x,2),w=e=>{var n=La(),r=z(n,!0);V(()=>J(r,W(t).details)),q(e,n)};Y(C,e=>{W(t).details&&e(w)}),A(i),V(e=>{J(l,W(t).name),h=li(m,1,`meter-graphic`,null,h,{"bar-graphic":W(a)===`bars`||W(a)===`fuel`}),J(S,`RESETS // ${e??``}`)},[()=>ia(W(t).reset)]),q(e,i)}),A(n);var i=B(n,2),c=e=>{q(e,za())};Y(i,e=>{$.data.meters.length||e(c)}),V(()=>r=li(n,1,`quota-grid`,null,r,{radial:W(a)===`pie`,zone:W(a)===`zone`})),q(e,t)};Y(l,e=>{W(a)===`thresholds`?e(u):W(a)===`resets`?e(d,1):e(f,-1)}),Ee(2),V(e=>J(c,`QUOTA // OBSERVED ${e??``}`),[()=>ia($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),Je()}var Wa=K(`
        `),Ga=K(`

        `,1);function Ka(e,t){qe(t,!0);let n=zi(t,`values`,19,()=>[]),r=zi(t,`label`,3,`Token activity`),i=zi(t,`capacity`,3,0),a=N(()=>Math.max(0,...n())),o=N(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Ga(),c=R(s),l=z(c),u=B(c,2);Z(u,21,()=>W(o),X,(e,t)=>{var n=Wa();let r;V((e,t)=>{Q(n,`title`,e),r=di(n,``,r,{height:t})},[()=>W(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*W(t)/Math.max(1,W(a))}%`]),q(e,n)}),A(u),V((e,t)=>{J(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>W(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${W(a).toLocaleString(`en-GB`)} tokens.`]),q(e,s),Je()}var qa=K(`

        CURRENT PROFILE

        MODEL / REASONING LEVEL / SPEED

         

        PROPOSED PROFILE

        MODEL / REASONING LEVEL / SPEED

         

        Applied settings remain after Codexometer closes.

        `,1),Ja=K(`

        `),Ya=K(`

         
        `,1),Xa=K(`

        Command unavailable from this observation. Open Codex to inspect the + request.

        `),Za=K(`

        Session controls temporarily unavailable. Check Codex for current state.

        `),Qa=K(`

        Checking session controls…

        `),$a=K(`

        `),eo=K(`
        About browser controls

        Controls require a supported live request from a connected shared + app-server session. Local observations alone cannot provide them.

        `),to=K(` `,1),no=K(` `),ro=K(`Grants permission beyond this one command. Check the scope + carefully.`),io=K(``),ao=K(``),oo=K(``),so=K(``),co=K(` `,1),lo=K(`
      • `),uo=K(`
        View fixed choices

        Type one of these choices exactly. Your answer stays masked.

          `),fo=K(` `,1),po=K(`

          `,1),mo=K(``),ho=K(`

          `,1),go=K(`

          `);function _o(e,t){qe(t,!0);let n=[],r=zi(t,`observedCommand`,3,``),i=zi(t,`review`,3,``),a=zi(t,`suspended`,3,!1),o=zi(t,`onProtectedChange`,3,e=>{}),s=F(null),c=F($t([])),l=F(null),u=F(``),d=F(0),f=F($t(Date.now())),p=F(!1),m=F(``),h=F(!1),g=F(!1),_=F(``);Sn(()=>(o()(W(p)||W(c).some(e=>e.length>0)),()=>o()(!1)));let v=N(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),y=N(()=>!$.connected||!!$.data?.sessionsError),b=N(()=>i()!==`profile`&&W(s)?.kind===`prompt`&&!W(s).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),x=N(()=>!W(y)&&!W(g)&&!!W(s)?.id&&W(s).kind===`approval`&&W(_)!==W(s).id),S=N(()=>W(x)?W(s).command:r()),C=N(()=>!!W(u)&&W(f)W(s)?.questions?.length?W(s).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),T=N(()=>W(s)?.kind===`approval`||W(s)?.kind===`profile`?W(l)!==null:W(c).length===W(w).length&&W(c).every((e,t)=>e.trim().length>0&&(W(w)[t].freeText||W(w)[t].options?.includes(e))));Sn(()=>{(W(y)||a()||W(b)||W(f)>=W(d))&&I(u,``)});let E=new AbortController;Bi(()=>{let e,n=setInterval(()=>{I(f,Date.now(),!0)},1e3);async function r(){try{let e=await ca(`offer`,{session:t.session,...i()?{review:i()}:{}},E.signal);if(E.signal.aborted)return;I(g,!1),W(s)?.id!==e.id&&(I(u,``),I(l,null),I(c,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),I(s,e,!0),W(h)&&e.id&&e.id!==W(_)&&(I(m,``),I(h,!1))}catch{E.signal.aborted||(I(s,null),I(g,!0),I(u,``))}finally{E.signal.aborted||(e=setTimeout(r,2e3))}}return r(),()=>{E.abort(),clearTimeout(e),clearInterval(n)}});async function ee(){if(!W(s)?.id||W(p)||W(y)||a()||W(b)||!W(T))return;let e=W(s).id;I(p,!0),I(m,``),I(h,!1),I(u,``);try{let n=await ca(`prepare`,{session:t.session,...i()?{review:i()}:{},offer:e,...W(s).kind===`approval`||W(s).kind===`profile`?{choice:W(l)}:{answers:[...W(c)]}},E.signal);W(s)?.id===e&&!E.signal.aborted&&!W(y)&&!a()&&!W(b)&&(I(u,n.confirmation,!0),I(d,Date.parse(n.expires),!0))}catch(e){E.signal.aborted||I(m,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{I(p,!1)}}async function te(){if(!W(s)?.id||W(p)||a()||W(b)||!W(C))return;let e=W(s).id,n=W(s).kind,r=W(u);I(u,``),I(p,!0),I(_,e,!0);try{await ca(`commit`,{session:t.session,...i()?{review:i()}:{},offer:e,confirmation:r},E.signal),I(h,!0),I(m,n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){I(m,e instanceof oa?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{I(p,!1),I(c,[],!0),I(l,null)}}var ne=Ir(),re=R(ne),ie=e=>{var r=go(),a=L(r),o=z(a,!0),b=B(a,2),E=e=>{var t=qa(),n=R(t),r=z(n),i=B(n,6),a=z(i,!0),o=z(B(i,6),!0);Ee(2),V(()=>{J(r,`Your ${W(s).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),J(a,W(s).profile.current),J(o,W(s).profile.proposed)}),q(e,t)};Y(b,e=>{W(s)?.profile&&!W(y)&&!W(g)&&e(E)});var ne=B(b,2),re=e=>{var t=Ja();let n;var r=z(t,!0);V(()=>{n=li(t,1,`svelte-1oupzfc`,null,n,{notice:!W(h),sent:W(h)}),J(r,W(m))}),q(e,t)};Y(ne,e=>{W(m)&&e(re)});var ie=B(ne,2),ae=e=>{var t=Ya(),n=R(t),r=z(n,!0),i=z(B(n,2),!0);V(()=>{J(r,W(x)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(i,W(S))}),q(e,t)},oe=e=>{q(e,Xa())};Y(ie,e=>{W(S)?e(ae):i()!==`profile`&&W(v)===`APPROVAL NEEDED`&&!W(h)&&e(oe,1)});var se=B(ie,2),ce=e=>{q(e,Za())},le=e=>{q(e,Qa())},ue=e=>{var t=to(),n=R(t),r=e=>{var t=$a(),n=z(t,!0);V(e=>J(n,e),[()=>W(v)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(v)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(W(v)===`WORKING`||!W(h)&&!W(p))&&e(r)});var i=B(n,2),a=e=>{q(e,eo())},o=N(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(v)||``)&&!W(h));Y(i,e=>{W(o)&&e(a)}),q(e,t)},de=e=>{var r=ho(),a=R(r),o=z(a),m=B(a,2),h=L(m),g=z(h,!0),_=B(h,2),v=e=>{var r=Ir();Z(R(r),17,()=>W(s).choices||[],X,(e,r,a)=>{var o=io(),s=L(o);Si(s),s.value=s.__value=a;var c=B(s),u=B(c),d=e=>{var t=no(),n=z(t,!0);V(()=>J(n,W(r).detail)),q(e,t)};Y(u,e=>{W(r).detail&&e(d)});var f=B(u,2),p=e=>{q(e,ro())};Y(f,e=>{W(r).persistent&&e(p)}),A(o),V(()=>{Q(s,`name`,`decision-`+t.session+`-`+i()),J(c,` ${W(r).label??``} `)}),Oi(n,[],s,()=>W(l),e=>I(l,e)),q(e,o)}),q(e,r)},b=e=>{var t=Ir();Z(R(t),17,()=>W(w),X,(e,t,n)=>{var r=fo(),i=R(r),a=L(i),o=B(a),s=e=>{var t=ao();Si(t),Ei(t,()=>W(c)[n],e=>W(c)[n]=e),q(e,t)},l=e=>{var r=so(),i=L(r);i.value=i.__value=``,Z(B(i),17,()=>W(t).options||[],X,(e,t)=>{var n=oo(),r=z(n,!0),i={};V(()=>{J(r,W(t)),i!==(i=W(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),A(r),hi(r),gi(r,()=>W(c)[n],e=>W(c)[n]=e),q(e,r)},u=e=>{var r=co(),i=R(r);st(i);var a=B(i,2),o=e=>{var n=$a(),r=z(n);V(e=>J(r,`Suggested answers: ${e??``}`),[()=>W(t).options.join(` · `)]),q(e,n)};Y(a,e=>{W(t).options?.length&&e(o)}),Ei(i,()=>W(c)[n],e=>W(c)[n]=e),q(e,r)};Y(o,e=>{W(t).secret?e(s):W(t).freeText?e(u,-1):e(l,1)}),A(i);var d=B(i,2),f=e=>{var n=uo(),r=B(L(n),4);Z(r,21,()=>W(t).options||[],X,(e,t)=>{var n=lo(),r=z(n,!0);V(()=>J(r,W(t))),q(e,n)}),A(r),A(n),q(e,n)};Y(d,e=>{W(t).secret&&!W(t).freeText&&e(f)}),V(()=>J(a,`${W(t).text??``} `)),q(e,r)}),q(e,t)};Y(_,e=>{W(s).kind===`approval`||W(s).kind===`profile`?e(v):e(b,-1)}),A(m);var x=B(m,2),S=e=>{var t=po(),n=R(t),r=z(n),i=B(n,2),a=z(i),o=B(i,2);V(e=>{J(r,`Check the target and ${W(s).kind===`profile`?`profile above`:W(s).kind===`approval`?`exact command and permission scope`:`message above`}. This will send to Codex; it may start work + using your quota. Confirmation expires in ${e??``}s.`),i.disabled=W(p)||W(y),J(a,`CONFIRM ${(W(s).kind===`approval`||W(s).kind===`profile`?W(s).choices?.[W(l)]?.label:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((W(d)-W(f))/1e3))]),G(`click`,i,te),G(`click`,o,()=>{I(u,``)}),q(e,t)},E=e=>{var t=mo(),n=z(t,!0);V(()=>{t.disabled=W(p)||W(y)||!W(T),J(n,W(p)?`SENDING…`:`REVIEW BEFORE SENDING`)}),G(`click`,t,ee),q(e,t)};Y(x,e=>{W(C)?e(S):e(E,-1)}),V(()=>{J(o,`TARGET // ${W(s).thread??``} // ${(W(s).directory||`Directory unavailable`)??``}`),m.disabled=W(p)||W(C)||W(y),J(g,W(s).kind===`approval`||W(s).kind===`profile`?`Choose a decision`:`Reply to this session`)}),q(e,r)};Y(se,e=>{W(y)||W(g)?e(ce):W(s)?W(s).id?W(_)!==W(s).id&&e(de,3):e(ue,2):e(le,1)}),A(r),V(()=>J(o,i()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(re,e=>{W(b)||e(ie)}),q(e,ne),Je()}Er([`click`]);var vo=K(`
          `);function yo(e,t){qe(t,!0);let n=zi(t,`active`,3,!1),r=N(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!t.session.text.trim()),i=F(!1),a=F(``),o=F(!1);Sn(()=>{if(!W(o))return;let e=setTimeout(()=>{I(o,!1)},150);return()=>clearTimeout(e)}),Sn(()=>{t.session.text,t.session.status,I(a,``)});async function s(){if(!W(r)||W(i))return;let e=t.session.text;I(i,!0),I(o,!0),I(a,``);try{await navigator.clipboard.writeText(e),t.session.text===e&&I(a,`Copied.`)}catch{t.session.text===e&&I(a,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{I(i,!1)}}function c(e){!n()||!W(r)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),s())}var l=Ir();Tr(`keydown`,nn,c);var u=R(l),d=e=>{var t=vo(),n=L(t),r=z(n,!0),c=B(n,2);let l;A(t),V(()=>{J(r,W(a)),c.disabled=W(i),l=li(c,1,`svelte-543j00`,null,l,{flashed:W(o)})}),G(`click`,c,s),q(e,t)};Y(u,e=>{W(r)&&e(d)}),q(e,l),Je()}Er([`click`]);var bo=K(`

          `),xo=K(`

          `),So=K(`
           
          `),Co=K(`

          Command unavailable from this observation. Open Codex to inspect the + request.

          `),wo=K(`

          `,1),To=K(`

          `),Eo=K(`
           
          `,1),Do=K(`
          `),Oo=K(`

          Session connection or refresh unavailable. Context and telemetry may be + stale.

          `),ko=K(`

          Some quota profile checks are unavailable. Only sessions with freshly + verified quota and settings can be updated; previous outcome notices remain + visible.

          `),Ao=K(` `),jo=K(` `),Mo=K(``),No=K(`

          Read only — reply or approve in Codex.

          `),Po=K(`

          `),Fo=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Io=K(`
          `),Lo=K(`
          `),Ro=K(`

          This session is no longer in the current observation. Return to sessions.

          `),zo=K(`

          `),Bo=K(` `),Vo=K(`

          `),Ho=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Uo=K(` `,1),Wo=K(`

          `),Go=K(`

          TOKEN ACTIVITY // 30 SECOND SAMPLES

          `),Ko=K(`

          TOKENS

          FULL DETAIL →
          `),qo=K(`

          No locally observed sessions yet. Keep Codex running alongside + Codexometer.

          `),Jo=K(`

          ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

          `,1),Yo=K(`

          SESSION TOTALS

          `,1);function Xo(e,t){qe(t,!0);let n=(e,t=f,n,r)=>{let i=yt(()=>g(n?.(),!0)),a=yt(()=>g(r?.(),!1));var o=Eo(),s=R(o),c=e=>{var n=bo();let r;var i=z(n,!0);V(e=>{r=li(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>b(t())]),q(e,n)},l=N(()=>b(t())&&(!W(a)||W(d)||t().status===`CHECK SESSION`));Y(s,e=>{W(l)&&e(c)});var u=B(s,2),p=e=>{var n=xo(),r=z(n,!0);V(()=>J(r,t().contextKind||`LAST ACTIVITY`)),q(e,n)};Y(u,e=>{W(i)&&e(p)});var m=B(u,2),h=z(m,!0),_=B(m,2),v=e=>{var n=wo(),r=B(R(n),2),i=z(r,!0),a=B(r,2),o=e=>{var n=So(),r=z(n,!0);V(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,Co())};Y(a,e=>{t().command?e(o):e(s,-1)}),V(()=>J(i,W(d)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(_,e=>{(!W(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(v)});var y=B(_,2),x=e=>{var n=To(),r=z(n);V(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(y,e=>{W(a)||e(x)}),V(()=>J(h,t().text||`No session context available.`)),q(e,o)},r=zi(t,`params`,19,()=>({})),i=N(()=>$.data?.sessions||[]),a=N(()=>$.data?.control&&$.data.profiles||[]),o=F(!1);function s(e,t){if(r().id&&r().id!==t&&W(o)){e.preventDefault();return}h(t)}Sn(()=>{let e=r().id;e&&gr(()=>{Zi.selected=e,na(e,2)})});let c=N(()=>W(i).find(e=>e.id===r().id)),l=N(()=>new URLSearchParams(Ui.querystring).get(`review`)===`profile`&&W(a).some(e=>e.session===r().id&&e.pending)),u=N(()=>W(i).some(e=>e.id===Zi.selected)?Zi.selected:W(i)[0]?.id),d=N(()=>!$.connected||!!$.data?.sessionsError),p=N(()=>[[`OBSERVED TOKENS`,ra(W(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,ra(W(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,W(d)?`—`:ra(W(i).filter(e=>e.status===t).length)])]),m=N(()=>W(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function h(e){Zi.selected=e,pr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function v(e,t){if(h(e),r().id){t<0&&(na(e,2),location.hash=`/sessions`);return}let n=ea(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):na(e,n)}function y(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),v(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||W(u)))e.preventDefault(),v(r().id||W(u),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&W(i).length){e.preventDefault();let t=W(i).findIndex(e=>e.id===W(u));h(W(i)[Math.max(0,Math.min(W(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function b(e){return W(d)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}var x=Yo();Tr(`keydown`,nn,y);var S=R(x),C=z(B(L(S),2));A(S);var w=B(S,2);let T;Z(w,21,()=>W(p),X,(e,t)=>{var n=N(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=Do(),o=L(a),s=z(o,!0),c=z(B(o,2),!0);A(a),V(()=>{J(s,r()),J(c,i())}),q(e,a)}),A(w);var E=B(w,2),ee=z(E),te=B(E,2),ne=e=>{q(e,Oo())};Y(te,e=>{W(d)&&e(ne)});var re=B(te,2),ie=e=>{q(e,ko())};Y(re,e=>{$.data?.profileError&&e(ie)});var ae=B(re,2),oe=e=>{var t=Mo(),n=L(t);Z(n,17,()=>W(m),X,(e,t)=>{var n=Ao();let r;var i=z(n);V(e=>{r=li(n,1,`button`,null,r,{approval:W(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),J(i,`${W(t).status??``} // ${(W(t).directory||W(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,n,()=>h(W(t).id)),q(e,n)}),Z(B(n,2),17,()=>W(a).filter(e=>e.pending&&W(i).some(t=>t.id===e.session)),X,(e,t)=>{var n=jo(),a=z(n);V((e,i)=>{Q(n,`title`,r().id&&r().id!==W(t).session&&W(o)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(a,`QUOTA THRESHOLD // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session)+`?review=profile`,()=>W(i).find(e=>e.id===W(t).session)?.directory||W(t).session]),G(`click`,n,e=>s(e,W(t).session)),q(e,n)}),A(t),q(e,t)},se=N(()=>(W(m).length||W(a).some(e=>e.pending))&&!W(d));Y(ae,e=>{W(se)&&e(oe)});var ce=B(ae,2),le=e=>{var t=Ir(),i=R(t),s=e=>{var t=Lo(),i=L(t),s=L(i),u=L(s);let f;var p=B(u);A(s);var m=B(s,2);A(i);var g=B(i,2),_=z(g),v=B(g,2);let y;var b=L(v),x=L(b);n(x,()=>W(c),()=>!0,()=>!0),A(b);var S=B(b,2),C=e=>{var t=Ir();Jr(R(t),()=>W(c).id,e=>{_o(e,{get session(){return W(c).id},get observedCommand(){return W(c).command},get suspended(){return W(l)},onProtectedChange:e=>{I(o,e,!0)}})}),q(e,t)},w=e=>{q(e,No())};Y(S,e=>{$.data?.control?e(C):e(w,-1)}),A(v);var T=B(v,2);Z(T,17,()=>W(a).filter(e=>e.session===W(c).id),e=>e.session,(e,t)=>{var n=Io(),r=L(n),i=e=>{var n=Po(),r=z(n,!0);V(()=>J(r,W(t).notice)),q(e,n)};Y(r,e=>{W(t).notice&&e(i)});var a=B(r,2),o=e=>{_o(e,{get session(){return W(c).id},review:`profile`})},s=e=>{var t=Fo();V(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(c).id)+`?review=profile`]),q(e,t)};Y(a,e=>{W(t).pending&&W(l)?e(o):W(t).pending&&e(s,1)}),A(n),V(()=>Q(n,`id`,`quota-profile-`+W(c).id)),q(e,n)});var E=B(T,2),ee=e=>{var t=Ir();Jr(R(t),()=>W(c).id,e=>{yo(e,{get session(){return W(c)},active:!0})}),q(e,t)};Y(E,e=>{W(l)||e(ee)}),A(t),V(e=>{f=li(u,1,`lamp lit`,null,f,{working:W(c).status===`WORKING`&&!W(d)}),J(p,`${(W(d)?`STALE`:W(l)?`QUOTA THRESHOLD`:W(c).status)??``} // ${W(c).directory??``}`),J(_,`${e??``} TOKENS // ${W(c).id??``} // CONTEXT SOURCE // ${(W(c).source||`LOCAL`)??``}`),y=di(v,``,y,{display:W(l)?`none`:void 0})},[()=>ra(W(c).tokens)]),G(`click`,m,()=>{h(r().id),na(r().id,2)}),q(e,t)},u=e=>{q(e,Ro())};Y(i,e=>{W(c)?e(s):e(u,-1)}),q(e,t)},ue=e=>{var t=Jo(),r=R(t),o=B(L(r),2),c=L(o),l=B(c,2);A(o),A(r);var f=B(r,2);Z(f,17,()=>W(i),e=>e.id,(e,t)=>{let r=N(()=>ea(W(t).id));var i=Ko();let o;var c=L(i),l=L(c),f=L(l);let p;var m=B(f,1,!0);A(l);var g=B(l,2),_=z(g,!0),y=B(g,2),b=L(y);Ee(),A(y);var x=B(y,2),S=z(x),C=B(x,2),w=z(C),T=B(C,2),E=L(T),ee=B(E,2),te=z(ee,!0),ne=B(ee,2);A(T);var re=B(T,2),ie=B(re,2),ae=e=>{var n=zo(),r=z(n,!0);V(()=>J(r,W(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:W(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),q(e,n)},oe=N(()=>!W(d)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(W(t).status));Y(ie,e=>{W(oe)&&e(ae)}),A(c);var se=B(c,2),ce=e=>{var r=Wo(),i=L(r),o=L(i),c=z(o,!0),l=B(o,2),f=e=>{var n=Bo(),r=z(n,!0);V(e=>{Q(n,`href`,e),J(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id)]),q(e,n)};Y(l,e=>{!W(d)&&W(t).status===`APPROVAL NEEDED`&&e(f)}),A(i);var p=B(i,2);n(p,()=>W(t),()=>!1);var m=B(p,2);Z(m,17,()=>W(a).filter(e=>e.session===W(t).id),X,(e,n)=>{var r=Uo(),i=R(r),a=e=>{var t=Vo(),r=z(t,!0);V(()=>J(r,W(n).notice)),q(e,t)};Y(i,e=>{W(n).notice&&e(a)});var o=B(i,2),c=e=>{var n=Ho();V(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(t).id)+`?review=profile`]),G(`click`,n,e=>s(e,W(t).id)),q(e,n)};Y(o,e=>{W(n).pending&&e(c)}),q(e,r)});var h=B(m,2);{let e=N(()=>W(u)===W(t).id);yo(h,{get session(){return W(t)},get active(){return W(e)}})}A(r),V(()=>J(c,W(t).contextKind||`LAST ACTIVITY`)),q(e,r)};Y(se,e=>{W(r)>0&&e(ce)});var le=B(se,2),ue=e=>{var n=Go(),r=B(L(n),2);{let e=N(()=>(W(t).samples||[]).map(e=>e.tokens));Ka(r,{get values(){return W(e)},capacity:120})}var i=z(B(r,2));A(n),V(()=>J(i,`LAST ${(W(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(le,e=>{W(r)<2&&e(ue)}),A(i),V((e,n,a)=>{o=li(i,1,`session-row`,null,o,{selected:W(u)===W(t).id,wide:W(r)===2,split:W(r)===1}),Q(i,`aria-label`,`Session `+(W(t).directory||W(t).id)),p=li(f,1,`lamp lit`,null,p,{working:W(t).status===`WORKING`&&!W(d)}),J(m,W(d)?`STALE`:W(t).status),Q(g,`aria-pressed`,W(u)===W(t).id),J(_,W(t).directory||W(t).id),J(b,`${e??``} `),J(S,`${W(t).agents??``} LINKED AGENTS`),J(w,`ACTIVE // ${n??``}`),E.disabled=W(r)===0,Q(ee,`aria-expanded`,W(r)>0),J(te,W(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(re,`href`,a)},[()=>ra(W(t).tokens),()=>ia(W(t).activity),()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,g,()=>h(W(t).id)),G(`click`,E,()=>v(W(t).id,-1)),G(`click`,ee,()=>{h(W(t).id),na(W(t).id,+!W(r))}),G(`click`,ne,()=>v(W(t).id,1)),G(`click`,re,()=>h(W(t).id)),q(e,i)});var p=B(f,2),m=e=>{q(e,qo())};Y(p,e=>{W(i).length||e(m)}),G(`click`,c,()=>ta(1)),G(`click`,l,()=>ta(0)),q(e,t)};Y(ce,e=>{r().id?e(le):e(ue,-1)}),V(e=>{J(C,`OBSERVED ${e??``}`),T=li(w,1,`session-totals`,null,T,{stale:W(d)}),J(ee,`${W(d)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens + observed since this server started for currently listed sessions; linked + agents are already included. Totals can decrease when a session leaves the + list. History samples every 30 seconds. Not account-wide totals.`)},[()=>ia($.data?.sessionsAt)]),q(e,x),Je()}Er([`click`]);var Zo=864e5;function Qo(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function $o(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Qo(r,-t),a=new Date(i.getTime()+Zo);if(e===n)return{start:a,end:r};r=i}}var es=K(`

          History refresh failed. Any displayed history is the last successful + observation.

          `),ts=K(``),ns=K(`
          `),rs=K(`

          LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

          `,1),is=K(`
          `,1),as=K(` `),os=K(`

          LIFETIME TOKENS

          PEAK DAY

          CURRENT STREAK

          DAYS

          Accessible data table
          Date (UTC)Tokens

          `,1),ss=K(`

          History unavailable or awaiting a matching account observation. Missing + history is not treated as zero usage.

          `),cs=K(`

          USAGE // ACCOUNT HISTORY

          Account-wide history reported by Codex, not the local Sessions counter. Dates + use UTC. Historical resets are not provided by this data.

          `,1);function ls(e,t){qe(t,!0);let n=F(`daily`),r=F(12),i=F(0),a=N(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=$o(new Date,W(r),W(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=N(()=>Math.max(1,...W(a).map(e=>e.tokens))),s=N(()=>W(a).length?new Date(W(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=N(()=>{if(W(n)===`monthly`){let e=new Map;for(let t of W(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return W(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=cs(),u=B(R(l),4),d=L(u),f=B(L(d)),p=L(f);p.value=p.__value=`daily`;var m=B(p);m.value=m.__value=`monthly`;var h=B(m);h.value=h.__value=`cumulative`,A(f),hi(f),A(d);var g=B(d),_=B(L(g)),v=L(_);v.value=v.__value=6;var y=B(v);y.value=y.__value=12,A(_),hi(_),A(g);var b=B(g),x=B(b);A(u);var S=B(u,2),C=e=>{q(e,es())};Y(S,e=>{$.data?.usageError&&e(C)});var w=B(S,2),T=e=>{var t=os(),r=R(t),i=L(r),l=z(B(L(i),2),!0);A(i);var u=B(i,2),d=z(B(L(u),2),!0);A(u);var f=B(u,2),p=B(L(f),2),m=L(p);Ee(),A(p),A(f),A(r);var h=B(r,2),g=L(h),_=z(g),v=B(g,2),y=e=>{var t=rs(),n=R(t),r=L(n),i=L(r);Z(i,17,()=>Array(W(s)),X,(e,t)=>{q(e,ts())}),Z(B(i,2),17,()=>W(a),X,(e,t)=>{var n=ns();let r,i;V(e=>{r=li(n,1,`heat-cell`,null,r,{zero:W(t).tokens===0}),Q(n,`title`,e),i=di(n,``,i,{opacity:W(t).tokens?.25+.75*W(t).tokens/W(o):1})},[()=>`${W(t).date}: ${ra(W(t).tokens)} tokens`]),q(e,n)}),A(r),A(n),Ee(2),q(e,t)},b=e=>{var t=is(),r=R(t);{let e=N(()=>W(c).map(e=>e.tokens)),t=N(()=>W(n)+` usage`);Ka(r,{get values(){return W(e)},get label(){return W(t)}})}var i=B(r,2),a=L(i),o=z(a,!0),s=z(B(a),!0);A(i),V(e=>{J(o,W(c)[0]?.date),J(s,e)},[()=>W(c).at(-1)?.date]),q(e,t)};Y(v,e=>{W(n)===`daily`?e(y):e(b,-1)});var x=B(v,2),S=B(L(x),2),C=L(S),w=B(L(C));Z(w,21,()=>W(n)===`daily`?W(a):W(c),X,(e,t)=>{var n=as(),r=L(n),i=z(r,!0),a=z(B(r),!0);A(n),V(e=>{J(i,W(t).date),J(a,e)},[()=>ra(W(t).tokens)]),q(e,n)}),A(w),A(C),A(S),A(x),A(h);var T=z(B(h,2));V((e,t,n,r,i)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${W(a)[0]?.date??``} — ${r??``}`),J(T,`OBSERVED ${i??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>ra($.data.usage.summary.lifetimeTokens),()=>ra($.data.usage.summary.peakDailyTokens),()=>ra($.data.usage.summary.currentStreakDays),()=>W(a).at(-1)?.date,()=>ia($.data.usageAt)]),q(e,t)},E=e=>{q(e,ss())};Y(w,e=>{$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(T):e(E,-1)}),V(()=>x.disabled=W(i)===0),gi(f,()=>W(n),e=>I(n,e)),G(`change`,_,()=>I(i,0)),gi(_,()=>W(r),e=>I(r,e)),G(`click`,b,()=>Xt(i)),G(`click`,x,()=>Xt(i,-1)),q(e,l),Je()}Er([`change`,`click`]);var us=K(`

          Page not found

          Return to Quota

          `,1);function ds(e){var t=us();Ee(2),q(e,t)}var fs=K(` `),ps=K(`

          `),ms=K(`

          Connecting to your local Codexometer…

          `),hs=K(``),gs=K(`
          CODEXOMETER

          Your quota. Your sessions. Your command centre.

          `);function _s(e,t){qe(t,!0);let n={"/":Ua,"/quota/:view?":Ua,"/sessions/:id?":Xo,"/usage":ls,"*":ds},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=F(`hacker`),a=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];Sn(()=>{Qi()}),Sn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Ui.location)&&(Zi.tab=e)}),Bi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&a.includes(e)&&I(i,e,!0)}catch{}return la()});function o(){try{localStorage.setItem(`codexometer.web.theme`,W(i))}catch{}}var s=gs(),c=L(s),l=B(L(c),2),u=L(l);let d;var f=B(u,1,!0),p=z(B(f));A(l),A(c);var m=B(c,2);Z(m,21,()=>Object.entries(r),X,(e,t)=>{var n=N(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1],a=N(()=>i().test(Ui.location));var o=fs();let s;var c=z(o,!0);V(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+Zi.view:`#/`+r()),Q(o,`aria-current`,W(a)?`page`:void 0),s=li(o,1,``,null,s,{active:W(a)}),J(c,e)},[()=>r().toUpperCase()]),q(e,o)}),A(m);var h=B(m,2),g=L(h),v=e=>{var t=ps(),n=z(t,!0);V(()=>J(n,$.error)),q(e,t)};Y(g,e=>{$.error&&e(v)});var y=B(g,2),b=e=>{Ki(e,{get routes(){return n}})},x=e=>{q(e,ms())};Y(y,e=>{$.data?e(b):$.error||e(x,1)}),A(h);var S=B(h,2),C=L(S),w=z(C),T=B(C,2),E=z(T,!0),ee=B(T,2),te=B(L(ee));Z(te,21,()=>a,X,(e,t)=>{var n=hs(),r=z(n,!0),i={};V(e=>{J(r,e),i!==(i=W(t))&&(n.value=(n.__value=i)??``)},[()=>W(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),A(te),hi(te),A(ee),A(S),A(s),V(()=>{Q(s,`data-theme`,W(i)),d=li(u,1,`lamp`,null,d,{lit:$.connected}),J(f,$.connected?`CONNECTED`:`OFFLINE`),J(p,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),J(w,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(E,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),G(`change`,te,o),gi(te,()=>W(i),e=>I(i,e)),q(e,s),Je()}Er([`change`]),Hr(_s,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-CCAs5nbB.js b/internal/web/dist/assets/index-CCAs5nbB.js deleted file mode 100644 index 0f2b940..0000000 --- a/internal/web/dist/assets/index-CCAs5nbB.js +++ /dev/null @@ -1,30 +0,0 @@ -(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 e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return e()}function m(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function g(e,t,n=!1){return e===void 0?n?t():t:e}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,ee=1<<20,te=1<<25,D=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`component`),se=Symbol(`legacy props`),ce=Symbol(``),le=Symbol(`attributes`),ue=Symbol(`class`),de=Symbol(`style`),fe=Symbol(`text`),pe=Symbol(`form reset`),me=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},he=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ge={},O=Symbol(`uninitialized`),_e=`http://www.w3.org/1999/xhtml`;function ve(){console.warn(`https://svelte.dev/e/derived_inert`)}function ye(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function be(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function xe(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var k=!1;function Se(e){k=e}var A;function Ce(e){if(e===null)throw ye(),ge;return A=e}function we(){return Ce(ln(A))}function j(e){if(k){if(ln(A)!==null)throw ye(),ge;A=e}}function Te(e=1){if(k){for(var t=e,n=A;t--;)n=ln(n);A=n}}function Ee(e=!0){for(var t=0,n=A;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=ln(n);e&&n.remove(),n=i}}function De(e){if(!e||e.nodeType!==8)throw ye(),ge;return e.data}function Oe(e){return e===this.v}function ke(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ae(e){return!ke(e,this.v)}function je(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Me(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Ne(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Pe(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Fe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Ie(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Le(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Re(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ze(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Be(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ve(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function He(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ue=!1;function We(){Ue=!0}var M=null;function Ge(e){M=e}function Ke(e,t=!1,n){M={p:M,i:!1,c:null,e:null,s:e,x:null,r:W,l:Ue&&!t?{s:null,u:null,$:[]}:null}}function qe(e){var t=M,n=t.e;if(n!==null){t.e=null;for(var r of n)Sn(r)}return e!==void 0&&(t.x=e),t.i=!0,M=t.p,Je(e)}function Je(e={}){return i(e,oe,{value:!0}),e}function Ye(){return!Ue||M!==null&&M.l===null}var Xe=[];function Ze(){var e=Xe;Xe=[],m(e)}function Qe(e){if(Xe.length===0&&!Ot){var t=Xe;queueMicrotask(()=>{t===Xe&&Ze()})}Xe.push(e)}function $e(){for(;Xe.length>0;)Ze()}var et=~(y|b|v);function N(e,t){e.f=e.f&et|t}function tt(e){e.f&512||e.deps===null?N(e,v):N(e,b)}function nt(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=D,nt(t.deps))}function rt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),nt(e.deps),N(e,v)}var it=!1;function at(e){var t=it;try{return it=!1,[e(),it]}finally{it=t}}function ot(e){k&&cn(e)!==null&&un(e)}var st=!1;function ct(){st||(st=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[pe]?.()})},{capture:!0}))}function lt(e){var t=U,n=W;Kn(null),qn(null);try{return e()}finally{Kn(t),qn(n)}}function ut(e,t,n,r=n){e.addEventListener(t,()=>lt(n));let i=e[pe];e[pe]=i?()=>{i(),r(!0)}:()=>r(!0),ct()}function dt(e,t,n,r){let i=Ye()?ht:vt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=W,c=ft(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){hn(e,s)}pt()}}var d=mt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>_t(e))).then(u).catch(e=>hn(e,s)).finally(d)}l?l.then(()=>{c(),f(),pt()}):f()}function ft(){var e=W,t=U,n=M,r=F;return function(i=!0){qn(e),Kn(t),Ge(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function pt(e=!0){qn(null),Kn(null),Ge(null),e&&F?.deactivate()}function mt(){var e=W,t=e.b,n=F,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function ht(e){var t=2|y;return W!==null&&(W.f|=E),{ctx:M,deps:null,effects:null,equals:Oe,f:t,fn:e,reactions:null,rv:0,v:O,wv:0,parent:W,ac:null}}var gt=Symbol(`obsolete`);function _t(e,t,n){let r=W;r===null&&Me();var i=void 0,a=Gt(O),o=!U,s=new Set;return En(()=>{var t=W,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==me&&n.reject(e)}).finally(pt)}catch(e){n.reject(e),pt()}var c=F;if(o){if(t.f&32768)var l=mt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(gt);else for(let e of s.values())e.reject(gt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==gt&&(c.activate(),t?(a.f|=ie,qt(a,t)):(a.f&8388608&&(a.f^=ie),qt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),bn(()=>{for(let e of s)e.reject(gt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function P(e){let t=ht(e);return Yn(t),t}function vt(e){let t=ht(e);return t.equals=Ae,t}function yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(me),t.ac=null}),t.fn!==null&&(t.teardown=f),ur(t,0),jn(t))}function Ct(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&dr(t)}var wt=null,F=null,Tt=null,Et=null,Dt=null,Ot=!1,kt=!1,At=null,jt=null,Mt=0,Nt=1,Pt=class e{id=Nt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){wt===null?wt=this:(wt.#n=this,this.#t=wt),wt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)N(r,y),t(r);for(r of n.m)N(r,b),t(r)}this.#p.add(e)}#g(){this.#e=!0,Mt++>1e3&&(this.#x(),It());for(let e of this.#u)this.#d.delete(e),N(e,y),this.schedule(e);for(let e of this.#d)N(e,b),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=At=[],r=[],i=jt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Vt(e),this.#h()||this.discard(),t}if(F=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(At=null,jt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Bt(e,t);i.length>0&&F.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Tt=this,Rt(r),Rt(n),Tt=null,this.#s?.resolve();var s=F;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Ut.clear(),s.#g())}#_(e,t,n){e.f^=v;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=v:i&4?t.push(r):ar(r)&&(i&16&&this.#d.add(r),dr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),N(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),F=this,this.#g()}#b(e){for(var t=0;t{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=h()).promise}static ensure(){if(F===null){let t=F=new e;!kt&&!Ot&&Qe(()=>{t.#e||t.flush()})}return F}apply(){Et=null}schedule(e){if(Dt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(At!==null&&t===W&&(U===null||!(U.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?wt=e:t.#t=e,this.linked=!1}}};function Ft(e){var t=Ot;Ot=!0;try{var n;for(e&&(F!==null&&!F.is_fork&&F.flush(),n=e());;){if($e(),F===null)return n;F.flush()}}finally{Ot=t}}function It(){try{Le()}catch(e){hn(e,Dt)}}var Lt=null;function Rt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Ut.clear();for(let e of Lt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Lt.has(n)&&(Lt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||dr(n)}}Lt.clear()}}Lt=null}}function zt(e){F.schedule(e)}function Bt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),N(e,v);for(var n=e.first;n!==null;)Bt(n,t),n=n.next}}function Vt(e){N(e,v);for(var t=e.first;t!==null;)Vt(t),t=t.next}var Ht=new Set,Ut=new Map,Wt=!1;function Gt(e,t){return{f:0,v:e,reactions:null,equals:Oe,rv:0,wv:0}}function I(e,t){let n=Gt(e,t);return Yn(n),n}function Kt(e,t=!1,n=!0){let r=Gt(e);return t||(r.equals=Ae),Ue&&n&&M!==null&&M.l!==null&&(M.l.s??=[]).push(r),r}function L(e,t,n=!1){return U!==null&&(!Gn||U.f&131072)&&Ye()&&U.f&4325394&&(Jn===null||!Jn.has(e))&&Ve(),qt(e,n?Qt(t):t,jt)}function qt(e,t,n=null){if(!e.equals(t)){Un?Ut.set(e,t):Ut.has(e)||Ut.set(e,e.v);var r=Pt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&bt(t),Et===null&&tt(t)}e.wv=ir(),Zt(e,y,n),Ye()&&W!==null&&W.f&1024&&!(W.f&96)&&(Qn===null?$n([e]):Qn.push(e)),!r.is_fork&&Ht.size>0&&!Wt&&Jt()}return t}function Jt(){Wt=!1;for(let e of Ht){e.f&1024&&N(e,b);let t;try{t=ar(e)}catch{t=!0}t&&dr(e)}Ht.clear()}function Yt(e,t=1){var n=G(e),r=t===1?n++:n--;return L(e,n),r}function Xt(e){L(e,e.v+1)}function Zt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ye(),a=r.length,o=0;o{if(nr===d)return e();var t=U,n=nr;Kn(null),rr(d);var r=e();return Kn(t),rr(n),r};return i&&r.set(`length`,I(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ze();var i=r.get(t);return i===void 0?f(()=>{var e=I(n.value,u);return r.set(t,e),e}):L(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>I(O,u));r.set(t,e),Xt(o)}}else L(n,O),Xt(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>I(Qt(s?e[n]:O),u)),r.set(n,o)),o!==void 0){var c=G(o);return c===O?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=G(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==O)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==O||Reflect.has(e,t);return(n!==void 0||W!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>I(i?Qt(e[t]):O,u)),r.set(t,n)),G(n)===O)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dI(O,u)),r.set(d+``,p)):L(p,O)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>I(void 0,u)),L(c,Qt(n)),r.set(t,c));else{l=c.v!==O;var m=f(()=>Qt(n));L(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&L(g,_+1)}Xt(o)}return!0},ownKeys(e){G(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==O});for(var[n,i]of r)i.v!==O&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Be()}})}function $t(e){try{if(typeof e==`object`&&e&&ae in e)return e[ae]}catch{}return e}function en(e,t){return Object.is($t(e),$t(t))}var tn,nn,rn,an;function on(){if(tn===void 0){tn=window,nn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;rn=a(t,`firstChild`).get,an=a(t,`nextSibling`).get,u(e)&&(e[ue]=void 0,e[le]=null,e[de]=void 0,e.__e=void 0),u(n)&&(n[fe]=void 0)}}function sn(e=``){return document.createTextNode(e)}function cn(e){return rn.call(e)}function ln(e){return an.call(e)}function R(e,t){if(!k)return cn(e);var n=cn(A);if(n===null)n=A.appendChild(sn());else if(t&&n.nodeType!==3){var r=sn();return n?.before(r),Ce(r),r}return t&&pn(n),Ce(n),n}function z(e,t=!1){if(!k){var n=cn(e);return n instanceof Comment&&n.data===``?ln(n):n}if(t){if(A?.nodeType!==3){var r=sn();return A?.before(r),Ce(r),r}pn(A)}return A}function B(e,t=!1){if(!k)return cn(e);var n=R(e,t);return j(e),n}function V(e,t=1,n=!1){let r=k?A:e;for(var i;t--;)i=r,r=ln(r);if(!k)return r;if(n){if(r?.nodeType!==3){var a=sn();return r===null?i?.after(a):r.before(a),Ce(a),a}pn(r)}return Ce(r),r}function un(e){e.textContent=``}function dn(){return!1}function fn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function pn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function mn(e){var t=W;if(t===null)return U.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;hn(e,t)}function hn(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function gn(e){W===null&&(U===null&&Ie(e),Fe()),Un&&Pe(e)}function _n(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function vn(e,t){var n=W;n!==null&&n.f&8192&&(e|=x);var r={ctx:M,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};F?.register_created_effect(r);var i=r;if(e&4)At===null?Pt.ensure().schedule(r):At.push(r);else if(t!==null){try{dr(r)}catch(e){throw Nn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=T))}if(i!==null&&(i.parent=n,n!==null&&_n(i,n),U!==null&&U.f&2&&!(e&64))){var a=U;(a.effects??=[]).push(i)}return r}function yn(){return U!==null&&!Gn}function bn(e){let t=vn(8,null);return N(t,v),t.teardown=e,t}function xn(e){gn(`$effect`);var t=W.f;if(!U&&t&32&&M!==null&&!M.i){var n=M;(n.e??=[]).push(e)}else return Sn(e)}function Sn(e){return vn(4|ee,e)}function Cn(e){return gn(`$effect.pre`),vn(8|ee,e)}function wn(e){Pt.ensure();let t=vn(64|E,e);return(e={})=>new Promise(n=>{e.outro?In(t,()=>{Nn(t),n(void 0)}):(Nn(t),n(void 0))})}function Tn(e){return vn(4,e)}function En(e){return vn(re|E,e)}function Dn(e,t=0){return vn(8|t,e)}function H(e,t=[],n=[],r=[]){dt(r,t,n,t=>{vn(8,()=>{e(...t.map(G))})})}function On(e,t=0){return vn(16|t,e)}function kn(e){return vn(32|E,e)}function An(e){var t=e.teardown;if(t!==null){let n=Un,r=U;Wn(!0),Kn(null);try{t.call(null)}catch(t){hn(t,e.parent)}finally{Wn(n),Kn(r)}}}function jn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&<(()=>{e.abort(me)});var r=n.next;n.f&64?n.parent=null:Nn(n,t),n=r}}function Mn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Nn(t),t=n}}function Nn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Pn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,jn(e,t&&!n),ur(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();An(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Fn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Pn(e,t){for(;e!==null;){var n=e===t?null:ln(e);e.remove(),e=n}}function Fn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function In(e,t,n=!0){var r=[];e.f|=256,Ln(e,r,!0);var i=()=>{n&&Nn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Ln(e,t,n){if(!(e.f&8192)){e.f^=x;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Ln(i,t,o?n:!1)}i=a}}}function Rn(e){e.f&=-257,zn(e,!0)}function zn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(N(e,y),Pt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);zn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Bn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:ln(n);t.append(n),n=i}}var Vn=null,Hn=!1,Un=!1;function Wn(e){Un=e}var U=null,Gn=!1;function Kn(e){U=e}var W=null;function qn(e){W=e}var Jn=null;function Yn(e){U!==null&&(Jn??=new Set).add(e)}var Xn=null,Zn=0,Qn=null;function $n(e){Qn=e}var er=1,tr=0,nr=tr;function rr(e){nr=e}function ir(){return++er}function ar(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~D),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&Et===null&&N(e,v)}return!1}function or(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Jn!==null&&Jn.has(e)))for(var i=0;i{e.ac.abort(me)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=C;var f=cr(e);if(Ye()&&Qn!==null&&!Gn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Zn+Xn.length,r=0;r{s.ac.abort(me),s.ac=null,N(s,y)}),St(s),ur(s,0)}}function ur(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function wr(e,t,n,r,i){var a={capture:r,passive:i},o=Cr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&bn(()=>{t.removeEventListener(e,o,a)})}function Tr(e,t,n){(t[br]??={})[e]=n}function Er(e){for(var t=0;t{Or=!1,Dr=null}));var s=0,c=Dr===e&&e[br];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[br]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=U,f=W;Kn(null),qn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[br]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s{throw e});throw p}}finally{e[br]=t,delete e.currentTarget,Kn(d),qn(f)}}}var Ar=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function jr(e){return Ar?.createHTML(e)??e}function Mr(e){var t=fn(`template`);return t.innerHTML=jr(e.replaceAll(``,``)),t.content}function Nr(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(k)return Nr(A,null),A;i===void 0&&(i=Mr(a?e:``+e),n||(i=cn(i)));var t=r||nn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=cn(t),s=t.lastChild;Nr(o,s)}else Nr(t,t);return t}}function Pr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(k)return Nr(A,null),A;if(!o){var e=cn(Mr(a));if(i)for(o=document.createDocumentFragment();cn(e);)o.appendChild(cn(e));else o=cn(e)}var t=o.cloneNode(!0);if(i){var n=cn(t),r=t.lastChild;Nr(n,r)}else Nr(t,t);return t}}function Fr(e,t){return Pr(e,t,`svg`)}function Ir(){if(k)return Nr(A,null),A;var e=document.createDocumentFragment(),t=document.createComment(``),n=sn();return e.append(t,n),Nr(t,n),e}function q(e,t){if(k){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=A),we();return}e!==null&&e.before(t)}function Lr(){if(k&&A&&A.nodeType===8&&A.textContent?.startsWith(`$`)){let e=A.textContent.substring(1);return we(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Rr(e){let t=0,n=Gt(0),r;return()=>{yn()&&(G(n),Dn(()=>(t===0&&(r=hr(()=>e(()=>Xt(n)))),t+=1,()=>{Qe(()=>{--t,t===0&&(r?.(),r=void 0,Xt(n))})})))}}var zr=T|E;function Br(e,t,n,r){new Vr(e,t,n,r)}var Vr=class{parent;is_pending=!1;transform_error;#e;#t=k?A:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Rr(()=>(this.#m=Gt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=W;t.b=this,t.f|=128,n(e)},this.parent=W.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=On(()=>{if(k){let e=this.#t;we();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},zr),k&&(this.#e=A)}#g(){try{this.#a=kn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Qe(r),t&&(this.#s=kn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){xe();return}t=!0,n&&He(),this.#s!==null&&In(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){hn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=kn(()=>e(this.#e)),Qe(()=>{var e=this.#c=document.createDocumentFragment(),t=sn(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return kn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){hn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(F);return}this.#u===0&&(this.#e.before(e),this.#c=null,In(this.#o,()=>{this.#o=null}),this.#x(F))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=kn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Bn(this.#a,e);let t=this.#n.pending;this.#o=kn(()=>t(this.#e))}else this.#x(F)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){rt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=W,n=U,r=M;qn(this.#i),Kn(this.#i),Ge(this.#i.ctx);try{return Pt.ensure(),e()}finally{qn(t),Kn(n),Ge(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&In(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Qe(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),G(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;F?.is_fork?(this.#a&&F.skip_effect(this.#a),this.#o&&F.skip_effect(this.#o),this.#s&&F.skip_effect(this.#s),F.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(Nn(this.#a),null),this.#o&&=(Nn(this.#o),null),this.#s&&=(Nn(this.#s),null),k&&(Ce(this.#t),Te(),Ce(Ee()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return kn(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return hn(e,this.#i.parent),null}}))};Qe(()=>{var t;try{t=this.transform_error(e)}catch(e){hn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>hn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[fe]??=e.nodeValue)&&(e[fe]=n,e.nodeValue=`${n}`)}function Hr(e,t){return Wr(e,t)}var Ur=new Map;function Wr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){on();var l=void 0,u=wn(()=>{var s=n??t.appendChild(sn());Br(s,{pending:()=>{}},t=>{Ke({});var n=M;if(o&&(n.c=o),a&&(i.$$events=a),k&&Nr(t,null),l=e(t,i)||Je(),k&&(W.nodes.end=A,A===null||A.nodeType!==8||A.data!==`]`))throw ye(),ge;qe()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Ur.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,kr),r.delete(e),r.size===0&&Ur.delete(n)):r.set(e,i)}Sr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Gr.set(l,u),l}var Gr=new WeakMap,Kr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Rn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Rn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Nn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Bn(r,t),t.append(sn()),this.#n.set(e,{effect:r,fragment:t})}else Nn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),In(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Nn(n.effect),this.#n.delete(e))};ensure(e,t){var n=F,r=dn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=sn();i.append(a),this.#n.set(e,{effect:kn(()=>t(a)),fragment:i})}else this.#t.set(e,kn(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else k&&(this.anchor=A),this.#a(n)}};function Y(e,t,n=!1){var r;k&&(r=A,we());var i=new Kr(e),a=n?T:0;function o(e,t){if(k){var n=De(r);if(e!==parseInt(n.substring(1))){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,t),Se(!0);return}}i.ensure(e,t)}On(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var qr=Symbol(`NaN`);function Jr(e,t,n){k&&we();var r=new Kr(e),i=!Ye();On(()=>{var e=t();e!==e&&(e=qr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Yr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Xr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;un(d),d.append(u),e.items.clear()}Xr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Xr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,$r(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=te,ti(d,null,c)):Rn(d):In(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:On(()=>{p=G(f);var e=p.length;let t=!1;k&&De(c)===`[!`!=(e===0)&&(c=Ee(),Ce(c),Se(!1),t=!0);for(var r=new Set,u=F,v=dn(),y=0;ys(c)):(d=kn(()=>s(Zr??=sn())),d.f|=te)),e>r.size&&Ne(``,``,``),k&&e>0&&Ce(Ee()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&Se(!0),G(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,k&&(c=A)}function Qr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function $r(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Qr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var E=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function ei(e,t,n,r,i,a,o,s){var c=o&1?o&16?Gt(n):Kt(n,!1,!1):null,l=o&2?Gt(i):null;return{v:c,i:l,e:kn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ti(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=ln(r);if(a.before(r),r===i)return;r=o}}function ni(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ri(e,t,n){var r;k&&(r=A,we());var i=new Kr(e);On(()=>{var e=t()??null;if(k&&De(r)===`[`!=(e!==null)){var a=Ee();Ce(a),i.anchor=a,Se(!1),i.ensure(e,e&&(t=>n(t,e))),Se(!0);return}i.ensure(e,e&&(t=>n(t,e)))},T)}var ii=[...` -\r\f\xA0\v`];function ai(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ii.includes(r[o-1]))&&(s===r.length||ii.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function oi(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function si(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ci(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(si)),i&&c.push(...Object.keys(i).map(si));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(vi)||(`__defaultValue`in e&&pi(e,!1),`__value`in e&&mi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),bn(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;ut(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),_i);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&_i(o)}n(a),e.__value=a,F!==null&&r.add(F)}),Tn(()=>{var a=t();if(e===document.activeElement){var o=F;if(r.has(o))return}if(mi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=_i(s),n(a))}e.__value=a,i=!1})}function _i(e){return`__value`in e?e.__value:e.value}function vi(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var yi=Symbol(`is custom element`),bi=Symbol(`is html`),xi=he?`link`:`LINK`;function Si(e){if(k){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[pe]=n,Qe(n),ct()}}function Q(e,t,n,r){var i=Ci(e);k&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===xi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ce]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[le]??={[yi]:e.nodeName.includes(`-`),[bi]:e.namespaceURI===_e}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function Ei(e,t,n=t){var r=new WeakSet;ut(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ai(e)?ji(a):a,n(a),F!==null&&r.add(F),await fr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(k&&e.defaultValue!==e.value||hr(t)==null&&e.value)&&(n(Ai(e)?ji(e.value):e.value),F!==null&&r.add(F)),Dn(()=>{var n=t();if(e===document.activeElement){var i=F;if(r.has(i))return}Ai(e)&&n===ji(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Di=new Set;function Oi(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),ut(n,`change`,()=>{var e=n.__value;a&&(e=ki(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Dn(()=>{var e=r();if(k&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=en(n.__value,e)}),bn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Di.has(o)||(Di.add(o),Qe(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Di.delete(o)})),Qe(()=>{if(s){var e=a?ki(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function ki(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Ni(e,t,n){var r=Mi.observe(e,()=>n(e[t]));Tn(()=>(hr(()=>n(e[t])),r))}function Pi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Dn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&bn(()=>{n.removeEventListener(t,a)})}function Fi(e=!1){let t=M,n=t.l.u;if(!n)return;let r=()=>gr(t.s);if(e){let e=0,n={},i=ht(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>G(i)}n.b.length&&Cn(()=>{Ii(t,r),m(n.b)}),xn(()=>{let e=hr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&xn(()=>{Ii(t,r),m(n.a)})}function Ii(e,t){if(e.l.s)for(let t of e.l.s)G(t);t()}var Li={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ae||t===se)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ri(...e){return new Proxy({props:e},Li)}function zi(e,t,n,r){var i=!Ue||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ht(r),G(u)):(l&&(l=!1,c=s?hr(r):r),c);let f;if(o){var p=ae in e||se in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=at(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Re(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?ht:vt)(()=>(v=!1,g()));o&&G(y);var b=W;return(function(e,t){if(arguments.length>0){let n=t?G(y):i&&o?Qt(e):e;return L(y,n),v=!0,c!==void 0&&(c=n),e}return Un&&v||b.f&16384?y.v:G(y)})}function Bi(e){M===null&&je(`onMount`),Ue&&M.l!==null?Vi(M).m.push(e):xn(()=>{let t=hr(e);if(typeof t==`function`)return t})}function Vi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Hi(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ui=new class{#e=I(Wi());get _loc(){return G(this.#e)}set _loc(e){L(this.#e,e)}#t=P(()=>this._loc.location);get _location(){return G(this.#t)}set _location(e){L(this.#t,e)}#n=P(()=>this._loc.querystring);get _querystring(){return G(this.#n)}set _querystring(e){L(this.#n,e)}#r=I(void 0);get _params(){return G(this.#r)}set _params(e){L(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=Wi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Wi(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function Gi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Ki(e,t){Ke(t,!0);let n=zi(t,`routes`,19,()=>({})),r=zi(t,`prefix`,3,``),i=zi(t,`restoreScrollState`,3,!1),a=zi(t,`onConditionsFailed`,3,()=>{}),o=zi(t,`onRouteLoaded`,3,()=>{}),s=zi(t,`onRouteLoading`,3,()=>{}),c=zi(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Hi(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=I(null),f=I(null),p=I({}),m=null,h=null;xn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),xn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await fr(),e(t)}xn(()=>{let e=Ui.loc,t=!1;return hr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Ir(),y=z(v),b=e=>{let t=P(()=>G(d));var n=Ir(),r=z(n),i=e=>{var n=Ir();ri(z(n),()=>G(t),(e,t)=>{t(e,Ri({get params(){return G(f)},get onRouteEvent(){return c()}},()=>G(p)))}),q(e,n)},a=e=>{var n=Ir();ri(z(n),()=>G(t),(e,t)=>{t(e,Ri({get onRouteEvent(){return c()}},()=>G(p)))}),q(e,n)};Y(r,e=>{G(f)?e(i):e(a,-1)}),q(e,n)};Y(y,e=>{G(d)&&e(b)}),q(e,v),qe()}var qi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`],Ji=`codexometer.web.preferences.v1`,Yi={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function Xi(){try{let e=JSON.parse(localStorage.getItem(Ji)||`null`);return!e||typeof e!=`object`?Yi:{tab:[`quota`,`sessions`,`usage`,`thresholds`].includes(e.tab)?e.tab:`quota`,view:qi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Yi}}var Zi=Qt(Xi());function Qi(){let e=JSON.stringify(Zi);try{localStorage.setItem(Ji,e)}catch{}}function $i(){return Zi.tab===`quota`?`/quota/`+Zi.view:`/`+Zi.tab}function ea(e){return Zi.layouts.find(t=>t.id===e)?.level??Zi.defaultDetail}function ta(e){Zi.defaultDetail=e,Zi.layouts=[]}function na(e,t){Zi.layouts=[...Zi.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Qt({data:null,connected:!1,error:``}),ra=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ia=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),aa=`codexometer.web.session`,oa=class extends Error{},sa;async function ca(e,t,n){if(!sa||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await sa(e,t,n)}function la(){let e=new AbortController,t,n=``;sa=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new oa(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(aa)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+$i()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem(aa,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(aa)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` - -`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{sa=void 0,e.abort(),clearTimeout(t),$.connected=!1}}var ua=Fr(` `,1),da=Fr(` `,1),fa=K(` `),pa=K(`
          Quota observations
          Observed atPeriod elapsedConsumedTrail segment
          `),ma=K(`


          Observed quota - path, not individual session usage. Gaps are not interpolated. Expand the - observation table for times, positions and gaps.

          OBSERVATION TABLE
          `,1),ha=K(`
          CONSUMPTIONQUOTA PERIOD ELAPSED


          `,1);function ga(e,t){let n=Lr();Ke(t,!0);let r=zi(t,`trail`,19,()=>[]),i=I(!1),a=[0,25,50,75,100],o=I(400),s=I(240),c=P(()=>G(o)-24),l=P(()=>G(s)-48),u=P(()=>Math.max(1,G(c)-48)),d=P(()=>Math.max(1,G(l)-20)),f=P(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*G(u)),p=P(()=>G(l)-Math.max(0,Math.min(100,t.used))/100*G(d)),m=P(()=>t.used-t.elapsed),h=P(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*G(u)} ${G(l)-e.used/100*G(d)}`).join(` `));var g=ha(),_=z(g),v=R(_),y=R(v),b=B(y),x=V(y),S=V(x);Z(S,17,()=>a,X,(e,t)=>{var n=ua(),r=z(n),i=V(r),a=V(i),o=B(a),s=V(a),f=B(s);H(()=>{Q(r,`x1`,48+G(t)/100*G(u)),Q(r,`x2`,48+G(t)/100*G(u)),Q(r,`y2`,G(l)),Q(i,`y1`,G(l)-G(t)/100*G(d)),Q(i,`x2`,G(c)),Q(i,`y2`,G(l)-G(t)/100*G(d)),Q(a,`x`,48+G(t)/100*G(u)),Q(a,`y`,G(l)+20),J(o,`${G(t)??``}%`),Q(s,`y`,G(l)+4-G(t)/100*G(d)),J(f,`${G(t)??``}%`)}),q(e,n)});var C=V(S),w=V(C),T=V(w),E=e=>{var t=da(),n=z(t),i=V(n),a=B(R(i));j(i),H(e=>{Q(n,`d`,G(h)),Q(i,`cx`,48+r()[0].elapsed/100*G(u)),Q(i,`cy`,G(l)-r()[0].used/100*G(d)),J(a,`First observation: ${e??``}`)},[()=>ia(r()[0].at)]),q(e,t)};Y(T,e=>{r().length&&e(E)});var ee=V(T,2),te=V(ee),D=V(te),ne=B(R(D));j(D),j(v),j(_);var re=V(_,2),ie=R(re),ae=B(V(ie,3),!0);j(re);var oe=V(re,2),se=e=>{var t=ma(),a=z(t),o=R(a);Te(2),j(a);var s=V(a,2),c=V(R(s),2),l=e=>{var t=pa(),n=R(t),i=V(R(n),2);Z(i,21,r,X,(e,t,n)=>{var r=fa(),i=R(r),a=R(i),o=B(a,!0);j(i);var s=V(i),c=B(s),l=V(s),u=B(l),d=B(V(l),!0);j(r),H((e,r)=>{Q(a,`datetime`,G(t).at),J(o,e),J(c,`${r??``}%`),J(u,`${G(t).used??``}%`),J(d,n===0?`First observation`:G(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ia(G(t).at),()=>G(t).elapsed.toFixed(1)]),q(e,r)}),j(i),j(n),j(t),q(e,t)};Y(c,e=>{G(i)&&e(l)}),j(s),H(e=>{Q(a,`id`,n+`-trail-summary`),J(o,`○ START ${e??``} // ${r().length??``} - ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>ia(r()[0].at)]),Pi(`open`,`toggle`,s,e=>L(i,e),()=>G(i)),q(e,t)};Y(oe,e=>{r().length&&e(se)}),H((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${G(o)} ${G(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,G(u)),Q(x,`height`,G(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${G(l)} H${G(c)}`),Q(w,`y1`,G(l)),Q(w,`x2`,G(c)),Q(ee,`x`,48+G(u)/2),Q(ee,`y`,G(s)-5),Q(te,`cx`,G(f)),Q(te,`cy`,G(p)),Q(D,`cx`,G(f)),Q(D,`cy`,G(p)),J(ne,`${t.used??``}% consumed // ${i??``}% of period elapsed`),J(ie,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),J(ae,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${G(m)>0?`Above`:G(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(G(m))<.05?`ON PACE`:G(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Ni(_,`clientWidth`,e=>L(o,e)),Ni(_,`clientHeight`,e=>L(s,e)),q(e,g),qe()}var _a=K(` `),va=K(`

          Quota refresh failed. Values below are the last successful observation.

          `),ya=K(`

          Expiry details unavailable. No listed expiry does not mean no expiry.

          `),ba=K(`

          `),xa=K(`

          Read-only preview. Use the terminal to redeem a reset.

          The backend may return only some credits. This list does not establish - redemption order.

          `),Sa=K(` `,1),Ca=Fr(``),wa=Fr(``),Ta=K(`
          `),Ea=K(`

          Cycle duration or reset date unavailable — position cannot be - plotted.

          `),Da=K(`
          −100 // OVER BUDGET+100 // HEADROOM

          `,1),Oa=K(`

          Cycle duration unavailable — pace cannot be calculated.

          `),ka=K(`
          EMPTYFULL
          `),Aa=K(`

          `,1),ja=K(`
          `,1),Ma=K(`

          `),Na=K(`

          `),Pa=K(`

          No quota windows reported yet.

          `),Fa=K(`
          `,1),Ia=K(`

          All reported windows are shown. API-equivalent learning and quota status - scoring remain in the terminal for this first preview.

          `,1),La=K(` `,1);function Ra(e,t){Ke(t,!0);let n=zi(t,`params`,19,()=>({})),r=qi,i=I(Qt(Date.now())),a=P(()=>r.includes(n().view||``)?n().view:`bars`);Bi(()=>{let e=setInterval(()=>L(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-G(i))/(e.duration*6e4))))}xn(()=>{Zi.view=G(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=La(),l=z(c);Z(l,21,()=>r,X,(e,t)=>{var n=_a();let r;var i=B(n,!0);H(e=>{Q(n,`href`,`#/quota/`+G(t)),Q(n,`aria-current`,G(a)===G(t)?`page`:void 0),r=li(n,1,``,null,r,{active:G(a)===G(t)}),J(i,e)},[()=>G(t)===`pace`?`CONSUMPTION PACE`:G(t)===`zone`?`CONSUMPTION ZONE`:G(t)===`fuel`?`FUEL TANK`:G(t).toUpperCase()]),q(e,n)}),j(l);var u=V(l,2),d=e=>{var t=Ia(),n=z(t),r=e=>{q(e,va())};Y(n,e=>{$.data.quotaError&&e(r)});var i=V(n,2),c=B(i),l=V(i,2),u=e=>{var t=xa(),n=R(t),r=B(n),i=V(n,4),a=e=>{q(e,ya())};Y(i,e=>{$.data.credits.length||e(a)}),Z(V(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=ba(),r=R(n),i=B(r),a=B(V(r,2),!0);j(n),H(e=>{J(i,`${(G(t).title||`Quota reset`)??``} // ${G(t).status??``}`),J(a,e)},[()=>G(t).expiryKnown?G(t).expires?`EXPIRES `+ia(G(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),Te(2),j(t),H(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},d=e=>{var t=Fa(),n=z(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=P(()=>o(G(t))),r=P(()=>G(n)===null?null:G(n)-G(t).used);var i=Na(),c=R(i),l=B(c,!0),u=V(c,2),d=R(u),f=e=>{var n=Sa(),r=z(n),i=B(r),a=B(V(r));H(()=>{J(i,`FREE ${100-G(t).used}%`),J(a,`USED ${G(t).used??``}%`)}),q(e,n)},p=e=>{var n=Sa(),r=z(n),i=B(r),a=B(V(r));H(()=>{J(i,`USED ${G(t).used??``}%`),J(a,`FREE ${100-G(t).used}%`)}),q(e,n)};Y(d,e=>{G(a)===`fuel`?e(f):e(p,-1)}),j(u);var m=V(u,2);let h;var g=R(m),_=e=>{var n=Ta(),r=R(n),i=V(R(r)),a=e=>{q(e,Ca())},o=e=>{var n=wa();H(e=>Q(n,`d`,e),[()=>s(G(t).used)]),q(e,n)};Y(i,e=>{G(t).used>=100?e(a):G(t).used>0&&e(o,1)}),j(r),j(n),H(()=>Q(r,`aria-label`,`${G(t).used}% quota used`)),q(e,n)},v=e=>{var r=Ir(),i=z(r),a=e=>{{let r=P(()=>G(t).trail||[]);ga(e,{get used(){return G(t).used},get elapsed(){return G(n)},get trail(){return G(r)}})}},o=e=>{q(e,Ea())};Y(i,e=>{G(n)===null?e(o,-1):e(a)}),q(e,r)},y=e=>{var t=Ir(),n=z(t),i=e=>{var t=Da(),n=z(t),i=V(R(n),2);let a;j(n);var o=V(n,4),s=R(o),c=B(V(s),!0);j(o),H(e=>{a=di(i,``,a,{left:`${(G(r)+100)/2}%`}),J(s,`${G(r)>=0?`+`:``}${e??``} PP `),J(c,G(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>G(r).toFixed(1)]),q(e,t)},a=e=>{q(e,Oa())};Y(n,e=>{G(r)===null?e(a,-1):e(i)}),q(e,t)},b=e=>{var r=ja(),i=z(r),o=R(i);let s;j(i);var c=V(i,2),l=e=>{q(e,ka())};Y(c,e=>{G(a)===`fuel`&&e(l)});var u=V(c,2),d=e=>{var t=Aa(),r=z(t),i=B(r),o=V(r,2),s=R(o);let c;j(o),H(e=>{J(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=di(s,``,c,{width:`${G(a)===`fuel`?100-G(n):G(n)}%`})},[()=>Math.floor(G(n))]),q(e,t)};Y(u,e=>{G(n)!==null&&e(d)}),H(()=>{Q(i,`aria-label`,G(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,G(a)===`fuel`?100-G(t).used:G(t).used),s=di(o,``,s,{width:`${G(a)===`fuel`?100-G(t).used:G(t).used}%`})}),q(e,r)};Y(g,e=>{G(a)===`pie`?e(_):G(a)===`zone`?e(v,1):G(a)===`pace`?e(y,2):e(b,-1)}),j(m);var x=V(m,2),S=B(x),C=V(x,2),w=e=>{var n=Ma(),r=B(n,!0);H(()=>J(r,G(t).details)),q(e,n)};Y(C,e=>{G(t).details&&e(w)}),j(i),H(e=>{J(l,G(t).name),h=li(m,1,`meter-graphic`,null,h,{"bar-graphic":G(a)===`bars`||G(a)===`fuel`}),J(S,`RESETS // ${e??``}`)},[()=>ia(G(t).reset)]),q(e,i)}),j(n);var i=V(n,2),c=e=>{q(e,Pa())};Y(i,e=>{$.data.meters.length||e(c)}),H(()=>r=li(n,1,`quota-grid`,null,r,{radial:G(a)===`pie`,zone:G(a)===`zone`})),q(e,t)};Y(l,e=>{G(a)===`resets`?e(u):e(d,-1)}),Te(2),H(e=>J(c,`QUOTA // OBSERVED ${e??``}`),[()=>ia($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),qe()}var za=K(`
          `),Ba=K(`

          `,1);function Va(e,t){Ke(t,!0);let n=zi(t,`values`,19,()=>[]),r=zi(t,`label`,3,`Token activity`),i=zi(t,`capacity`,3,0),a=P(()=>Math.max(0,...n())),o=P(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Ba(),c=z(s),l=B(c),u=V(c,2);Z(u,21,()=>G(o),X,(e,t)=>{var n=za();let r;H((e,t)=>{Q(n,`title`,e),r=di(n,``,r,{height:t})},[()=>G(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*G(t)/Math.max(1,G(a))}%`]),q(e,n)}),j(u),H((e,t)=>{J(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>G(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${G(a).toLocaleString(`en-GB`)} tokens.`]),q(e,s),qe()}var Ha=K(`

          CURRENT PROFILE

          MODEL / REASONING LEVEL / SPEED

           

          PROPOSED PROFILE

          MODEL / REASONING LEVEL / SPEED

           

          Applied settings remain after Codexometer closes.

          `,1),Ua=K(`

          `),Wa=K(`

           
          `,1),Ga=K(`

          Command unavailable from this observation. Open Codex to inspect the - request.

          `),Ka=K(`

          Session controls temporarily unavailable. Check Codex for current state.

          `),qa=K(`

          Checking session controls…

          `),Ja=K(`

          `),Ya=K(`
          About browser controls

          Controls require a supported live request from a connected shared - app-server session. Local observations alone cannot provide them.

          `),Xa=K(` `,1),Za=K(` `),Qa=K(`Grants permission beyond this one command. Check the scope - carefully.`),$a=K(``),eo=K(``),to=K(``),no=K(``),ro=K(` `,1),io=K(`
        • `),ao=K(`
          View fixed choices

          Type one of these choices exactly. Your answer stays masked.

            `),oo=K(` `,1),so=K(`

            `,1),co=K(``),lo=K(`

            `,1),uo=K(`

            `);function fo(e,t){Ke(t,!0);let n=[],r=zi(t,`observedCommand`,3,``),i=zi(t,`review`,3,``),a=zi(t,`suspended`,3,!1),o=zi(t,`onProtectedChange`,3,e=>{}),s=I(null),c=I(Qt([])),l=I(null),u=I(``),d=I(0),f=I(Qt(Date.now())),p=I(!1),m=I(``),h=I(!1),g=I(!1),_=I(``);xn(()=>(o()(G(p)||G(c).some(e=>e.length>0)),()=>o()(!1)));let v=P(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),y=P(()=>!$.connected||!!$.data?.sessionsError),b=P(()=>i()!==`profile`&&G(s)?.kind===`prompt`&&!G(s).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),x=P(()=>!G(y)&&!G(g)&&!!G(s)?.id&&G(s).kind===`approval`&&G(_)!==G(s).id),S=P(()=>G(x)?G(s).command:r()),C=P(()=>!!G(u)&&G(f)G(s)?.questions?.length?G(s).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),T=P(()=>G(s)?.kind===`approval`||G(s)?.kind===`profile`?G(l)!==null:G(c).length===G(w).length&&G(c).every((e,t)=>e.trim().length>0&&(G(w)[t].freeText||G(w)[t].options?.includes(e))));xn(()=>{(G(y)||a()||G(b)||G(f)>=G(d))&&L(u,``)});let E=new AbortController;Bi(()=>{let e,n=setInterval(()=>{L(f,Date.now(),!0)},1e3);async function r(){try{let e=await ca(`offer`,{session:t.session,...i()?{review:i()}:{}},E.signal);if(E.signal.aborted)return;L(g,!1),G(s)?.id!==e.id&&(L(u,``),L(l,null),L(c,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),L(s,e,!0),G(h)&&e.id&&e.id!==G(_)&&(L(m,``),L(h,!1))}catch{E.signal.aborted||(L(s,null),L(g,!0),L(u,``))}finally{E.signal.aborted||(e=setTimeout(r,2e3))}}return r(),()=>{E.abort(),clearTimeout(e),clearInterval(n)}});async function ee(){if(!G(s)?.id||G(p)||G(y)||a()||G(b)||!G(T))return;let e=G(s).id;L(p,!0),L(m,``),L(h,!1),L(u,``);try{let n=await ca(`prepare`,{session:t.session,...i()?{review:i()}:{},offer:e,...G(s).kind===`approval`||G(s).kind===`profile`?{choice:G(l)}:{answers:[...G(c)]}},E.signal);G(s)?.id===e&&!E.signal.aborted&&!G(y)&&!a()&&!G(b)&&(L(u,n.confirmation,!0),L(d,Date.parse(n.expires),!0))}catch(e){E.signal.aborted||L(m,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{L(p,!1)}}async function te(){if(!G(s)?.id||G(p)||a()||G(b)||!G(C))return;let e=G(s).id,n=G(s).kind,r=G(u);L(u,``),L(p,!0),L(_,e,!0);try{await ca(`commit`,{session:t.session,...i()?{review:i()}:{},offer:e,confirmation:r},E.signal),L(h,!0),L(m,n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){L(m,e instanceof oa?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{L(p,!1),L(c,[],!0),L(l,null)}}var D=Ir(),ne=z(D),re=e=>{var r=uo(),a=R(r),o=B(a,!0),b=V(a,2),E=e=>{var t=Ha(),n=z(t),r=B(n),i=V(n,6),a=B(i,!0),o=B(V(i,6),!0);Te(2),H(()=>{J(r,`Your ${G(s).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),J(a,G(s).profile.current),J(o,G(s).profile.proposed)}),q(e,t)};Y(b,e=>{G(s)?.profile&&!G(y)&&!G(g)&&e(E)});var D=V(b,2),ne=e=>{var t=Ua();let n;var r=B(t,!0);H(()=>{n=li(t,1,`svelte-1oupzfc`,null,n,{notice:!G(h),sent:G(h)}),J(r,G(m))}),q(e,t)};Y(D,e=>{G(m)&&e(ne)});var re=V(D,2),ie=e=>{var t=Wa(),n=z(t),r=B(n,!0),i=B(V(n,2),!0);H(()=>{J(r,G(x)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(i,G(S))}),q(e,t)},ae=e=>{q(e,Ga())};Y(re,e=>{G(S)?e(ie):i()!==`profile`&&G(v)===`APPROVAL NEEDED`&&!G(h)&&e(ae,1)});var oe=V(re,2),se=e=>{q(e,Ka())},ce=e=>{q(e,qa())},le=e=>{var t=Xa(),n=z(t),r=e=>{var t=Ja(),n=B(t,!0);H(e=>J(n,e),[()=>G(v)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(v)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(G(v)===`WORKING`||!G(h)&&!G(p))&&e(r)});var i=V(n,2),a=e=>{q(e,Ya())},o=P(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(v)||``)&&!G(h));Y(i,e=>{G(o)&&e(a)}),q(e,t)},ue=e=>{var r=lo(),a=z(r),o=B(a),m=V(a,2),h=R(m),g=B(h,!0),_=V(h,2),v=e=>{var r=Ir();Z(z(r),17,()=>G(s).choices||[],X,(e,r,a)=>{var o=$a(),s=R(o);Si(s),s.value=s.__value=a;var c=V(s),u=V(c),d=e=>{var t=Za(),n=B(t,!0);H(()=>J(n,G(r).detail)),q(e,t)};Y(u,e=>{G(r).detail&&e(d)});var f=V(u,2),p=e=>{q(e,Qa())};Y(f,e=>{G(r).persistent&&e(p)}),j(o),H(()=>{Q(s,`name`,`decision-`+t.session+`-`+i()),J(c,` ${G(r).label??``} `)}),Oi(n,[],s,()=>G(l),e=>L(l,e)),q(e,o)}),q(e,r)},b=e=>{var t=Ir();Z(z(t),17,()=>G(w),X,(e,t,n)=>{var r=oo(),i=z(r),a=R(i),o=V(a),s=e=>{var t=eo();Si(t),Ei(t,()=>G(c)[n],e=>G(c)[n]=e),q(e,t)},l=e=>{var r=no(),i=R(r);i.value=i.__value=``,Z(V(i),17,()=>G(t).options||[],X,(e,t)=>{var n=to(),r=B(n,!0),i={};H(()=>{J(r,G(t)),i!==(i=G(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),j(r),hi(r),gi(r,()=>G(c)[n],e=>G(c)[n]=e),q(e,r)},u=e=>{var r=ro(),i=z(r);ot(i);var a=V(i,2),o=e=>{var n=Ja(),r=B(n);H(e=>J(r,`Suggested answers: ${e??``}`),[()=>G(t).options.join(` · `)]),q(e,n)};Y(a,e=>{G(t).options?.length&&e(o)}),Ei(i,()=>G(c)[n],e=>G(c)[n]=e),q(e,r)};Y(o,e=>{G(t).secret?e(s):G(t).freeText?e(u,-1):e(l,1)}),j(i);var d=V(i,2),f=e=>{var n=ao(),r=V(R(n),4);Z(r,21,()=>G(t).options||[],X,(e,t)=>{var n=io(),r=B(n,!0);H(()=>J(r,G(t))),q(e,n)}),j(r),j(n),q(e,n)};Y(d,e=>{G(t).secret&&!G(t).freeText&&e(f)}),H(()=>J(a,`${G(t).text??``} `)),q(e,r)}),q(e,t)};Y(_,e=>{G(s).kind===`approval`||G(s).kind===`profile`?e(v):e(b,-1)}),j(m);var x=V(m,2),S=e=>{var t=so(),n=z(t),r=B(n),i=V(n,2),a=B(i),o=V(i,2);H(e=>{J(r,`Check the target and ${G(s).kind===`profile`?`profile above`:G(s).kind===`approval`?`exact command and permission scope`:`message above`}. This will send to Codex; it may start work - using your quota. Confirmation expires in ${e??``}s.`),i.disabled=G(p)||G(y),J(a,`CONFIRM ${(G(s).kind===`approval`||G(s).kind===`profile`?G(s).choices?.[G(l)]?.label:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((G(d)-G(f))/1e3))]),Tr(`click`,i,te),Tr(`click`,o,()=>{L(u,``)}),q(e,t)},E=e=>{var t=co(),n=B(t,!0);H(()=>{t.disabled=G(p)||G(y)||!G(T),J(n,G(p)?`SENDING…`:`REVIEW BEFORE SENDING`)}),Tr(`click`,t,ee),q(e,t)};Y(x,e=>{G(C)?e(S):e(E,-1)}),H(()=>{J(o,`TARGET // ${G(s).thread??``} // ${(G(s).directory||`Directory unavailable`)??``}`),m.disabled=G(p)||G(C)||G(y),J(g,G(s).kind===`approval`||G(s).kind===`profile`?`Choose a decision`:`Reply to this session`)}),q(e,r)};Y(oe,e=>{G(y)||G(g)?e(se):G(s)?G(s).id?G(_)!==G(s).id&&e(ue,3):e(le,2):e(ce,1)}),j(r),H(()=>J(o,i()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(ne,e=>{G(b)||e(re)}),q(e,D),qe()}Er([`click`]);var po=K(`
            `);function mo(e,t){Ke(t,!0);let n=zi(t,`active`,3,!1),r=P(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!t.session.text.trim()),i=I(!1),a=I(``),o=I(!1);xn(()=>{if(!G(o))return;let e=setTimeout(()=>{L(o,!1)},150);return()=>clearTimeout(e)}),xn(()=>{t.session.text,t.session.status,L(a,``)});async function s(){if(!G(r)||G(i))return;let e=t.session.text;L(i,!0),L(o,!0),L(a,``);try{await navigator.clipboard.writeText(e),t.session.text===e&&L(a,`Copied.`)}catch{t.session.text===e&&L(a,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{L(i,!1)}}function c(e){!n()||!G(r)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),s())}var l=Ir();wr(`keydown`,tn,c);var u=z(l),d=e=>{var t=po(),n=R(t),r=B(n,!0),c=V(n,2);let l;j(t),H(()=>{J(r,G(a)),c.disabled=G(i),l=li(c,1,`svelte-543j00`,null,l,{flashed:G(o)})}),Tr(`click`,c,s),q(e,t)};Y(u,e=>{G(r)&&e(d)}),q(e,l),qe()}Er([`click`]);var ho=K(`

            `),go=K(`

            `),_o=K(`
             
            `),vo=K(`

            Command unavailable from this observation. Open Codex to inspect the - request.

            `),yo=K(`

            `,1),bo=K(`

            `),xo=K(`
             
            `,1),So=K(`
            `),Co=K(`

            Session connection or refresh unavailable. Context and telemetry may be - stale.

            `),wo=K(`

            Some quota profile checks are unavailable. Only sessions with freshly - verified quota and settings can be updated; previous outcome notices remain - visible.

            `),To=K(` `),Eo=K(` `),Do=K(``),Oo=K(`

            Read only — reply or approve in Codex.

            `),ko=K(`

            `),Ao=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),jo=K(`
            `),Mo=K(`
            `),No=K(`

            This session is no longer in the current observation. Return to sessions.

            `),Po=K(`

            `),Fo=K(` `),Io=K(`

            `),Lo=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Ro=K(` `,1),zo=K(`

            `),Bo=K(`

            TOKEN ACTIVITY // 30 SECOND SAMPLES

            `),Vo=K(`

            TOKENS

            FULL DETAIL →
            `),Ho=K(`

            No locally observed sessions yet. Keep Codex running alongside - Codexometer.

            `),Uo=K(`

            ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

            `,1),Wo=K(`

            SESSION TOTALS

            `,1);function Go(e,t){Ke(t,!0);let n=(e,t=f,n,r)=>{let i=vt(()=>g(n?.(),!0)),a=vt(()=>g(r?.(),!1));var o=xo(),s=z(o),c=e=>{var n=ho();let r;var i=B(n,!0);H(e=>{r=li(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>b(t())]),q(e,n)},l=P(()=>b(t())&&(!G(a)||G(d)||t().status===`CHECK SESSION`));Y(s,e=>{G(l)&&e(c)});var u=V(s,2),p=e=>{var n=go(),r=B(n,!0);H(()=>J(r,t().contextKind||`LAST ACTIVITY`)),q(e,n)};Y(u,e=>{G(i)&&e(p)});var m=V(u,2),h=B(m,!0),_=V(m,2),v=e=>{var n=yo(),r=V(z(n),2),i=B(r,!0),a=V(r,2),o=e=>{var n=_o(),r=B(n,!0);H(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,vo())};Y(a,e=>{t().command?e(o):e(s,-1)}),H(()=>J(i,G(d)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(_,e=>{(!G(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(v)});var y=V(_,2),x=e=>{var n=bo(),r=B(n);H(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(y,e=>{G(a)||e(x)}),H(()=>J(h,t().text||`No session context available.`)),q(e,o)},r=zi(t,`params`,19,()=>({})),i=P(()=>$.data?.sessions||[]),a=P(()=>$.data?.control&&$.data.profiles||[]),o=I(!1);function s(e,t){if(r().id&&r().id!==t&&G(o)){e.preventDefault();return}h(t)}xn(()=>{let e=r().id;e&&hr(()=>{Zi.selected=e,na(e,2)})});let c=P(()=>G(i).find(e=>e.id===r().id)),l=P(()=>new URLSearchParams(Ui.querystring).get(`review`)===`profile`&&G(a).some(e=>e.session===r().id&&e.pending)),u=P(()=>G(i).some(e=>e.id===Zi.selected)?Zi.selected:G(i)[0]?.id),d=P(()=>!$.connected||!!$.data?.sessionsError),p=P(()=>[[`OBSERVED TOKENS`,ra(G(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,ra(G(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,G(d)?`—`:ra(G(i).filter(e=>e.status===t).length)])]),m=P(()=>G(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function h(e){Zi.selected=e,fr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function v(e,t){if(h(e),r().id){t<0&&(na(e,2),location.hash=`/sessions`);return}let n=ea(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):na(e,n)}function y(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),v(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||G(u)))e.preventDefault(),v(r().id||G(u),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&G(i).length){e.preventDefault();let t=G(i).findIndex(e=>e.id===G(u));h(G(i)[Math.max(0,Math.min(G(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function b(e){return G(d)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}var x=Wo();wr(`keydown`,tn,y);var S=z(x),C=B(V(R(S),2));j(S);var w=V(S,2);let T;Z(w,21,()=>G(p),X,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=So(),o=R(a),s=B(o,!0),c=B(V(o,2),!0);j(a),H(()=>{J(s,r()),J(c,i())}),q(e,a)}),j(w);var E=V(w,2),ee=B(E),te=V(E,2),D=e=>{q(e,Co())};Y(te,e=>{G(d)&&e(D)});var ne=V(te,2),re=e=>{q(e,wo())};Y(ne,e=>{$.data?.profileError&&e(re)});var ie=V(ne,2),ae=e=>{var t=Do(),n=R(t);Z(n,17,()=>G(m),X,(e,t)=>{var n=To();let r;var i=B(n);H(e=>{r=li(n,1,`button`,null,r,{approval:G(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),J(i,`${G(t).status??``} // ${(G(t).directory||G(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),Tr(`click`,n,()=>h(G(t).id)),q(e,n)}),Z(V(n,2),17,()=>G(a).filter(e=>e.pending&&G(i).some(t=>t.id===e.session)),X,(e,t)=>{var n=Eo(),a=B(n);H((e,i)=>{Q(n,`title`,r().id&&r().id!==G(t).session&&G(o)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(a,`QUOTA THRESHOLD // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session)+`?review=profile`,()=>G(i).find(e=>e.id===G(t).session)?.directory||G(t).session]),Tr(`click`,n,e=>s(e,G(t).session)),q(e,n)}),j(t),q(e,t)},oe=P(()=>(G(m).length||G(a).some(e=>e.pending))&&!G(d));Y(ie,e=>{G(oe)&&e(ae)});var se=V(ie,2),ce=e=>{var t=Ir(),i=z(t),s=e=>{var t=Mo(),i=R(t),s=R(i),u=R(s);let f;var p=V(u);j(s);var m=V(s,2);j(i);var g=V(i,2),_=B(g),v=V(g,2);let y;var b=R(v),x=R(b);n(x,()=>G(c),()=>!0,()=>!0),j(b);var S=V(b,2),C=e=>{var t=Ir();Jr(z(t),()=>G(c).id,e=>{fo(e,{get session(){return G(c).id},get observedCommand(){return G(c).command},get suspended(){return G(l)},onProtectedChange:e=>{L(o,e,!0)}})}),q(e,t)},w=e=>{q(e,Oo())};Y(S,e=>{$.data?.control?e(C):e(w,-1)}),j(v);var T=V(v,2);Z(T,17,()=>G(a).filter(e=>e.session===G(c).id),e=>e.session,(e,t)=>{var n=jo(),r=R(n),i=e=>{var n=ko(),r=B(n,!0);H(()=>J(r,G(t).notice)),q(e,n)};Y(r,e=>{G(t).notice&&e(i)});var a=V(r,2),o=e=>{fo(e,{get session(){return G(c).id},review:`profile`})},s=e=>{var t=Ao();H(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(c).id)+`?review=profile`]),q(e,t)};Y(a,e=>{G(t).pending&&G(l)?e(o):G(t).pending&&e(s,1)}),j(n),H(()=>Q(n,`id`,`quota-profile-`+G(c).id)),q(e,n)});var E=V(T,2),ee=e=>{var t=Ir();Jr(z(t),()=>G(c).id,e=>{mo(e,{get session(){return G(c)},active:!0})}),q(e,t)};Y(E,e=>{G(l)||e(ee)}),j(t),H(e=>{f=li(u,1,`lamp lit`,null,f,{working:G(c).status===`WORKING`&&!G(d)}),J(p,`${(G(d)?`STALE`:G(l)?`QUOTA THRESHOLD`:G(c).status)??``} // ${G(c).directory??``}`),J(_,`${e??``} TOKENS // ${G(c).id??``} // CONTEXT SOURCE // ${(G(c).source||`LOCAL`)??``}`),y=di(v,``,y,{display:G(l)?`none`:void 0})},[()=>ra(G(c).tokens)]),Tr(`click`,m,()=>{h(r().id),na(r().id,2)}),q(e,t)},u=e=>{q(e,No())};Y(i,e=>{G(c)?e(s):e(u,-1)}),q(e,t)},le=e=>{var t=Uo(),r=z(t),o=V(R(r),2),c=R(o),l=V(c,2);j(o),j(r);var f=V(r,2);Z(f,17,()=>G(i),e=>e.id,(e,t)=>{let r=P(()=>ea(G(t).id));var i=Vo();let o;var c=R(i),l=R(c),f=R(l);let p;var m=V(f,1,!0);j(l);var g=V(l,2),_=B(g,!0),y=V(g,2),b=R(y);Te(),j(y);var x=V(y,2),S=B(x),C=V(x,2),w=B(C),T=V(C,2),E=R(T),ee=V(E,2),te=B(ee,!0),D=V(ee,2);j(T);var ne=V(T,2),re=V(ne,2),ie=e=>{var n=Po(),r=B(n,!0);H(()=>J(r,G(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:G(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),q(e,n)},ae=P(()=>!G(d)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(G(t).status));Y(re,e=>{G(ae)&&e(ie)}),j(c);var oe=V(c,2),se=e=>{var r=zo(),i=R(r),o=R(i),c=B(o,!0),l=V(o,2),f=e=>{var n=Fo(),r=B(n,!0);H(e=>{Q(n,`href`,e),J(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),q(e,n)};Y(l,e=>{!G(d)&&G(t).status===`APPROVAL NEEDED`&&e(f)}),j(i);var p=V(i,2);n(p,()=>G(t),()=>!1);var m=V(p,2);Z(m,17,()=>G(a).filter(e=>e.session===G(t).id),X,(e,n)=>{var r=Ro(),i=z(r),a=e=>{var t=Io(),r=B(t,!0);H(()=>J(r,G(n).notice)),q(e,t)};Y(i,e=>{G(n).notice&&e(a)});var o=V(i,2),c=e=>{var n=Lo();H(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(t).id)+`?review=profile`]),Tr(`click`,n,e=>s(e,G(t).id)),q(e,n)};Y(o,e=>{G(n).pending&&e(c)}),q(e,r)});var h=V(m,2);{let e=P(()=>G(u)===G(t).id);mo(h,{get session(){return G(t)},get active(){return G(e)}})}j(r),H(()=>J(c,G(t).contextKind||`LAST ACTIVITY`)),q(e,r)};Y(oe,e=>{G(r)>0&&e(se)});var ce=V(oe,2),le=e=>{var n=Bo(),r=V(R(n),2);{let e=P(()=>(G(t).samples||[]).map(e=>e.tokens));Va(r,{get values(){return G(e)},capacity:120})}var i=B(V(r,2));j(n),H(()=>J(i,`LAST ${(G(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(ce,e=>{G(r)<2&&e(le)}),j(i),H((e,n,a)=>{o=li(i,1,`session-row`,null,o,{selected:G(u)===G(t).id,wide:G(r)===2,split:G(r)===1}),Q(i,`aria-label`,`Session `+(G(t).directory||G(t).id)),p=li(f,1,`lamp lit`,null,p,{working:G(t).status===`WORKING`&&!G(d)}),J(m,G(d)?`STALE`:G(t).status),Q(g,`aria-pressed`,G(u)===G(t).id),J(_,G(t).directory||G(t).id),J(b,`${e??``} `),J(S,`${G(t).agents??``} LINKED AGENTS`),J(w,`ACTIVE // ${n??``}`),E.disabled=G(r)===0,Q(ee,`aria-expanded`,G(r)>0),J(te,G(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ne,`href`,a)},[()=>ra(G(t).tokens),()=>ia(G(t).activity),()=>`#/sessions/`+encodeURIComponent(G(t).id)]),Tr(`click`,g,()=>h(G(t).id)),Tr(`click`,E,()=>v(G(t).id,-1)),Tr(`click`,ee,()=>{h(G(t).id),na(G(t).id,+!G(r))}),Tr(`click`,D,()=>v(G(t).id,1)),Tr(`click`,ne,()=>h(G(t).id)),q(e,i)});var p=V(f,2),m=e=>{q(e,Ho())};Y(p,e=>{G(i).length||e(m)}),Tr(`click`,c,()=>ta(1)),Tr(`click`,l,()=>ta(0)),q(e,t)};Y(se,e=>{r().id?e(ce):e(le,-1)}),H(e=>{J(C,`OBSERVED ${e??``}`),T=li(w,1,`session-totals`,null,T,{stale:G(d)}),J(ee,`${G(d)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens - observed since this server started for currently listed sessions; linked - agents are already included. Totals can decrease when a session leaves the - list. History samples every 30 seconds. Not account-wide totals.`)},[()=>ia($.data?.sessionsAt)]),q(e,x),qe()}Er([`click`]);var Ko=864e5;function qo(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Jo(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=qo(r,-t),a=new Date(i.getTime()+Ko);if(e===n)return{start:a,end:r};r=i}}var Yo=K(`

            History refresh failed. Any displayed history is the last successful - observation.

            `),Xo=K(``),Zo=K(`
            `),Qo=K(`

            LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

            `,1),$o=K(`
            `,1),es=K(` `),ts=K(`

            LIFETIME TOKENS

            PEAK DAY

            CURRENT STREAK

            DAYS

            Accessible data table
            Date (UTC)Tokens

            `,1),ns=K(`

            History unavailable or awaiting a matching account observation. Missing - history is not treated as zero usage.

            `),rs=K(`

            USAGE // ACCOUNT HISTORY

            Account-wide history reported by Codex, not the local Sessions counter. Dates - use UTC. Historical resets are not provided by this data.

            `,1);function is(e,t){Ke(t,!0);let n=I(`daily`),r=I(12),i=I(0),a=P(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Jo(new Date,G(r),G(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=P(()=>Math.max(1,...G(a).map(e=>e.tokens))),s=P(()=>G(a).length?new Date(G(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=P(()=>{if(G(n)===`monthly`){let e=new Map;for(let t of G(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return G(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=rs(),u=V(z(l),4),d=R(u),f=V(R(d)),p=R(f);p.value=p.__value=`daily`;var m=V(p);m.value=m.__value=`monthly`;var h=V(m);h.value=h.__value=`cumulative`,j(f),hi(f),j(d);var g=V(d),_=V(R(g)),v=R(_);v.value=v.__value=6;var y=V(v);y.value=y.__value=12,j(_),hi(_),j(g);var b=V(g),x=V(b);j(u);var S=V(u,2),C=e=>{q(e,Yo())};Y(S,e=>{$.data?.usageError&&e(C)});var w=V(S,2),T=e=>{var t=ts(),r=z(t),i=R(r),l=B(V(R(i),2),!0);j(i);var u=V(i,2),d=B(V(R(u),2),!0);j(u);var f=V(u,2),p=V(R(f),2),m=R(p);Te(),j(p),j(f),j(r);var h=V(r,2),g=R(h),_=B(g),v=V(g,2),y=e=>{var t=Qo(),n=z(t),r=R(n),i=R(r);Z(i,17,()=>Array(G(s)),X,(e,t)=>{q(e,Xo())}),Z(V(i,2),17,()=>G(a),X,(e,t)=>{var n=Zo();let r,i;H(e=>{r=li(n,1,`heat-cell`,null,r,{zero:G(t).tokens===0}),Q(n,`title`,e),i=di(n,``,i,{opacity:G(t).tokens?.25+.75*G(t).tokens/G(o):1})},[()=>`${G(t).date}: ${ra(G(t).tokens)} tokens`]),q(e,n)}),j(r),j(n),Te(2),q(e,t)},b=e=>{var t=$o(),r=z(t);{let e=P(()=>G(c).map(e=>e.tokens)),t=P(()=>G(n)+` usage`);Va(r,{get values(){return G(e)},get label(){return G(t)}})}var i=V(r,2),a=R(i),o=B(a,!0),s=B(V(a),!0);j(i),H(e=>{J(o,G(c)[0]?.date),J(s,e)},[()=>G(c).at(-1)?.date]),q(e,t)};Y(v,e=>{G(n)===`daily`?e(y):e(b,-1)});var x=V(v,2),S=V(R(x),2),C=R(S),w=V(R(C));Z(w,21,()=>G(n)===`daily`?G(a):G(c),X,(e,t)=>{var n=es(),r=R(n),i=B(r,!0),a=B(V(r),!0);j(n),H(e=>{J(i,G(t).date),J(a,e)},[()=>ra(G(t).tokens)]),q(e,n)}),j(w),j(C),j(S),j(x),j(h);var T=B(V(h,2));H((e,t,n,r,i)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${G(a)[0]?.date??``} — ${r??``}`),J(T,`OBSERVED ${i??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>ra($.data.usage.summary.lifetimeTokens),()=>ra($.data.usage.summary.peakDailyTokens),()=>ra($.data.usage.summary.currentStreakDays),()=>G(a).at(-1)?.date,()=>ia($.data.usageAt)]),q(e,t)},E=e=>{q(e,ns())};Y(w,e=>{$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(T):e(E,-1)}),H(()=>x.disabled=G(i)===0),gi(f,()=>G(n),e=>L(n,e)),Tr(`change`,_,()=>L(i,0)),gi(_,()=>G(r),e=>L(r,e)),Tr(`click`,b,()=>Yt(i)),Tr(`click`,x,()=>Yt(i,-1)),q(e,l),qe()}Er([`change`,`click`]),We();var as=K(`

            Quota refresh failed. Policy state is based on the last successful - observation.

            `),os=K(`

            `),ss=K(`

            The longest Codex quota window selects one active model profile. ASK - creates a per-session review; AUTO applies the profile on the next - eligible check.

            `,1),cs=K(`

            No threshold-based model steps were configured at launch.

            `);function ls(e,t){Ke(t,!1),Fi();var n=Ir(),r=z(n),i=e=>{var t=ss(),n=z(t),r=B(n),i=V(n,2),a=e=>{q(e,as())};Y(i,e=>{$.data.quotaError&&e(a)});var o=V(i,2),s=R(o),c=B(s),l=V(s,4);Z(l,5,()=>$.data.thresholds,X,(e,t)=>{var n=os();let r;var i=R(n),a=B(i),o=V(i,2),s=R(o),c=B(s,!0),l=B(V(s,2));j(o);var u=V(o,2),d=B(u,!0),f=B(V(u,2));j(n),H((e,i)=>{r=li(n,1,``,null,r,{active:G(t).state===`ACTIVE`,next:G(t).state===`NEXT`}),J(a,`${G(t).threshold??``}%`),J(c,G(t).model),J(l,`${e??``} REASONING // ${i??``} - SPEED`),J(d,G(t).mode),J(f,`${G(t).state??``}${G(t).state===`NEXT`?` // ${G(t).remaining||0} PP TO GO`:``}`)},[()=>G(t).effort.toUpperCase(),()=>G(t).speed.toUpperCase()]),q(e,n)}),j(l),j(o),H(e=>{J(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),J(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ia($.data.quotaAt)]),q(e,t)},a=e=>{q(e,cs())};Y(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),q(e,n),qe()}var us=K(`

            Page not found

            Return to Quota

            `,1);function ds(e){var t=us();Te(2),q(e,t)}var fs=K(` `),ps=K(`

            `),ms=K(`

            Connecting to your local Codexometer…

            `),hs=K(``),gs=K(`
            CODEXOMETER

            Your quota. Your sessions. Your command centre.

            `);function _s(e,t){Ke(t,!0);let n={"/":Ra,"/quota/:view?":Ra,"/sessions/:id?":Go,"/usage":is,"/thresholds":ls,"*":ds},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=P(()=>$.data?.thresholds?.length?{quota:r.quota,thresholds:/^\/thresholds\/?$/,sessions:r.sessions,usage:r.usage}:r),a=I(`hacker`),o=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];xn(()=>{Qi()}),xn(()=>{if($.data){if(/^\/thresholds\/?$/.test(Ui.location)&&!$.data.thresholds?.length){location.hash=`#/quota/`+Zi.view;return}for(let[e,t]of Object.entries(G(i)))t.test(Ui.location)&&(Zi.tab=e)}}),Bi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&o.includes(e)&&L(a,e,!0)}catch{}return la()});function s(){try{localStorage.setItem(`codexometer.web.theme`,G(a))}catch{}}var c=gs(),l=R(c),u=V(R(l),2),d=R(u);let f;var p=V(d,1,!0),m=B(V(p));j(u),j(l);var h=V(l,2);Z(h,21,()=>Object.entries(G(i)),X,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1],a=P(()=>i().test(Ui.location));var o=fs();let s;var c=B(o,!0);H(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+Zi.view:`#/`+r()),Q(o,`aria-current`,G(a)?`page`:void 0),s=li(o,1,``,null,s,{active:G(a)}),J(c,e)},[()=>r().toUpperCase()]),q(e,o)}),j(h);var g=V(h,2),v=R(g),y=e=>{var t=ps(),n=B(t,!0);H(()=>J(n,$.error)),q(e,t)};Y(v,e=>{$.error&&e(y)});var b=V(v,2),x=e=>{Ki(e,{get routes(){return n}})},S=e=>{q(e,ms())};Y(b,e=>{$.data?e(x):$.error||e(S,1)}),j(g);var C=V(g,2),w=R(C),T=B(w),E=V(w,2),ee=B(E,!0),te=V(E,2),D=V(R(te));Z(D,21,()=>o,X,(e,t)=>{var n=hs(),r=B(n,!0),i={};H(e=>{J(r,e),i!==(i=G(t))&&(n.value=(n.__value=i)??``)},[()=>G(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),j(D),hi(D),j(te),j(C),j(c),H(()=>{Q(c,`data-theme`,G(a)),f=li(d,1,`lamp`,null,f,{lit:$.connected}),J(p,$.connected?`CONNECTED`:`OFFLINE`),J(m,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),J(T,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(ee,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),Tr(`change`,D,s),gi(D,()=>G(a),e=>L(a,e)),q(e,c),qe()}Er([`change`]),Hr(_s,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/index.html b/internal/web/dist/index.html index 1ef6117..74cc3b5 100644 --- a/internal/web/dist/index.html +++ b/internal/web/dist/index.html @@ -5,7 +5,7 @@ Codexometer // Experimental web - + diff --git a/intro-post.md b/intro-post.md index aed19a0..23e3ec2 100644 --- a/intro-post.md +++ b/intro-post.md @@ -51,7 +51,7 @@ keep priority. These shortcuts navigate only; they never approve or send for you Optional quota step-down profiles also join the session command centre in the terminal and writable web interface: configure `--quota-step-down PERCENT:MODEL:EFFORT[:SPEED[:ask|auto]]`, then follow a **QUOTA THRESHOLD** pill to review the proposed settings for that session. -Configuring any steps also reveals a dedicated **Thresholds** tab in the terminal +Configuring any steps also reveals **Quota → Thresholds**, after Resets, in the terminal and web dashboards, giving you a compact overview of every trigger and clearly marking the active and next model profile. It stays hidden on normal launches. Apply and confirm individually, or skip. A session can have separate pills for diff --git a/web/src/App.svelte b/web/src/App.svelte index 69d47dd..d4a00f6 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -5,7 +5,6 @@ import Quota from './Quota.svelte'; import Sessions from './Sessions.svelte'; import Usage from './Usage.svelte'; - import Thresholds from './Thresholds.svelte'; import Missing from './Missing.svelte'; import { preferences, savePreferences } from './preferences.svelte'; @@ -14,24 +13,13 @@ '/quota/:view?': Quota, '/sessions/:id?': Sessions, '/usage': Usage, - '/thresholds': Thresholds, '*': Missing, }; - const baseTabPaths = { + const tabPaths = { quota: /^(?:\/|\/quota(?:\/[^/]+)?\/?)$/, sessions: /^\/sessions(?:\/[^/]+)?\/?$/, usage: /^\/usage\/?$/, }; - let tabPaths = $derived( - live.data?.thresholds?.length - ? { - quota: baseTabPaths.quota, - thresholds: /^\/thresholds\/?$/, - sessions: baseTabPaths.sessions, - usage: baseTabPaths.usage, - } - : baseTabPaths, - ); let theme = $state('hacker'); const themes = ['hacker', 'rust', 'blue-steel', 'ultraviolet', 'nightshade']; $effect(() => { @@ -39,13 +27,6 @@ }); $effect(() => { if (!live.data) return; - if ( - /^\/thresholds\/?$/.test(router.location) && - !live.data.thresholds?.length - ) { - location.hash = '#/quota/' + preferences.view; - return; - } for (const [tab, pattern] of Object.entries(tabPaths)) { if (pattern.test(router.location)) preferences.tab = tab as typeof preferences.tab; diff --git a/web/src/Quota.svelte b/web/src/Quota.svelte index f0baeaf..09764b4 100644 --- a/web/src/Quota.svelte +++ b/web/src/Quota.svelte @@ -2,10 +2,15 @@ import { onMount } from 'svelte'; import { live, date } from './state.svelte'; import type { Meter } from './state.svelte'; + import Thresholds from './Thresholds.svelte'; import ConsumptionZone from './ConsumptionZone.svelte'; import { preferences, quotaViews } from './preferences.svelte'; let { params = {} }: { params?: { view?: string } } = $props(); - const views = quotaViews; + let views = $derived( + quotaViews.filter( + (view) => view !== 'thresholds' || !!live.data?.thresholds?.length, + ), + ); let now = $state(Date.now()); let view = $derived( views.includes(params.view || '') ? params.view! : 'bars', @@ -49,7 +54,9 @@ Quota refresh failed. Values below are the last successful observation.

            {/if}

            QUOTA // OBSERVED {date(live.data.quotaAt)}

            - {#if view === 'resets'} + {#if view === 'thresholds'} + + {:else if view === 'resets'}

            RESET INVENTORY // {live.data.creditCount} AVAILABLE

            Read-only preview. Use the terminal to redeem a reset.

            diff --git a/web/src/preferences.svelte.ts b/web/src/preferences.svelte.ts index 58ed29c..f01944d 100644 --- a/web/src/preferences.svelte.ts +++ b/web/src/preferences.svelte.ts @@ -1,7 +1,15 @@ -export const quotaViews = ['bars', 'pace', 'zone', 'pie', 'fuel', 'resets']; +export const quotaViews = [ + 'bars', + 'pace', + 'zone', + 'pie', + 'fuel', + 'resets', + 'thresholds', +]; const key = 'codexometer.web.preferences.v1'; interface Preferences { - tab: 'quota' | 'sessions' | 'usage' | 'thresholds'; + tab: 'quota' | 'sessions' | 'usage'; view: string; selected: string; defaultDetail: number; @@ -19,7 +27,7 @@ function read(): Preferences { const value = JSON.parse(localStorage.getItem(key) || 'null'); if (!value || typeof value !== 'object') return defaults; return { - tab: ['quota', 'sessions', 'usage', 'thresholds'].includes(value.tab) + tab: ['quota', 'sessions', 'usage'].includes(value.tab) ? value.tab : 'quota', view: quotaViews.includes(value.view) ? value.view : 'bars', diff --git a/web/tests/browser.spec.ts b/web/tests/browser.spec.ts index fe686ae..6b7f564 100644 --- a/web/tests/browser.spec.ts +++ b/web/tests/browser.spec.ts @@ -109,6 +109,17 @@ test.describe('quota profile reviews', () => { exact: true, }); await expect(thresholds).toBeVisible(); + await expect( + page + .getByRole('navigation', { name: 'Main navigation' }) + .getByRole('link', { name: 'THRESHOLDS' }), + ).toHaveCount(0); + await expect( + page + .getByRole('navigation', { name: 'Quota view' }) + .getByRole('link') + .last(), + ).toHaveText('THRESHOLDS'); await thresholds.click(); await expect( page.getByRole('heading', { name: /THRESHOLDS/ }), From 86c901b25744cb55212fa731ee9406749a248a79 Mon Sep 17 00:00:00 2001 From: merefield Date: Sat, 19 Sep 2026 14:01:14 +0100 Subject: [PATCH 3/3] FIX: display standard speed consistently in Thresholds --- internal/ui/thresholds.go | 2 ++ internal/ui/thresholds_test.go | 15 +++++++++++++++ internal/web/state.go | 2 ++ internal/web/thresholds_test.go | 15 +++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/internal/ui/thresholds.go b/internal/ui/thresholds.go index 0cdbf6e..f0c4a20 100644 --- a/internal/ui/thresholds.go +++ b/internal/ui/thresholds.go @@ -31,6 +31,8 @@ func (m Model) thresholdDetailLines(width int, colors palette) []string { speed := step.ServiceTier if speed == "" { speed = i18n.Text("speed unchanged") + } else if speed == "default" { + speed = "standard" } mode := i18n.Text("ASK") if step.Mode == "auto" { diff --git a/internal/ui/thresholds_test.go b/internal/ui/thresholds_test.go index 10ef615..8c6f936 100644 --- a/internal/ui/thresholds_test.go +++ b/internal/ui/thresholds_test.go @@ -56,3 +56,18 @@ func TestThresholdsRenderCompactAndStayWithinBounds(t *testing.T) { t.Fatalf("compact threshold view exceeded 36x8:\n%s", ansi.Strip(output)) } } + +func TestThresholdSpeedDisplay(t *testing.T) { + for _, tc := range []struct{ tier, want string }{ + {"default", "standard"}, {"", "speed unchanged"}, {"fast", "fast"}, {"priority", "priority"}, + } { + m := Model{quotaSteps: []codex.QuotaStep{{Threshold: 80, Model: "model", Effort: "low", ServiceTier: tc.tier}}} + output := ansi.Strip(m.renderThresholds(120, 16, paletteFor(themeHacker))) + if !strings.Contains(output, "model / low / "+tc.want) { + t.Errorf("tier %q: missing displayed speed %q in %s", tc.tier, tc.want, output) + } + if m.quotaSteps[0].ServiceTier != tc.tier { + t.Fatal("presentation changed configured tier") + } + } +} diff --git a/internal/web/state.go b/internal/web/state.go index 7c83592..3def6ab 100644 --- a/internal/web/state.go +++ b/internal/web/state.go @@ -168,6 +168,8 @@ func (s *store) refreshThresholds(snapshot codex.Snapshot) { speed, mode := step.ServiceTier, "ASK" if speed == "" { speed = "UNCHANGED" + } else if speed == "default" { + speed = "standard" } if step.Mode == "auto" { mode = "AUTO" diff --git a/internal/web/thresholds_test.go b/internal/web/thresholds_test.go index 6122209..a56d6b9 100644 --- a/internal/web/thresholds_test.go +++ b/internal/web/thresholds_test.go @@ -29,3 +29,18 @@ func TestThresholdPolicyProjectionIsSortedAndTracksQuota(t *testing.T) { t.Fatalf("next threshold = %#v", got[1]) } } + +func TestThresholdSpeedDisplay(t *testing.T) { + for _, tc := range []struct{ tier, want string }{ + {"default", "standard"}, {"", "UNCHANGED"}, {"fast", "fast"}, {"priority", "priority"}, + } { + s := newStore() + s.configureThresholds([]codex.QuotaStep{{Threshold: 80, ServiceTier: tc.tier}}) + if got := s.state.Thresholds[0].Speed; got != tc.want { + t.Errorf("tier %q: got %q, want %q", tc.tier, got, tc.want) + } + if s.thresholdPolicy[0].ServiceTier != tc.tier { + t.Fatal("presentation changed configured tier") + } + } +}