diff --git a/README.md b/README.md index 4b3c150..b5f4db8 100644 --- a/README.md +++ b/README.md @@ -1991,7 +1991,7 @@ read-only browser mode, except for the terminal-only `/commands` shortcut. | Command | Behaviour | | --- | --- | -| `/usage` | Open Codexometer’s existing usage history. Quota/reset views retain their existing controls and confirmation. | +| `/usage` | Choose **View analytics** or open the reset inventory; `/usage daily`, `/usage weekly` and `/usage cumulative` go straight to a chart. Reset redemption stays terminal-only and requires separate confirmation. | | `/copy` | Reuse the selected session’s Copy action, copying the full observed reply/activity text. Ineligible or missing text gives feedback. | | `/theme` | Choose and save a Codexometer display theme; terminal picker or existing browser theme selector. | | `/exit`, `/quit` | Quit the Codexometer terminal interface; in the browser, leave session detail for Sessions. Codex sessions and the browser server continue running. | @@ -2037,14 +2037,14 @@ usage and does not change token totals, quota learning or API-EQ calculations. | --- | --- | | `/cd` | Change the selected session’s directory after review and confirmation while idle and with no queued messages. Absolute, session-relative and `~/` paths are supported; success is verified from running configuration. Retains thread ID/history; does not reproduce native project-config reload/fork. | | `/cwd`, `/pwd` | Read-only aliases showing the running session’s current directory, including during active turns. | -| `/resume` | Search saved session names, preview completed turns and open the selected conversation on a shared Codex 0.170.0+ app-server signed in to ChatGPT. Browser preview is read-only; resuming requires write mode. | +| `/resume` | Search, preview and resume saved sessions on a shared Codex 0.170.0+ app-server signed in to ChatGPT. `/resume ` filters the picker; `/resume ` targets the exact session using the usual resume confirmation policy. Browser preview is read-only; resuming requires write mode. | | `/subagents` | Inspect linked agents and their attributable completed turns without changing the parent composer or approval target. | | `/ps` | Show and refresh the connected session’s background terminals. This is read-only and does not stop processes. | | `/rename` | Edit the selected session’s saved name and apply it without a second confirmation by default. Uses Codex’s name API; works during an active turn and does not send a prompt or change model settings. | | `/goal` | Inspect this session’s objective, official goal state and token budget/usage. Set an objective, edit it, pause, resume or clear it. Native forms `/goal `, `/goal edit`, `/goal pause`, `/goal resume` and `/goal clear` are supported. The Budget option (also `/goal budget `) changes the total goal-token budget. **Resume after quota recovery** arms a one-shot trigger for that goal. Mutations require confirmation by default. | -| `/model` | Advertised models, their descriptions and supported reasoning levels. Save the next-turn setting in Codex immediately, even while a turn is running. Choosing a model resets its explicit speed override to the server default. | +| `/model` | Advertised models, their descriptions and supported reasoning levels. Also accepts `/model [model-id] [--reasoning=] [--speed=]`. Apply settings for subsequent turns, even during an active turn. Switching models without an explicit speed clears the previous model's speed override. | | Advertised speed commands, such as `/fast` | Show the default speed and every advertised tier in one list, initially highlighting the current speed. Up/Down highlights; **Enter APPLY** or clicking a choice applies it without a second confirmation by default. IDs and descriptions come from the current model's catalogue; no tier IDs are guessed. The changed speed is verified before success is reported. | -| `/plan` | Advertised collaboration modes, using Codex's built-in mode instructions. | +| `/plan` | Switch an idle session directly into native Plan mode. Use `/plan ` to send a prompt in Plan mode in one request. Requires the shared server to advertise Plan mode. | | `/permissions` | The same starter choices as Codex CLI: **Ask for approval**, **Approve for me**, **Full Access**, **Read Only**, then any custom profiles. Availability follows Codex's requirements. Also accepts `/permissions [--approval-policy=] [--reviewer=user\|auto_review]`. Changes are verified against the running session. | | `/approve` | Review a recently observed native Auto-review denial and record consent for **one retry of that exact action**. It does not run the action directly; the retry still passes through Auto-review. | | `/skills`, `/apps`, `/mcp`, `/hooks`, `/experimental` | **Browse-only** live inventories and supplied help, including MCP tool descriptions. Invoke/configure these through Codex. | @@ -2267,10 +2267,15 @@ not retried automatically. Read-only web mode offers no command-control endpoint Codexometer uses a balanced confirmation policy by default. Explicit one-time approvals, replies, ordinary queue edits, Close All, `/rename`, model/reasoning -selection, advertised speed changes such as `/fast`, and `/plan` apply immediately. +selection, advertised speed changes such as `/fast`, `/plan` (with or without a +prompt), and `/goal pause` apply immediately. Pausing a goal reports if it also +cancels a pending scheduled resume. They still require an explicit action and a fresh, valid session capability. -Broader permission grants, `/permissions`, `/cd`, quota-profile changes, native +Selecting an already-active `/permissions` preset does nothing. Switching to a +known narrower sandbox applies immediately only when the approval policy and +reviewer do not make it easier to gain additional access. Broader or uncertain +permission changes, `/cd`, quota-profile changes, native queue deletion, scheduled follow-ups and Send now, and broad/external benchmark launches keep their review steps. Terminal schedule forms retain their explicit Confirm Schedule / Save Changes action. Settings affect subsequent work; model @@ -2279,7 +2284,7 @@ and speed choices can affect quota consumption or API cost. | Setting | Behaviour | |---|---| | Omitted | Balanced default: confirm higher-impact actions. | -| `--confirmation none` | Skip extra confirmations, except quota-reset redemption and granting folder trust. Native denial inspection still precedes an explicit Apply action. | +| `--confirmation none` | Skip extra confirmations, except quota-reset redemption, folder trust and Full Access. Native denial inspection still precedes an explicit Apply action. | | `--confirmation require` | Confirm every substantive action; navigation and viewing stay immediate. | ```sh @@ -2287,7 +2292,7 @@ codexometer --confirmation none codexometer --web --web-control --confirmation require ``` -**Quota-reset redemption and granting folder trust always require confirmation.** Strict +**Quota-reset redemption, granting folder trust and selecting Full Access always require confirmation.** Strict mode also reviews ordinary terminal replies, active-turn steer/queue/interrupt actions, queued-message edits and trigger deletion. Reviews bind the exact target, payload and live capability, expire, and can be cancelled without discarding the diff --git a/SECURITY.md b/SECURITY.md index a9c7e8b..f688c1c 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -62,7 +62,7 @@ Reversible session-local slash changes (name, model/reasoning, advertised speed, and collaboration mode) apply on explicit selection without a second UI click. Permissions, directories and unknown actions remain guarded by default. `--confirmation none` is a launch-only opt-out from other Codexometer confirmation clicks; -quota-reset redemption and terminal folder trust remain guarded. It does not select +quota-reset redemption, terminal folder trust and Full Access remain guarded. It does not select approvals automatically, change Codex sandbox policies, enable read-only web control routes or bypass server-side preparation/commit, source freshness, revision, one-use capability or replay validation. Browser preparation and commit diff --git a/docs/slash-command-support.md b/docs/slash-command-support.md index 173a19f..b54dc81 100644 --- a/docs/slash-command-support.md +++ b/docs/slash-command-support.md @@ -49,8 +49,8 @@ Local display commands remain daemon-independent. Server-backed menus use a boun | `/goal` | Session adapter | Done | — | Session-scoped `thread/goal/get`, `set`, `clear`; native objective/edit/pause/resume/clear forms plus a token-budget editor. **Resume after quota recovery** is a local, one-shot trigger for an active or usage-limited goal, not a scheduled slash message. It requires observed goal/quota state and a live idle shared app-server session before dispatch. Fresh review/verification, default mutation confirmation, live goal notifications and stale-safe snapshot fallback shared by TUI/web. Goal state follows row statusline fields and precedes full-detail controls. Requires a goal-enabled shared app-server. | | `/cd ` | Implemented with narrower semantics | P1 | Very high | Confirmed `thread/settings/update`, sending only `threadId` and `cwd`. Requires idle/local session, empty queue, no pending approval and an existing directory. Resolves relative paths from the running session directory, expands `~`/`~/`, rechecks symlinks and verifies the result from running configuration. No write retries. See the semantics below. Proposed next increment: destination project-context reload with trust/permission validation and a verified conversation handoff. Reuse the lifecycle foundation below; native-client cooperation may still be necessary. | | `/pwd`, `/cwd` | Implemented aliases | Done | — | Read-only `thread/resume` **without overrides** reports the running directory, including during active turns. Captured `thread/read.cwd` metadata is not used as the answer. The session directory/footer also follows live directory reads and settings notifications. | -| `/model` | Session adapter | Done | — | Live model/reasoning catalogue; send one verified `thread/settings/update` immediately on idle or working sessions, for subsequent turns only. No Codexometer-side queue or automatic retry. Fresh provider/settings/catalogue checks precede the write. The balanced default needs no extra confirmation. Selecting a model clears its explicit speed override. Session-only scope is intentional; no native persistent-default editor is proposed. | -| `/plan` | Partial | P2 | Medium | Advertised collaboration-mode selection; no native optional prompt argument. Proposed next increment: explicit review of an inline plan prompt and confirmed mode/prompt submission without losing the draft. | +| `/model` | Session adapter | Done | — | Live model/reasoning catalogue and inline `/model [model-id] [--reasoning=] [--speed=]`. Send one verified `thread/settings/update` immediately on idle or working sessions, for subsequent turns only. No Codexometer-side queue or automatic retry. Fresh provider/settings/catalogue checks precede the write. Changing model without choosing a speed clears its explicit speed override. Session-only scope is intentional. | +| `/plan` | Session adapter | Done | — | Switch an idle session directly to the advertised native Plan mode. An inline prompt is bound to Plan mode in a single `turn/start` rather than a settings write followed by an independent prompt. | | `/permissions` | Session adapter | Done | — | Native preset order: Ask for approval, Approve for me, Full Access, Read Only, then custom profiles. Supports `/permissions [--approval-policy=] [--reviewer=user\|auto_review]`, shell-style quoting and native granular policy JSON. May update subsequent-turn settings during work, but retained/overflowed human requests and native approval/input waits block writes. Managed requirements and the `guardian_approval` feature govern availability. Requested settings are read back; uncertain writes are not retried. Browser edits invalidate prepared/in-flight inline reviews. Older servers without reviewer metadata retain profile-only controls; no global configuration editor is implied. | | `/approve` | Session adapter | Done | — | `thread/approveGuardianDeniedAction` records consent for one exact recent native denial, not direct execution. The retry still passes through Auto-review; critical-risk and mandatory human checks are not bypassed. Full action/rationale inspection precedes consent even with `--confirmation none`. Inventories and assessment display are root-thread-scoped, memory-only and connection-local: up to ten denials per thread and 256 tracked threads, with spent-consent replay protection. Unknown/incomplete actions stay in Codex. Read-only web displays assessments but cannot send consent. | | `/skills` | Browse only | P2 | Medium | `skills/list` inventory/help. No invocation or configuration flow; `skills/config/write` exists but needs scope/review UI. Proposed next increment: invoke an advertised skill through structured input after review. Configuration/enablement writes are a separate High-complexity extension. | @@ -58,8 +58,8 @@ Local display commands remain daemon-independent. Server-backed menus use a boun | `/mcp` | Browse only | P2 | High | `mcpServerStatus/list` and tool help. No `/mcp login`, including 0.171's optional `--environment` selector, resource browser or arbitrary tool invocation. Proposed next increment: server- and environment-aware login/status and verbose inspection. Arbitrary tool execution remains a separate reviewed workflow. | | `/hooks` | Browse only | P3 | High | `hooks/list`; on 0.166+ discovery is scoped to the loaded thread and its execution environments, with supplied environment attribution. Older servers retain directory-scoped discovery; genuine server errors do not become a different inventory. No lifecycle-hook editor or configuration-write review. Proposed next increment: a scope-aware editor with preview and reload handling. | | `/experimental` | Browse only | P3 | Medium | `experimentalFeature/list`. Enablement changes process/configuration scope, rather than a single session; no mutation UI. Proposed next increment: review an advertised enablement change with its process/configuration scope and refresh/restart effects made clear. | -| `/usage` | Local equivalent | Done | — | Opens the existing Codexometer usage-history view. Existing quota/reset views and their confirmation flows are retained. No account mutation is sent by the alias. | -| `/resume` | Implemented | Done | — | Shared Codex 0.170.0+ with ChatGPT sign-in: search saved sessions by name, preview recent completed turns and explicitly open the selected thread in Sessions detail without sending a prompt. Read-only web can browse and preview; resuming requires write mode. | +| `/usage` | Local equivalent | Done | — | Analytics/reset navigation and `daily`, `weekly` and `cumulative` shortcuts. Terminal redemption still uses the guarded reset screen; the browser reset inventory is read-only. No account mutation is sent by the alias. | +| `/resume` | Implemented | Done | — | Shared Codex 0.170.0+ with ChatGPT sign-in: browse and preview saved sessions, prefill the picker with `/resume `, or target one account-verified session with `/resume `. The shortcut does not send a prompt or bypass strict confirmation. Read-only web can browse and preview; resuming requires write mode. | | `/ps` | Implemented | Done | — | Lists background terminals for the selected connected session using `thread/backgroundTerminals/list`, with refresh. Read-only in both interfaces; does not stop processes. | | `/subagents` | Implemented | Done | — | Opens a read-only picker for linked agents and attributable child transcripts; the parent remains the target for composing and approvals. | | `/copy` | Local equivalent | Done | — | Reuses the selected session’s Copy action and complete observed reply/activity payload. Missing or ineligible text gives feedback. Historical-fragment selection remains outside this increment. | diff --git a/internal/codex/session_auto_review_unix_test.go b/internal/codex/session_auto_review_unix_test.go index cb23cd8..bdfc3e1 100644 --- a/internal/codex/session_auto_review_unix_test.go +++ b/internal/codex/session_auto_review_unix_test.go @@ -329,9 +329,16 @@ func TestNativePermissionPickerUsesCLIOrderAndUpdatesCompletePreset(t *testing.T t.Fatalf("expected four native options: %+v %v", menu.Choices, err) } for i, choice := range menu.Choices { - if choice.Label != want[i].label || choice.Selected != (i == selected) || !choice.Action || choice.Reversible || choice.Next != "" { + active := i == selected + if choice.Label != want[i].label || choice.Selected != active || choice.NoOp != active || choice.Action == active || choice.Reversible || choice.Next != "" { t.Fatalf("unexpected preset at %d: %+v", i, choice) } + if choice.AlwaysConfirm != (!active && choice.Label == "Full Access") { + t.Fatalf("unexpected mandatory confirmation: %+v", choice) + } + } + if err := p.ExecuteSessionCommand(ctx, "one", menu.Path, menu.Revision, menu.Choices[selected].ID); err == nil { + t.Fatal("selecting the current preset must not issue a write") } if err := p.ExecuteSessionCommand(ctx, "one", menu.Path, menu.Revision, menu.Choices[apply].ID); err != nil { t.Fatal(err) @@ -344,6 +351,36 @@ func TestNativePermissionPickerUsesCLIOrderAndUpdatesCompletePreset(t *testing.T t.Fatalf("wrong complete update for %s: %v", preset.label, got) } } + inline, err := p.SessionCommands(ctx, "one", "permissions :danger-full-access") + if err != nil || len(inline.Choices) != 1 || !inline.Choices[0].AlwaysConfirm { + t.Fatal("inline Full Access must also require confirmation", inline, err) + } +} + +func TestPermissionChangesSkipReviewOnlyForKnownNarrowing(t *testing.T) { + for _, tc := range []struct { + name, from, to, policy, newPolicy, reviewer, newReviewer string + want bool + }{ + {"workspace to read-only", ":workspace", ":read-only", `"on-request"`, `"on-request"`, "user", "user", true}, + {"leave full access", ":danger-full-access", ":workspace", `"never"`, `"on-request"`, "user", "user", true}, + {"reviewer also narrowed", ":workspace", ":read-only", `"on-request"`, `"on-request"`, "auto_review", "user", true}, + {"reviewer weakened", ":workspace", ":read-only", `"on-request"`, `"on-request"`, "user", "auto_review", false}, + {"sandbox expanded", ":read-only", ":workspace", `"on-request"`, `"on-request"`, "user", "user", false}, + {"reviewer-only edit", ":workspace", ":workspace", `"on-request"`, `"on-request"`, "auto_review", "user", false}, + {"new escalation path", ":workspace", ":read-only", `"never"`, `"on-request"`, "user", "user", false}, + {"sandbox permissions unknown", "managed", ":read-only", `"on-request"`, `"on-request"`, "user", "user", false}, + {"approval policies incomparable", ":workspace", ":read-only", `{"granular":{}}`, `"on-request"`, "user", "user", false}, + {"reviewer unknown", ":workspace", ":read-only", `"on-request"`, `"on-request"`, "", "user", false}, + } { + t.Run(tc.name, func(t *testing.T) { + current := &sessionPermissions{Profile: &struct{ ID string }{tc.from}, Policy: json.RawMessage(tc.policy), Reviewer: tc.reviewer} + params := map[string]any{"permissions": tc.to, "approvalPolicy": json.RawMessage(tc.newPolicy), "approvalsReviewer": tc.newReviewer} + if got := permissionChangeNarrows(current, params); got != tc.want { + t.Fatalf("direct = %v, want %v", got, tc.want) + } + }) + } } func TestNativePermissionPickerHonoursRestrictions(t *testing.T) { diff --git a/internal/codex/session_commands.go b/internal/codex/session_commands.go index 8acb6d7..3615212 100644 --- a/internal/codex/session_commands.go +++ b/internal/codex/session_commands.go @@ -30,6 +30,9 @@ func ValidSessionCommandPath(path string) bool { if objective, direct := strings.CutPrefix(command, "goal "); direct { return utf8.RuneCountInString(objective) <= SessionGoalInputLimit } + if prompt, direct := strings.CutPrefix(command, "plan "); direct { + return utf8.RuneCountInString(prompt) <= sessionContextLimit + } for _, family := range []struct { name string limit int @@ -38,6 +41,7 @@ func ValidSessionCommandPath(path string) bool { {"cd", SessionDirectoryInputLimit}, {"goal/set", SessionGoalInputLimit}, {"goal/edit", SessionGoalInputLimit}, + {"plan/send", sessionContextLimit}, {"goal/budget", 32}, } { value, encoded := strings.CutPrefix(command, family.name+"/") @@ -62,19 +66,26 @@ func ValidSessionCommandPath(path string) bool { // Command catalogues are interface-neutral, live and memory-only. Front ends // render metadata; they never manufacture RPC methods or permission profiles. type SessionCommandChoice struct { - ID string `json:"id"` - Label string `json:"label"` - Help string `json:"help"` - Next string `json:"next,omitempty"` - Action bool `json:"action,omitempty"` - Selected bool `json:"selected,omitempty"` + ID string `json:"id"` + Label string `json:"label"` + Help string `json:"help"` + Next string `json:"next,omitempty"` + // Unavailable explains a blocked action; empty with no Action can be browse-only help. + Unavailable string `json:"unavailable,omitempty"` + + method string + params map[string]any + + Action bool `json:"action,omitempty"` + Selected bool `json:"selected,omitempty"` // Reversible is set only for an explicit allowlist of session-local settings. // Unknown actions and permission changes retain confirmation by default. Reversible bool `json:"reversible,omitempty"` - // Unavailable explains a blocked action; an empty reason with no Action is genuine browse-only help. - Unavailable string `json:"unavailable,omitempty"` - method string - params map[string]any + // DirectInBalanced covers reviewed low-impact operations that aren't reversible. + DirectInBalanced bool `json:"directInBalanced,omitempty"` + // AlwaysConfirm protects sensitive choices even in confirmation mode none. + AlwaysConfirm bool `json:"alwaysConfirm,omitempty"` + NoOp bool `json:"noOp,omitempty"` // Already active; selecting it requires no RPC. } // ParameterNames uses advertised navigation, never inferred RPC methods. The @@ -141,7 +152,7 @@ var localSessionCommandHelp = map[string]string{ "subagents": "Inspect the selected session’s linked agents and their read-only transcripts.", "ps": "List the selected session’s background terminals without stopping anything.", "statusline": "Choose fields for Codexometer’s detail footer. Saved display preferences only.", - "usage": "Open Codexometer’s usage history. Existing quota and reset views remain available.", + "usage": "View account usage or resets. Specify daily, weekly or cumulative to open a chart.", "copy": "Copy the selected session’s observed reply or activity using Codexometer’s copy control.", "theme": "Choose a Codexometer display theme. Saved local display preferences only.", "exit": "Leave this Codexometer interface. Codex sessions continue running.", @@ -183,10 +194,16 @@ var ErrSessionCommand = errors.New("command unavailable or session/options chang // Shared acknowledgements describe the native operation, not inferred execution // of an approved action. Keep terminal and browser wording aligned. -func SessionCommandSuccess(path string, speed bool) string { +func SessionCommandSuccess(path string, speed, disarmed bool) string { if path == ScheduleGoalResumePath { return "GOAL RESUME SCHEDULED" } + if isGoalPause(path) { + if disarmed { + return "Goal paused. Scheduled resume cancelled." + } + return "Goal paused." + } family, _, _ := strings.Cut(path, "/") switch family { case "model": @@ -199,6 +216,11 @@ func SessionCommandSuccess(path string, speed bool) string { return "Goal updated." case "approve": return "Approval recorded for one retry. The retry still goes through Auto-review." + case "plan": + if strings.HasPrefix(path, "plan/send/") { + return "Plan-mode prompt sent." + } + return "Plan mode set for this session." } if speed { return "Session speed changed. Applies to subsequent turns." diff --git a/internal/codex/session_commands_unix.go b/internal/codex/session_commands_unix.go index 45156d0..717c03a 100644 --- a/internal/codex/session_commands_unix.go +++ b/internal/codex/session_commands_unix.go @@ -181,6 +181,12 @@ func (p *daemonStatusProvider) sessionCommands(ctx context.Context, id, path str if directory, ok := strings.CutPrefix(path, "cd "); ok { path = "cd/" + url.PathEscape(strings.TrimSpace(directory)) } + if prompt, ok := strings.CutPrefix(path, "plan "); ok { + path = "plan/send/" + url.PathEscape(prompt) + } + if args, ok := strings.CutPrefix(path, "model "); ok { + path = "model/apply/" + url.PathEscape(args) + } if !ValidSessionCommandPath(path) { return SessionCommandMenu{}, ErrSessionCommand } @@ -233,9 +239,17 @@ func normalizeCommandMenu(menu SessionCommandMenu) SessionCommandMenu { } o.Label, o.Help = commandLabel(o.Label), helpText(o.Help) o.Unavailable = commandText(o.Unavailable) - o.ID = commandDigest([]any{o.Label, o.Help, o.Next, o.Unavailable, o.method, o.params}) + o.NoOp = menu.Path == "permissions" && o.Selected && o.method != "" + if o.NoOp { + o.method, o.params = "", nil + } + o.ID = commandDigest([]any{o.Label, o.Help, o.Next, o.Unavailable, o.method, o.params, o.NoOp}) o.Action = o.method != "" o.Reversible = reversibleSessionCommand(*o) + o.AlwaysConfirm = o.Action && o.params["permissions"] == ":danger-full-access" + o.DirectInBalanced = o.Action && (o.method == "turn/start" && strings.HasPrefix(menu.Path, "plan/send/") || + o.method == "thread/goal/set" && isGoalPause(menu.Path) && o.params["status"] == "paused" || + o.method == "thread/settings/update" && permissionChangeNarrows(menu.permissions, o.params)) if !seen[o.ID] { unique = append(unique, *o) seen[o.ID] = true @@ -336,6 +350,8 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, return p.permissionMenu(ctx, t, path) case "approve": return p.autoReviewMenu(t, path) + case "plan": + return p.planCommandMenu(ctx, t, path) } if parts[0] == "rename" { m.Title = "/rename" @@ -361,7 +377,7 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, }) return m, nil } - if parts[0] == "model" || parts[0] == "tier" || parts[0] == "plan" { + if parts[0] == "model" || parts[0] == "tier" { current, err := p.readQuotaSession(ctx, t.ID) if err != nil { return m, err @@ -374,10 +390,6 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, m.Choices = append(m.Choices, SessionCommandChoice{Label: label, Help: help, Unavailable: "Session state unavailable; refresh before changing model."}) return } - if !threadAcceptsFollowup(t.Status.Type) && parts[0] == "plan" { - m.Choices = append(m.Choices, SessionCommandChoice{Label: label, Help: help, Unavailable: "Waiting for idle. Refresh options when this turn finishes."}) - return - } m.Choices = append(m.Choices, SessionCommandChoice{Label: label, Help: help, method: "thread/settings/update", params: params}) } switch parts[0] { @@ -393,6 +405,18 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, } return m, nil } + if strings.HasPrefix(path, "model/apply/") { + _, args, ok := SessionCommandInputValue(path) + if !ok { + return m, ErrSessionCommand + } + params, label, help, err := inlineModelSettings(args, current, models) + if err != nil { + return m, err + } + setting(label, help, params) + return m, nil + } if len(parts) != 2 { return m, ErrSessionCommand } @@ -441,31 +465,6 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, return m, nil } } - case "plan": - m.Help = "Choose an advertised collaboration mode for subsequent turns. Uses Codex's built-in mode instructions, not a generated prompt." - rows, err := p.commandRows(ctx, "collaborationMode/list", map[string]any{}) - if err != nil { - return m, err - } - for _, raw := range rows { - var v struct { - Name, Mode string - Model *string - Effort *string `json:"reasoning_effort"` - } - if json.Unmarshal(raw, &v) != nil || !commandSafe(v.Mode) { - continue - } - model, effort := current.Model, current.Effort - if v.Model != nil { - model = *v.Model - } - if v.Effort != nil { - effort = *v.Effort - } - setting(v.Name, v.Mode+" // "+model+" // "+effort, map[string]any{"collaborationMode": map[string]any{"mode": v.Mode, "settings": map[string]any{"model": model, "reasoning_effort": effort, "developer_instructions": nil}}}) - } - return m, nil } return m, ErrSessionCommand } @@ -579,6 +578,9 @@ func (p *daemonStatusProvider) ExecuteSessionCommand(ctx context.Context, id, pa } return p.writeVerifiedPermissions(ctx, conn, id, permission, o.params) } + if strings.HasPrefix(m.Path, "plan") { + return p.applyPlanCommand(ctx, conn, id, o) + } if m.Picker || changingModel { if m.settings == nil { return ErrSessionCommand @@ -593,9 +595,11 @@ func (p *daemonStatusProvider) ExecuteSessionCommand(ctx context.Context, id, pa if effort, ok := o.params["effort"].(string); ok { current.Effort = effort } - current.Tier = nil - if tier, ok := o.params["serviceTier"].(string); ok { - current.Tier = &tier + if speed, set := o.params["serviceTier"]; set { + current.Tier = nil + if tier, ok := speed.(string); ok { + current.Tier = &tier + } } if changingModel { // Discovery can outlive the original thread state. Active is diff --git a/internal/codex/session_finder.go b/internal/codex/session_finder.go index f255c75..eaca7a2 100644 --- a/internal/codex/session_finder.go +++ b/internal/codex/session_finder.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "github.com/google/uuid" "golang.org/x/text/cases" "golang.org/x/text/unicode/norm" ) @@ -101,9 +102,24 @@ func savedNameQuery(query string) string { return savedNameKey(strings.Join(strings.Fields(query), " ")) } +// SavedSessionLookupID recognises a complete native ID, not a short prefix +// that could be shared by several saved sessions. +func SavedSessionLookupID(query string) string { + query = strings.TrimSpace(query) + if len(query) == 36 { + if id, err := uuid.Parse(query); err == nil { + return id.String() + } + } + return "" +} + // SavedSessionNameFilter is deliberately narrower than the live filter. Fold // Unicode case and normalise accents without replacing an accent with ASCII. func SavedSessionNameFilter(query string) func(SavedSession) bool { + if id := SavedSessionLookupID(query); id != "" { + return func(row SavedSession) bool { return row.ID == id } + } needle := savedNameQuery(query) return func(row SavedSession) bool { return needle == "" || strings.Contains(savedNameKey(row.Name), needle) diff --git a/internal/codex/session_finder_index_unix.go b/internal/codex/session_finder_index_unix.go index d5ce923..6f4ffbe 100644 --- a/internal/codex/session_finder_index_unix.go +++ b/internal/codex/session_finder_index_unix.go @@ -155,6 +155,9 @@ func (p *daemonStatusProvider) preloadSavedIndex(i *savedMetadataIndex) { } func (p *daemonStatusProvider) searchSaved(ctx context.Context, scope, cursor, query string) (SavedPage, error) { + if id := SavedSessionLookupID(query); id != "" { + return p.searchSavedID(ctx, scope, id) + } needle := savedNameQuery(query) i := p.savedIndex(scope, needle == "" && cursor == "") if i == nil { @@ -207,3 +210,22 @@ func (p *daemonStatusProvider) searchSaved(ctx context.Context, scope, cursor, q } return page, nil } + +func (p *daemonStatusProvider) searchSavedID(ctx context.Context, scope, id string) (SavedPage, error) { + conn, generation, account, err := p.savedSessionAction(ctx, scope) + if err != nil { + return SavedPage{}, ErrSavedSessions + } + page, err := p.savedIDPage(ctx, conn, scope, id) + if err != nil { + return SavedPage{}, ErrSavedSessions + } + current, err := p.savedAccount(ctx, scope) + p.mu.Lock() + valid := p.connection == conn && p.savedScope == scope && p.commandGeneration == generation + p.mu.Unlock() + if err != nil || current != account || !valid { + return SavedPage{}, ErrSavedSessions + } + return page, nil +} diff --git a/internal/codex/session_finder_unix.go b/internal/codex/session_finder_unix.go index c2e6ad0..7c7e0cf 100644 --- a/internal/codex/session_finder_unix.go +++ b/internal/codex/session_finder_unix.go @@ -160,7 +160,12 @@ func (p *daemonStatusProvider) resumeSaved(ctx context.Context, scope, cursor, i if err != nil { return ErrSavedSessions } - if _, err := savedPageFor(ctx, p, scope, cursor, id); err != nil { + if SavedSessionLookupID(id) != "" { + page, err := p.savedIDPage(ctx, conn, scope, id) + if err != nil || len(page.Sessions) != 1 { + return ErrSavedSessions + } + } else if _, err := savedPageFor(ctx, p, scope, cursor, id); err != nil { return ErrSavedSessions } if current, err := p.savedAccount(ctx, scope); err != nil || current != account { diff --git a/internal/codex/session_finder_unix_test.go b/internal/codex/session_finder_unix_test.go index 6eff07e..cf839b3 100644 --- a/internal/codex/session_finder_unix_test.go +++ b/internal/codex/session_finder_unix_test.go @@ -12,6 +12,32 @@ import ( "time" ) +func TestInlineResumeUUIDUsesAccountScopedExactLookup(t *testing.T) { + const id = "067ab230-2e8f-4715-8eed-6de534918a78" + p, f := newQuotaDaemon(t) + f.catalogues = map[string]map[string]any{ + "initialize": {"userAgent": "codex/0.172.0 (Linux)"}, + "account/read": {"account": map[string]string{"type": "chatgpt", "email": "example@example.test"}}, + "thread/list": {"data": []any{map[string]string{"id": id, "name": "Saved"}}}, + } + ctx := t.Context() + if err := p.ensureConnected(ctx); err != nil { + t.Fatal(err) + } + p.mu.Lock() + scope := p.savedScope + p.mu.Unlock() + page, err := p.searchSaved(ctx, scope, "", id) + if err != nil || len(page.Sessions) != 1 || page.Sessions[0].ID != id || page.Next != "" { + t.Fatal(page, err) + } + f.mu.Lock() + defer f.mu.Unlock() + if len(f.savedReads) != 1 || f.savedReads[0]["currentAccountOnly"] != true || f.savedReads[0]["includedThreadIds"].([]any)[0] != id || len(f.resumeReads) != 0 { + t.Fatal("ID lookup should be exact and read-only", f.savedReads, f.resumeReads) + } +} + func TestSavedBrowserOnlyReadsBoundedAccountHistory(t *testing.T) { p, f := newQuotaDaemon(t) f.catalogues = map[string]map[string]any{ diff --git a/internal/codex/session_goal.go b/internal/codex/session_goal.go index eab62a0..b3573a4 100644 --- a/internal/codex/session_goal.go +++ b/internal/codex/session_goal.go @@ -77,12 +77,33 @@ func knownGoalStatus(status string) bool { return false } +const GoalPauseActivationPath = "goal/pause/apply" + +func isGoalPause(path string) bool { return path == "goal/pause" || path == GoalPauseActivationPath } + // Input command paths have an explicit allowlist shared by adapters and views. // The value is URL-encoded as a single segment, including any literal slashes. func SessionCommandInputValue(path string) (parent, value string, ok bool) { - if encoded, found := strings.CutPrefix(path, "permissions/apply/"); found { + if path == GoalPauseActivationPath { + return "goal", "pause", true + } + for _, family := range []string{"plan", "model", "permissions"} { + if value, found := strings.CutPrefix(path, family+" "); found { + return family, value, true + } + } + if path == "plan/activate" { + return "plan", "", true + } + if encoded, found := strings.CutPrefix(path, "plan/send/"); found { decoded, err := url.PathUnescape(encoded) - return "permissions", decoded, err == nil + return "plan", decoded, err == nil + } + for _, family := range []string{"permissions", "model"} { + if encoded, found := strings.CutPrefix(path, family+"/apply/"); found { + decoded, err := url.PathUnescape(encoded) + return family, decoded, err == nil + } } for _, prefix := range []string{"rename", "cd", "goal/set", "goal/edit", "goal/budget"} { if encoded, found := strings.CutPrefix(path, prefix+"/"); found { diff --git a/internal/codex/session_goal_commands_unix.go b/internal/codex/session_goal_commands_unix.go index eb3956f..a04be57 100644 --- a/internal/codex/session_goal_commands_unix.go +++ b/internal/codex/session_goal_commands_unix.go @@ -140,7 +140,7 @@ func (p *daemonStatusProvider) commandGoalMenu(ctx context.Context, thread comma // The local adapters intercept this reviewed action. It is never an RPC. method, label = "local/goal/resume-after-quota", "Schedule resume" detail = "Wait until this goal stops for quota (if still active), quota is available, and the session is idle. Keep Codexometer open; resuming uses quota." - case "goal/pause": + case "goal/pause", GoalPauseActivationPath: label, params["status"] = "Pause goal", "paused" detail = "Pause pursuit. The current turn continues." case "goal/resume": diff --git a/internal/codex/session_links_unix.go b/internal/codex/session_links_unix.go index a61a67f..7239e45 100644 --- a/internal/codex/session_links_unix.go +++ b/internal/codex/session_links_unix.go @@ -2,7 +2,11 @@ package codex -import "context" +import ( + "context" + + "github.com/gorilla/websocket" +) func (p *daemonStatusProvider) previewSessionLink(ctx context.Context, reader *LiveUsageReader, scope, id string) (SessionLinkPreview, error) { root, name, since := reader.sessionLinkTarget(id) @@ -13,9 +17,6 @@ func (p *daemonStatusProvider) previewSessionLink(ctx context.Context, reader *L if err != nil { return SessionLinkPreview{}, ErrSavedSessions } - p.mu.Lock() - exact := p.savedExactIDs - p.mu.Unlock() current := func() bool { p.mu.Lock() defer p.mu.Unlock() @@ -24,28 +25,8 @@ func (p *daemonStatusProvider) previewSessionLink(ctx context.Context, reader *L if !current() { return SessionLinkPreview{}, ErrSavedSessions } - var page SavedPage - if exact { - // The default source filter matches interactive roots only. - page, err = p.readSavedPage(ctx, conn, map[string]any{ - "includedThreadIds": []string{root}, "currentAccountOnly": true, "archived": false, - "modelProviders": []string{}, "limit": 1, "useStateDbOnly": true, - }) - } else { - // Codex 0.170 has account scoping, but silently ignores includedThreadIds. - page, err = savedPageFor(ctx, p, scope, "", root) - } - if err != nil || exact && len(page.Sessions) != 1 || !current() { - return SessionLinkPreview{}, ErrSavedSessions - } - var row SavedSession - for _, candidate := range page.Sessions { - if candidate.ID == root { - row = candidate - break - } - } - if row.ID == "" { + page, err := p.savedIDPage(ctx, conn, scope, root) + if err != nil || len(page.Sessions) != 1 || !current() { return SessionLinkPreview{}, ErrSavedSessions } turns, unverified, err := p.readSessionHistoryOn(ctx, conn, generation, id, since) @@ -59,9 +40,39 @@ func (p *daemonStatusProvider) previewSessionLink(ctx context.Context, reader *L return SessionLinkPreview{}, ErrSavedSessions } reader.protectSessionHistory(id, turns) - preview := SessionLinkPreview{Root: row, Turns: savedTurns(turns), UnverifiedTurns: unverified} + preview := SessionLinkPreview{Root: page.Sessions[0], Turns: savedTurns(turns), UnverifiedTurns: unverified} if root != id { preview.Agent = &SessionAgent{ID: id, Name: name} } return preview, nil } + +func (p *daemonStatusProvider) savedIDPage(ctx context.Context, conn *websocket.Conn, scope, id string) (SavedPage, error) { + p.mu.Lock() + exact := p.savedExactIDs + p.mu.Unlock() + var page SavedPage + var err error + if exact { + // The default source filter matches interactive roots only. + page, err = p.readSavedPage(ctx, conn, map[string]any{ + "includedThreadIds": []string{id}, "currentAccountOnly": true, "archived": false, + "modelProviders": []string{}, "limit": 1, "useStateDbOnly": true, + }) + } else { + // Codex 0.170 has account scoping, but silently ignores includedThreadIds. + page, err = savedPageFor(ctx, p, scope, "", id) + } + if err != nil || exact && len(page.Sessions) > 1 { + return SavedPage{}, ErrSavedSessions + } + for _, row := range page.Sessions { + if row.ID == id { + return SavedPage{Sessions: []SavedSession{row}}, nil + } + } + if len(page.Sessions) != 0 { + return SavedPage{}, ErrSavedSessions + } + return SavedPage{}, nil +} diff --git a/internal/codex/session_model_command_unix.go b/internal/codex/session_model_command_unix.go new file mode 100644 index 0000000..be1cfde --- /dev/null +++ b/internal/codex/session_model_command_unix.go @@ -0,0 +1,105 @@ +//go:build unix + +package codex + +import ( + "fmt" + "strings" + + "github.com/google/shlex" +) + +func parseInlineModelArgs(input string) (model string, flags map[string]string, err error) { + words, err := shlex.Split(input) + if err != nil || len(words) == 0 || !commandSafe(input) { + return "", nil, ErrSessionCommand + } + flags = make(map[string]string, 2) + for i := 0; i < len(words); i++ { + word := words[i] + if !strings.HasPrefix(word, "-") { + if model != "" || word == "" { + return "", nil, ErrSessionCommand + } + model = word + continue + } + key, value, inline := strings.Cut(word, "=") + if !inline && i+1 < len(words) { + i++ + value = words[i] + } + if (key != "--reasoning" && key != "--speed") || flags[key] != "" || value == "" || strings.HasPrefix(value, "-") { + return "", nil, ErrSessionCommand + } + flags[key] = value + } + return model, flags, nil +} + +func inlineModelSettings(args string, current QuotaSession, models []commandModel) (map[string]any, string, string, error) { + name, flags, err := parseInlineModelArgs(args) + if err != nil { + return nil, "", "", err + } + model := name + if model == "" { + model = current.Model + } + for _, candidate := range models { + if candidate.Model != model { + continue + } + effort := flags["--reasoning"] + if effort == "" && name == "" { + effort = current.Effort + } + if effort == "" { + effort = candidate.DefaultReasoningEffort + } + if !inlineReasoningAvailable(candidate, effort) { + return nil, "", "", fmt.Errorf("requested reasoning is unavailable for this model: %w", ErrSessionCommand) + } + params := map[string]any{"model": candidate.Model, "effort": effort} + speed := "Unchanged" + if requested := flags["--speed"]; requested != "" { + tier, ok := inlineModelTier(candidate, requested) + if !ok { + return nil, "", "", fmt.Errorf("requested speed is unavailable for this model: %w", ErrSessionCommand) + } + params["serviceTier"], speed = tier, requested + } else if current.Model != candidate.Model { + params["serviceTier"], speed = nil, "Server default" + } + help := fmt.Sprintf("Model: %s\nReasoning: %s\nSpeed: %s", candidate.Model, effort, speed) + return params, "Apply model settings", help, nil + } + return nil, "", "", fmt.Errorf("requested model is unavailable: %w", ErrSessionCommand) +} + +func inlineReasoningAvailable(model commandModel, effort string) bool { + if !commandSafe(effort) { + return false + } + if len(model.SupportedReasoningEfforts) == 0 { + return effort == model.DefaultReasoningEffort + } + for _, option := range model.SupportedReasoningEfforts { + if effort == option.ReasoningEffort { + return true + } + } + return false +} + +func inlineModelTier(model commandModel, requested string) (string, bool) { + if requested == "standard" { + return "default", true // Explicit Standard uses the native request sentinel. + } + for _, tier := range model.ServiceTiers { + if commandSafe(tier.ID) && (tier.ID == requested || strings.EqualFold(tier.Name, requested)) { + return tier.ID, true + } + } + return "", false +} diff --git a/internal/codex/session_model_command_unix_test.go b/internal/codex/session_model_command_unix_test.go new file mode 100644 index 0000000..502e4cf --- /dev/null +++ b/internal/codex/session_model_command_unix_test.go @@ -0,0 +1,55 @@ +//go:build unix + +package codex + +import ( + "errors" + "testing" +) + +func TestInlineModelCommandUsesAdvertisedSettings(t *testing.T) { + p, f := newQuotaDaemon(t) + f.commandStatus = "active" + ctx := t.Context() + menu, err := p.SessionCommands(ctx, "one", `model "small" --reasoning=medium --speed Fast`) + if err != nil || len(menu.Choices) != 1 || !menu.Choices[0].Reversible { + t.Fatal(menu, err) + } + if err := p.ExecuteSessionCommand(ctx, "one", menu.Path, menu.Revision, menu.Choices[0].ID); err != nil { + t.Fatal(err) + } + f.mu.Lock() + if len(f.writes) != 1 || f.writes[0]["model"] != "small" || f.writes[0]["effort"] != "medium" || f.writes[0]["serviceTier"] != "flex" { + t.Error(f.writes) + } + f.mu.Unlock() + for _, input := range []string{"small --reasoning xhigh", "small --speed bogus", "small --speed fast --speed flex", "unknown --reasoning medium", "small --reasoning", "small --effort=medium"} { + if m, err := p.SessionCommands(ctx, "one", "model "+input); err == nil { + t.Errorf("invalid model arguments accepted: %q (%+v)", input, m) + } + } + menu, err = p.SessionCommands(ctx, "one", "model --speed=flex") + if err != nil || len(menu.Choices) != 1 || menu.Choices[0].params["serviceTier"] != "flex" { + t.Fatal(menu, err) + } + menu, err = p.SessionCommands(ctx, "one", "model --speed=standard") + if err != nil || len(menu.Choices) != 1 || menu.Choices[0].params["serviceTier"] != "default" || menu.Choices[0].params["effort"] != "medium" { + t.Fatal(menu, err) + } +} + +func TestInlineModelCommandRejectsUnadvertisedFlex(t *testing.T) { + p, f := newQuotaDaemon(t) + f.mu.Lock() + f.providerModels = map[string]map[string]any{"": providerCatalogue("small", "medium", "priority")} + f.mu.Unlock() + ctx := t.Context() + menu, err := p.SessionCommands(ctx, "one", "model small --reasoning=medium --speed=flex") + if !errors.Is(err, ErrSessionCommand) || len(menu.Choices) != 0 { + t.Fatalf("unadvertised flex offered a model change: %+v (%v)", menu, err) + } + menu, err = p.SessionCommands(ctx, "one", "model small --reasoning=medium --speed=standard") + if err != nil || len(menu.Choices) != 1 || menu.Choices[0].params["serviceTier"] != "default" { + t.Fatalf("standard must remain available when only priority is advertised: %+v (%v)", menu, err) + } +} diff --git a/internal/codex/session_permissions_menu_unix.go b/internal/codex/session_permissions_menu_unix.go index 0a72bcb..c37945a 100644 --- a/internal/codex/session_permissions_menu_unix.go +++ b/internal/codex/session_permissions_menu_unix.go @@ -200,6 +200,51 @@ func reviewerName(reviewer string) string { return reviewer } +// Only order built-in sandboxes. Custom profiles, unknown policy, and a +// switch to an automatic reviewer must still go through explicit review. +func permissionChangeNarrows(current *sessionPermissions, params map[string]any) bool { + if current == nil || current.Profile == nil { + return false + } + for key := range params { + switch key { + case "threadId", "permissions", "approvalPolicy", "approvalsReviewer": + default: + return false + } + } + profiles := map[string]int{":read-only": 1, ":workspace": 2, ":danger-full-access": 3} + target, _ := params["permissions"].(string) + from, to := profiles[current.Profile.ID], profiles[target] + if to == 0 || to >= from { + return false + } + var policy string + if json.Unmarshal(current.Policy, &policy) != nil { + return false + } + newPolicy := policy + if value, set := params["approvalPolicy"]; set { + raw, ok := value.(json.RawMessage) + if !ok || json.Unmarshal(raw, &newPolicy) != nil { + return false + } + } + // On Request is not generally a tightening from Never: in a sandbox it + // can let a user grant access that used to be denied without prompting. + if newPolicy != policy && !(from == 3 && policy == "never" && newPolicy == "on-request") { + return false + } + if policy != "on-request" && policy != "never" { + return false + } + reviewer := current.Reviewer + if value, set := params["approvalsReviewer"]; set { + reviewer, _ = value.(string) + } + return reviewer == "user" && (current.Reviewer == "user" || current.Reviewer == "auto_review") +} + type permissionProfileOption struct { ID, Description string Allowed bool diff --git a/internal/codex/session_plan_unix.go b/internal/codex/session_plan_unix.go new file mode 100644 index 0000000..c777bb9 --- /dev/null +++ b/internal/codex/session_plan_unix.go @@ -0,0 +1,74 @@ +//go:build unix + +package codex + +import ( + "context" + "encoding/json" + "strings" + + "github.com/gorilla/websocket" +) + +func (p *daemonStatusProvider) planCommandMenu(ctx context.Context, t commandThread, path string) (SessionCommandMenu, error) { + m := SessionCommandMenu{Title: "/plan", Help: "Switch to native Plan mode. Use /plan followed by a prompt to start that turn in Plan mode."} + current, err := p.readQuotaSession(ctx, t.ID) + if err != nil { + return m, err + } + rows, err := p.commandRows(ctx, "collaborationMode/list", map[string]any{}) + if err != nil { + return m, err + } + for _, raw := range rows { + var v struct { + Mode string + Model *string + Effort *string `json:"reasoning_effort"` + } + if json.Unmarshal(raw, &v) != nil || v.Mode != "plan" { + continue + } + model, effort := current.Model, current.Effort + if v.Model != nil { + model = *v.Model + } + if v.Effort != nil { + effort = *v.Effort + } + mode := map[string]any{"mode": "plan", "settings": map[string]any{"model": model, "reasoning_effort": effort, "developer_instructions": nil}} + choice := SessionCommandChoice{Label: "Enter Plan mode", Help: model + " // " + effort, method: "thread/settings/update", params: map[string]any{"threadId": t.ID, "collaborationMode": mode}} + if path != "plan" && path != "plan/activate" { + _, prompt, ok := SessionCommandInputValue(path) + if !ok || strings.TrimSpace(prompt) == "" || !approvalTextDisplayable(prompt) { + return m, ErrSessionCommand + } + choice.Label, choice.Help, choice.method = "Send in Plan mode", SanitizeApprovalText(prompt), "turn/start" + choice.params["input"] = []map[string]string{{"type": "text", "text": prompt}} + } + if !threadAcceptsFollowup(t.Status.Type) || parseSessionRuntimeStatus(t.Status.Type, t.Status.ActiveFlags) == sessionRuntimeApproval { + choice.method, choice.params, choice.Unavailable = "", nil, "Waiting for idle. Refresh options when this turn finishes." + } + m.Revision = commandDigest([]any{current, mode}) + m.Choices = []SessionCommandChoice{choice} + break + } + return m, nil +} + +func (p *daemonStatusProvider) applyPlanCommand(ctx context.Context, conn *websocket.Conn, id string, choice SessionCommandChoice) error { + t, err := p.commandThread(ctx, id) + if err != nil || !threadAcceptsFollowup(t.Status.Type) || len(t.Status.ActiveFlags) != 0 { + return ErrSessionCommand + } + var result struct{ Turn struct{ ID string } } + if err := p.requestOnChecked(ctx, conn, choice.method, choice.params, &result, nil, func() bool { + return !p.commandHumanWaitLocked(id) && p.statuses[id] != sessionRuntimeWorking + }); err != nil { + return err + } + if choice.method == "turn/start" && result.Turn.ID == "" { + return ErrSessionCommand + } + return nil +} diff --git a/internal/codex/session_plan_unix_test.go b/internal/codex/session_plan_unix_test.go new file mode 100644 index 0000000..155acbb --- /dev/null +++ b/internal/codex/session_plan_unix_test.go @@ -0,0 +1,42 @@ +//go:build unix + +package codex + +import "testing" + +func TestPlanCommandUsesOnlyNativePlanAndSendsAtomically(t *testing.T) { + p, f := newQuotaDaemon(t) + f.catalogues = map[string]map[string]any{ + "collaborationMode/list": {"data": []any{ + map[string]any{"name": "Default", "mode": "default"}, + map[string]any{"name": "Plan", "mode": "plan", "reasoning_effort": "high"}, + }}, + "turn/start": {"turn": map[string]string{"id": "new-turn"}}, + } + ctx := t.Context() + menu, err := p.SessionCommands(ctx, "one", "plan/activate") + if err != nil || len(menu.Choices) != 1 || !menu.Choices[0].Reversible || menu.Choices[0].Label != "Enter Plan mode" { + t.Fatal(menu, err) + } + if err = p.ExecuteSessionCommand(ctx, "one", menu.Path, menu.Revision, menu.Choices[0].ID); err != nil { + t.Fatal(err) + } + const prompt = "Plan a change in /tmp\n\tKeep the test coverage." + menu, err = p.SessionCommands(ctx, "one", "plan "+prompt) + if err != nil || len(menu.Choices) != 1 || !menu.Choices[0].Action || menu.Choices[0].Reversible || !menu.Choices[0].DirectInBalanced { + t.Fatal(menu, err) + } + if err = p.ExecuteSessionCommand(ctx, "one", menu.Path, menu.Revision, menu.Choices[0].ID); err != nil { + t.Fatal(err) + } + f.mu.Lock() + defer f.mu.Unlock() + if len(f.writes) != 1 || len(f.turnStarts) != 1 { + t.Fatal("expected one bare mode update and one self-contained turn", f.writes, f.turnStarts) + } + mode := f.turnStarts[0]["collaborationMode"].(map[string]any) + input := f.turnStarts[0]["input"].([]any)[0].(map[string]any) + if mode["mode"] != "plan" || mode["settings"].(map[string]any)["reasoning_effort"] != "high" || input["text"] != prompt { + t.Fatal(f.turnStarts) + } +} diff --git a/internal/schedule/goal_resume.go b/internal/schedule/goal_resume.go index 6f467a8..738a348 100644 --- a/internal/schedule/goal_resume.go +++ b/internal/schedule/goal_resume.go @@ -55,15 +55,11 @@ func (q *Queue) PendingGoalResumeID(session string) string { // DisarmGoalResume cancels only the still-pending job seen before a manual // mutation. It cannot recall an in-flight write or erase its uncertain result. -func (q *Queue) DisarmGoalResume(id string) { - if id != "" { - q.disarmGoal(id) - } -} +func (q *Queue) DisarmGoalResume(id string) bool { return id != "" && q.updateGoal(id, time.Time{}) } func (q *Queue) disarmGoal(id string) { q.updateGoal(id, time.Time{}) } -func (q *Queue) updateGoal(id string, stopped time.Time) { +func (q *Queue) updateGoal(id string, stopped time.Time) bool { q.mu.Lock() defer q.mu.Unlock() for i, j := range q.jobs { @@ -72,12 +68,14 @@ func (q *Queue) updateGoal(id string, stopped time.Time) { } if stopped.IsZero() { q.jobs = append(q.jobs[:i], q.jobs[i+1:]...) + return true } else if j.WaitingForGoalStop { q.jobs[i].WaitingForGoalStop = false q.jobs[i].stopObserved = stopped } break } + return false } func (q *Queue) claimGoalRead(id string, now time.Time) bool { diff --git a/internal/ui/monitor_auto_review_test.go b/internal/ui/monitor_auto_review_test.go index 572ee46..e4d5485 100644 --- a/internal/ui/monitor_auto_review_test.go +++ b/internal/ui/monitor_auto_review_test.go @@ -191,3 +191,18 @@ func TestInlinePermissionsQuotedProfileUsesNativeParser(t *testing.T) { } } } + +func TestFullAccessAlwaysRequiresExplicitConfirmation(t *testing.T) { + m, _ := commandTestModel(t) + m.confirmations.Mode = confirmation.None + m.monitorCommands.menu.Path = "permissions" + m.monitorCommands.menu.Choices = []codex.SessionCommandChoice{{Label: "Full Access", Action: true, AlwaysConfirm: true, Selected: true}} + row := m.monitorCommandRows(80, 12)[0] + if !strings.Contains(row.text, "CURRENT") { + t.Fatal("current preset missing", row) + } + next, cmd, _ := m.chooseMonitorCommand() + if cmd != nil || !next.monitorCommands.detail { + t.Fatal("Full Access skipped its required confirmation") + } +} diff --git a/internal/ui/monitor_commands.go b/internal/ui/monitor_commands.go index 517c7cf..8d2c75e 100644 --- a/internal/ui/monitor_commands.go +++ b/internal/ui/monitor_commands.go @@ -43,12 +43,13 @@ type monitorCommandsState struct { escapeUntil time.Time } type monitorCommandsResult struct { - session string - path string - request uint64 - menu codex.SessionCommandMenu - applied bool - err error + session string + path string + request uint64 + menu codex.SessionCommandMenu + applied bool + disarmed bool + err error } func (m *Model) loadMonitorCommands(path string, fresh ...bool) tea.Cmd { @@ -206,6 +207,12 @@ func (m Model) openMonitorCommands(path string, draft ...string) (Model, tea.Cmd if path == "commands" { path = "" } + if path == "plan" && len(draft) == 0 { + path = "plan/activate" + } + if strings.EqualFold(path, "goal pause") && len(draft) == 0 { + path = codex.GoalPauseActivationPath + } if updated, cmd, local := m.runLocalMonitorCommand(path); local { return updated, cmd, true } @@ -265,16 +272,31 @@ func (m Model) commandChoice() (codex.SessionCommandChoice, bool) { return p.menu.Choices[p.selected], true } +func (m Model) commandNeedsConfirmation(o codex.SessionCommandChoice) bool { + return o.AlwaysConfirm || m.confirmations.Required(confirmation.Command(o.Reversible || o.DirectInBalanced)) +} + func (m Model) chooseMonitorCommand() (Model, tea.Cmd, bool) { o, ok := m.commandChoice() if !ok || m.monitorCommands.busy || o.Unavailable != "" || m.monitorCommands.notice != "" { return m, nil, true } + if o.NoOp { + cmd := m.finishLocalMonitorCommand() + m.monitorPrompt.notice = "Permission preset already active." + return m, cmd, true + } if o.Next != "" { if updated, cmd, local := m.runLocalMonitorCommand(o.Next); local { return updated, cmd, true } - cmd := m.navigateMonitorCommands(o.Next) + path := o.Next + if path == "plan" { + path = "plan/activate" + } else if path == "goal/pause" { + path = codex.GoalPauseActivationPath + } + cmd := m.navigateMonitorCommands(path) return m, cmd, true } if o.Action && strings.HasPrefix(m.monitorCommands.menu.Path, "approve/") { @@ -287,7 +309,7 @@ func (m Model) chooseMonitorCommand() (Model, tea.Cmd, bool) { m.monitorCommands.until = time.Now().Add(30 * time.Second) return m, nil, true } - if o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + if o.Action && !m.commandNeedsConfirmation(o) { return m.executeMonitorCommand(o) } if m.monitorCommands.menu.Picker { @@ -369,6 +391,7 @@ func (m Model) executeMonitorCommand(o codex.SessionCommandChoice) (Model, tea.C ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second) defer cancel() var err error + disarmed := false if path == codex.ScheduleGoalResumePath { err = codex.ErrSessionCommand if goals != nil && m.err == nil { @@ -381,10 +404,10 @@ func (m Model) executeMonitorCommand(o codex.SessionCommandChoice) (Model, tea.C } err = c.ExecuteSessionCommand(ctx, id, path, rev, o.ID) if err == nil && disarm != "" { - q.DisarmGoalResume(disarm) + disarmed = q.DisarmGoalResume(disarm) } } - return monitorCommandsResult{session: id, path: path, request: seq, applied: true, err: err} + return monitorCommandsResult{session: id, path: path, request: seq, applied: true, disarmed: disarmed, err: err} }, true } @@ -514,7 +537,7 @@ func (m Model) monitorCommandRows(width, height int) []commandDisplayRow { for _, i := range indices[start:min(start+max(choiceCapacity, 0), len(indices))] { o := p.menu.Choices[i] label := o.Label - if (p.menu.Picker || p.menu.Path == "theme") && o.Selected { + if (p.menu.Picker || p.menu.Path == "theme" || p.menu.Path == "permissions") && o.Selected { label += " // CURRENT" } if p.menu.Multiple { @@ -531,7 +554,7 @@ func (m Model) monitorCommandRows(width, height int) []commandDisplayRow { } else { label += " // " + i18n.Text("UNAVAILABLE") } - } else if !o.Action && o.Next == "" { + } else if !o.Action && o.Next == "" && !o.NoOp { label += " // HELP" } rows = append(rows, commandDisplayRow{text: ansi.Truncate(label, w, "…"), help: o.Help, choice: i, action: "choose"}) @@ -586,7 +609,7 @@ func (m Model) commandFooter(width int) []commandDisplayRow { } buttons = append(buttons, commandDisplayRow{text: i18n.Text(label), action: "confirm"}) } else if o, ok := m.commandChoice(); ok && o.Action && !p.busy && p.notice == "" { - if !m.confirmations.Required(confirmation.Command(o.Reversible)) { + if !m.commandNeedsConfirmation(o) { action := "stage" label := "[ ENTER APPLY ]" if strings.HasPrefix(p.menu.Path, "approve/") { @@ -610,7 +633,7 @@ func (m Model) commandFooter(width int) []commandDisplayRow { label = i18n.Text("[ ENTER APPLY ]") } buttons = append(buttons, commandDisplayRow{text: label, action: "stage"}) - } else { + } else if !o.NoOp { buttons = append(buttons, commandDisplayRow{text: i18n.Text("[ ENTER HELP ]"), action: "stage"}) } } @@ -755,7 +778,7 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { } cmd := m.focusMonitorPrompt() m.monitorPrompt.session = r.session - m.monitorPrompt.notice = codex.SessionCommandSuccess(r.path, speed) + m.monitorPrompt.notice = codex.SessionCommandSuccess(r.path, speed, r.disarmed) return m, cmd, true } else { if p.inline && r.menu.Picker { @@ -818,7 +841,7 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { return m, cmd, true } if commandInputReview(p.menu.Path) && len(p.menu.Choices) == 1 { - if o := p.menu.Choices[0]; o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + if o := p.menu.Choices[0]; o.Action && !m.commandNeedsConfirmation(o) { return m.executeMonitorCommand(o) } p.detail = true @@ -999,7 +1022,7 @@ func (m Model) updateMonitorCommands(msg tea.Msg) (Model, tea.Cmd, bool) { p.reviewedChoice = "" } p.selected = p.hover - if o, ok := m.commandChoice(); ok && o.Action && !m.confirmations.Required(confirmation.Command(o.Reversible)) { + if o, ok := m.commandChoice(); ok && o.Action && !m.commandNeedsConfirmation(o) { return m.chooseMonitorCommand() } return m, nil, true diff --git a/internal/ui/monitor_commands_inline.go b/internal/ui/monitor_commands_inline.go index 8e2cd18..cc65685 100644 --- a/internal/ui/monitor_commands_inline.go +++ b/internal/ui/monitor_commands_inline.go @@ -1,6 +1,7 @@ package ui import ( + "net/url" "strings" "time" "unicode" @@ -13,6 +14,11 @@ func (m Model) inlineCommandPrefix(path string) string { if path == "goal/set" { return "/goal " } + if slug, ok := strings.CutPrefix(path, "model/"); ok && !strings.Contains(slug, "/") { + if model, err := url.PathUnescape(slug); err == nil { + return "/model " + model + " " + } + } if strings.HasPrefix(path, "tier/") { if m.monitorCommands.menu.Path == path && m.monitorCommands.menu.Picker { return m.monitorCommands.menu.Title + " " @@ -43,7 +49,7 @@ func (m *Model) openInlineCommandLevel(path, argument, parentDraft string) tea.C // Only these local commands have browsable TUI submenus. Other local // paths (including theme/) are actions and require Enter or a click. root, _, _ := strings.Cut(path, "/") - if codex.IsLocalSessionCommand(root) && path != "theme" && path != "statusline" { + if codex.IsLocalSessionCommand(root) && path != "theme" && path != "statusline" && path != "usage" { return nil } p := &m.monitorCommands @@ -191,6 +197,15 @@ func (m Model) updateInlineCommands(msg tea.Msg) (Model, tea.Cmd, bool) { return m.openMonitorCommands("permissions " + m.commandQuery()) } } + if p.menu.Path == "plan" && !p.detail && m.commandQuery() != "" { + return m.openMonitorCommands("plan " + m.commandQuery()) + } + if p.menu.Path == "usage" && m.commandQuery() != "" { + return m.runLocalMonitorCommand("usage " + m.commandQuery()) + } + if !p.detail && strings.Contains(m.commandQuery(), "--") && (p.menu.Path == "model" || strings.HasPrefix(p.menu.Path, "model/")) { + return m.openMonitorCommands(m.monitorPrompt.input.Value()) + } if p.menu.Path == "goal" && !p.detail && m.commandQuery() != "" { if choice, ok := m.commandChoice(); ok { for _, name := range choice.ParameterNames() { diff --git a/internal/ui/monitor_commands_inline_test.go b/internal/ui/monitor_commands_inline_test.go index f89ea0c..96d3e15 100644 --- a/internal/ui/monitor_commands_inline_test.go +++ b/internal/ui/monitor_commands_inline_test.go @@ -96,7 +96,7 @@ func TestTypingSpaceOpensParameterMenuWithoutEnter(t *testing.T) { } func TestInlineSpaceDoesNotExecuteLocalActions(t *testing.T) { - for _, path := range []string{"quit", "exit", "copy", "usage"} { + for _, path := range []string{"quit", "exit", "copy"} { t.Run(path, func(t *testing.T) { m, _ := suggestionTestModel(t) m.monitorSessionData[0].preview.Text = "Reply to copy" diff --git a/internal/ui/monitor_commands_test.go b/internal/ui/monitor_commands_test.go index 344b39e..ff7e093 100644 --- a/internal/ui/monitor_commands_test.go +++ b/internal/ui/monitor_commands_test.go @@ -19,6 +19,7 @@ import ( "github.com/merefield/codexometer/internal/codex" "github.com/merefield/codexometer/internal/confirmation" "github.com/merefield/codexometer/internal/i18n" + "github.com/merefield/codexometer/internal/schedule" ) type commandTestClient struct { @@ -73,6 +74,41 @@ func TestMonitorCommandsApplyReversibleChoicesWithoutExtraConfirmation(t *testin } } +func TestGoalPauseCancelsPendingResumeAndReportsIt(t *testing.T) { + m, f := commandTestModel(t) + m.SetConfirmationMode(confirmation.Balanced) + m.monitorCommands.menu.Path = codex.GoalPauseActivationPath + m.monitorCommands.menu.Choices[0].DirectInBalanced = true + m.monitorPrompt.input.SetValue("/goal pause") + now := time.Now() + duration := int64(60) + m.snapshot = codex.Snapshot{AccountFingerprint: "account", FetchedAt: now, RateLimits: codex.RateLimitSnapshot{Primary: &codex.Window{UsedPercent: 10, WindowDurationMins: &duration}}} + m.scheduleUI.queue = schedule.New() + if err := m.scheduleUI.queue.ArmGoalResume(t.Context(), compactGoalFixture{}, m.snapshot, now, "root-one", "revision", "choice"); err != nil { + t.Fatal(err) + } + m, cmd, _ := m.chooseMonitorCommand() + if cmd == nil { + t.Fatal("Balanced mode must submit pause immediately") + } + m, _, _ = m.updateMonitorCommands(cmd()) + if f.calls != 1 || m.scheduleUI.queue.HasPendingGoalResume() || m.monitorPrompt.notice != "Goal paused. Scheduled resume cancelled." { + t.Fatal("pause did not report a real cancellation", m.monitorPrompt.notice, f.calls) + } +} + +func TestActivePermissionPresetClosesWithoutConfirmingOrWriting(t *testing.T) { + m, f := commandTestModel(t) + m.SetConfirmationMode(confirmation.Require) + m.monitorCommands.menu.Path = "permissions" + m.monitorCommands.menu.Choices[0] = codex.SessionCommandChoice{Label: "Ask for approval", NoOp: true, Selected: true} + m.monitorPrompt.input.SetValue("/permissions") + m, _, _ = m.chooseMonitorCommand() + if m.monitorCommands.open || f.calls != 0 || m.monitorPrompt.notice != "Permission preset already active." { + t.Fatal("selecting the active preset was not a no-op") + } +} + func TestConfirmationNoneDoesNotApplyUnavailableOrHiddenCommands(t *testing.T) { for _, blocked := range []string{"unavailable", "tiny", "busy", "notice", "closed"} { m, f := commandTestModel(t) diff --git a/internal/ui/monitor_local_commands.go b/internal/ui/monitor_local_commands.go index f94e512..a1888e7 100644 --- a/internal/ui/monitor_local_commands.go +++ b/internal/ui/monitor_local_commands.go @@ -31,6 +31,15 @@ func (m Model) localCommandsMenu() codex.SessionCommandMenu { func (m Model) localMonitorMenu(path string) (codex.SessionCommandMenu, bool) { switch path { + case "usage": + menu := codex.SessionCommandMenu{Title: "/usage", Path: "usage", Help: "Account usage and resets. Use /usage daily, weekly or cumulative to jump to a chart.", Choices: []codex.SessionCommandChoice{ + {ID: "usage-analytics", Label: "View analytics", Help: "Open account usage history.", Next: "usage/daily"}, + {ID: "usage-reset", Label: "Redeem reset", Help: "Open the reset view. Nothing is redeemed without confirmation.", Next: "usage/reset"}, + }} + if credits := m.snapshot.RateLimitResetCredits; credits != nil && credits.AvailableCount <= 0 { + menu.Choices[1].Unavailable = "No resets available." + } + return menu, true case "statusline": return m.statusLineMenu(), true case "theme": @@ -63,6 +72,20 @@ func (m *Model) finishLocalMonitorCommand() tea.Cmd { } func (m Model) runLocalMonitorCommand(path string) (Model, tea.Cmd, bool) { + if idOrName, ok := strings.CutPrefix(path, "resume "); ok { + m.finishLocalMonitorCommand() + cmd := m.openResumePicker(idOrName) + return m, cmd, true + } + if view, ok := strings.CutPrefix(path, "usage "); ok { + switch strings.ToLower(strings.TrimSpace(view)) { + case "daily", "weekly", "cumulative": + path = "usage/" + strings.ToLower(strings.TrimSpace(view)) + default: + m.monitorPrompt.notice = "Usage: /usage [daily|weekly|cumulative]" + return m, nil, true + } + } switch path { case "subagents", "ps": id := m.monitorContextTarget() @@ -76,9 +99,15 @@ func (m Model) runLocalMonitorCommand(path string) (Model, tea.Cmd, bool) { m.finishLocalMonitorCommand() cmd := m.openResumePicker() return m, cmd, true - case "usage": + case "usage/daily", "usage/weekly", "usage/cumulative", "usage/reset": m.finishLocalMonitorCommand() - updated, cmd := m.pressViewTab(viewUsage) + view := viewUsage + if path == "usage/reset" { + view = viewResets + } else { + m.activateHistory(map[string]int{"usage/daily": 0, "usage/weekly": 1, "usage/cumulative": 2}[path]) + } + updated, cmd := m.pressViewTab(view) return updated.(Model), cmd, true case "copy": id := m.monitorContextTarget() diff --git a/internal/ui/monitor_local_commands_test.go b/internal/ui/monitor_local_commands_test.go index 1c25c58..c4d1851 100644 --- a/internal/ui/monitor_local_commands_test.go +++ b/internal/ui/monitor_local_commands_test.go @@ -57,15 +57,15 @@ func TestLocalSlashCatalogueWithoutDaemon(t *testing.T) { } func TestLocalSlashUsageConsumesCommandAndPreservesOrdinaryDraft(t *testing.T) { - for _, draft := range []string{"/usage", "keep ordinary draft"} { + for _, draft := range []string{"/usage weekly", "keep ordinary draft"} { m := localCommandModel() m.monitorPrompt.input.SetValue(draft) - m, cmd, _ := m.openMonitorCommands("/usage") - if m.meterView != viewUsage || m.monitorCommands.open || cmd == nil { + m, cmd, _ := m.openMonitorCommands("/usage weekly") + if m.meterView != viewUsage || m.history.mode != 1 || m.monitorCommands.open || cmd == nil { t.Fatal("usage did not use the existing view") } expected := draft - if draft == "/usage" { + if draft == "/usage weekly" { expected = "" } if m.monitorDrafts["root-one"] != expected { @@ -74,6 +74,21 @@ func TestLocalSlashUsageConsumesCommandAndPreservesOrdinaryDraft(t *testing.T) { } } +func TestBareUsageShowsAnalyticsAndGuardedResetNavigation(t *testing.T) { + m := localCommandModel() + m.monitorPrompt.input.SetValue("/usage") + m, _, _ = m.openMonitorCommands("/usage") + choices := m.monitorCommands.menu.Choices + if m.meterView != viewMonitor || len(choices) != 2 || choices[0].Label != "View analytics" || choices[1].Label != "Redeem reset" { + t.Fatal("expected the native two-option usage menu", choices) + } + m.monitorCommands.selected = 1 + next, _, _ := m.chooseMonitorCommand() + if next.meterView != viewResets || next.resetBusy || !next.resetConfirmUntil.IsZero() { + t.Fatal("reset navigation must not redeem or pre-authorise a reset") + } +} + func commandCopiesText(cmd tea.Cmd, text string) bool { if cmd == nil { return false diff --git a/internal/ui/monitor_suggestions.go b/internal/ui/monitor_suggestions.go index 5df5708..4b019d9 100644 --- a/internal/ui/monitor_suggestions.go +++ b/internal/ui/monitor_suggestions.go @@ -186,6 +186,13 @@ func (m Model) updateMonitorSuggestions(msg tea.Msg) (Model, tea.Cmd, bool) { s.selected = 0 return m, nil, true } + name, argument, _ := codex.SplitSessionCommand(m.monitorPrompt.input.Value()) + if name == "goal" && strings.EqualFold(strings.TrimSpace(argument), "pause") { + return m.openMonitorCommands(codex.GoalPauseActivationPath) + } + if (name == "plan" || name == "usage" || name == "resume") && strings.TrimSpace(argument) != "" || name == "model" && strings.Contains(argument, "--") { + return m.openMonitorCommands(name + " " + argument) + } return m.openMonitorCommands(o.Next) } } diff --git a/internal/ui/session_finder.go b/internal/ui/session_finder.go index 87f4b6c..d67cb9a 100644 --- a/internal/ui/session_finder.go +++ b/internal/ui/session_finder.go @@ -33,6 +33,7 @@ type sessionFinder struct { filterOpen bool scope, next, detail string resumeID string + lookupID string // One explicit /resume submission. selected string resumeNotice string epoch uint64 @@ -79,7 +80,7 @@ func (f *sessionFinder) clearHistory() { f.include, f.loading, f.failed = false, false, false f.detail, f.next = "", "" f.rows, f.turns = nil, nil - f.resumeID = "" + f.resumeID, f.lookupID = "", "" f.selected, f.resumeNotice = "", "" f.index, f.scroll = 0, 0 } @@ -108,8 +109,13 @@ func (m *Model) focusFinder() tea.Cmd { return f.editInput().Focus() } -func (m *Model) openResumePicker() tea.Cmd { - return tea.Batch(m.beginResumePicker(), m.requestSaved("", "")) +func (m *Model) openResumePicker(arguments ...string) tea.Cmd { + focus := m.beginResumePicker() + if len(arguments) != 0 { + m.finder.editInput().SetValue(strings.TrimSpace(arguments[0])) + m.finder.lookupID = codex.SavedSessionLookupID(m.finder.query()) + } + return tea.Batch(focus, m.requestSaved("", "")) } func (m *Model) beginResumePicker() tea.Cmd { @@ -630,6 +636,20 @@ func (m Model) updateSessionFinder(message tea.Msg) (Model, tea.Cmd, bool) { return m, nil, true } f.accept(r) + if f.include && r.scope == f.scope && r.epoch == f.epoch && r.id == "" && f.lookupID != "" { + id := f.lookupID + f.lookupID = "" // Never auto-select on a retry or after editing the search. + if !f.failed && codex.SavedSessionLookupID(f.query()) == id && len(f.rows) == 1 && f.rows[0].ID == id { + for _, row := range m.monitorSessionData { + if row.id == id && m.monitorSessionVisible(row) { + m.openLiveSessionDetail(id) + return m, nil, true + } + } + cmd := m.activateSaved(true) + return m, cmd, true + } + } if f.include && f.selected == "" && r.scope == f.scope && r.epoch == f.epoch && r.id == "" { f.selectIndex(m.savedMatches(), f.index) } @@ -775,6 +795,7 @@ func (m Model) updateSessionFinder(message tea.Msg) (Model, tea.Cmd, bool) { f.input = &input if old != f.query() { if f.include { + f.lookupID = "" f.index, f.selected = 0, "" if _, cachedSearch := m.fetcher.(codex.SavedSessionSearchClient); cachedSearch { f.stopRequest() diff --git a/internal/ui/session_finder_test.go b/internal/ui/session_finder_test.go index cf65ef1..3dc1c0a 100644 --- a/internal/ui/session_finder_test.go +++ b/internal/ui/session_finder_test.go @@ -134,6 +134,28 @@ func (p *resumeFinderProbe) ResumeSavedSession(_ context.Context, scope, cursor, return nil } +func TestInlineResumePrefillsNameAndResolvesOnlyFullIDsDirectly(t *testing.T) { + const id = "067ab230-2e8f-4715-8eed-6de534918a78" + for _, query := range []string{"My saved session", id} { + m := contextTestModel() + probe := &resumeFinderProbe{} + m.fetcher = probe + m.finder.setScope("scope") + m, _, _ = m.openMonitorCommands("/resume " + query) + if !m.finder.include || m.finder.query() != query { + t.Fatal("resume did not use the submitted argument", m.finder.query()) + } + m, cmd, _ := m.updateSessionFinder(savedResult{scope: "scope", epoch: m.finder.epoch, page: codex.SavedPage{Sessions: []codex.SavedSession{{ID: id, Name: "My saved session"}}}}) + if query == id { + if cmd == nil || m.finder.resumeID != id || cmd().(savedResult).err != nil || probe.resumed != id { + t.Fatal("a verified exact ID must enter the existing resume flow") + } + } else if cmd != nil || probe.resumed != "" || len(m.savedMatches()) != 1 { + t.Fatal("a name must remain a visible picker search") + } + } +} + func TestResumePickerReturnOpensLiveDetail(t *testing.T) { m := contextTestModel() probe := &resumeFinderProbe{} diff --git a/internal/ui/session_start.go b/internal/ui/session_start.go index a1b4a80..5c1abd7 100644 --- a/internal/ui/session_start.go +++ b/internal/ui/session_start.go @@ -75,9 +75,10 @@ func (m *Model) startDraftSession() tea.Cmd { return nil } value := d.prompt.Value() + name, target, _ := codex.SplitSessionCommand(strings.TrimSpace(value)) switch { - case strings.EqualFold(strings.TrimSpace(value), "/resume"): - return m.openResumePicker() + case codex.IsSessionCommand(value) && strings.EqualFold(name, "resume"): + return m.openResumePicker(target) case strings.TrimSpace(value) == "" || codex.IsSessionCommand(value): d.notice = i18n.Text("Type a first message, or use /resume to open a saved session.") return nil diff --git a/internal/web/control_commands.go b/internal/web/control_commands.go index 3603496..de1d019 100644 --- a/internal/web/control_commands.go +++ b/internal/web/control_commands.go @@ -54,6 +54,7 @@ func (c *control) handleCommands(w http.ResponseWriter, r *http.Request, body ac c.mu.Unlock() q = p.request.Command var err error + disarmed := false if q.Path == codex.ScheduleGoalResumePath { err = codex.ErrSessionCommand if goals, ok := c.commands.(codex.ScheduledGoalClient); ok { @@ -71,15 +72,17 @@ func (c *control) handleCommands(w http.ResponseWriter, r *http.Request, body ac } err = c.commands.ExecuteSessionCommand(ctx, body.Session, q.Path, q.Revision, q.Choice) if err == nil && disarm != "" { - c.schedules.DisarmGoalResume(disarm) - c.publishSchedules() + disarmed = c.schedules.DisarmGoalResume(disarm) + if disarmed { + c.publishSchedules() + } } } if err != nil { http.Error(w, "Command unconfirmed; check Codex before retrying", 409) return } - message := codex.SessionCommandSuccess(q.Path, p.speed) + message := codex.SessionCommandSuccess(q.Path, p.speed, disarmed) _ = json.NewEncoder(w).Encode(map[string]string{"message": message}) return } diff --git a/internal/web/dist/assets/index-C6C_6ivu.js b/internal/web/dist/assets/index-C6C_6ivu.js deleted file mode 100644 index 4cfd76e..0000000 --- a/internal/web/dist/assets/index-C6C_6ivu.js +++ /dev/null @@ -1,54 +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,D=1<<20,ee=1<<25,O=1<<21,te=1<<22,ne=1<<23,k=Symbol(`$state`),A=Symbol(`component`),re=Symbol(`legacy props`),ie=Symbol(``),ae=Symbol(`attributes`),oe=Symbol(`class`),se=Symbol(`style`),ce=Symbol(`text`),j=Symbol(`form reset`),le=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ue=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),de={},fe=Symbol(`uninitialized`),pe=`http://www.w3.org/1999/xhtml`;function me(){console.warn(`https://svelte.dev/e/derived_inert`)}function he(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ge(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function _e(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function ve(e){M=e}var N;function ye(e){if(e===null)throw he(),de;return N=e}function be(){return ye(on(N))}function P(e){if(M){if(on(N)!==null)throw he(),de;N=e}}function xe(e=1){if(M){for(var t=e,n=N;t--;)n=on(n);N=n}}function Se(e=!0){for(var t=0,n=N;;){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=on(n);e&&n.remove(),n=i}}function Ce(e){if(!e||e.nodeType!==8)throw he(),de;return e.data}function we(e){return e===this.v}function Te(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ee(e){return!Te(e,this.v)}function De(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Oe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ke(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ae(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function je(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Me(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ne(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Pe(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Fe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ie(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Le(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Re(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ze=!1;function Be(){ze=!0}var Ve=null;function He(e){Ve=e}function Ue(e,t=!1,n){Ve={p:Ve,i:!1,c:null,e:null,s:e,x:null,r:Gn,l:ze&&!t?{s:null,u:null,$:[]}:null}}function We(e){var t=Ve,n=t.e;if(n!==null){t.e=null;for(var r of n)yn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ve=t.p,Ge(e)}function Ge(e={}){return i(e,A,{value:!0}),e}function Ke(){return!ze||Ve!==null&&Ve.l===null}var qe=[];function Je(){var e=qe;qe=[],m(e)}function Ye(e){if(qe.length===0&&!Ct){var t=qe;queueMicrotask(()=>{t===qe&&Je()})}qe.push(e)}function Xe(){for(;qe.length>0;)Je()}var Ze=~(y|b|v);function Qe(e,t){e.f=e.f&Ze|t}function $e(e){e.f&512||e.deps===null?Qe(e,v):Qe(e,b)}function et(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Qe(e,v)}function tt(e){M&&an(e)!==null&&sn(e)}var nt=!1;function rt(){nt||(nt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[j]?.()})},{capture:!0}))}function it(e){var t=Hn,n=Gn;Wn(null),Kn(null);try{return e()}finally{Wn(t),Kn(n)}}function at(e,t,n,r=n){e.addEventListener(t,()=>it(n));let i=e[j];e[j]=i?()=>{i(),r(!0)}:()=>r(!0),rt()}function ot(e,t,n,r){let i=Ke()?ut:pt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=Gn,c=st(),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){fn(e,s)}ct()}}var d=lt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>ft(e))).then(u).catch(e=>fn(e,s)).finally(d)}l?l.then(()=>{c(),f(),ct()}):f()}function st(){var e=Gn,t=Hn,n=Ve,r=I;return function(i=!0){Kn(e),Wn(t),He(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ct(e=!0){Kn(null),Wn(null),He(null),e&&I?.deactivate()}function lt(){var e=Gn,t=e.b,n=I,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 ut(e){var t=2|y;return Gn!==null&&(Gn.f|=E),{ctx:Ve,deps:null,effects:null,equals:we,f:t,fn:e,reactions:null,rv:0,v:fe,wv:0,parent:Gn,ac:null}}var dt=Symbol(`obsolete`);function ft(e,t,n){let r=Gn;r===null&&Oe();var i=void 0,a=Bt(fe),o=!Hn,s=new Set;return Cn(()=>{var t=Gn,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==le&&n.reject(e)}).finally(ct)}catch(e){n.reject(e),ct()}var c=I;if(o){if(t.f&32768)var l=lt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(dt);else for(let e of s.values())e.reject(dt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==dt&&(c.activate(),t?(a.f|=ne,Wt(a,t)):(a.f&8388608&&(a.f^=ne),Wt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),_n(()=>{for(let e of s)e.reject(dt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function F(e){let t=ut(e);return Jn(t),t}function pt(e){let t=ut(e);return t.equals=Ee,t}function mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(le),t.ac=null}),t.fn!==null&&(t.teardown=f),lr(t,0),On(t))}function vt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&ur(t)}var yt=null,I=null,bt=null,xt=null,St=null,Ct=!1,wt=!1,Tt=null,Et=null,Dt=0,Ot=1,kt=class e{id=Ot++;#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(){yt===null?yt=this:(yt.#n=this,this.#t=yt),yt=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)Qe(r,y),t(r);for(r of n.m)Qe(r,b),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=v}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),Qe(e,y),this.schedule(e);for(let e of this.#d)Qe(e,b),this.schedule(e);this.apply();for(var t=Tt=[],n=[],r=Et=[];this.#c.length>0;){Dt++>1e3&&(this.#S(),jt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw It(e),this.#h()||this.discard(),t}}if(I=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Tt=null,Et=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Ft(e,t);r.length>0&&I.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),bt=this,Nt(n),Nt(t),bt=null,this.#s?.resolve();var o=I;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(Rt.clear(),o.#_())}}#v(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):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}}}#y(){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}#b(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),Qe(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),I=this,this.#_()}#x(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(I===null){let t=I=new e;!wt&&!Ct&&Ye(()=>{t.#e||t.flush()})}return I}apply(){xt=null}schedule(e){St=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?yt=e:t.#t=e,this.linked=!1}}};function At(e){var t=Ct;Ct=!0;try{var n;for(e&&(I!==null&&!I.is_fork&&I.flush(),n=e());;){if(Xe(),I===null)return n;I.flush()}}finally{Ct=t}}function jt(){try{Ne()}catch(e){fn(e,St)}}var Mt=null;function Nt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Rt.clear();for(let e of Mt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Mt.has(n)&&(Mt.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)}}Mt.clear()}}Mt=null}}function Pt(e){I.schedule(e)}function Ft(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Qe(e,v);for(var n=e.first;n!==null;)Ft(n,t),n=n.next}}function It(e){Qe(e,v);for(var t=e.first;t!==null;)It(t),t=t.next}var Lt=new Set,Rt=new Map,zt=!1;function Bt(e,t){return{f:0,v:e,reactions:null,equals:we,rv:0,wv:0}}function L(e,t){let n=Bt(e,t);return Jn(n),n}function Vt(e,t=!1,n=!0){let r=Bt(e);return t||(r.equals=Ee),ze&&n&&Ve!==null&&Ve.l!==null&&(Ve.l.s??=[]).push(r),r}function R(e,t,n=!1){return Hn!==null&&(!Un||Hn.f&131072)&&Ke()&&Hn.f&4325394&&(qn===null||!qn.has(e))&&Le(),Wt(e,n?Yt(t):t,Et)}var Ht=null,Ut=0;function Wt(e,t,n=null){if(!e.equals(t)){Bn?Rt.set(e,t):Rt.has(e)||Rt.set(e,e.v);var r=kt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&ht(t),xt===null&&$e(t)}e.wv=rr(),Ht=null,Ut=0,Jt(e,y,n),Ht=null,Ke()&&Gn!==null&&Gn.f&1024&&!(Gn.f&96)&&(Zn===null?Qn([e]):Zn.push(e)),!r.is_fork&&Lt.size>0&&!zt&&Gt()}return t}function Gt(){zt=!1;for(let e of Lt){e.f&1024&&Qe(e,b);let t;try{t=ir(e)}catch{t=!0}t&&ur(e)}Lt.clear()}function Kt(e,t=1){var n=W(e),r=t===1?n++:n--;return R(e,n),r}function qt(e){R(e,e.v+1)}function Jt(e,t,n){var r=e.reactions;if(r!==null){var i=Ke(),a=r.length;if(Ut+=a,Ut>1e5&&Ht===null&&(Ht=new Set),Ht!==null){if(Ht.has(e))return;Ht.add(e)}for(var o=0;o{if(tr===d)return e();var t=Hn,n=tr;Wn(null),nr(d);var r=e();return Wn(t),nr(n),r};return i&&r.set(`length`,L(t.length,u)),new Proxy(t,{defineProperty(e,t,n){`value`in n&&n.configurable!==!1&&n.enumerable!==!1&&n.writable!==!1||Fe();var i=r.get(t);return i===void 0?f(()=>{var e=L(n.value,u);return r.set(t,e),e}):R(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>L(fe,u));r.set(t,e),qt(o)}}else R(n,fe),qt(o);return!0},get(e,n,i){if(n===k)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>L(Yt(s?e[n]:fe),u)),r.set(n,o)),o!==void 0){var c=W(o);return c===fe?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var n=Reflect.getOwnPropertyDescriptor(e,t),i=r.get(t);if(i!==void 0){var a=W(i);if(a===fe)return;if(n&&`value`in n)n.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return n},has(e,t){if(t===k)return!0;var n=r.get(t),i=n!==void 0&&n.v!==fe||Reflect.has(e,t);return(n!==void 0||Gn!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>L(i?Yt(e[t]):fe,u)),r.set(t,n)),W(n)===fe)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dL(fe,u)),r.set(d+``,p)):R(p,fe)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>L(void 0,u)),R(c,Yt(n)),r.set(t,c));else{l=c.v!==fe;var m=f(()=>Yt(n));R(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&&R(g,_+1)}qt(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!==fe});for(var[n,i]of r)i.v!==fe&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ie()}})}function Xt(e){try{if(typeof e==`object`&&e&&k in e)return e[k]}catch{}return e}function Zt(e,t){return Object.is(Xt(e),Xt(t))}var Qt,$t,en,tn;function nn(){if(Qt===void 0){Qt=window,$t=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;en=a(t,`firstChild`).get,tn=a(t,`nextSibling`).get,u(e)&&(e[oe]=void 0,e[ae]=null,e[se]=void 0,e.__e=void 0),u(n)&&(n[ce]=void 0)}}function rn(e=``){return document.createTextNode(e)}function an(e){return en.call(e)}function on(e){return tn.call(e)}function z(e,t){if(!M)return an(e);var n=an(N);if(n===null)n=N.appendChild(rn());else if(t&&n.nodeType!==3){var r=rn();return n?.before(r),ye(r),r}return t&&un(n),ye(n),n}function B(e,t=!1){if(!M){var n=an(e);return n instanceof Comment&&n.data===``?on(n):n}if(t){if(N?.nodeType!==3){var r=rn();return N?.before(r),ye(r),r}un(N)}return N}function V(e,t=!1){if(!M)return an(e);var n=z(e,t);return P(e),n}function H(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=on(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=rn();return r===null?i?.after(a):r.before(a),ye(a),a}un(r)}return ye(r),r}function sn(e){e.textContent=``}function cn(){return!1}function ln(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 un(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 dn(e){var t=Gn;if(t===null)return Hn.f|=ne,e;if(!(t.f&32768)&&!(t.f&4))throw e;fn(e,t)}function fn(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 pn(e){Gn===null&&(Hn===null&&Me(e),je()),Bn&&Ae(e)}function mn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function hn(e,t){var n=Gn;n!==null&&n.f&8192&&(e|=x);var r={ctx:Ve,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};I?.register_created_effect(r);var i=r;if(e&4)Tt===null?kt.ensure().schedule(r):Tt.push(r);else if(t!==null){try{ur(r)}catch(e){throw An(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&&mn(i,n),Hn!==null&&Hn.f&2&&!(e&64))){var a=Hn;(a.effects??=[]).push(i)}return r}function gn(){return Hn!==null&&!Un}function _n(e){let t=hn(8,null);return Qe(t,v),t.teardown=e,t}function vn(e){pn(`$effect`);var t=Gn.f;if(!Hn&&t&32&&Ve!==null&&!Ve.i){var n=Ve;(n.e??=[]).push(e)}else return yn(e)}function yn(e){return hn(4|D,e)}function bn(e){return pn(`$effect.pre`),hn(8|D,e)}function xn(e){kt.ensure();let t=hn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Nn(t,()=>{An(t),n(void 0)}):(An(t),n(void 0))})}function Sn(e){return hn(4,e)}function Cn(e){return hn(te|E,e)}function wn(e,t=0){return hn(8|t,e)}function U(e,t=[],n=[],r=[]){ot(r,t,n,t=>{hn(8,()=>{e(...t.map(W))})})}function Tn(e,t=0){return hn(16|t,e)}function En(e){return hn(32|E,e)}function Dn(e){var t=e.teardown;if(t!==null){let n=Bn,r=Hn;Vn(!0),Wn(null);try{t.call(null)}catch(t){fn(t,e.parent)}finally{Vn(n),Wn(r)}}}function On(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&it(()=>{e.abort(le)});var r=n.next;n.f&64?n.parent=null:An(n,t),n=r}}function kn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||An(t),t=n}}function An(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(jn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,On(e,t&&!n),lr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Dn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Mn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function jn(e,t){for(;e!==null;){var n=e===t?null:on(e);e.remove(),e=n}}function Mn(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 Nn(e,t,n=!0){var r=[];e.f|=256,Pn(e,r,!0);var i=()=>{n&&An(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Pn(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);Pn(i,t,o?n:!1)}i=a}}}function Fn(e){e.f&=-257,In(e,!0)}function In(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(Qe(e,y),kt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);In(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 Ln(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:on(n);t.append(n),n=i}}var Rn=null,zn=!1,Bn=!1;function Vn(e){Bn=e}var Hn=null,Un=!1;function Wn(e){Hn=e}var Gn=null;function Kn(e){Gn=e}var qn=null;function Jn(e){Hn!==null&&(Hn.f&2097152||Hn.f&2)&&(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&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&xt===null&&Qe(e,v)}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(le)}),e.ac=null);try{e.f|=O;var u=e.fn,d=u();e.f|=C;var f=sr(e);if(Ke()&&Zn!==null&&!Un&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Xn+Yn.length,r=0;r{s.ac.abort(le),s.ac=null,Qe(s,y)}),_t(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`?(i.__removed=!1,Ye(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Cr(e,t,n,r,i){var a={capture:r,passive:i},o=Sr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&_n(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function G(e,t,n){(t[yr]??={})[e]=n}function wr(e){for(var t=0;t{Er=!1,Tr=null}));var s=0,c=Tr===e&&e[yr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[yr]=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=Hn,f=Gn;Wn(null),Kn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[yr]?.[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[yr]=t,delete e.currentTarget,Wn(d),Kn(f)}}}var Or=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function kr(e){return Or?.createHTML(e)??e}function Ar(e){var t=ln(`template`);return t.innerHTML=kr(e.replaceAll(``,``)),t.content}function jr(e,t){var n=Gn;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(M)return jr(N,null),N;i===void 0&&(i=Ar(a?e:``+e),n||(i=an(i)));var t=r||$t?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=an(t),s=t.lastChild;jr(o,s)}else jr(t,t);return t}}function Mr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(M)return jr(N,null),N;if(!o){var e=an(Ar(a));if(i)for(o=document.createDocumentFragment();an(e);)o.appendChild(an(e));else o=an(e)}var t=o.cloneNode(!0);if(i){var n=an(t),r=t.lastChild;jr(n,r)}else jr(t,t);return t}}function Nr(e,t){return Mr(e,t,`svg`)}function Pr(e=``){if(!M){var t=rn(e+``);return jr(t,t),t}var n=N;return n.nodeType===3?un(n):(n.before(n=rn()),ye(n)),jr(n,n),n}function Fr(){if(M)return jr(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=rn();return e.append(t,n),jr(t,n),e}function q(e,t){if(M){var n=Gn;n.f&32768&&n.nodes.end!==null||(n.nodes.end=N),be()}else e!==null&&e.before(t)}function Ir(){if(M&&N&&N.nodeType===8&&N.textContent?.startsWith(`$`)){let e=N.textContent.substring(1);return be(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Lr(e){let t=0,n=Bt(0),r;return()=>{gn()&&(W(n),wn(()=>(t===0&&(r=mr(()=>e(()=>qt(n)))),t+=1,()=>{Ye(()=>{--t,t===0&&(r?.(),r=void 0,qt(n))})})))}}var Rr=T|E;function zr(e,t,n,r){new Br(e,t,n,r)}var Br=class{parent;is_pending=!1;transform_error;#e;#t=M?N: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=Lr(()=>(this.#m=Bt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=Gn;t.b=this,t.f|=128,n(e)},this.parent=Gn.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Tn(()=>{if(M){let e=this.#t;be();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()},Rr),M&&(this.#e=N)}#g(){try{this.#a=En(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Ye(r),t&&(this.#s=En(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{t?_e():(t=!0,n&&Re(),this.#s!==null&&Nn(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){fn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=En(()=>e(this.#e)),Ye(()=>{var e=this.#c=document.createDocumentFragment(),t=rn(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return En(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){fn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(I)):this.#u===0&&(this.#e.before(e),this.#c=null,Nn(this.#o,()=>{this.#o=null}),this.#x(I))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=En(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Ln(this.#a,e);let t=this.#n.pending;this.#o=En(()=>t(this.#e))}else this.#x(I)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){et(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=Gn,n=Hn,r=Ve;Kn(this.#i),Wn(this.#i),He(this.#i.ctx);try{return kt.ensure(),e()}finally{Kn(t),Wn(n),He(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Nn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Ye(()=>{this.#d=!1,this.#m&&Wt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;I?.is_fork?(this.#a&&I.skip_effect(this.#a),this.#o&&I.skip_effect(this.#o),this.#s&&I.skip_effect(this.#s),I.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(An(this.#a),null),this.#o&&=(An(this.#o),null),this.#s&&=(An(this.#s),null),M&&(ye(this.#t),xe(),ye(Se()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return En(()=>{var r=Gn;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return fn(e,this.#i.parent),null}}))};Ye(()=>{var t;try{t=this.transform_error(e)}catch(e){fn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>fn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ce]??=e.nodeValue)&&(e[ce]=n,e.nodeValue=`${n}`)}function Vr(e,t){return Ur(e,t)}var Hr=new Map;function Ur(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){nn();var l=void 0,u=xn(()=>{var s=n??t.appendChild(rn());zr(s,{pending:()=>{}},t=>{Ue({});var n=Ve;if(o&&(n.c=o),a&&(i.$$events=a),M&&jr(t,null),l=e(t,i)||Ge(),M&&(Gn.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw he(),de;We()},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=Hr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Dr),r.delete(e),r.size===0&&Hr.delete(n)):r.set(e,i)}xr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Wr.set(l,u),l}var Wr=new WeakMap,Gr=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)Fn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Fn(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&&(An(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();Ln(r,t),t.append(rn()),this.#n.set(e,{effect:r,fragment:t})}else An(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Nn(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)||(An(n.effect),this.#n.delete(e))};ensure(e,t){var n=I,r=cn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=rn();i.append(a),this.#n.set(e,{effect:En(()=>t(a)),fragment:i})}else this.#t.set(e,En(()=>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 M&&(this.anchor=N),this.#a(n)}};function Y(e,t,n=!1){var r;M&&(r=N,be());var i=new Gr(e),a=n?T:0;function o(e,t){if(M){var n=Ce(r);if(e!==parseInt(n.substring(1))){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,t),ve(!0);return}}i.ensure(e,t)}Tn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Kr=Symbol(`NaN`);function qr(e,t,n){M&&be();var r=new Gr(e),i=!Ke();Tn(()=>{var e=t();e!==e&&(e=Kr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Jr(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;Yr(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;sn(d),d.append(u),e.items.clear()}Yr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Yr(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,Qr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ee,ei(d,null,c)):Fn(d):Nn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Tn(()=>{p=W(f);var e=p.length;let t=!1;M&&Ce(c)===`[!`!=(e===0)&&(c=Se(),ye(c),ve(!1),t=!0);for(var r=new Set,u=I,v=cn(),y=0;ys(c)):(d=En(()=>s(Xr??=rn())),d.f|=ee)),e>r.size&&ke(``,``,``),M&&e>0&&ye(Se()),!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&&ve(!0),W(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,M&&(c=N)}function Zr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Qr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Zr(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 $r(e,t,n,r,i,a,o,s){var c=o&1?o&16?Bt(n):Vt(n,!1,!1):null,l=o&2?Bt(i):null;return{v:c,i:l,e:En(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ei(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=on(r);if(a.before(r),r===i)return;r=o}}function ti(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ni(e,t,...n){var r=new Gr(e);Tn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},T)}function ri(e,t,n){var r;M&&(r=N,be());var i=new Gr(e);Tn(()=>{var e=t()??null;if(M&&Ce(r)===`[`!=(e!==null)){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,e&&(t=>n(t,e))),ve(!0)}else 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`]}),_n(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;at(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,I!==null&&r.add(I)}),Sn(()=>{var a=t();if(e===document.activeElement){var o=I;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=ue?`link`:`LINK`;function Si(e){if(M){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[j]=n,Ye(n),rt()}}function Ci(e,t){var n=wi(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Q(e,t,n,r){var i=wi(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===xi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ie]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ei(e).has(t)?e[t]=n:e.setAttribute(t,n))}function wi(e){return e[ae]??={[yi]:e.nodeName.includes(`-`),[bi]:e.namespaceURI===pe}}var Ti=new Map;function Ei(e){var t=e.getAttribute(`is`)||e.nodeName,n=Ti.get(t);if(n)return n;Ti.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 Di(e,t,n=t){var r=new WeakSet;at(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Mi(e)?Ni(a):a,n(a),I!==null&&r.add(I),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))}}}),(M&&e.defaultValue!==e.value||mr(t)==null&&e.value)&&(n(Mi(e)?Ni(e.value):e.value),I!==null&&r.add(I)),wn(()=>{var n=t();if(e===document.activeElement){var i=I;if(r.has(i))return}Mi(e)&&n===Ni(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Oi=new Set;function ki(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),at(n,`change`,()=>{var e=n.__value;a&&(e=ji(o,e,n.checked)),i(e)},()=>i(a?[]:null)),wn(()=>{var e=r();M&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=Zt(n.__value,e)}),_n(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Oi.has(o)||(Oi.add(o),Ye(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Oi.delete(o)})),Ye(()=>{if(s){var e=a?ji(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Ai(e,t,n=t){at(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(M&&e.defaultChecked!==e.checked||mr(t)==null)&&n(e.checked),wn(()=>{e.checked=!!t()})}function ji(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 Fi(e,t,n){var r=Pi.observe(e,()=>n(e[t]));Sn(()=>(mr(()=>n(e[t])),r))}function Ii(e,t){return e===t||e?.[k]===t}function Li(e=Ge(),t,n,r){var i=Ve.r,a=Gn;return Sn(()=>{var o,s;return wn(()=>{o=s,s=r?.()||[],mr(()=>{Ii(n(...s),e)||(t(e,...s),o&&Ii(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ii(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ri(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?wn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&_n(()=>{n.removeEventListener(t,a)})}function zi(e=!1){let t=Ve,n=t.l.u;if(!n)return;let r=()=>hr(t.s);if(e){let e=0,n={},i=ut(()=>{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&&bn(()=>{Bi(t,r),m(n.b)}),vn(()=>{let e=mr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&vn(()=>{Bi(t,r),m(n.a)})}function Bi(e,t){if(e.l.s)for(let t of e.l.s)W(t);t()}var Vi=!1;function Hi(e){var t=Vi;try{return Vi=!1,[e(),Vi]}finally{Vi=t}}var Ui={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===k||t===re)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 Wi(...e){return new Proxy({props:e},Ui)}function Gi(e,t,n,r){var i=!ze||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ut(r),W(u)):(l&&(l=!1,c=s?mr(r):r),c);let f;if(o){var p=k in e||re in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=Hi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Pe(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?ut:pt)(()=>(v=!1,g()));o&&W(y);var b=Gn;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&o?Yt(e):e;return R(y,n),v=!0,c!==void 0&&(c=n),e}return Bn&&v||b.f&16384?y.v:W(y)})}function Ki(e){Ve===null&&De(`onMount`),ze&&Ve.l!==null?Ji(Ve).m.push(e):vn(()=>{let t=mr(e);if(typeof t==`function`)return t})}function qi(e){Ve===null&&De(`onDestroy`),Ki(()=>()=>mr(e))}function Ji(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Yi(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 Xi=new class{#e=L(Zi());get _loc(){return W(this.#e)}set _loc(e){R(this.#e,e)}#t=F(()=>this._loc.location);get _location(){return W(this.#t)}set _location(e){R(this.#t,e)}#n=F(()=>this._loc.querystring);get _querystring(){return W(this.#n)}set _querystring(e){R(this.#n,e)}#r=L(void 0);get _params(){return W(this.#r)}set _params(e){R(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=Zi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Zi(){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}}async function Qi(e){if(!e||e.length<1||e.charAt(0)!=`/`&&e.indexOf(`#/`)!==0)throw Error(`Invalid parameter location`);await dr();let t=(e.charAt(0)==`#`?``:`#`)+e;try{let e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,``,t)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event(`hashchange`))}function $i(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function ea(e,t){Ue(t,!0);let n=Gi(t,`routes`,19,()=>({})),r=Gi(t,`prefix`,3,``),i=Gi(t,`restoreScrollState`,3,!1),a=Gi(t,`onConditionsFailed`,3,()=>{}),o=Gi(t,`onRouteLoaded`,3,()=>{}),s=Gi(t,`onRouteLoading`,3,()=>{}),c=Gi(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=Yi(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=L(null),f=L(null),p=L({}),m=null,h=null;vn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),vn(()=>{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)}vn(()=>{let e=Xi.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=Fr(),y=B(v),b=e=>{let t=F(()=>W(d));var n=Fr(),r=B(n),i=e=>{var n=Fr();ri(B(n),()=>W(t),(e,t)=>{t(e,Wi({get params(){return W(f)},get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)},a=e=>{var n=Fr();ri(B(n),()=>W(t),(e,t)=>{t(e,Wi({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),We()}var ta=[`bars`,`pace`,`pie`,`fuel`,`resets`,`thresholds`];function na(e){return e===`zone`||e===`consumption-pace`?`pace`:typeof e==`string`&&ta.includes(e)?e:`bars`}var ra=`codexometer.web.preferences.v1`,ia={statusLine:null,tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function aa(){try{let e=JSON.parse(localStorage.getItem(ra)||`null`);return!e||typeof e!=`object`?ia:{statusLine:Array.isArray(e.statusLine)?[...new Set(e.statusLine.filter(e=>typeof e==`string`&&e.length<64))].slice(0,32):null,tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:na(e.view),selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:[0,1,2].includes(e.defaultDetail)?e.defaultDetail:0,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 ia}}var oa=Yt(aa()),sa=Yt({open:!1}),ca=Yt({requests:0});function la(){let e=JSON.stringify(oa);try{localStorage.setItem(ra,e)}catch{}}function ua(){return oa.tab===`quota`?`/quota/`+oa.view:`/`+oa.tab}function da(e){return oa.layouts.find(t=>t.id===e)?.level??oa.defaultDetail}function fa(e){if(!e.length)return;let t=e.map(da),n=Math.max(...t);oa.defaultDetail=t.every(e=>e===n)?(n+1)%3:n;let r=new Set(e);oa.layouts=oa.layouts.filter(e=>!r.has(e.id))}function pa(e,t){oa.layouts=[...oa.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Yt({data:null,connected:!1,error:``}),ma=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ha=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ga=`codexometer.web.session`,_a=class extends Error{},va,ya=Yt({open:!1}),ba=Yt({ids:[],scope:``});function xa(e){ba.ids.includes(e)||ba.ids.length>=8||(ba.ids.length||(ba.scope=$.connected&&!$.data?.sessionsError&&$.data?.savedScope||``),ba.ids=[...ba.ids,e])}var Sa,Ca=Yt({root:``,kind:`agents`}),wa,Ta,Ea,Da;async function Oa(e,t,n){if(!va||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await va(e,t,n)}function ka(){let e=new AbortController,t,n=``;async function r(t,r,i,a){let o=await fetch(t+`?`+new URLSearchParams(r),{headers:{Authorization:`Bearer ${n}`},signal:AbortSignal.any([e.signal,i,AbortSignal.timeout(a)]),cache:`no-store`});if(!o.ok)throw Error(`Session information unavailable`);return o.json()}function i(t,r,i,a=8e3){return fetch(t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(a),...i?[i]:[]]),cache:`no-store`})}wa=async(e,t,n,i)=>{if(!$.connected||$.data?.sessionsError)throw Error(`Session unavailable`);return r(`/api/sessions/inspect`,{root:e,agent:t,kind:n},i,6500)},Da=async(e,t,n,i,a=``)=>{if(!$.connected||$.data?.savedScope!==e)throw Error(`History unavailable`);return r(`/api/sessions/saved`,{scope:e,cursor:t,id:n,q:a},i,8e3)},Sa=(e,t,n)=>!e||!$.connected||$.data?.sessionsError||$.data?.savedScope!==e?Promise.reject(Error(`Session unavailable here.`)):r(`/api/sessions/linked`,{scope:e,id:t},n,6500),Ea=async(e,t,n,r)=>{if(!$.connected||!$.data?.control||$.data.sessionsError||$.data.savedScope!==e)throw new _a(`Resume unavailable. Check the live connection.`);let a=await i(`/api/sessions/resume`,{scope:e,cursor:t,id:n,...r},void 0,14e3);if(!a.ok)throw a.status>=500?Error(`Resume outcome unknown.`):new _a((await a.text()).trim());return r?.mode===`prepare`?(await a.json()).confirmation:``},Ta=async(e,t,n,r)=>{if(!$.connected||!$.data?.control||$.data.savedScope!==e||$.data.sessionsError)throw new _a(`New sessions unavailable. Check the Codex connection.`);let a=await i(`/api/sessions/new`,{scope:e,directory:t,prompt:n,...r},void 0,14e3);if(!a.ok)throw a.status>=500?Error(`Could not verify the new session. Check Codex before trying again.`):new _a((await a.text()).trim());return a.json()},va=async(e,t,n)=>{let r=await i(`/api/control/`+e,t,n);if(!r.ok)throw r.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new _a(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return r.json()};try{n=sessionStorage.getItem(ga)||``}catch{}let a=location.hash,o=a.startsWith(`#pair=`)?a.slice(6):``;(o||!a||a===`#`)&&(history.replaceState(null,``,`/#`+ua()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function s(){if(o)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:o}),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(ga,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}n?await c():$.error=`Open the private pairing link printed by codexometer --web in your terminal.`}async function c(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(ga)}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(c,2500))}return s(),()=>{va=void 0,Da=void 0,Ea=void 0,ya.open=!1,wa=void 0,Sa=void 0,ba.ids=[],Ca.root=``,e.abort(),clearTimeout(t),$.connected=!1}}Be();var Aa=K(`

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

`),ja=K(`

`),Ma=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),Na=K(`

No threshold-based model steps were configured at launch.

`);function Pa(e,t){Ue(t,!1),zi();var n=Fr(),r=B(n),i=e=>{var t=Ma(),n=B(t),r=V(n),i=H(n,2),a=e=>{q(e,Aa())};Y(i,e=>{$.data.quotaError&&e(a)});var o=H(i,2),s=z(o),c=V(s),l=H(s,4);Z(l,5,()=>$.data.thresholds,X,(e,t)=>{var n=ja();let r;var i=z(n),a=V(i),o=H(i,2),s=z(o),c=V(s,!0),l=V(H(s,2));P(o);var u=H(o,2),d=V(u,!0),f=V(H(u,2));P(n),U((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)}),P(l),P(o),U(e=>{J(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),J(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ha($.data.quotaAt)]),q(e,t)},a=e=>{q(e,Na())};Y(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),q(e,n),We()}var Fa=Nr(` `,1),Ia=Nr(` `,1),La=Nr(` `,1),Ra=Nr(` `,1),za=K(`
`,1),Ba=K(` `),Va=K(`
Quota observations
Observed atPeriod elapsedConsumedTrail segment
`),Ha=K(`
OBSERVATION DATA
`),Ua=K(`
CONSUMPTIONQUOTA PERIOD ELAPSED
`,1);function Wa(e,t){let n=Ir();Ue(t,!0);let r=Gi(t,`trail`,19,()=>[]),i=L(!1),a=L(!0),o=L(`window`),s=[0,25,50,75,100],c=F(()=>t.plot?.known?t.plot.elapsed:t.elapsed),l=L(400),u=L(240),d=F(()=>W(l)-24),f=F(()=>W(u)-48),p=F(()=>Math.max(1,W(d)-48)),m=F(()=>Math.max(1,W(f)-20)),h=F(()=>48+Math.max(0,Math.min(100,W(c)))/100*W(p));function g(e){return W(f)-(e-0)/100*W(m)}let _=F(()=>g(t.used)),v=F(()=>t.used-W(c)),y=F(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*W(p)} ${g(e.used)}`).join(` `)),b=F(()=>{let e=0;for(let t=r().length-1;t>0;t--)if(r()[t].break){e=t;break}return r().slice(e)}),x=F(()=>W(b).length<2?0:Math.max(0,Date.parse(W(b).at(-1).at)-Date.parse(W(b)[0].at))),S=F(()=>Object.fromEntries((t.plot?.modes||[]).map(e=>[e.id,e.available])));vn(()=>{W(o)!==`window`&&!W(S)[W(o)]&&R(o,`window`)});let C=F(()=>{let e=t.plot?.modes.find(e=>e.id===W(o));if(!e?.segment)return null;let{x1:n,y1:r,x2:i,y2:a}=e.segment,s=Math.hypot((i-n)/100*W(p),(a-r)/100*W(m)),c=Math.max(3,Math.min(9,Math.floor(s/65)+2));return{path:`M${Array.from({length:c},(e,t)=>{let o=n+(i-n)*t/(c-1),s=r+(a-r)*t/(c-1);return`${48+o/100*W(p)} ${g(s)}`}).join(` L`)}`,projected:e.projected,safe:e.safe}}),w=F(()=>{if(W(b).length===0)return`NO OBSERVATIONS`;if(W(b).length===1)return`ONE OBSERVATION`;let e=Math.floor(W(x)/6e4);if(e<60)return`${e} MIN CONTINUOUS`;let t=Math.floor(e/60);return t<24?`${t}H CONTINUOUS`:`${Math.floor(t/24)}D ${t%24}H CONTINUOUS`});var T=Ua(),E=B(T),D=z(E);let ee;var O=z(D),te=z(O),ne=H(te);P(O);var k=H(O),A=H(k);Z(A,17,()=>s,X,(e,t)=>{var n=Fa(),r=B(n),i=H(r),a=V(i);U(()=>{Q(r,`x1`,48+W(t)/100*W(p)),Q(r,`x2`,48+W(t)/100*W(p)),Q(r,`y2`,W(f)),Q(i,`x`,48+W(t)/100*W(p)),Q(i,`y`,W(f)+20),J(a,`${W(t)??``}%`)}),q(e,n)});var re=H(A);Z(re,17,()=>s,X,(e,t)=>{var n=Ia(),r=B(n),i=H(r),a=V(i);U((e,n,o)=>{Q(r,`y1`,e),Q(r,`x2`,W(d)),Q(r,`y2`,n),Q(i,`y`,o),J(a,`${W(t)??``}%`)},[()=>g(W(t)),()=>g(W(t)),()=>g(W(t))+4]),q(e,n)});var ie=H(re),ae=H(ie),oe=H(ae),se=e=>{var t=La(),n=B(t),i=H(n),a=H(i),o=V(z(a));P(a),U((e,t)=>{Q(n,`d`,W(y)),Q(i,`d`,W(y)),Q(a,`cx`,48+r()[0].elapsed/100*W(p)),Q(a,`cy`,e),J(o,`First observation: ${t??``}`)},[()=>g(r()[0].used),()=>ha(r()[0].at)]),q(e,t)};Y(oe,e=>{W(a)&&r().length&&e(se)});var ce=H(oe),j=e=>{var t=Ra(),r=B(t),i=H(r),a=V(z(i));P(i),U(e=>{Q(r,`d`,W(C).path),Q(i,`d`,W(C).path),Q(i,`marker-mid`,`url(#${n}-trend-arrow)`),J(a,`${W(o)===`window`?`Window-average pace`:`Recent consumption trajectory`} projects ${e??``}% at reset if continued`)},[()=>W(C).projected.toFixed(1)]),q(e,t)};Y(ce,e=>{W(C)&&e(j)});var le=H(ce,2),ue=H(le),de=H(ue),fe=V(z(de));P(de),P(D),P(E);var pe=H(E,2),me=z(pe),he=z(me),ge=H(he,3),_e=V(ge,!0),M=H(ge,2),ve=e=>{var t=za(),n=V(H(B(t)));U(e=>J(n,`TREND // ${e??``}`),[()=>W(C).projected>=100?`QUOTA EXHAUSTION PROJECTED`:`${W(C).projected.toFixed(1)}% PROJECTED AT RESET`]),q(e,t)};Y(M,e=>{W(C)&&e(ve)}),P(me);var N=H(me,2),ye=z(N),be=z(ye);Si(be),xe(),P(ye);var Se=H(ye,2),Ce=H(z(Se),2),we=z(Ce);we.value=we.__value=`off`;var Te=H(we),Ee=V(Te);Te.value=Te.__value=`halfHour`;var De=H(Te),Oe=V(De);De.value=De.__value=`hour`;var ke=H(De),Ae=V(ke);ke.value=ke.__value=`day`;var je=H(ke),Me=V(je);je.value=je.__value=`window`,P(Ce),hi(Ce),P(Se);var Ne=V(H(Se,2));P(N),P(pe);var Pe=H(pe,2),Fe=e=>{var t=Ha(),n=H(z(t),2),a=e=>{var t=Va(),n=z(t),i=H(z(n),2);Z(i,21,r,X,(e,t,n)=>{var r=Ba(),i=z(r),a=z(i),o=V(a,!0);P(i);var s=H(i),c=V(s),l=H(s),u=V(l),d=V(H(l),!0);P(r),U((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`)},[()=>ha(W(t).at),()=>W(t).elapsed.toFixed(1)]),q(e,r)}),P(i),P(n),P(t),q(e,t)};Y(n,e=>{W(i)&&e(a)}),P(t),Ri(`open`,`toggle`,t,e=>R(i,e),()=>W(i)),q(e,t)};Y(Pe,e=>{r().length&&e(Fe)}),U((e,r,i,a,o,s)=>{Q(D,`viewBox`,`0 0 ${W(l)} ${W(u)}`),Q(D,`aria-label`,e),ee=di(D,``,ee,{"--trend-color":W(C)?.safe?`#115b35`:`#7f1825`}),Q(te,`id`,n),Q(ne,`id`,n+`-trend-arrow`),Q(k,`width`,W(p)),Q(k,`height`,W(m)),Q(k,`fill`,`url(#${n})`),Q(ie,`d`,`M48 20 V${W(f)} H${W(d)}`),Q(ae,`y1`,r),Q(ae,`x2`,W(d)),Q(ae,`y2`,i),Q(le,`x`,48+W(p)/2),Q(le,`y`,W(u)-5),Q(ue,`cx`,W(h)),Q(ue,`cy`,W(_)),Q(de,`cx`,W(h)),Q(de,`cy`,W(_)),J(fe,`${t.used??``}% consumed // ${a??``}% of period elapsed`),J(he,`${t.used??``}% USED // ${o??``}% TIME ELAPSED`),J(_e,s),Te.disabled=!W(S).halfHour,J(Ee,`LAST 30 MINUTES${W(S).halfHour?``:` — UNAVAILABLE`}`),De.disabled=!W(S).hour,J(Oe,`LAST HOUR${W(S).hour?``:` — UNAVAILABLE`}`),ke.disabled=!W(S).day,J(Ae,`LAST 24 HOURS${W(S).day?``:` — UNAVAILABLE`}`),je.disabled=!W(S).window,J(Me,`FROM WINDOW START${W(S).window?``:` — NO TIME ELAPSED`}`),J(Ne,`HISTORY // ${W(w)??``}`)},[()=>`Pace: ${t.used}% consumed, ${W(c).toFixed(1)}% of quota period elapsed. ${W(v)>0?`Above`:W(v)<0?`Below`:`On`} the steady-consumption line.${W(a)&&r().length?` Trace path contains ${r().length} ${r().length===1?`observation`:`observations`}; gaps are not interpolated.`:``}`,()=>g(0),()=>g(100),()=>W(c).toFixed(1),()=>W(c).toFixed(1),()=>Math.abs(W(v))<.05?`ON PACE`:W(v)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Fi(E,`clientWidth`,e=>R(l,e)),Fi(E,`clientHeight`,e=>R(u,e)),Ai(be,()=>W(a),e=>R(a,e)),gi(Ce,()=>W(o),e=>R(o,e)),q(e,T),We()}var Ga=K(` `),Ka=K(`

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

`),qa=K(`

`),Ja=K(`

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

`),Ya=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.

`),Za=K(` `,1),Qa=Nr(``),$a=Nr(``),eo=Nr(``),to=Nr(``,1),no=K(` `),ro=K(`
`),io=K(`

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

`),ao=K(`
EMPTYFULL
`),oo=K(`

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

`),uo=K(`

`),fo=K(`

No quota windows reported yet.

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

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

`,1),ho=K(` `,1);function go(e,t){Ue(t,!0);let n=Gi(t,`params`,19,()=>({})),r=F(()=>ta.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=L(Yt(Date.now())),a=F(()=>W(r).includes(na(n().view))?na(n().view):`bars`);Ki(()=>{let e=setInterval(()=>R(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))))}vn(()=>{oa.view=W(a),(n().view===`zone`||n().view===`consumption-pace`)&&Qi(`/quota/pace`)});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=ho(),l=B(c);Z(l,21,()=>W(r),X,(e,t)=>{var n=Ga();let r;var i=V(n,!0);U(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)===`fuel`?`FUEL TANK`:W(t).toUpperCase()]),q(e,n)}),P(l);var u=H(l,2),d=e=>{var t=mo(),n=B(t),r=e=>{q(e,Ka())};Y(n,e=>{$.data.quotaError&&e(r)});var i=H(n,2),c=e=>{var t=qa(),n=V(t);U(()=>J(n,`Last usage accounting issue: - ${$.data.usageDiagnostic??``}`)),q(e,t)};Y(i,e=>{$.data.usageDiagnostic&&e(c)});var l=H(i,2),u=V(l),d=H(l,2),f=e=>{Pa(e,{})},p=e=>{var t=Xa(),n=z(t),r=V(n),i=H(n,4),a=e=>{q(e,Ja())};Y(i,e=>{$.data.credits.length||e(a)}),Z(H(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=Ya(),r=z(n),i=V(r),a=V(H(r,2),!0);P(n),U(e=>{J(i,`${(W(t).title||`Quota reset`)??``} // ${W(t).status??``}`),J(a,e)},[()=>W(t).expiryKnown?W(t).expires?`EXPIRES `+ha(W(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),xe(2),P(t),U(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},m=e=>{var t=po(),n=B(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=F(()=>o(W(t))),r=F(()=>W(n)===null?null:Math.round(W(n)));var i=uo(),c=z(i),l=V(c,!0),u=H(c,2);let d;var f=z(u),p=e=>{var n=Za(),r=B(n),i=V(r),a=V(H(r));U(()=>{J(i,`FREE ${100-W(t).used}%`),J(a,`USED ${W(t).used??``}%`)}),q(e,n)},m=e=>{var n=Za(),r=B(n),i=V(r),a=V(H(r));U(()=>{J(i,`USED ${W(t).used??``}%`),J(a,`FREE ${100-W(t).used}%`)}),q(e,n)};Y(f,e=>{W(a)===`fuel`?e(p):e(m,-1)}),P(u);var h=H(u,2);let g;var _=z(h),v=e=>{var i=ro(),a=z(i),o=z(a),c=H(z(o)),l=e=>{q(e,Qa())},u=e=>{var n=$a();U(e=>Q(n,`d`,e),[()=>s(W(t).used)]),q(e,n)};Y(c,e=>{W(t).used>=100?e(l):W(t).used>0&&e(u,1)});var d=H(c),f=e=>{var t=to(),r=H(B(t)),i=e=>{var t=eo();U(()=>Q(t,`stroke-dasharray`,`${W(n)} 100`)),q(e,t)};Y(r,e=>{W(n)>0&&e(i)}),q(e,t)};Y(d,e=>{W(n)!==null&&e(f)}),P(o),P(a);var p=H(a,2),m=z(p),h=V(m),g=H(m,2),_=e=>{var t=no(),n=V(t);U(()=>J(n,`RING // ${W(r)??``}% ELAPSED`)),q(e,t)};Y(g,e=>{W(r)!==null&&e(_)}),P(p),P(i),U(()=>{Q(o,`aria-label`,`${W(t).used}% quota used; ${W(r)===null?`reset cycle unavailable`:`${W(r)}% of reset cycle elapsed`}`),J(h,`PIE  // ${W(t).used??``}% USED`)}),q(e,i)},y=e=>{var r=Fr(),i=B(r),a=e=>{{let r=F(()=>W(t).trail||[]);Wa(e,{get used(){return W(t).used},get elapsed(){return W(n)},get trail(){return W(r)},get plot(){return W(t).plot}})}},o=e=>{q(e,io())};Y(i,e=>{W(n)===null?e(o,-1):e(a)}),q(e,r)},b=e=>{var r=so(),i=B(r),o=z(i);let s;P(i);var c=H(i,2),l=e=>{q(e,ao())};Y(c,e=>{W(a)===`fuel`&&e(l)});var u=H(c,2),d=e=>{var t=oo(),r=B(t),i=V(r),o=H(r,2),s=z(o);let c;P(o),U(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)}),U(()=>{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(_,e=>{W(a)===`pie`?e(v):W(a)===`pace`?e(y,1):e(b,-1)}),P(h);var x=H(h,2),S=z(x),C=e=>{var t=Fr(),n=B(t),i=e=>{q(e,Pr(`RESET CYCLE UNAVAILABLE ·`))},a=e=>{var t=co(),n=V(t);U(()=>J(n,`RING ${W(r)??``}% ELAPSED ·`)),q(e,t)};Y(n,e=>{W(r)===null?e(i):e(a,-1)}),q(e,t)};Y(S,e=>{W(a)===`pie`&&e(C)});var w=H(S);P(x);var T=H(x,2),E=e=>{var n=lo(),r=V(n,!0);U(()=>J(r,W(t).details)),q(e,n)};Y(T,e=>{W(t).details&&e(E)}),P(i),U(e=>{J(l,W(t).name),d=li(u,1,`spread`,null,d,{"pie-stats":W(a)===`pie`}),g=li(h,1,`meter-graphic`,null,g,{"bar-graphic":W(a)===`bars`||W(a)===`fuel`}),J(w,` RESETS // ${e??``}`)},[()=>ha(W(t).reset)]),q(e,i)}),P(n);var i=H(n,2),c=e=>{q(e,fo())};Y(i,e=>{$.data.meters.length||e(c)}),U(()=>r=li(n,1,`quota-grid`,null,r,{radial:W(a)===`pie`,zone:W(a)===`pace`})),q(e,t)};Y(d,e=>{W(a)===`thresholds`?e(f):W(a)===`resets`?e(p,1):e(m,-1)}),xe(2),U(e=>J(u,`QUOTA // OBSERVED ${e??``}`),[()=>ha($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),We()}var _o=K(`
`),vo=K(`

`,1);function yo(e,t){Ue(t,!0);let n=Gi(t,`values`,19,()=>[]),r=Gi(t,`label`,3,`Token activity`),i=Gi(t,`capacity`,3,0),a=F(()=>Math.max(0,...n())),o=F(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=vo(),c=B(s),l=V(c),u=H(c,2);Z(u,21,()=>W(o),X,(e,t)=>{var n=_o();let r;U((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)}),P(u),U((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),We()}function bo(e,t=!1){return e===`require`||e!==`none`&&!t}function xo(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var So=[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer. Saved display preferences only.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`Open Codexometer’s usage history. Existing quota and reset views remain available.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity using Codexometer’s copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Choose a Codexometer display theme. Saved local display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave this Codexometer interface. Codex sessions continue running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit. Codex sessions continue running.`,next:`quit`},{id:`local-resume`,label:`/resume`,help:`Search saved Codex sessions, preview, or explicitly resume one in Sessions.`,next:`resume`},{id:`local-subagents`,label:`/subagents`,help:`Inspect the selected session’s linked agents and their read-only transcripts.`,next:`subagents`},{id:`local-ps`,label:`/ps`,help:`List the selected session’s background terminals without stopping anything.`,next:`ps`}],Co=[`surface`,`model`,`feature`,`task start`],wo=K(` `),To=K(``),Eo=K(`

`),Do=K(`

`),Oo=K(`
`),ko=K(`

`),Ao=K(`

`,1),jo=K(`

`),Mo=K(`

Loading / sending…

`),No=K(`
`),Po=K(`

`),Fo=K(`

 
`),Io=K(`
`),Lo=K(`
`),Ro=K(`

Review expired. Press Enter to review again.

`),zo=K(`

`,1),Bo=K(`

`,1),Vo=K(`

No available matching commands.

`),Ho=K(` `,1),Uo=K(`

`),Wo=K(`

Review expired. Review the option again.

`),Go=K(``),Ko=K(``),qo=K(``),Jo=K(``),Yo=K(``),Xo=K(``),Zo=K(`
`),Qo=K(`
`);function $o(e,t){let n=Ir();Ue(t,!0);let r=e=>{var t=Fr();Z(B(t),19,()=>W(ve),e=>e.id,(e,t,r)=>{var i=To();let o;var s=z(i),c=V(s,!0),l=H(s),u=V(l),d=H(l),f=e=>{var n=wo(),r=V(n,!0);U(()=>J(r,W(t).help)),q(e,n)};Y(d,e=>{(W(v)?.path===``||W(de))&&e(f)}),P(i),U((e,s)=>{Q(i,`id`,`${n}-${W(r)}`),Q(i,`role`,W(de)?`option`:void 0),Q(i,`aria-selected`,W(de)?W(D)===W(r):void 0),Q(i,`tabindex`,W(de)?-1:void 0),i.disabled=W(g)||W(xe)&&!a(),Q(i,`title`,W(t).help),Q(i,`aria-label`,e),o=li(i,1,`svelte-7bfwr9`,null,o,{suggested:W(D)===W(r)}),J(c,W(t).label),J(u,`${W(de)&&W(t).selected?` // CURRENT`:``}${s??``}`)},[()=>W(t).label+(W(de)&&W(t).selected?` // CURRENT`:``)+ce(W(t)),()=>ce(W(t))]),Cr(`focus`,i,()=>{W(de)||Ce(W(r))}),G(`click`,i,()=>{Ce(W(r)),De(W(t))}),q(e,i)}),q(e,t)},i=Gi(t,`query`,3,``),a=Gi(t,`localOnly`,3,!1),o=Gi(t,`oncopy`,3,()=>{}),s=Gi(t,`onchange`,3,()=>{}),c=Gi(t,`oncomplete`,3,e=>{}),l=So.map(e=>e.next);function u(){return So.map(e=>[`exit`,`quit`].includes(e.next||``)?{...e,help:`Return to Sessions. The local server and Codex sessions remain running.`}:{...e})}function d(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:u()}}function f(){R(A,null),R(b,``),R(k,``),R(x,0),R(ae,[],!0)}function p(){E++,R(g,!1),R(h,!1),R(ee,i()),f(),R(_,``),W(me)?s()():c()(i())}async function m(e){if(!l.includes(e))return!1;if(e===`copy`&&!xo($.data?.sessions.find(e=>e.id===t.session)))return R(_,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();p(),await e}else p(),e===`usage`?location.hash=`/usage`:e===`resume`?(ya.open=!0,location.hash=`/sessions`):e===`subagents`||e===`ps`?(Ca.kind=e===`ps`?`terminals`:`agents`,Ca.root=t.session):e===`theme`?ca.requests++:e===`statusline`?sa.open=!0:location.hash=`/sessions`;return!0}let h=L(!1),g=L(!1),_=L(``),v=L(null),y=L(null),b=L(``),x=L(0),S=L(Yt(Date.now())),C=L(``),w=L(``),T=F(()=>i().trimStart());vn(()=>{W(w)&&W(v)?.input&&W(T).startsWith(W(w))&&R(C,W(T).slice(W(w).length)||W(v).value||``,!0)});let E=0,D=L(0),ee=L(null),O=L(void 0),te=L(void 0),ne=L(void 0),k=L(``),A=L(null);function re(){return W(A)===null||W(A)===i()}function ie(){E++,R(g,!1),R(y,null),R(v,null),R(_,``),f(),W(h)&&Ee(``)}vn(()=>{let e=i(),t=W(A);t!==null&&t!==e&&mr(ie)});let ae=L(Yt([])),oe=F(()=>!!W(v)?.inputReview),se=F(()=>!!W(y)&&!W(oe)||!!W(k)||W(ae).length>0);function ce(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:e.action?``:` // HELP`}async function j(e,t){W(v)&&!(W(Se)&&W(he))&&R(ae,[...W(ae),{path:W(v).path,index:W(D),input:W(C),draft:t??(W(me)?i():void 0)}],!0),await Ee(e,void 0,!1,t!==void 0)}async function le(){if(!W(se))return;if(E++,R(g,!1),R(b,``),R(x,0),R(_,``),W(k)){R(k,``),W(O)?.focus();return}if(W(y)&&!W(oe)){R(y,null),await dr(),W(O)?.focus();return}let e=W(ae).at(-1);e&&(R(ae,W(ae).slice(0,-1),!0),e.draft!==void 0&&e.draft!==i()&&c()(e.draft),await Ee(e.path,e))}function ue(){W(v)&&W(C).trim()&&!W(g)&&!W(xe)&&j(W(v).path+`/`+encodeURIComponent(W(C).trim()))}let de=F(()=>W(h)&&!!W(v)?.picker&&!W(y)),fe=F(()=>W(h)&&!W(v)?.input&&!W(y)),pe=setInterval(()=>{R(S,Date.now(),!0)},1e3);qi(()=>{clearInterval(pe),E++});let me=F(()=>W(T).startsWith(`/`)&&!W(T).startsWith(`//`)),he=F(()=>W(v)?.path===``&&W(me)?W(T).slice(1).split(/\s/,1)[0].toLowerCase():M().trim().toLowerCase());function ge(e){let t=[e.label.replace(/^\//,``)];return e.next&&t.push(decodeURIComponent(e.next.split(`/`).at(-1))),t}function _e(e){return e===`goal/set`?`/goal `:e.startsWith(`tier/`)?(W(v)?.picker?W(v).title:i().trim().split(/\s/,1)[0])+` `:`/`+e.split(`/`).map(decodeURIComponent).join(` `)+` `}function M(){if(!W(me)||!W(v)?.path||W(v).input||W(v).multiple||W(v).inputReview)return``;let e=_e(W(v).path);return W(T).toLowerCase().startsWith(e.toLowerCase())?W(T).slice(e.length):``}let ve=F(()=>{let e=W(v)?.path===`permissions`?W(he).split(/\s/,1)[0]:W(he),t=(W(v)?.choices||[]).filter(t=>!e||ge(t).some(t=>t.toLowerCase().startsWith(e)));return!t.length&&W(v)?.path===`goal`?(W(v).choices||[]).filter(e=>e.next===`goal/set`):t}),N=F(()=>W(y)||W(ve)[W(D)]),ye=F(()=>!!W(b)&&W(S)W(ve).find(e=>e.id===W(k))),xe=F(()=>!$.connected||!!$.data?.sessionsError),Se=F(()=>W(h)&&W(me)&&(!W(v)||W(v).path===``)&&!W(y));vn(()=>{if(!W(h)||W(g)||W(y)||!W(v)||W(v).input||W(v).multiple||W(v).inputReview||W(ae).length>=16)return;let e=W(v).path===``&&W(me)?W(T).slice(1):M();for(let t of W(v).choices||[]){if(!t.next||l.includes(t.next))continue;let n=ge(t);if(!n.some(t=>e.toLowerCase()===t.toLowerCase())){for(let r of n)if(e.slice(0,r.length).toLowerCase()===r.toLowerCase()&&/^\s/.test(e.slice(r.length))){let n=e.slice(r.length).trimStart(),a=i().slice(0,i().length-e.length+r.length);mr(()=>{c()(_e(t.next)+n),j(t.next,a)});return}}}}),vn(()=>{i(),R(D,0)}),vn(()=>{let e=W(D);W(ve),W(fe)&&dr().then(()=>{let t=W(O)?.children[e];if(!t||!W(O))return;let n=W(O).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(W(O).scrollTop+=r.bottom-n.bottom)})});function Ce(e){W(D)!==e&&W(v)?.picker&&(R(k,``),R(b,``),R(x,0),R(_,``),E++),R(D,e,!0)}function we(){E++,R(g,!1),R(h,!1),R(ee,i()),f(),c()(i())}function Te(e){let t=!!W(te)?.contains(e.target);if(!W(h)||!W(fe)&&!W(y)&&!W(v)?.input||!W(me)&&!t||W(xe)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(W(v)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),we());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,o=e.key.toLowerCase()===`c`;if((o||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!o&&!r&&!n||e.key===`Tab`&&(W(y)||W(v)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!W(O)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||W(y)&&!t||W(y)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){we();return}if(W(g)||e.repeat&&(o||e.key===`Enter`))return;if(n){W(se)&&le();return}if(r){Ee(W(v)?.path||``,void 0,!0);return}if(o){(W(y)?.action||W(de)&&W(k))&&ke();return}if(W(y)){if(e.key===`Enter`&&W(ye)&&W(v)?.path.startsWith(`approve/`)&&!bo($.data?.confirmationMode,!!W(y).reversible)){ke();return}e.key===`Enter`&&W(y).action&&!W(ye)&&!W(_)&&Oe(W(y));return}if(e.key===`Enter`&&(W(v)?.path===``||W(v)?.path===`permissions`)&&/^\/permissions\s+\S/.test(i().trim())){j(i().trim().slice(1));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){Ce(Math.min(Math.max(W(D)+(e.key===`ArrowUp`?-1:1),0),Math.max(W(ve).length-1,0))),!W(de)&&W(O)?.contains(e.target)&&dr().then(()=>(W(O)?.children[W(D)])?.focus());return}if(e.key===`Enter`&&(W(v)?.path===``||W(v)?.path===`goal`)&&/^\/goal\s+\S/.test(i().trim())){let e=W(v)?.path===`goal`?W(ve).find(e=>ge(e).some(e=>i().trim().slice(6).trim().toLowerCase()===e.toLowerCase())):void 0;if(e){De(e);return}j(i().trim().slice(1));return}let s=W(ve)[W(D)];s&&(e.key===`Tab`?c()(s.label):W(de)?Oe(s):De(s))}vn(()=>{W(xe)&&!a()&&(E++,R(g,!1),f(),W(h)&&(R(h,!1),R(ee,i())),R(v,null),R(y,null))}),vn(()=>{W(me)&&!W(h)&&i()!==W(ee)&&(!W(xe)||a())&&(f(),R(h,!0),Ee(``))});async function Ee(e,n,r=!1,o=!1){if(!re()){ie();return}R(A,e.startsWith(`permissions `)||e.startsWith(`permissions/apply/`)?i():null,!0);let s=++E;if(R(w,``),W(v)&&R(v,{...W(v),path:e},!0),n&&R(C,n.input,!0),R(g,!0),R(y,null),R(k,``),R(b,``),R(x,0),R(_,``),a())R(v,d(),!0),R(D,n?.index??0,!0),R(g,!1);else try{let i=await Oa(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});s===E&&re()&&(i.choices||=[],(e===``||e===`help`)&&(i.choices=[...i.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...u()]),R(v,i,!0),R(D,n?Math.min(n.index,Math.max(i.choices.length-1,0)):i.picker?Math.max(i.choices.findIndex(e=>e.selected),0):0,!0),i.picker&&dr().then(()=>W(O)?.focus()),R(C,n?.input??i.value??``,!0),o&&i.input&&R(w,_e(i.path),!0),n&&dr().then(()=>{i.input?W(te)?.querySelector(`input`)?.focus():W(O)?.focus()}),i.inputReview&&i.choices.length===1&&(R(g,!1),De(i.choices[0])))}catch{s===E&&(R(_,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(R(v,d(),!0),R(_,``)):R(v,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{s===E&&R(g,!1)}}async function De(e){e.unavailable||W(g)||e.next&&await m(e.next)||W(_)||(W(v)?.picker?(Ce(W(ve).findIndex(t=>t.id===e.id)),e.action&&!bo($.data?.confirmationMode,!!e.reversible)?await Oe(e):W(O)?.focus()):e.next?await j(e.next):await Oe(e))}async function Oe(e){if(W(g)||W(xe)||!W(v)||e.unavailable||W(_)||!re())return;if(W(v).path.startsWith(`approve/`)&&W(y)?.id===e.id&&W(ye)&&!bo($.data?.confirmationMode,!!e.reversible)){await ke();return}let n=e.action&&!W(v).path.startsWith(`approve/`)&&!bo($.data?.confirmationMode,!!e.reversible);if(W(v).picker){if(W(ye)&&W(k)===e.id)return;R(k,e.id,!0)}else n||(R(y,e,!0),dr().then(()=>W(ne)?.focus()));if(R(b,``),R(x,0),R(_,``),!e.action)return;let r=++E;R(g,!0);try{let n=await Oa(`commands`,{session:t.session,command:{mode:`prepare`,path:W(v).path,revision:W(v).revision,choice:e.id}});if(r===E&&re()){let e=Date.parse(n.expires);if(!n.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);R(b,n.confirmation,!0),R(x,e,!0)}}catch{r===E&&R(_,`Option changed or unavailable. Refresh before retrying.`)}finally{r===E&&R(g,!1)}n&&r===E&&W(b)&&re()&&await ke()}async function ke(){if(!W(b)||!re()||W(xe)||W(g)||Date.now()>=W(x)||!W(v)||W(v).picker&&W(k)!==W(ve)[W(D)]?.id)return;let e=W(b);R(b,``),R(g,!0);let n=++E;try{let r=await Oa(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:W(v).path}});n===E&&(R(_,r.message,!0),R(h,!1),R(v,null),R(y,null),f(),R(ee,null),s()())}catch{n===E&&R(_,`Change unconfirmed. Check Codex before retrying.`)}finally{n===E&&R(g,!1)}}var Ae={handleKey:Te},je=Qo(),Me=z(je),Ne=H(Me,2),Pe=e=>{var t=Eo(),n=V(t,!0);U(()=>J(n,W(_))),q(e,t)};Y(Ne,e=>{W(_)&&!W(h)&&e(Pe)});var Fe=H(Ne,2),Ie=e=>{var i=Zo();let o;var s=z(i),c=e=>{var t=Ao(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=Oo();Z(t,21,()=>W(v).help.split(` -`),X,(e,t)=>{var n=Do(),r=V(n,!0);U(()=>{Q(n,`title`,W(t)),J(r,W(t))}),q(e,n)}),P(t),q(e,t)},o=e=>{var t=ko(),n=V(t,!0);U(()=>J(n,W(v)?.help||`Loading live options…`)),q(e,t)};Y(i,e=>{W(v)?.path===`goal`?e(a):e(o,-1)}),U(()=>J(r,W(v)?.title||`/ COMMANDS`)),q(e,t)};Y(s,e=>{W(Se)||e(c)});var l=H(s,2),u=e=>{var t=jo(),n=V(t,!0);U(()=>J(n,W(_))),q(e,t)};Y(l,e=>{W(_)&&e(u)});var d=H(l,2),f=e=>{q(e,Mo())};Y(d,e=>{W(g)&&e(f)});var p=H(d,2),m=e=>{var t=No(),r=z(t),i=z(r),o=H(i);Si(o),P(r),P(t),U(e=>{Q(t,`id`,`${n}-input`),J(i,`${e??``} `),Q(o,`aria-label`,W(v).inputLabel||`Session name`),Q(o,`maxlength`,W(v).inputLimit||512),o.disabled=W(g)||W(xe)&&!a()},[()=>(W(v).inputLabel||`Session name`).toUpperCase()]),Cr(`submit`,t,e=>{e.preventDefault(),ue()}),Di(o,()=>W(C),e=>R(C,e)),q(e,t)},h=e=>{var n=Fo(),r=z(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{var n=Po(),r=z(n),i=H(r),a=e=>{q(e,Pr(`Only this session's saved - name changes.`))},o=F(()=>W(v)?.path.startsWith(`rename/`)),s=e=>{q(e,Pr(`Only this session’s - directory changes; project configuration is not reloaded.`))},c=F(()=>W(v)?.path.startsWith(`cd/`)),l=e=>{q(e,Pr(`Only this session's goal - changes.`))},u=F(()=>W(v)?.path.startsWith(`goal/`)),d=e=>{q(e,Pr(`Records consent for - one exact retry, not execution. The retry still goes through - Codex's native reviewer.`))},f=F(()=>W(v)?.path.startsWith(`approve/`)),p=e=>{q(e,Pr(`Changes this - session's native permissions for subsequent turns, subject to - managed policy. Review carefully.`))},m=F(()=>W(v)?.path.startsWith(`permissions`)),h=e=>{q(e,Pr(`No change sent yet. Model, reasoning and speed settings can - change token usage and cost. Changes affect subsequent turns of - this session, not global defaults. Automatic quota thresholds - may later supersede model settings.`))};Y(i,e=>{W(o)?e(a):W(c)?e(s,1):W(u)?e(l,2):W(f)?e(d,3):W(m)?e(p,4):e(h,-1)}),P(n),U(()=>J(r,`TARGET // ${t.session??``}. `)),q(e,n)};Y(s,e=>{W(y).action&&e(c)}),P(n),Li(n,e=>R(ne,e),()=>W(ne)),U(()=>{J(i,W(y).label),J(o,W(y).help||`No additional help supplied by Codex.`)}),q(e,n)},w=e=>{var t=Ho(),i=B(t),a=e=>{var t=Io(),i=z(t);r(i),P(t),Li(t,e=>R(O,e),()=>W(O)),U(()=>Q(t,`aria-activedescendant`,`${n}-${W(D)}`)),q(e,t)},o=e=>{var t=Lo();let n;var i=z(t);r(i),P(t),Li(t,e=>R(O,e),()=>W(O)),U(()=>n=li(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:W(Se)})),q(e,t)};Y(i,e=>{W(de)?e(a):e(o,-1)});var s=H(i,2),c=e=>{var t=Bo(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=zo(),n=B(t),r=V(n),i=H(n,2),a=e=>{q(e,Ro())};Y(i,e=>{W(b)&&W(S)>=W(x)&&e(a)}),U(()=>J(r,`REVIEW // ${W(be).label??``}. No change sent yet.`)),q(e,t)};Y(i,e=>{W(be)&&e(a)}),U(()=>J(r,W(ve)[W(D)]?.help)),q(e,t)};Y(s,e=>{W(de)&&e(c)});var l=H(s,2),u=e=>{q(e,Vo())};Y(l,e=>{!W(g)&&!W(ve).length&&e(u)}),q(e,t)};Y(p,e=>{W(v)?.input?e(m):W(y)?e(h,1):e(w,-1)});var T=H(p,2),E=e=>{var t=Uo(),n=V(t,!0);U(()=>J(n,W(N).unavailable)),q(e,t)};Y(T,e=>{W(N)?.unavailable&&e(E)});var ee=H(T,2),k=e=>{q(e,Wo())};Y(ee,e=>{W(b)&&W(S)>=W(x)&&!W(de)&&e(k)});var A=H(ee,2),re=z(A),ie=e=>{var t=Fr(),r=B(t),i=e=>{var t=Go(),r=V(t,!0);U((e,i)=>{Q(t,`form`,`${n}-input`),t.disabled=e,J(r,i)},[()=>W(g)||W(xe)||!W(C).trim(),()=>bo($.data?.confirmationMode,!!W(v).reversibleInput)?`ENTER REVIEW`:`ENTER APPLY`]),q(e,t)},o=e=>{var t=Fr(),n=B(t),r=e=>{var t=Ko();U(()=>t.disabled=W(g)||W(xe)&&!a()),G(`click`,t,ke),q(e,t)},i=F(()=>W(ye)&&bo($.data?.confirmationMode,!!W(N).reversible)),o=e=>{var t=qo(),n=V(t,!0);U(e=>{t.disabled=W(g)||W(xe)&&!a(),J(n,e)},[()=>bo($.data?.confirmationMode,!!W(N).reversible)?`ENTER REVIEW`:`ENTER APPLY`]),G(`click`,t,()=>{W(N)&&Oe(W(N))}),q(e,t)};Y(n,e=>{W(i)?e(r):e(o,-1)}),q(e,t)},s=e=>{var t=qo(),n=V(t);U(()=>{t.disabled=W(g)||W(xe)&&!a(),J(n,`ENTER ${W(N).next?`OPEN`:`HELP`}`)}),G(`click`,t,()=>{W(N)&&De(W(N))}),q(e,t)};Y(r,e=>{W(v)?.input?e(i):W(N)?.action&&!W(N).unavailable?e(o,1):!W(y)&&W(N)&&!W(N).unavailable&&e(s,2)}),q(e,t)};Y(re,e=>{W(_)||e(ie)});var ae=H(re,2),oe=e=>{var t=Jo();U(()=>t.disabled=W(g)),G(`click`,t,le),q(e,t)};Y(ae,e=>{W(se)&&e(oe)});var ce=H(ae,2),j=e=>{var t=Yo();U(()=>t.disabled=W(g)),G(`click`,t,()=>Ee(W(v)?.path||``,void 0,!0)),q(e,t)};Y(ce,e=>{W(Se)||e(j)});var fe=H(ce,2);P(A);var pe=H(A,2),me=e=>{var t=Xo(),n=V(t);U(()=>J(n,`↑/↓ select${W(Se)?` · Tab complete`:``}`)),q(e,t)};Y(pe,e=>{!W(v)?.input&&!W(y)&&e(me)}),P(i),Li(i,e=>R(te,e),()=>W(te)),U(()=>{Q(i,`aria-label`,W(Se)?`Slash command suggestions`:`Session command options`),o=li(i,1,`svelte-7bfwr9`,null,o,{"command-popup":W(Se)})}),G(`keydown`,i,Te),G(`click`,fe,we),q(e,i)};return Y(Fe,e=>{W(h)&&e(Ie)}),P(je),U(()=>Me.disabled=W(xe)&&!a()||W(g)),G(`click`,Me,()=>{R(h,!W(h)),R(ee,W(h)?null:i(),!0),R(b,``),W(h)?(R(ae,[],!0),Ee(``)):we()}),q(e,je),We(Ae)}wr([`click`,`keydown`]);var es=K(` `,1),ts=K(`
`),ns=K(`
/
`);function rs(e,t){Ue(t,!0);let n=F(()=>t.lines.filter(e=>e.kind===`addition`).length),r=F(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=ns(),a=z(i),o=z(a),s=V(o),c=V(H(o,2));P(a),Z(H(a,2),17,()=>t.lines,X,(e,t)=>{var n=ts();let r;var i=z(n),a=e=>{var n=es(),r=B(n),i=V(r,!0),a=V(H(r),!0);U(()=>{J(i,W(t).old||``),J(a,W(t).new||``)}),q(e,n)};Y(i,e=>{W(t).kind!==`heading`&&W(t).kind!==`metadata`&&e(a)});var o=V(H(i),!0);P(n),U(()=>{r=li(n,1,`diff-line svelte-x4gtb6`,null,r,{added:W(t).kind===`addition`,removed:W(t).kind===`removal`,heading:W(t).kind===`heading`}),J(o,W(t).text)}),q(e,n)}),P(i),U(()=>{Q(a,`aria-label`,`${W(n)} lines added, ${W(r)} lines removed`),J(s,`+${W(n)??``}`),J(c,`−${W(r)??``}`)}),q(e,i),We()}var is=K(`

TOOL

 
`,1),as=K(`

TITLE

`,1),os=K(`

APP

`,1),ss=K(`

MCP TOOL APPROVAL

MCP SERVER

 

ARGUMENTS

 
`);function cs(e,t){Ue(t,!0);var n=ss(),r=H(z(n),2),i=V(r,!0),a=H(r,4),o=V(a,!0),s=H(a,2),c=e=>{var n=is(),r=V(H(B(n),2),!0);U(()=>J(r,t.details.name)),q(e,n)};Y(s,e=>{t.details.name&&e(c)});var l=H(s,2),u=e=>{var n=as(),r=V(H(B(n),2),!0);U(()=>J(r,t.details.title)),q(e,n)};Y(l,e=>{t.details.title&&e(u)});var d=H(l,2),f=e=>{var n=os(),r=V(H(B(n),2),!0);U(()=>J(r,t.details.connector)),q(e,n)};Y(d,e=>{t.details.connector&&e(f)});var p=V(H(d,4),!0);P(n),U(()=>{J(i,t.details.message),J(o,t.details.server),J(p,t.details.arguments||`—`)}),q(e,n),We()}var ls=K(`

 
`,1),us=K(`

`);function ds(e,t){Ue(t,!0);var n=us(),r=z(n),i=V(r,!0);Z(H(r,2),17,()=>t.review.fields||[],X,(e,t)=>{var n=ls(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{J(i,W(t).label),J(a,W(t).value)}),q(e,n)}),P(n),U(()=>{Q(n,`aria-label`,t.review.title),J(i,t.review.title)}),q(e,n),We()}var fs=K(`
 
`),ps=K(` `),ms=K(`

`),hs=K(`

`);function gs(e,t){Ue(t,!0);let n=Gi(t,`full`,3,!1);var r=hs();let i;var a=z(r),o=e=>{var n=fs(),r=V(n,!0);U(()=>J(r,t.assessment.subject)),q(e,n)};Y(a,e=>{!t.assessment.attached&&t.assessment.subject&&e(o)});var s=H(a,2),c=z(s),l=V(c,!0),u=H(c,2),d=z(u),f=H(d);P(u);var p=H(u,2),m=e=>{var n=ps(),r=V(n);U(e=>J(r,`RISK: ${e??``}`),[()=>t.assessment.risk.toUpperCase()]),q(e,n)};Y(p,e=>{t.assessment.risk&&e(m)});var h=H(p,2),g=e=>{var n=ps(),r=V(n);U(e=>J(r,`USER AUTHORISATION: ${e??``}`),[()=>t.assessment.authorization.toUpperCase()]),q(e,n)};Y(h,e=>{n()&&t.assessment.authorization&&e(g)}),P(s);var _=H(s,2),v=e=>{var n=ms(),r=V(n,!0);U(()=>J(r,t.assessment.rationale)),q(e,n)};Y(_,e=>{t.assessment.rationale&&e(v)}),P(r),U(()=>{i=li(r,1,`assessment svelte-16iojek`,null,i,{attached:t.assessment.attached}),Q(r,`aria-label`,t.assessment.title),J(l,t.assessment.title),Q(d,`data-status`,t.assessment.status),J(f,` ${t.assessment.decision??``}`)}),q(e,r),We()}var _s=K(`
 
`),vs=K(`

`),ys=K(``),bs=K(``),xs=K(`

Send this saved prompt now? This starts Codex work and consumes quota.

`,1),Ss=K(``),Cs=K(`

In memory only. Closing Codexometer cancels pending work.

`),ws=K(`

HUMAN APPROVAL REQUIRED

Managed policy requires approval each time.

`,1),Ts=K(`

CURRENT PROFILE

MODEL / REASONING LEVEL / SPEED

 

PROPOSED PROFILE

MODEL / REASONING LEVEL / SPEED

 

Applied settings remain after Codexometer closes.

`,1),Es=K(`

`),Ds=K(`

 
`,1),Os=K(`

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

`),ks=K(`

Session controls temporarily unavailable. Check Codex for current state.

`),As=K(`

Checking session controls…

`),js=K(`

`),Ms=K(`
About browser controls

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

`),Ns=K(` `,1),Ps=K(` `),Fs=K(`Grants permission beyond this one action. Check the scope - carefully.`),Is=K(``),Ls=K(``),Rs=K(``),zs=K(``),Bs=K(`

Not before this time; when quota and idle allow.

`),Vs=K(`

`,1),Hs=K(`

The existing trigger remains active until saved or deleted. If - it changes or sends while you edit, saving is blocked.

`),Us=K(` `,1),Ws=K(``),Gs=K(``),Ks=K(``),qs=K(` `,1),Js=K(`
  • `),Ys=K(`
    View fixed choices

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

      `),Xs=K(` `,1),Zs=K(`

      `),Qs=K(`

      `,1),$s=K(` `,1),ec=K(``),tc=K(`

      `,1),nc=K(`

      `);function rc(e,t){Ue(t,!0);let n=[],r=Gi(t,`observedCommand`,3,``),i=Gi(t,`observedFileChanges`,19,()=>[]),a=Gi(t,`review`,3,``),o=Gi(t,`suspended`,3,!1),s=Gi(t,`openScheduler`,3,!1),c=Gi(t,`onProtectedChange`,3,e=>{}),l=Gi(t,`oncopy`,3,()=>{}),u=L(null),d=L(Yt([])),f=L(null),p=L(``),m=L(0),h=L(Yt(Date.now())),g=L(!1),_=L(``),v=L(!1),y=L(!1),b=L(``),x=L(!1),S=L(``),C=L(!1),w=L(``),T=L(``),E=L(0),D=L(`now`),ee=L(60),O=L(``),te=L(!1),ne=L(``),k=L(Yt([])),A=F(()=>W(k).find(e=>e.status!==`sent`)),re=L(void 0),ie=L(void 0);function ae(e){if(W(x)){dr().then(()=>W(re)?.focus());return}if(e.resumeGoal||e.status!==`pending`||W(g)||!W(u)?.id||W(u).kind!==`prompt`||W(u).questions?.length)return;R(x,!0),R(S,e.id,!0),dr().then(()=>W(re)?.focus()),R(d,[e.text],!0),R(D,e.trigger===`quota`?`quota`:`at`,!0),R(p,``),R(w,``);let t=new Date(e.at||0);e.trigger!==`quota`&&R(O,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}vn(()=>{s()&&W(A)&&!W(A).resumeGoal&&!W(C)&&W(u)?.id&&W(u).kind===`prompt`&&!W(u).questions?.length&&(R(C,!0),ae(W(A)))});async function oe(){if(!a())try{R(k,await Oa(`schedules`,{session:t.session},ye.signal),!0),W(x)&&!W(k).some(e=>e.id===W(S)&&e.status===`pending`)&&R(p,``),W(w)&&!W(k).some(e=>e.id===W(w)&&e.status===`pending`)&&(R(p,``),R(w,``))}catch{}}async function se(e){if(bo($.data?.confirmationMode,!0)&&(W(T)!==e||W(h)>=W(E))){R(T,e,!0),R(E,W(h)+3e4);return}R(T,``);let n=W(k).some(t=>t.id===e&&t.resumeGoal);try{R(k,await Oa(`schedules`,{session:t.session,cancelId:e},ye.signal),!0),R(x,!1),R(p,``),R(w,``),n||R(d,[],!0)}catch(e){R(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}vn(()=>(c()(W(g)||W(d).some(e=>e.length>0)),()=>c()(!1)));let ce=F(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),j=F(()=>!$.connected||!!$.data?.sessionsError),le=F(()=>a()!==`profile`&&W(u)?.kind===`prompt`&&!W(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),ue=F(()=>!W(j)&&!W(y)&&!!W(u)?.id&&W(u).kind===`approval`&&W(b)!==W(u).id),de=F(()=>W(ue)?W(u).command:r()),fe=F(()=>!!W(p)&&W(h)bo($.data?.confirmationMode,W(u)?.kind===`approval`?W(f)!==null&&!W(u).choices?.[W(f)]?.persistent:W(u)?.kind===`profile`?W(f)===1:!(W(u)?.kind!==`prompt`||W(w)||W(x)||!W(u).questions?.length&&W(D)!==`now`))),me=F(()=>W(u)?.questions?.length?W(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),he=F(()=>W(u)?.kind===`approval`||W(u)?.kind===`profile`?W(f)!==null:W(d).length===W(me).length&&W(d).every((e,t)=>e.trim().length>0&&(W(me)[t].freeText||W(me)[t].options?.includes(e)))),ge=F(()=>W(u)?.kind===`prompt`&&!W(u).questions?.length&&W(D)!==`now`);vn(()=>{W(A)?.resumeGoal&&R(D,`now`)});let _e=F(()=>W(D)===`delay`?W(h)+W(ee)*6e4:Date.parse(W(O))),M=F(()=>{if(!W(ge))return``;if(W(x)&&!W(k).some(e=>e.id===W(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!W(d)[0]?.trim())return`Enter a message to schedule.`;if(W(D)===`quota`)return``;if(!Number.isFinite(W(_e))||W(_e)<=W(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(W(h));return e.setFullYear(e.getFullYear()+1),W(_e)>=e.getTime()?`Choose a time within one year.`:``});function ve(e){return e===void 0?`Not yet available`:new Date(e).toLocaleString([],{timeZoneName:`short`})}function N(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&e.at&&Date.parse(e.at)>W(h))return`Due in `+Math.ceil((Date.parse(e.at)-W(h))/6e4)+` min`;let t=W(j)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}vn(()=>{(W(j)||o()||W(le)||W(h)>=W(m))&&R(p,``)});let ye=new AbortController;Ki(()=>{let e=e=>{!ba.ids.length&&e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&W(A)&&!W(A).resumeGoal&&(e.preventDefault(),ae(W(A)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{R(h,Date.now(),!0)},1e3);async function i(){await oe();try{let e=await Oa(`offer`,{session:t.session,...a()?{review:a()}:{}},ye.signal);if(ye.signal.aborted)return;R(y,!1),W(u)?.id!==e.id&&(R(p,``),R(f,null),R(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),R(u,e,!0),W(v)&&e.id&&e.id!==W(b)&&(R(_,``),R(v,!1))}catch{ye.signal.aborted||(R(u,null),R(y,!0),R(p,``))}finally{ye.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),ye.abort(),clearTimeout(n),clearInterval(r)}});async function be(e){if(!e&&W(u)?.kind===`prompt`&&!W(u).questions?.length&&W(d)[0]?.trim().startsWith(`/`)&&!W(d)[0]?.trim().startsWith(`//`)){R(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!W(u)?.id||W(g)||W(j)||o()||W(le)||(e?!e.canSend:!W(he)||W(M)))return;let n=W(u).id;R(g,!0),R(_,``),R(v,!1),R(p,``),R(w,e?.id||``,!0);try{let r=!e&&W(u).kind===`prompt`&&!W(u).questions?.length&&W(D)!==`now`?{trigger:W(D)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...W(D)===`quota`?{}:{at:(W(D)===`delay`?new Date(Date.now()+W(ee)*6e4):new Date(W(O))).toISOString()}}:void 0;R(te,!!r),R(ne,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ve(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await Oa(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&W(x)?{editId:W(S)}:{},...W(u).kind===`approval`||W(u).kind===`profile`?{choice:W(f)}:{answers:e?[e.text]:[...W(d)]}},ye.signal);W(u)?.id!==n||ye.signal.aborted||W(j)||o()||W(le)||(R(p,i.confirmation,!0),R(m,Date.parse(i.expires),!0))}catch(e){ye.signal.aborted||R(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{R(g,!1)}!W(pe)&&W(p)&&!ye.signal.aborted&&await Se()}async function Se(){if(!W(u)?.id||W(g)||o()||W(le)||!W(fe))return;let e=W(u).id,n=W(u).kind,r=W(p);R(p,``),R(g,!0),R(b,e,!0);try{await Oa(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},ye.signal),R(v,!0),R(x,!1),W(te)&&(R(b,``),await oe()),R(_,W(te)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){R(_,e instanceof _a?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{R(g,!1),R(w,``),await oe(),R(d,[],!0),R(f,null)}}var Ce=Ns(),we=B(Ce),Te=e=>{var t=Fr();Z(B(t),17,()=>W(k).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=Cs(),r=z(n),i=V(r,!0),a=H(r,2),s=V(a),c=H(a,2),l=V(c,!0),d=H(c,2),f=V(d,!0),m=H(d,2),v=e=>{var n=_s(),r=V(n,!0);U(()=>J(r,W(t).text)),q(e,n)};Y(m,e=>{W(t).resumeGoal||e(v)});var y=H(m,2),b=e=>{var t=vs(),n=V(t,!0);U(()=>J(n,W(_))),q(e,t)};Y(y,e=>{W(_)&&e(b)});var x=H(y,2),S=H(z(x)),C=e=>{q(e,Pr(`Follows session model, reasoning and speed.`))};Y(S,e=>{W(t).resumeGoal||e(C)}),P(x);var D=H(x,2),ee=e=>{var n=ys();U(()=>n.disabled=W(g)||!W(u)?.id||W(u).kind!==`prompt`||!!W(u).questions?.length||W(t).status!==`pending`),G(`click`,n,()=>ae(W(t))),q(e,n)};Y(D,e=>{W(t).resumeGoal||e(ee)});var O=H(D,2),te=V(O,!0),ne=H(O,2),k=e=>{var t=bs();G(`click`,t,()=>{R(T,``)}),q(e,t)};Y(ne,e=>{W(T)===W(t).id&&W(h){},ie=e=>{var n=xs(),r=H(B(n),2),i=H(r,2);U(()=>r.disabled=W(g)||W(j)||!W(t).canSend),G(`click`,r,Se),G(`click`,i,()=>{R(p,``),R(w,``)}),q(e,n)},oe=e=>{var n=Ss();U(()=>n.disabled=W(g)||W(j)||!W(t).canSend||o()),G(`click`,n,()=>be(W(t))),q(e,n)};Y(A,e=>{W(t).resumeGoal?e(re):W(fe)&&W(w)===W(t).id?e(ie,1):e(oe,-1)}),P(n),U((e,n)=>{J(i,W(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:W(t).resumeGoal?`SCHEDULED GOAL RESUME`:`SCHEDULED FOLLOW-UP`),J(s,`TARGET // ${W(t).session??``}`),J(l,e),J(f,n),O.disabled=W(g)||W(t).status===`sending`,J(te,W(T)===W(t).id&&W(h)W(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ve(W(t).at)}`,()=>N(W(t))]),G(`click`,O,()=>se(W(t).id)),q(e,n)}),q(e,t)},Ee=F(()=>!a()&&W(u)?.kind!==`approval`&&!W(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(ce)||``));Y(we,e=>{W(Ee)&&e(Te)});var De=H(we,2),Oe=e=>{var r=nc(),o=z(r),s=V(o,!0),c=H(o,2),S=e=>{var t=ws();xe(2),q(e,t)};Y(c,e=>{W(u)?.requiredHumanApproval&&!W(j)&&!W(y)&&e(S)});var C=H(c,2),w=e=>{var t=Ts(),n=B(t),r=V(n),i=H(n,6),a=V(i,!0),o=V(H(i,6),!0);xe(2),U(()=>{J(r,`Your ${W(u).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),J(a,W(u).profile.current),J(o,W(u).profile.proposed)}),q(e,t)};Y(C,e=>{W(u)?.profile&&!W(j)&&!W(y)&&e(w)});var T=H(C,2),E=e=>{var t=Es();let n;var r=V(t,!0);U(()=>{n=li(t,1,`svelte-1oupzfc`,null,n,{notice:!W(v),sent:W(v)}),J(r,W(_))}),q(e,t)};Y(T,e=>{W(_)&&e(E)});var k=H(T,2),ae=e=>{ds(e,{get review(){return W(u).approvalReview}})},oe=e=>{cs(e,{get details(){return W(u).mcpTool}})},se=e=>{rs(e,{get lines(){return W(u).fileChanges}})},le=e=>{rs(e,{get lines(){return i()}})},ge=e=>{ds(e,{get review(){return t.observedAction}})},N=e=>{var n=Ds(),r=B(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{gs(e,{get assessment(){return t.observedReview},full:!0})};Y(s,e=>{t.observedReview&&(!W(ue)||W(u)?.reviewId===t.observedReview.id)&&e(c)}),U(()=>{J(i,W(ue)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(o,W(de))}),q(e,n)},ye=e=>{q(e,Os())};Y(k,e=>{W(u)?.approvalReview&&!W(j)&&!W(y)?e(ae):W(u)?.mcpTool&&!W(j)&&!W(y)?e(oe,1):W(u)?.fileChanges?.length&&!W(j)&&!W(y)?e(se,2):i().length?e(le,3):t.observedAction&&!W(u)?.id&&!W(de)&&a()!==`profile`?e(ge,4):W(de)?e(N,5):a()!==`profile`&&W(ce)===`APPROVAL NEEDED`&&!W(v)&&e(ye,6)});var Ce=H(k,2),we=e=>{q(e,ks())},Te=e=>{q(e,As())},Ee=e=>{var t=Ns(),n=B(t),r=e=>{var t=js(),n=V(t,!0);U(e=>J(n,e),[()=>W(ce)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(ce)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(W(ce)===`WORKING`||!W(v)&&!W(g))&&e(r)});var i=H(n,2),a=e=>{q(e,Ms())},o=F(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(ce)||``)&&!W(v));Y(i,e=>{W(o)&&e(a)}),q(e,t)},De=e=>{var r=tc(),i=B(r),o=V(i),s=H(i,2),c=z(s),_=V(c,!0),v=H(c,2),y=e=>{var r=Fr();Z(B(r),17,()=>W(u).choices||[],X,(e,r,i)=>{var o=Is(),s=z(o);Si(s),s.value=s.__value=i;var c=H(s),l=H(c),u=e=>{var t=Ps(),n=V(t,!0);U(()=>J(n,W(r).detail)),q(e,t)};Y(l,e=>{W(r).detail&&e(u)});var d=H(l,2),p=e=>{q(e,Fs())};Y(d,e=>{W(r).persistent&&e(p)}),P(o),U(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),J(c,` ${W(r).label??``} `)}),ki(n,[],s,()=>W(f),e=>R(f,e)),q(e,o)}),q(e,r)},b=e=>{var n=Ns(),r=B(n),i=e=>{var t=Us(),n=B(t),r=H(z(n)),i=z(r),a=e=>{var t=Ls();t.value=t.__value=`now`,q(e,t)};Y(i,e=>{W(x)||e(a)});var o=H(i);o.value=o.__value=`quota`;var s=H(o);s.value=s.__value=`delay`;var c=H(s);c.value=c.__value=`at`,P(r),hi(r),P(n);var l=H(n,2),u=e=>{var t=Rs(),n=H(z(t));Si(n),P(t),Di(n,()=>W(ee),e=>R(ee,e)),q(e,t)};Y(l,e=>{W(D)===`delay`&&e(u)});var d=H(l,2),f=e=>{var t=zs(),n=H(z(t));Si(n),P(t),Di(n,()=>W(O),e=>R(O,e)),q(e,t)};Y(d,e=>{W(D)===`at`&&e(f)});var p=H(d,2),m=e=>{var t=Vs(),n=B(t),r=V(n),i=H(n,2),a=e=>{q(e,Bs())};Y(i,e=>{W(D)!==`quota`&&e(a)});var o=H(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. - One pending request per session; saving replaces it. Memory - only; Codexometer must stay running. Uses session model, - reasoning and speed.`,U(e=>J(r,`Will send: ${e??``}`),[()=>W(D)===`quota`?`when quota is available and this session is idle`:Number.isFinite(W(_e))?ve(W(_e)):`choose a date and time`]),q(e,t)};Y(p,e=>{W(D)!==`now`&&e(m)});var h=H(p,2),g=e=>{q(e,Hs())};Y(h,e=>{W(x)&&e(g)}),gi(r,()=>W(D),e=>R(D,e)),q(e,t)};Y(r,e=>{!W(u).questions?.length&&!W(A)?.resumeGoal&&e(i)}),Z(H(r,2),17,()=>W(me),X,(e,n,r)=>{var i=Xs(),o=B(i),s=e=>{{let n=F(()=>W(d)[0]||``);Li($o(e,{get session(){return t.session},get oncopy(){return l()},get query(){return W(n)},oncomplete:e=>{R(d,[e],!0),dr().then(()=>W(re)?.focus())},onchange:()=>{R(d,[``],!0),dr().then(()=>W(re)?.focus())}}),e=>R(ie,e,!0),()=>W(ie))}};Y(o,e=>{r===0&&a()!==`profile`&&W(u).kind===`prompt`&&!W(u).questions?.length&&e(s)});var c=H(o,2),f=z(c),p=H(f),m=e=>{var t=Ws();Si(t),Di(t,()=>W(d)[r],e=>W(d)[r]=e),q(e,t)},h=e=>{var t=Ks(),i=z(t);i.value=i.__value=``,Z(H(i),17,()=>W(n).options||[],X,(e,t)=>{var n=Gs(),r=V(n,!0),i={};U(()=>{J(r,W(t)),i!==(i=W(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),P(t),hi(t),gi(t,()=>W(d)[r],e=>W(d)[r]=e),q(e,t)},g=e=>{var t=qs(),i=B(t);tt(i),Li(i,e=>R(re,e),()=>W(re));var a=H(i,2),o=e=>{var t=js(),r=V(t);U(e=>J(r,`Suggested answers: ${e??``}`),[()=>W(n).options.join(` · `)]),q(e,t)};Y(a,e=>{W(n).options?.length&&e(o)}),G(`keydown`,i,e=>{W(u)?.kind===`prompt`&&!W(u).questions?.length&&W(ie)?.handleKey(e)}),Di(i,()=>W(d)[r],e=>W(d)[r]=e),q(e,t)};Y(p,e=>{W(n).secret?e(m):W(n).freeText?e(g,-1):e(h,1)}),P(c);var _=H(c,2),v=e=>{var t=Ys(),r=H(z(t),4);Z(r,21,()=>W(n).options||[],X,(e,t)=>{var n=Js(),r=V(n,!0);U(()=>J(r,W(t))),q(e,n)}),P(r),P(t),q(e,t)};Y(_,e=>{W(n).secret&&!W(n).freeText&&e(v)}),U(()=>J(f,`${W(n).text??``} `)),q(e,i)}),q(e,n)};Y(v,e=>{W(u).kind===`approval`||W(u).kind===`profile`?e(y):e(b,-1)}),P(s);var S=H(s,2),C=e=>{var t=Qs(),n=B(t),r=e=>{var t=Zs(),n=V(t);U(()=>J(n,`TRIGGER // ${W(ne)??``}`)),q(e,t)};Y(n,e=>{W(te)&&e(r)});var i=H(n,2),a=V(i),o=H(i,2),s=V(o),c=H(o,2);U(e=>{J(a,`Check the target and ${W(u).kind===`profile`?`profile above`:W(u).kind===`approval`?W(u).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${W(te)?`This schedules a follow-up that will send automatically when eligible`:`This will send to Codex`}; it may start work using your quota. - Confirmation expires in ${e??``}s.`),o.disabled=W(g)||W(j),J(s,`CONFIRM ${(W(u).kind===`approval`||W(u).kind===`profile`?W(u).choices?.[W(f)]?.label:W(te)?W(x)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((W(m)-W(h))/1e3))]),G(`click`,o,Se),G(`click`,c,()=>{R(p,``)}),q(e,t)},w=e=>{var t=$s(),n=B(t),r=e=>{var t=vs(),n=V(t,!0);U(()=>J(n,W(M))),q(e,t)};Y(n,e=>{W(M)&&e(r)});var i=H(n,2),a=V(i,!0);U(()=>{i.disabled=W(g)||W(j)||!W(he)||!!W(M),J(a,W(g)?`SENDING…`:W(pe)?W(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`:W(x)?`SAVE CHANGES`:W(u).kind===`approval`||W(u).kind===`profile`?`SEND DECISION`:W(u).kind===`prompt`&&!W(u).questions?.length&&W(D)!==`now`?`SET TRIGGER`:`SEND`)}),G(`click`,i,()=>be()),q(e,t)};Y(S,e=>{W(fe)&&W(pe)?e(C):e(w,-1)});var T=H(S,2),E=e=>{var t=ec();G(`click`,t,()=>{R(x,!1),R(p,``),R(d,[],!0)}),q(e,t)};Y(T,e=>{W(x)&&e(E)}),U(()=>{J(o,`TARGET // ${W(u).thread??``} // ${(W(u).directory||`Directory unavailable`)??``}`),s.disabled=W(g)||W(fe)||W(j),J(_,W(u).kind===`approval`||W(u).kind===`profile`?`Choose a decision`:W(x)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),q(e,r)};Y(Ce,e=>{W(j)||W(y)?e(we):W(u)?W(u).id?W(b)!==W(u).id&&e(De,3):e(Ee,2):e(Te,1)}),P(r),U(()=>J(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(De,e=>{!W(le)&&(!W(A)||W(A).resumeGoal||W(x)||a()||W(u)?.kind!==`prompt`||W(u).questions?.length)&&e(Oe)}),q(e,Ce),We()}wr([`click`,`keydown`]);var ic=(e,t=f)=>{var n=Fr(),r=B(n),i=e=>{var n=uc(),r=V(n,!0);U(()=>J(r,t().text)),q(e,n)},a=e=>{var n=Pr();U(()=>J(n,t().text)),q(e,n)};Y(r,e=>{t().code?e(i):e(a,-1)}),q(e,n)},ac=(e,t=f)=>{var n=Fr(),r=B(n),i=e=>{var n=dc();ic(z(n),t),P(n),q(e,n)},a=e=>{ic(e,t)};Y(r,e=>{t().italic?e(i):e(a,-1)}),q(e,n)},oc=(e,t=f)=>{var n=Fr();Z(B(n),17,t,X,(e,t)=>{var n=Fr(),r=B(n),i=e=>{var n=fc();ac(z(n),()=>W(t)),P(n),q(e,n)},a=e=>{ac(e,()=>W(t))};Y(r,e=>{W(t).bold?e(i):e(a,-1)}),q(e,n)}),q(e,n)},sc=(e,t=f)=>{var n=Fr();Z(B(n),17,()=>lc(t()),X,(e,t)=>{let n=F(()=>W(t)[0].threadId);var r=Fr(),i=B(r),a=e=>{var r=pc();oc(z(r),()=>W(t)),P(r),G(`click`,r,()=>xa(W(n))),q(e,r)},o=e=>{oc(e,()=>W(t))};Y(i,e=>{W(n)?e(a):e(o,-1)}),q(e,r)}),q(e,n)},cc=e=>e===`right`||e===`center`?e:`left`;function lc(e){let t=[];for(let n of e||[]){let e=t.at(-1);!e||n.threadStart||e[0].threadId!==n.threadId?t.push([n]):e.push(n)}return t}var uc=K(` `),dc=K(``),fc=K(``),pc=K(``),mc=K(``),hc=K(``),gc=K(``),_c=K(`
      `),vc=K(`
      `),yc=K(`
      `);function bc(e,t){Ue(t,!0);var n=yc();Z(n,21,()=>t.blocks,X,(e,t)=>{var n=Fr(),r=B(n),i=e=>{var n=_c(),r=z(n),i=z(r),a=z(i);Z(a,21,()=>W(t).rows[0]||[],X,(e,n,r)=>{var i=mc();let a;sc(z(i),()=>W(n)),P(i),U(e=>a=di(i,``,a,{"text-align":e}),[()=>cc(W(t).align?.[r])]),q(e,i)}),P(a),P(i);var o=H(i);Z(o,21,()=>W(t).rows.slice(1),X,(e,n)=>{var r=gc();Z(r,21,()=>W(n)||[],X,(e,n,r)=>{var i=hc();let a;sc(z(i),()=>W(n)),P(i),U(e=>a=di(i,``,a,{"text-align":e}),[()=>cc(W(t).align?.[r])]),q(e,i)}),P(r),q(e,r)}),P(o),P(r),P(n),q(e,n)},a=e=>{var n=vc();sc(z(n),()=>W(t).runs),P(n),q(e,n)};Y(r,e=>{W(t).rows?.length?e(i):e(a,-1)}),q(e,n)}),P(n),q(e,n),We()}wr([`click`]);var xc=K(` `);function Sc(e,t){Ue(t,!0);let n=Gi(t,`stale`,3,!1),r=F(()=>n()||!!t.goal?.stale);var i=Fr(),a=B(i),o=e=>{var n=xc();let i;var a=V(n,!0);U((e,o)=>{i=li(n,1,`goal-status svelte-1yfu3xi`,null,i,{stale:W(r),pursuing:!W(r)&&t.goal.status===`active`,blocked:e}),Q(n,`title`,o),J(a,W(r)?`GOAL STALE`:t.goal.label)},[()=>!W(r)&&[`blocked`,`usageLimited`,`budgetLimited`].includes(t.goal.status),()=>t.goal.objective+` -`+t.goal.tokensUsed.toLocaleString()+(t.goal.tokenBudget===null?` tokens`:` / `+t.goal.tokenBudget.toLocaleString()+` tokens`)]),q(e,n)};Y(a,e=>{t.goal&&e(o)}),q(e,i),We()}var Cc=K(` `,1),wc=K(`
      `),Tc=K(`

      STATUS LINE // CODEXOMETER

      Choose multiple fields and their order. These display preferences do not - change Codex CLI configuration. Missing values are omitted.

      `),Ec=K(`

      `,1);function Dc(e,t){Ue(t,!0);let n=Gi(t,`stale`,3,!1),r=L(Yt([])),i=L(!1),a=F(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??W(a).filter(e=>e.default).map(e=>e.id))].filter(e=>W(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=F(()=>[...W(r).map(e=>W(a).find(t=>t.id===e)).filter(Boolean),...W(a).filter(e=>!W(r).includes(e.id))]);vn(()=>{sa.open&&!W(i)?(R(r,o(oa.statusLine),!0),R(i,!0)):sa.open||R(i,!1)});function l(e,t){R(r,t?[...W(r),e]:W(r).filter(t=>t!==e),!0)}function u(e,t){let n=W(r).indexOf(e),i=n+t;if(n<0||i<0||i>=W(r).length)return;let a=[...W(r)];[a[n],a[i]]=[a[i],a[n]],R(r,a,!0)}var d=Ec(),p=B(d),m=e=>{var t=Tc(),n=H(z(t),4);Z(n,21,()=>W(c),e=>e.id,(e,t)=>{var n=wc(),i=z(n),a=z(i);Si(a);var o=H(a,1,!0),s=V(H(o),!0);P(i);var c=H(i,2),d=e=>{var n=Cc(),i=B(n),a=H(i,2);U((e,n)=>{Q(i,`aria-label`,`Move `+W(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+W(t).label+` later`),a.disabled=n},[()=>W(r).indexOf(W(t).id)===0,()=>W(r).indexOf(W(t).id)===W(r).length-1]),G(`click`,i,()=>u(W(t).id,-1)),G(`click`,a,()=>u(W(t).id,1)),q(e,n)},f=F(()=>W(r).includes(W(t).id));Y(c,e=>{W(f)&&e(d)}),P(n),U(e=>{Q(i,`title`,W(t).help),Ci(a,e),J(o,W(t).label),J(s,W(t).help)},[()=>W(r).includes(W(t).id)]),G(`change`,a,e=>l(W(t).id,e.currentTarget.checked)),q(e,n)}),P(n);var i=H(n,2),a=V(i),o=H(i,2),d=H(o,2);P(t),U(e=>J(a,`Preview // ${e??``}`),[()=>s(W(r))||`—`]),G(`click`,o,()=>{oa.statusLine=[...W(r)],la(),sa.open=!1}),G(`click`,d,()=>{sa.open=!1}),q(e,t)};Y(p,e=>{sa.open&&e(m)});var h=H(p,2),g=z(h),_=V(g,!0),v=H(g,2);{let e=F(()=>n()||!$.connected||!!$.data?.sessionsError);Sc(v,{get goal(){return t.session.goal},get stale(){return W(e)}})}var y=H(v,2);ni(H(y,2),()=>t.children??f),P(h),U((e,t)=>{Q(g,`title`,e),J(_,t)},[()=>s(oa.statusLine),()=>s(oa.statusLine)]),G(`click`,y,()=>{sa.open=!sa.open}),q(e,d),We()}wr([`change`,`click`]);var Oc=K(`
      `);function kc(e,t){Ue(t,!0);let n=Gi(t,`active`,3,!1),r=Gi(t,`compact`,3,!1),i=F(()=>xo(t.session)),a=F(()=>!!W(i)),o=L(!1),s=L(``),c=L(!1);vn(()=>{if(!W(c))return;let e=setTimeout(()=>{R(c,!1)},150);return()=>clearTimeout(e)}),vn(()=>{W(i),t.session.status,R(s,``)});async function l(){if(!W(a)||W(o))return;let e=W(i);R(o,!0),R(c,!0),R(s,``);try{await navigator.clipboard.writeText(e),W(i)===e&&R(s,`Copied.`)}catch{W(i)===e&&R(s,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{R(o,!1)}}function u(e){!n()||!W(a)||ba.ids.length||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(),l())}var d={copy:l},f=Fr();Cr(`keydown`,Qt,u);var p=B(f),m=e=>{var t=Oc();let n;var i=z(t),a=V(i,!0),u=H(i,2);let d;P(t),U(()=>{n=li(t,1,`session-copy svelte-543j00`,null,n,{compact:r()}),J(a,W(s)),u.disabled=W(o),d=li(u,1,`svelte-543j00`,null,d,{flashed:W(c)})}),G(`click`,u,l),q(e,t)};return Y(p,e=>{W(a)&&e(m)}),q(e,f),We(d)}wr([`click`]);var Ac=K(``);function jc(e,t){Ue(t,!0);let n=Gi(t,`field`,15),r=Gi(t,`value`,15,``),i=Gi(t,`disabled`,3,!1);var a=Ac(),o=H(z(a),2);Si(o),Li(o,e=>n(e),()=>n()),P(a),U(()=>{Q(o,`aria-label`,t.label),Q(o,`placeholder`,t.placeholder),o.disabled=i()}),G(`keydown`,o,function(...e){t.onkeydown?.apply(this,e)}),Di(o,r),q(e,a),We()}wr([`keydown`]);var Mc=K(`

      `),Nc=K(`

      View this reply in Codex.

      `),Pc=K(`

      `),Fc=K(` `,1);function Ic(e,t){Ue(t,!0);let n=Gi(t,`unverified`,3,!1);var r=Fr();Z(B(r),17,()=>[...t.turns||[]].reverse(),X,(e,t)=>{var n=Fc(),r=B(n),i=e=>{var n=Mc(),r=V(n,!0);U(()=>J(r,W(t).task)),q(e,n)};Y(r,e=>{W(t).task&&e(i)});var a=H(r,2),o=e=>{q(e,Nc())},s=e=>{bc(e,{get blocks(){return W(t).prose}})},c=e=>{var n=Pc(),r=V(n,!0);U(()=>J(r,W(t).reply)),q(e,n)};Y(a,e=>{W(t).restricted?e(o):W(t).prose?.length?e(s,1):W(t).reply&&e(c,2)}),q(e,n)},e=>{var t=Pc(),r=V(t,!0);U(()=>J(r,n()?`Could not verify which completed turns belong to this agent.`:`No completed turns available.`)),q(e,t)}),q(e,r),We()}var Lc=K(`

      SAVED // SESSIONS

      `,1),Rc=K(`

      `),zc=K(`
      SessionTime ago
      `),Bc=K(``),Vc=K(`

      `),Hc=K(``),Uc=K(`

      If this session has an active goal, Codex may continue it - automatically.

      `,1),Wc=K(`
      `,1),Gc=K(` `,1),Kc=K(`

      Loading saved sessions…

      `),qc=K(`

      `),Jc=K(``),Yc=K(`
      `);function Xc(e,t){Ue(t,!0);let n=Gi(t,`resumeBusy`,15,!1),r=L(``),i=L(void 0),a=L(Yt([])),o=L(``),s=L(``),c=L(void 0),l=L(!1),u=L(!1),d=L(``),f=L(``),p=L(null),m=L(Yt(Date.now())),h,g,_=!1,v=F(()=>n()||!!W(d)),y=F(()=>W(a).filter(e=>!!t.target||!t.liveIDs.has(e.id)||e.id===W(d)));async function b(e,n=``,i=W(r).trim()){g?.abort();let d=new AbortController;g=d,R(s,n,!0),R(c,void 0),R(l,!0),R(u,!1);try{if(!Da)throw Error();let r=await Da(t.scope,e,n,d.signal,i);if(d.signal.aborted)return;if(n)R(c,r.turns||[],!0);else{let t=new Set(W(a).map(e=>e.id));R(a,[...W(a),...(r.sessions||[]).filter(e=>!t.has(e.id)&&t.add(e.id)).map(t=>({...t,cursor:t.listCursor||e}))],!0),R(o,r.next===e?``:r.next||``,!0)}}catch{d.signal.aborted||(R(u,!0),(!e||n)&&(R(a,[],!0),R(o,``)),R(c,void 0))}finally{d.signal.aborted||R(l,!1)}}Ki(()=>{W(i)?.focus();let e=setInterval(()=>R(m,Date.now(),!0),15e3);return()=>{_=!0,g?.abort(),clearTimeout(h),clearInterval(e)}});function x(e,t){if(!e||e<0)return`—`;let n=Math.floor(Math.max(t/1e3-e,0)/60);return n>=1440?`${Math.floor(n/1440)}d ago`:n>=60?`${Math.floor(n/60)}h ago`:n?`${n}m ago`:`Just now`}vn(()=>{if(t.target){R(a,[{...t.target.row,cursor:``}],!0),R(s,t.target.row.id,!0),R(c,t.target.turns||[],!0);return}let e=W(r).trim(),n=requestAnimationFrame(()=>void b(``,``,e));return mr(()=>{g?.abort(),R(l,!0),R(u,!1),R(a,[],!0),R(s,``),R(p,null),R(c,void 0),R(o,``)}),()=>cancelAnimationFrame(n)}),vn(()=>{W(d)&&t.liveIDs.has(W(d))&&(location.hash=`/sessions/`+encodeURIComponent(W(d)),t.target?ba.ids=[]:ya.open=!1)});async function S(e){if(!Ea||W(v))return;let r=bo($.data?.confirmationMode,!0)&&W(p)?.id!==e.id;R(f,``),n(!0);try{if(r){let n=await Ea(t.scope,e.cursor,e.id,{mode:`prepare`});!_&&W(s)===e.id&&R(p,{id:e.id,token:n},!0);return}let n=W(p)?.id===e.id?W(p).token:``;if(R(p,null),await Ea(t.scope,e.cursor,e.id,n?{confirmation:n}:void 0),_)return;R(d,e.id,!0),h=setTimeout(()=>{R(f,`Resume accepted; still waiting for the session to appear.`)},15e3)}catch(t){if(_)return;!r&&!(t instanceof _a)?(R(d,e.id,!0),R(f,`Resume outcome unknown. Check Codex before trying again.`)):R(f,t instanceof _a?t.message:`Could not prepare the resume.`,!0)}finally{_||n(!1)}}var C=Yc(),w=z(C),T=e=>{var t=Lc(),a=H(B(t),2);jc(a,{label:`Search saved sessions`,placeholder:`Search by session name`,get disabled(){return W(v)},get field(){return W(i)},set field(e){R(i,e,!0)},get value(){return W(r)},set value(e){R(r,e,!0)}});var o=H(a,2);U(()=>o.disabled=n()),G(`click`,o,()=>ya.open=!1),q(e,t)};Y(w,e=>{t.target||e(T)});var E=H(w,2),D=e=>{var t=Rc(),n=V(t,!0);U(()=>J(n,W(f)||`Opening the resumed session…`)),q(e,t)};Y(E,e=>{(W(d)||W(f))&&e(D)});var ee=H(E,2),O=e=>{q(e,zc())};Y(ee,e=>{W(y).length&&!t.target&&e(O)});var te=H(ee,2);Z(te,17,()=>W(y),e=>e.id,(e,r)=>{var i=Gc(),a=B(i),o=e=>{var t=Bc(),n=z(t),i=V(n),a=V(H(n,2),!0);P(t),U((e,n)=>{t.disabled=W(v),Q(t,`aria-expanded`,W(s)===W(r).id),J(i,`${e??``} // ${(W(r).name||W(r).directory)??``}`),J(a,n)},[()=>W(r).id.slice(-5).toUpperCase(),()=>x(W(r).updatedAt,W(m))]),G(`click`,t,()=>{R(p,null),W(s)===W(r).id?(g?.abort(),R(s,``),R(l,!1),R(u,!1)):b(W(r).cursor,W(r).id)}),q(e,t)};Y(a,e=>{t.target||e(o)});var d=H(a,2),f=e=>{var i=Wc(),a=B(i);Ic(z(a),{get turns(){return W(c)}}),P(a);var o=H(a,2),s=e=>{var t=Uc(),i=H(B(t),2),a=e=>{var t=Vc(),i=z(t),a=V(i),o=H(i,2),s=H(o,2);P(t),U(()=>{J(a,`Resume ${(W(r).name||W(r).directory||W(r).id)??``}?`),o.disabled=n()}),G(`click`,o,()=>void S(W(r))),G(`click`,s,()=>R(p,null)),q(e,t)},o=e=>{var t=Hc();U(()=>t.disabled=W(v)),G(`click`,t,()=>void S(W(r))),q(e,t)};Y(i,e=>{W(p)?.id===W(r).id?e(a):e(o,-1)}),q(e,t)};Y(o,e=>{$.data?.control&&e(s)}),U(()=>a.inert=!!t.target&&n()),q(e,i)};Y(d,e=>{W(s)===W(r).id&&W(c)&&e(f)}),q(e,i)});var ne=H(te,2),k=e=>{q(e,Kc())},A=e=>{var t=Rc(),n=V(t,!0);U(()=>J(n,W(o)?`Could not load older sessions. Try again.`:`Saved history unavailable. Live filtering still works.`)),q(e,t)},re=e=>{var t=qc(),n=V(t,!0);U(e=>J(n,e),[()=>W(r).trim()?`No saved session names match this search.`:`No saved sessions to show.`]),q(e,t)};Y(ne,e=>{W(l)?e(k):W(u)?e(A,1):!W(y).length&&!W(o)&&e(re,2)});var ie=H(ne,2),ae=e=>{var t=Jc(),n=V(t,!0);U(e=>{t.disabled=W(l)||W(v),J(n,e)},[()=>W(r).trim()?`Search older sessions`:`Load more saved sessions`]),G(`click`,t,()=>b(W(o))),q(e,t)};Y(ie,e=>{W(o)&&e(ae)}),P(C),q(e,C),We()}wr([`click`]);var Zc=K(`

      Start a new Codex session and send this message?

      `,1),Qc=K(` `,1),$c=K(``),el=K(`

      `),tl=K(`

      NEW SESSION

      `);function nl(e,t){Ue(t,!0);let n=L(``),r=L(``),i=L(void 0),a=L(!1),o=L(!1),s=L(``),c=L(``),l=L(``),u=L(!1),d,f=F(()=>$.connected&&$.data?.control&&!$.data.sessionsError&&$.data.savedScope===t.scope),p=F(()=>W(a)||!!W(l)||!!W(c)||W(o)),m=F(()=>!!W(l)&&W(f)&&t.liveIDs.has(W(l)));Ki(()=>(W(i)?.focus(),()=>clearTimeout(d))),vn(()=>{ya.open||dr().then(()=>W(i)?.focus())}),vn(()=>{W(m)&&!W(u)&&h()});function h(){location.hash=`/sessions/`+encodeURIComponent(W(l)),t.onclose()}async function g(){if(!W(f)||!Ta||W(a)||W(l)||W(o))return;let e=W(r).trim();if(e.toLowerCase()===`/resume`){ya.open=!0;return}if(!e||e.startsWith(`/`)&&!e.startsWith(`//`)){R(s,`Type a first message, or use /resume to open a saved session.`);return}if(!W(n)){R(s,`Enter an absolute working directory on the Codex machine.`);return}let i=bo($.data?.confirmationMode,!0)&&!W(c),p=W(c);R(a,!0),R(s,``);try{let e=await Ta(t.scope,W(n),W(r),i?{mode:`prepare`}:p?{confirmation:p}:void 0);if(i&&e.confirmation)R(c,e.confirmation,!0);else if(e.id)R(u,e.firstMessageRejected===!0),R(l,e.id,!0),W(u)?R(s,`Session created, but Codex rejected the first message. Copy your draft before opening the session to try again.`):(R(s,`Opening the new session…`),d=setTimeout(()=>{R(s,`First message sent; still waiting for the session to appear.`)},15e3));else throw Error(`Could not verify the new session. Check Codex.`)}catch(e){R(o,!i&&!(e instanceof _a),!0),R(s,W(o)?`Could not verify the new session. Check Codex before trying again.`:e instanceof Error?e.message:`Could not start the new session.`,!0)}finally{R(a,!1),i||R(c,``)}}var _=tl(),v=z(_),y=H(z(v),2);P(v);var b=H(v,2),x=H(z(b));Si(x),P(b);var S=H(b,2),C=H(z(S));tt(C),Q(C,`maxlength`,4096),Li(C,e=>R(i,e),()=>W(i)),P(S);var w=H(S,2),T=e=>{var t=Zc(),n=H(B(t),2),r=H(n,2);U(()=>{n.disabled=W(a)||!W(f),r.disabled=W(a)}),G(`click`,n,()=>void g()),G(`click`,r,()=>R(c,``)),q(e,t)},E=e=>{var t=Qc(),n=B(t),r=H(n,2);U(()=>{n.disabled=W(p)||!W(f),r.disabled=W(p)||!W(f)}),G(`click`,n,()=>void g()),G(`click`,r,()=>ya.open=!0),q(e,t)};Y(w,e=>{W(c)?e(T):e(E,-1)});var D=H(w,2),ee=e=>{var t=$c();G(`click`,t,h),q(e,t)};Y(D,e=>{W(u)&&W(m)&&e(ee)});var O=H(D,2),te=e=>{var t=el(),n=V(t,!0);U(()=>J(n,W(s))),q(e,t)};Y(O,e=>{W(s)&&e(te)}),P(_),U(()=>{Q(_,`hidden`,ya.open),y.disabled=W(a),x.readOnly=W(p),C.readOnly=W(p)}),G(`click`,y,function(...e){t.onclose?.apply(this,e)}),Di(x,()=>W(n),e=>R(n,e)),G(`keydown`,C,e=>{W(p)||(e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),e.repeat||g()),e.key===`Escape`&&!W(p)&&t.onclose())}),Di(C,()=>W(r),e=>R(r,e)),q(e,_),We()}wr([`click`,`keydown`]);var rl=K(``),il=K(`

      Loading…

      `),al=K(`

      Session information unavailable.

      `),ol=K(`

      `,1),sl=K(`

      No background terminals reported.

      `),cl=K(`

      Additional background terminals are not shown.

      `),ll=K(` `,1),ul=K(``),dl=K(`

      No linked agents observed.

      `),fl=K(`

      `);function pl(e,t){Ue(t,!0);let n=L(Yt({})),r=L(``),i=L(!1),a=L(!1),o,s=L(void 0);async function c(e){o?.abort();let s=new AbortController;o=s,R(r,e,!0),R(n,{},!0),R(a,!1),R(i,!0);try{if(!wa)throw Error();let r=await wa(t.root,e,t.kind,s.signal);s.signal.aborted||R(n,r,!0)}catch{s.signal.aborted||R(a,!0)}finally{s.signal.aborted||R(i,!1)}}Ki(()=>(W(s)?.focus(),c(``),()=>o?.abort()));var l=fl(),u=z(l),d=z(u),f=V(d),p=H(d,2),m=e=>{var t=rl();U(()=>t.disabled=W(i)),G(`click`,t,()=>void c(``)),q(e,t)};Y(p,e=>{t.kind===`terminals`&&e(m)});var h=H(p,2),g=V(h,!0);Li(h,e=>R(s,e),()=>W(s)),P(u);var _=H(u,2),v=e=>{q(e,il())},y=e=>{q(e,al())},b=e=>{var t=ll(),r=B(t);Z(r,17,()=>W(n).terminals||[],X,(e,t)=>{var n=ol(),r=B(n),i=V(r),a=H(r,2),o=V(z(a),!0);P(a),U(()=>{J(i,`${W(t).id??``}${W(t).pid?` // PID ${W(t).pid}`:``}${W(t).directory?` // ${W(t).directory}`:``}`),J(o,W(t).command)}),q(e,n)},e=>{q(e,sl())});var i=H(r,2),a=e=>{q(e,cl())};Y(i,e=>{W(n).more&&e(a)}),q(e,t)},x=e=>{Ic(e,{get turns(){return W(n).turns},get unverified(){return W(n).unverifiedTurns}})},S=e=>{var t=Fr();Z(B(t),17,()=>W(n).agents||[],e=>e.id,(e,t)=>{var n=ul(),r=V(n);U(e=>J(r,`${e??``} // ${W(t).status??``}`),[()=>W(t).name||W(t).id.slice(-5)]),G(`click`,n,()=>void c(W(t).id)),q(e,n)},e=>{q(e,dl())}),q(e,t)};Y(_,e=>{W(i)?e(v):W(a)?e(y,1):t.kind===`terminals`?e(b,2):W(r)?e(x,3):e(S,-1)}),P(l),U(e=>{Q(l,`aria-label`,t.kind===`terminals`?`Background terminals`:`Linked agents`),J(f,`${t.kind===`terminals`?`Background terminals`:W(r)?`Agent transcript`:`Linked agents`} // ${e??``}`),J(g,W(r)?`Back to agents`:`Close`)},[()=>t.root.slice(-5)]),G(`click`,h,()=>W(r)?void c(``):Ca.root=``),q(e,l),We()}wr([`click`]);var ml=K(`

      Loading…

      `),hl=K(`

      Session unavailable here.

      `),gl=K(``),_l=K(`

      `);function vl(e,t){Ue(t,!0);let n=F(()=>ba.ids.at(-1)),r=L(void 0),i=L(void 0),a=L(void 0),o=L(void 0),s=L(!1),c=L(!1),l=L(!1),u,d=``,f=new Map;function p(){W(l)||(ba.ids=ba.ids.slice(0,-1))}function m(){W(o)&&(location.hash=`/sessions/`+encodeURIComponent(W(o).root.id),ba.ids=[])}vn(()=>{let e=W(n),p=W(r),m=ba.scope,h=t.scope;if(p){if(e&&m!==h)ba.ids=[];else if(!e)p.open&&p.close(),R(l,!1),u?.focus({preventScroll:!0}),u=void 0,f.clear(),d=``;else return p.open||(document.activeElement instanceof HTMLElement&&(u=document.activeElement),p.showModal()),mr(()=>{d&&W(i)&&f.set(d,W(i).scrollTop),d=e,R(c,!1),R(l,!1),R(o,void 0),R(s,!0),W(a)?.focus({preventScroll:!0});let n=new AbortController;return(async()=>{try{let r=await Sa?.(m,e,n.signal);n.signal.aborted||(R(c,!!r&&!r.agent&&!t.liveIDs.has(r.root.id)&&!!$.data?.control,!0),R(o,r,!0))}catch{}finally{n.signal.aborted||R(s,!1)}await dr(),!n.signal.aborted&&W(i)&&(W(i).scrollTop=f.get(e)||0)})(),()=>n.abort()})}}),qi(()=>{ba.ids=[]});var h=_l(),g=z(h),_=z(g),v=V(_),y=H(_,2);Li(y,e=>R(a,e),()=>W(a)),P(g);var b=H(g,2),x=z(b),S=e=>{q(e,ml())},C=e=>{q(e,hl())},w=e=>{{let n=F(()=>({row:W(o).root,turns:W(o).turns}));Xc(e,{get scope(){return t.scope},get liveIDs(){return t.liveIDs},get target(){return W(n)},get resumeBusy(){return W(l)},set resumeBusy(e){R(l,e,!0)}})}},T=e=>{Ic(e,{get turns(){return W(o).turns},get unverified(){return W(o).unverifiedTurns}})};Y(x,e=>{W(s)?e(S):W(o)?W(c)?e(w,2):e(T,-1):e(C,1)}),P(b),Li(b,e=>R(i,e),()=>W(i));var E=H(b,2),D=e=>{var t=gl();G(`click`,t,m),q(e,t)},ee=F(()=>W(o)&&!W(o).agent&&!W(c)&&t.liveIDs.has(W(o).root.id));Y(E,e=>{W(ee)&&e(D)}),P(h),Li(h,e=>R(r,e),()=>W(r)),U(e=>{J(v,`${W(o)?.agent?`Agent transcript`:`Session preview`}${e??``}`),y.disabled=W(l)},[()=>W(o)?` // ${W(o).agent?.name||(W(o).agent?W(o).agent.id.slice(-5):W(o).root.name||W(o).root.id.slice(-5))}`:``]),Cr(`cancel`,h,e=>{e.preventDefault(),p()}),G(`keydown`,h,e=>e.stopPropagation()),G(`click`,y,p),q(e,h),We()}wr([`keydown`,`click`]);function yl(e,t){let n=e.trim().toLowerCase();return!n||[t.id,t.name,t.directory].some(e=>e?.toLowerCase().includes(n))}var bl=K(`

      `),xl=K(`

       
      `,1),Sl=K(`

      LATEST GUIDANCE

       
      `,1),Cl=K(`

      CONTEXT

       

      `,1),wl=K(`

      `),Tl=K(`

      `),El=K(`
       
      `),Dl=K(`

       
      `,1),Ol=K(`
       
      `),kl=K(`

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

      `),Al=K(`

      `,1),jl=K(` `,1),Ml=K(`

      `),Nl=K(``),Pl=K(``),Fl=K(`
      `),Il=K(`
      `),Ll=K(`

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

      `),Rl=K(`

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

      `),zl=K(` `),Bl=K(` `),Vl=K(` `),Hl=K(``),Ul=K(`

      Read only — reply or approve in Codex.

      `),Wl=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Gl=K(`
      `),Kl=K(` `,1),ql=K(`
      `),Jl=K(`

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

      `),Yl=K(`

      No live sessions match the filter.

      `),Xl=K(`

      `),Zl=K(``),Ql=K(``),$l=K(`

      `),eu=K(` `),tu=K(`

      `),nu=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),ru=K(`

      `),iu=K(`

      TOKEN ACTIVITY // 30 SECOND SAMPLES

      `),au=K(`

      TOKENS

      FULL DETAIL →
      `),ou=K(`

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

      `),su=K(`

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

      `,1),cu=K(`

      SESSION TOTALS

      `,1);function lu(e,t){Ue(t,!0);let n=(e,t=f,n,r)=>{let i=pt(()=>g(n?.(),!0)),a=pt(()=>g(r?.(),!1));var o=jl(),s=B(o),c=e=>{var n=bl(),r=V(n);U(()=>J(r,`DEFAULT REVIEW // ${t().reviewer===`auto_review`?`AUTO`:`HUMAN`}`)),q(e,n)};Y(s,e=>{(t().reviewer===`user`||t().reviewer===`auto_review`)&&e(c)});var l=H(s,2),u=e=>{var n=xl(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{J(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),J(a,t().currentTask)}),q(e,n)};Y(l,e=>{t().currentTask&&e(u)});var d=H(l,2),p=e=>{var n=Sl(),r=V(H(B(n),2),!0);U(()=>J(r,t().latestGuidance)),q(e,n)};Y(d,e=>{t().latestGuidance&&e(p)});var m=H(d,2),h=e=>{var n=Cl(),r=V(H(B(n),2),!0);xe(2),U(()=>J(r,t().approvalContext)),q(e,n)};Y(m,e=>{W(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(h)});var _=H(m,2),v=e=>{var n=wl();let r;var i=V(n,!0);U(e=>{r=li(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>ve(t())]),q(e,n)},y=F(()=>ve(t())&&(!W(a)||W(E)||t().status===`CHECK SESSION`||D(t())));Y(_,e=>{W(y)&&e(v)});var b=H(_,2),x=e=>{var n=Tl(),r=V(n,!0);U(e=>J(r,e),[()=>N(t())]),q(e,n)};Y(b,e=>{W(i)&&e(x)});var S=H(b,2),C=e=>{ds(e,{get review(){return t().approvalReview}})},w=e=>{cs(e,{get details(){return t().mcpTool}})},T=e=>{var n=Fr(),r=B(n),i=e=>{bc(e,{get blocks(){return t().prose}})},a=e=>{var n=El(),r=V(n,!0);U(()=>J(r,t().text||`No session context available.`)),q(e,n)};Y(r,e=>{t().prose?.length?e(i):e(a,-1)}),q(e,n)};Y(S,e=>{t().approvalReview&&(!W(a)||!$.data?.control)?e(C):t().mcpTool&&(!W(a)||!$.data?.control)?e(w,1):t().approvalReview||!t().text&&t().workingCommand||e(T,2)});var ee=H(S,2),O=e=>{var n=Dl(),r=H(B(n),2),i=z(r),a=H(i),o=e=>{var n=Pr();U(()=>J(n,`// ${t().commandTiming??``}`)),q(e,n)};Y(a,e=>{t().commandTiming&&e(o)});var s=H(a,2),c=e=>{var n=Pr();U(()=>J(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),q(e,n)};Y(s,e=>{!W(E)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(c)});var l=H(s,2),u=e=>{q(e,Pr(`+`))};Y(l,e=>{t().runningLimited&&e(u)}),P(r);var d=V(H(r,2),!0);U(e=>{J(i,`COMMAND // ${e??``} `),J(d,t().workingCommand)},[()=>W(E)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),q(e,n)};Y(ee,e=>{t().workingCommand&&e(O)});var te=H(ee,2),ne=e=>{rs(e,{get lines(){return t().fileChanges}})},k=e=>{var n=Al(),r=H(B(n),2),i=V(r,!0),a=H(r,2),o=e=>{var n=Ol(),r=V(n,!0);U(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,kl())};Y(a,e=>{t().command?e(o):e(s,-1)}),U(()=>J(i,W(E)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(te,e=>{(!W(a)||!$.data?.control)&&t().fileChanges?.length?e(ne):W(a)&&$.data?.control||t().mcpTool||t().approvalReview||!t().command&&t().status!==`APPROVAL NEEDED`||e(k,1)});var A=H(te,2),re=e=>{gs(e,{get assessment(){return t().autoReview},get full(){return W(a)}})};Y(A,e=>{t().autoReview&&!(W(a)&&$.data?.control&&t().command&&t().autoReview.attached)&&e(re)});var ie=H(A,2),ae=e=>{var n=bl(),r=V(n);U(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(ie,e=>{W(a)||e(ae)}),q(e,o)},r=L(void 0),i=Gi(t,`params`,19,()=>({})),a=F(()=>$.data?.sessions||[]),o=L(``),s=L(``),c=L(void 0),l=F(()=>$.connected&&!$.data?.sessionsError&&$.data?.savedScope||``),u=L(``);vn(()=>{i().id&&R(u,``)});let d=``;vn(()=>{ya.open?!W(l)||d&&d!==W(l)?ya.open=!1:d=W(l):d=``});let p=F(()=>new Set(W(a).map(e=>e.id))),m=F(()=>W(a).filter(e=>yl(W(o),e)&&(!W(s)||e.status===W(s)))),h=F(()=>$.data?.control&&$.data.profiles||[]),v=F(()=>($.data?.triggers||[]).filter(e=>W(a).some(t=>t.id===e.session)));function y(e,t){i().id&&i().id!==t&&W(x)?e.preventDefault():he(t)}function b(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&W(v).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let x=L(!1);function S(e,t){i().id&&i().id!==t&&W(x)?e.preventDefault():he(t)}vn(()=>{let e=i().id;e&&mr(()=>{oa.selected=e,pa(e,2)})});let C=F(()=>W(a).find(e=>e.id===i().id)),w=F(()=>new URLSearchParams(Xi.querystring).get(`review`)===`profile`&&W(h).some(e=>e.session===i().id&&e.pending)),T=F(()=>W(m).some(e=>e.id===oa.selected)?oa.selected:W(m)[0]?.id),E=F(()=>!$.connected||!!$.data?.sessionsError);function D(e){return e.status!==`STALE`&&e.failed===!0}let ee=F(()=>[[`OBSERVED TOKENS`,ma(W(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,ma(W(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`ERRORS`,`ERRORS`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,W(E)?`—`:ma(W(a).filter(e=>t===`ERRORS`?D(e):e.status===t).length)])]),O=F(()=>W(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`].includes(e.status)||D(e)).sort((e,t)=>te(e)-te(t)));function te(e){return e.status===`APPROVAL NEEDED`?0:e.status===`INPUT NEEDED`?1:2}let ne=F(()=>W(a).filter(e=>e.status===`TURN COMPLETE`&&(!e.readStateKnown||e.unread)&&!W(v).some(t=>t.session===e.id)&&!W(h).some(t=>t.session===e.id&&t.pending))),k=L(``),A=new Set,re=0,ie=L(void 0);function ae(e){return $.data?.control&&!ba.ids.length&&!W(E)&&e.unread&&e.readRevision&&e.replyTurn&&!e.streaming&&e.contextKind===`LAST REPLY`&&!!e.text&&!W(w)&&!W(h).some(t=>t.session===e.id&&t.pending)}function oe(e){let t=document.getElementById(`content`),n=t?.getBoundingClientRect(),r=n?n.left+t.clientLeft:0,i=n?n.top+t.clientTop:0,a=r+(t?.clientWidth||0),o=i+(t?.clientHeight||0);return Array.from(document.querySelectorAll(`[data-result-session]`)).some(n=>{let s=n.querySelector(`[data-reply-text]`);if(!s)return!1;let c=s.getBoundingClientRect();return t?.contains(n)&&n.dataset.resultSession===e.id&&n.dataset.resultTurn===e.replyTurn&&!n.closest(`[inert], [hidden]`)&&document.visibilityState===`visible`&&c.leftMath.max(0,r)&&c.topMath.max(0,i)&&c.width>0&&c.height>0})}function se(){W(ie)&&clearTimeout(W(ie).timer),R(ie,void 0)}function ce(e){return!i().id&&W(T)===e.id&&da(e.id)===2&&ae(e)}function j(){if(!W(ie))return;let e=W(a).find(e=>e.id===W(ie).id);e&&ce(e)&&e.replyTurn===W(ie).turn&&e.readRevision===W(ie).revision&&oe(e)||se()}function le(e){if(j(),!ce(e)||!oe(e)||W(ie))return;let t=e.id,n=e.replyTurn,r=e.readRevision,i=++re;R(ie,{sequence:i,id:t,turn:n,revision:r,timer:setTimeout(()=>{if(j(),!W(ie)||W(ie).sequence!==i||W(ie).id!==t||W(ie).turn!==n||W(ie).revision!==r)return;let e=W(a).find(e=>e.id===t);se(),e&&ue(e)},3e3)},!0)}vn(()=>{j()}),Ki(()=>(document.addEventListener(`scroll`,j,!0),document.addEventListener(`visibilitychange`,j),window.addEventListener(`resize`,j),()=>{se(),document.removeEventListener(`scroll`,j,!0),document.removeEventListener(`visibilitychange`,j),window.removeEventListener(`resize`,j)}));async function ue(e){if(!ae(e))return;let t=e.id,n=e.readRevision,r=e.replyTurn,i=JSON.stringify([t,n,r]);if(!A.has(i)){A.add(i);try{await dr();let e=W(a).find(e=>e.id===t);if(!e||!ae(e)||!oe(e)||e.readRevision!==n||e.replyTurn!==r)return;await Oa(`read`,{session:t,read:{turn:r,revision:n}}),R(k,``)}catch{R(k,`Result changed or could not be marked read. Open it again to retry.`)}finally{A.delete(i)}}}function de(e){i().id===e.id?ue(e):le(e)}function fe(e){if(se(),he(e,!1),i().id===e){let t=W(a).find(t=>t.id===e);t&&ue(t)}}let pe=L(Yt(mr(()=>i().id||``))),me=L(``);vn(()=>{let e=i().id||``;e!==W(pe)&&(R(pe,e,!0),R(me,e,!0))}),vn(()=>{if(W(me)&&W(C)?.id===W(me)){let e=W(C);R(me,``),mr(()=>{ue(e)})}});function he(e,t=!0){let n=W(a).find(t=>t.id===e);n&&!yl(W(o),n)&&R(o,``),n&&W(s)&&n.status!==W(s)&&R(s,``),e!==W(T)&&se(),oa.selected=e,dr().then(()=>{document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`});let n=W(a).find(t=>t.id===e);t&&n&&le(n)})}function ge(e,t){if(he(e),i().id){t<0&&(pa(e,2),location.hash=`/sessions`);return}let n=da(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):pa(e,n)}function _e(){se(),i().id||fa(W(m).map(e=>e.id))}function M(e){let t=e.target;if(!(W(u)||ba.ids.length||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key.toLowerCase()===`f`&&!i().id)e.preventDefault(),W(c)?.focus();else if(!t.closest(`section[aria-label="Saved sessions"], [data-session-inspector]`)){if(e.key.toLowerCase()===`y`&&!i().id)e.preventDefault(),e.repeat||_e();else if(e.key===`Escape`&&i().id)e.preventDefault(),ge(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||W(T)))e.preventDefault(),ge(i().id||W(T),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&W(m).length){e.preventDefault();let t=W(m).findIndex(e=>e.id===W(T));he(W(m)[Math.max(0,Math.min(W(m).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}}function ve(e){return W(E)?`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.`:D(e)&&e.status.endsWith(` SPEND CAP`)?`CONFIRMED TURN FAILURE — check the reported API spend cap. This is separate from ChatGPT subscription quota. No automatic retry.`:D(e)?e.status===`MODEL BUSY`?`CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry when ready. This is not a quota-exhaustion signal.`:e.status===`MODEL UNAVAILABLE`?`CONFIRMED TURN FAILURE — the provider could not find the selected model. Choose an available model with /model. No automatic retry or model change.`:e.status===`CAPACITY RESTRICTED`?`CONFIRMED TURN FAILURE — capacity is unavailable on a policy-restricted route. Inspect the error before changing settings or retrying. This is not a quota-exhaustion signal; no automatic retry or policy change.`:`CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.`:$.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.`:``}function N(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var ye=cu();Cr(`keydown`,Qt,M);var be=B(ye);vl(be,{get scope(){return W(l)},get liveIDs(){return W(p)}});var Se=H(be,2),Ce=e=>{var t=Ml(),n=V(t,!0);U(()=>J(n,W(k))),q(e,t)};Y(Se,e=>{W(k)&&e(Ce)});var we=H(Se,2),Te=H(z(we),2),Ee=e=>{var t=Fl(),n=z(t);jc(n,{label:`Filter sessions`,placeholder:`Filter sessions (F)`,onkeydown:e=>{e.key===`Escape`&&(e.preventDefault(),R(o,``),W(c)?.blur()),(e.key===`Enter`||e.key===`ArrowDown`)&&(e.preventDefault(),W(m)[0]&&(he(W(m)[0].id,!1),document.querySelector(`.session-row button,.session-row a`)?.focus()))},get field(){return W(c)},set field(e){R(c,e,!0)},get value(){return W(o)},set value(e){R(o,e,!0)}});var r=H(n,2),i=z(r);i.value=i.__value=``,Z(H(i),17,()=>[...new Set([...W(a).map(e=>e.status),...W(s)?[W(s)]:[]])].sort(),X,(e,t)=>{var n=Nl(),r=V(n,!0),i={};U(()=>{J(r,W(t)),i!==(i=W(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),P(r),hi(r);var d=H(r,2),f=H(d,2),p=e=>{var t=Pl();G(`click`,t,()=>{ya.open=!1,R(u,W(l),!0)}),q(e,t)};Y(f,e=>{$.data?.control&&W(l)&&e(p)}),P(t),U(()=>{d.disabled=!W(l),Q(d,`aria-expanded`,ya.open&&!!W(l))}),gi(r,()=>W(s),e=>R(s,e)),G(`click`,d,()=>ya.open=!ya.open),q(e,t)};Y(Te,e=>{!i().id&&!W(u)&&e(Ee)});var De=V(H(Te,2));P(we);var Oe=H(we,2);let ke;Z(Oe,21,()=>W(ee),X,(e,t)=>{var n=F(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=Il();let o;var s=z(a),c=V(s,!0),l=V(H(s,2),!0);P(a),U(()=>{o=li(a,1,`svelte-mm4wfe`,null,o,{failed:r()===`ERRORS`&&i()!==`0`&&i()!==`—`}),J(c,r()),J(l,i())}),q(e,a)}),P(Oe);var Ae=H(Oe,2),je=e=>{var t=Fr();qr(B(t),()=>Ca.root+`:`+Ca.kind,e=>{pl(e,{get root(){return Ca.root},get kind(){return Ca.kind}})}),q(e,t)},Me=F(()=>Ca.root&&(!i().id||i().id===Ca.root)&&W(a).some(e=>e.id===Ca.root));Y(Ae,e=>{W(Me)&&e(je)});var Ne=H(Ae,2),Pe=V(Ne),Fe=H(Ne,2),Ie=e=>{q(e,Ll())};Y(Fe,e=>{W(E)&&e(Ie)});var Le=H(Fe,2),Re=e=>{q(e,Rl())};Y(Le,e=>{$.data?.profileError&&e(Re)});var ze=H(Le,2),Be=e=>{var t=Hl(),n=z(t);Z(n,17,()=>W(O),X,(e,t)=>{var n=zl();let r;var i=V(n);U((e,a,o)=>{r=li(n,1,`button`,null,r,{approval:e}),Q(n,`href`,a),J(i,`${W(t).status??``} - ${o??``} // ${(W(t).name||W(t).directory||W(t).id)??``}`)},[()=>W(t).status===`APPROVAL NEEDED`||W(t).status===`INPUT NEEDED`||D(W(t)),()=>`#/sessions/`+encodeURIComponent(W(t).id),()=>Array.from(W(t).id).slice(-5).join(``).toUpperCase()]),G(`click`,n,()=>he(W(t).id)),q(e,n)});var r=H(n,2);Z(r,17,()=>W(h).filter(e=>e.pending&&W(a).some(t=>t.id===e.session)),X,(e,t)=>{var n=Bl(),r=V(n);U((e,a,o)=>{Q(n,`title`,i().id&&i().id!==W(t).session&&W(x)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session)+`?review=profile`,()=>Array.from(W(t).session).slice(-5).join(``).toUpperCase(),()=>W(a).find(e=>e.id===W(t).session)?.name||W(a).find(e=>e.id===W(t).session)?.directory||W(t).session]),G(`click`,n,e=>S(e,W(t).session)),q(e,n)});var o=H(r,2);Z(o,17,()=>W(ne),X,(e,t)=>{var n=Vl(),r=V(n);U((e,i)=>{Q(n,`href`,e),J(r,`TURN COMPLETE ${i??``} // - ${(W(t).name||W(t).directory||W(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id),()=>Array.from(W(t).id).slice(-5).join(``).toUpperCase()]),G(`click`,n,()=>he(W(t).id)),q(e,n)}),Z(H(o,2),17,()=>W(v),X,(e,t)=>{var n=Vl(),r=V(n);U((e,t,i)=>{Q(n,`href`,e),J(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session),()=>Array.from(W(t).session).slice(-5).join(``).toUpperCase(),()=>W(a).find(e=>e.id===W(t).session)?.name||W(a).find(e=>e.id===W(t).session)?.directory]),G(`click`,n,e=>y(e,W(t).session)),q(e,n)}),P(t),q(e,t)},Ve=F(()=>(W(O).length||W(ne).length||W(h).some(e=>e.pending)||W(v).length)&&!W(E));Y(ze,e=>{W(Ve)&&e(Be)});var He=H(ze,2),Ge=e=>{var t=Fr(),a=B(t),o=e=>{var t=ql(),a=z(t),o=z(a);let s;var c=z(o);let l;var u=H(c);P(o);var d=H(o,2);P(a);var f=H(a,2),p=e=>{var t=bl(),n=V(t,!0);U(()=>J(n,W(C).directory)),q(e,t)};Y(f,e=>{W(C).name&&W(C).directory&&e(p)});var m=H(f,2),g=V(m),_=H(m,2);let v;var y=z(_),S=z(y);n(S,()=>W(C),()=>!0,()=>!0),P(y);var T=H(y,2),ee=e=>{var t=Fr();qr(B(t),()=>W(C).id,e=>{{let t=F(()=>new URLSearchParams(Xi.querystring).get(`schedule`)===`edit`),n=F(()=>W(C).approvalReview??void 0),i=F(()=>W(C).command&&W(C).autoReview?.attached?W(C).autoReview:void 0),a=F(()=>W(C).fileChanges||[]);rc(e,{get session(){return W(C).id},oncopy:()=>W(r)?.copy(),get openScheduler(){return W(t)},get observedCommand(){return W(C).command},get observedAction(){return W(n)},get observedReview(){return W(i)},get observedFileChanges(){return W(a)},get suspended(){return W(w)},onProtectedChange:e=>{R(x,e,!0)}})}}),q(e,t)},O=e=>{var t=Ul();qr(H(z(t),2),()=>W(C).id,e=>{$o(e,{get session(){return W(C).id},localOnly:!0,oncopy:()=>W(r)?.copy()})}),P(t),q(e,t)};Y(T,e=>{$.data?.control?e(ee):e(O,-1)}),P(_);var te=H(_,2);Z(te,17,()=>W(h).filter(e=>e.session===W(C).id),e=>e.session,(e,t)=>{var n=Gl(),r=z(n),i=e=>{var n=Ml(),r=V(n,!0);U(()=>J(r,W(t).notice)),q(e,n)};Y(r,e=>{W(t).notice&&e(i)});var a=H(r,2),o=e=>{rc(e,{get session(){return W(C).id},review:`profile`})},s=e=>{var t=Wl();U(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(C).id)+`?review=profile`]),q(e,t)};Y(a,e=>{W(t).pending&&W(w)?e(o):W(t).pending&&e(s,1)}),P(n),U(()=>Q(n,`id`,`quota-profile-`+W(C).id)),q(e,n)});var ne=H(te,2),k=e=>{var t=Fr();qr(B(t),()=>W(C).id,e=>{Dc(e,{get session(){return W(C)},get stale(){return W(E)},children:e=>{var t=Fr(),n=B(t),i=e=>{Li(kc(e,{get session(){return W(C)},active:!0,compact:!0}),e=>R(r,e,!0),()=>W(r))};Y(n,e=>{W(w)||e(i)}),q(e,t)},$$slots:{default:!0}})}),q(e,t)},A=e=>{var t=Kl(),n=B(t),i=e=>{var t=Fr();qr(B(t),()=>W(C).id,e=>{Li(kc(e,{get session(){return W(C)},active:!0}),e=>R(r,e,!0),()=>W(r))}),q(e,t)};Y(n,e=>{W(w)||e(i)}),qr(H(n,2),()=>W(C).id,e=>{Dc(e,{get session(){return W(C)},get stale(){return W(E)}})}),q(e,t)};Y(ne,e=>{W(C).goal?e(k):e(A,-1)}),P(t),U((e,t,n,r)=>{s=li(o,1,`svelte-mm4wfe`,null,s,{failed:e,reviewed:W(C).status===`TURN COMPLETE`&&W(C).readStateKnown&&!W(C).unread}),l=li(c,1,`lamp lit svelte-mm4wfe`,null,l,{failed:t,working:W(C).status===`WORKING`&&!W(E)}),J(u,`${n??``} // ${(W(C).name||W(C).directory)??``}`),J(g,`${r??``} TOKENS // ${W(C).id??``} // CONTEXT SOURCE // ${(W(C).source||`LOCAL`)??``}`),v=di(_,``,v,{display:W(w)?`none`:void 0}),Q(y,`data-result-session`,W(C).id),Q(y,`data-result-turn`,W(C).replyTurn)},[()=>D(W(C))&&!W(E)&&!W(w),()=>D(W(C))&&!W(E),()=>W(E)?`STALE`:W(w)?`QUOTA THRESHOLD`:b(W(C)),()=>ma(W(C).tokens)]),G(`click`,d,()=>{he(i().id),pa(i().id,2)}),Cr(`wheel`,y,()=>{de(W(C))}),q(e,t)},s=e=>{q(e,Jl())};Y(a,e=>{W(C)?e(o):e(s,-1)}),q(e,t)},Ke=e=>{var t=Kl(),n=B(t);nl(n,{get scope(){return W(u)},get liveIDs(){return W(p)},onclose:()=>R(u,``)});var r=H(n,2),i=e=>{var t=Fr();qr(B(t),()=>W(l),e=>{Xc(e,{get scope(){return W(l)},get liveIDs(){return W(p)}})}),q(e,t)};Y(r,e=>{W(l)&&ya.open&&e(i)}),q(e,t)},qe=e=>{var t=su(),r=B(t),i=V(H(z(r),2));P(r);var o=H(r,2),s=e=>{var t=Fr();qr(B(t),()=>W(l),e=>{Xc(e,{get scope(){return W(l)},get liveIDs(){return W(p)}})}),q(e,t)};Y(o,e=>{W(l)&&ya.open&&e(s)});var c=H(o,2),u=e=>{q(e,Yl())};Y(c,e=>{!W(m).length&&W(a).length&&e(u)});var d=H(c,2);Z(d,17,()=>W(m),e=>e.id,(e,t)=>{let r=F(()=>da(W(t).id));var i=au();let a;var o=z(i),s=z(o),c=e=>{var n=Xl(),r=z(n),i=V(r);P(n),U(e=>{Q(r,`aria-pressed`,W(T)===W(t).id),J(i,`${e??``} // ${W(t).name??``}`)},[()=>Array.from(W(t).id).slice(-5).join(``).toUpperCase()]),G(`click`,r,()=>he(W(t).id)),q(e,n)};Y(s,e=>{W(t).name&&e(c)});var l=H(s,2),u=z(l);let d;var f=z(u);let p;var m=H(f,1,!0);P(u),P(l);var g=H(l,2),_=e=>{var n=Zl(),r=V(n,!0);U(()=>{Q(n,`aria-pressed`,W(T)===W(t).id),J(r,W(t).directory||W(t).id)}),G(`click`,n,()=>he(W(t).id)),q(e,n)};Y(g,e=>{W(t).name||e(_)});var v=H(g,2),y=z(v);xe(),P(v);var x=H(v,2),C=e=>{var n=bl(),r=V(n,!0);U(()=>J(r,W(t).directory)),q(e,n)};Y(x,e=>{W(t).name&&W(t).directory&&e(C)});var w=H(x,2),ee=e=>{var n=Ql(),r=V(n);U(()=>J(r,`${W(t).agents??``} LINKED AGENTS`)),G(`click`,n,()=>{Ca.kind=`agents`,Ca.root=W(t).id}),q(e,n)};Y(w,e=>{W(t).agents>0&&e(ee)});var O=H(w,2),te=V(O),ne=H(O,2);Sc(ne,{get goal(){return W(t).goal},get stale(){return W(E)}});var k=H(ne,2),A=z(k),re=H(A,2),ie=V(re,!0),ae=H(re,2);P(k);var oe=H(k,2),se=H(oe,2),ce=e=>{var n=$l(),r=V(n,!0);U(e=>J(r,e),[()=>W(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:D(W(t))?`OPEN DETAIL FOR THE TURN ERROR`:$.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)},j=F(()=>!W(E)&&([`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(W(t).status)||D(W(t))));Y(se,e=>{W(j)&&e(ce)}),P(o);var le=H(o,2),ue=e=>{var r=ru(),i=z(r),a=z(i),o=V(a,!0),s=H(a,2),c=e=>{var n=eu(),r=V(n,!0);U(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(s,e=>{!W(E)&&W(t).status===`APPROVAL NEEDED`&&e(c)}),P(i);var l=H(i,2),u=z(l);n(u,()=>W(t),()=>!1),P(l);var d=H(l,2);Z(d,17,()=>W(h).filter(e=>e.session===W(t).id),X,(e,n)=>{var r=Kl(),i=B(r),a=e=>{var t=tu(),r=V(t,!0);U(()=>J(r,W(n).notice)),q(e,t)};Y(i,e=>{W(n).notice&&e(a)});var o=H(i,2),s=e=>{var n=nu();U(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(s)}),q(e,r)});var f=H(d,2);{let e=F(()=>W(T)===W(t).id);kc(f,{get session(){return W(t)},get active(){return W(e)}})}P(r),U(e=>{J(o,e),Q(l,`data-result-session`,W(t).id),Q(l,`data-result-turn`,W(t).replyTurn)},[()=>N(W(t))]),Cr(`wheel`,l,()=>{de(W(t))}),q(e,r)};Y(le,e=>{W(r)>0&&e(ue)});var pe=H(le,2),me=e=>{var n=iu(),r=H(z(n),2);{let e=F(()=>(W(t).samples||[]).map(e=>e.tokens));yo(r,{get values(){return W(e)},capacity:120})}var i=V(H(r,2));P(n),U(()=>J(i,`LAST ${(W(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(pe,e=>{W(r)<2&&e(me)}),P(i),U((e,n,o,s,c,l,h)=>{a=li(i,1,`session-row`,null,a,{selected:W(T)===W(t).id,wide:W(r)===2,split:W(r)===1}),Q(i,`aria-label`,`Session `+(W(t).name||W(t).directory||W(t).id)),d=li(u,1,`status-detail svelte-mm4wfe`,null,d,{reviewed:W(t).status===`TURN COMPLETE`&&W(t).readStateKnown&&!W(t).unread,failed:e}),Q(u,`href`,n),p=li(f,1,`lamp lit svelte-mm4wfe`,null,p,{failed:o,working:W(t).status===`WORKING`&&!W(E)}),J(m,s),J(y,`${c??``} `),J(te,`ACTIVE // ${l??``}`),A.disabled=W(r)===0,Q(re,`aria-expanded`,W(r)>0),J(ie,W(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(oe,`href`,h)},[()=>D(W(t))&&!W(E),()=>`#/sessions/`+encodeURIComponent(W(t).id),()=>D(W(t))&&!W(E),()=>W(E)?`STALE`:b(W(t)),()=>ma(W(t).tokens),()=>ha(W(t).activity),()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,u,()=>fe(W(t).id)),G(`click`,A,()=>ge(W(t).id,-1)),G(`click`,re,()=>{let e=W(r)===0;he(W(t).id),pa(W(t).id,+!!e)}),G(`click`,ae,()=>ge(W(t).id,1)),G(`click`,oe,()=>fe(W(t).id)),q(e,i)});var f=H(d,2),g=e=>{q(e,ou())};Y(f,e=>{W(a).length||e(g)}),U(()=>i.disabled=!W(m).length),G(`click`,i,_e),q(e,t)};Y(He,e=>{i().id?e(Ge):W(u)?e(Ke,1):e(qe,-1)}),U(e=>{J(De,`OBSERVED ${e??``}`),ke=li(Oe,1,`session-totals`,null,ke,{stale:W(E)}),J(Pe,`${W(E)?`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.`)},[()=>ha($.data?.sessionsAt)]),q(e,ye),We()}wr([`click`]);var uu=K(``),du=K(`

      `),fu=K(`

      Relative usage/credits are not tokens or quota percentages. Groupings - describe the same usage, not additional consumption.

      `,1),pu=K(`// APPROXIMATE`),mu=K(`

      Partial accounting: totals may still change.

      `),hu=K(`

      Percentage of this period's historical allowance, not today's limit. May - exceed 100%. This is not a manual/automatic reset log.

      `,1),gu=K(`

      `,1),_u=K(`

      This optional account report is unavailable. Token history remains - available; missing data does not mean zero usage.

      `),vu=K(`
      `),yu=K(`
      `),bu=K(`

      No usage reported for this day.

      `),xu=K(`

      Selected breakdown unavailable; missing does not mean zero.

      `),Su=K(`

      `,1);function Cu(e,t){Ue(t,!0);let n=L(Yt(Co[0])),r=L(0),i=F(()=>t.reports?.daily),a=F(()=>t.reports?.plan),o=F(()=>t.mode===`breakdown`?W(i)?.days?.length||0:W(a)?.periods?.length||0),s=F(()=>Math.min(W(r),Math.max(0,W(o)-1))),c=F(()=>W(i)?.days?.[(W(i)?.days?.length||0)-1-W(s)]),l=F(()=>W(a)?.periods?.[W(s)]),u=F(()=>t.mode===`breakdown`?W(i)?.units||``:`%`),d=F(()=>(t.mode===`breakdown`?W(c):W(l))?.views?.[W(n)]),f=F(()=>W(d)?.rows||[]),p=F(()=>W(d)?.total),m=F(()=>W(d)?.level||`unknown`),h=F(()=>W(d)?.peak||1),g=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var _=Su(),v=B(_),y=z(v),b=H(z(y));Z(b,21,()=>Co,X,(e,t)=>{var n=uu(),r=V(n,!0),i={};U(e=>{J(r,e),i!==(i=W(t))&&(n.value=(n.__value=i)??``)},[()=>W(t).charAt(0).toUpperCase()+W(t).slice(1)]),q(e,n)}),P(b),hi(b),P(y);var x=H(y,2),S=H(x,2),C=V(H(S,2),!0);P(v);var w=H(v,2),T=z(w),E=V(T,!0),D=H(T,2),ee=V(D),O=H(D,2),te=e=>{var t=fu(),n=B(t),r=V(n),a=H(n,2),o=e=>{var t=du(),n=V(t);U(()=>J(n,`Data as of ${W(i).dataAsOf??``}`)),q(e,t)};Y(a,e=>{W(i).dataAsOf&&e(o)});var s=V(H(a,2));xe(2),U((e,t)=>{J(r,`Latest fetch ${e??``} // queried ${W(i).from??``} → ${W(i).through??``}. - Reports are fetched from OpenAI and are not saved between runs.`),J(s,`${(W(c)?.date||`No daily buckets reported`)??``} // ${t??``} - ${W(u)??``}`)},[()=>ha(W(i).fetchedAt),()=>g(W(p))]),q(e,t)},ne=e=>{var t=gu(),n=B(t),r=z(n);let i;var o=V(r,!0),s=H(r),c=e=>{q(e,pu())};Y(s,e=>{W(a).approximate&&e(c)});var u=H(s);P(n);var d=H(n,2),f=z(d),h=H(f),_=e=>{var t=Pr();U(()=>J(t,`// Boundary tolerance ${W(a).boundary_tolerance_seconds??``}s`)),q(e,t)};Y(h,e=>{W(a).boundary_tolerance_seconds!=null&&e(_)}),P(d);var v=H(d,2),y=e=>{var t=hu(),n=B(t),r=z(n),i=H(r);let a;var o=V(i);P(n);var s=H(n,2),c=V(s),u=H(s,2),d=e=>{q(e,mu())};Y(u,e=>{W(l).accounting_complete||e(d)}),xe(2),U(e=>{J(r,`${W(l).window_minutes??``} MIN // ${W(l).plan_type??``} // `),a=li(i,1,`svelte-1fbui7h`,null,a,{muted:W(m)===`unknown`,"quota-near":W(m)===`near`,"quota-full":W(m)===`full`}),J(o,`USED ${e??``}${W(p)==null?``:`%`}`),J(c,`${W(l).starts_at??``} → ${W(l).ends_at??``}`)},[()=>g(W(p))]),q(e,t)};Y(v,e=>{W(l)&&e(y)}),U(e=>{i=li(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!W(a).coverage_complete}),J(o,W(a).coverage_complete?`Reported range complete`:`Partial coverage`),J(u,` // Latest fetch ${e??``}`),J(f,`Coverage starts ${(W(a).coverage_start||`unknown`)??``} // Data as of ${(W(a).data_as_of||`unknown`)??``}`)},[()=>ha(W(a).fetchedAt)]),q(e,t)},k=e=>{q(e,_u())};Y(O,e=>{t.mode===`breakdown`&&W(i)?e(te):t.mode===`periods`&&W(a)?e(ne,1):e(k,-1)});var A=H(O,2),re=e=>{var n=yu(),r=z(n),i=V(H(z(r),2),!0);P(r),Z(H(r,2),17,()=>W(f),X,(e,n,r)=>{let i=()=>W(n).name,a=()=>W(n).value;var o=vu();let s;var c=z(o),l=V(c,!0),u=H(c,2),d=z(u);let f;P(u);var p=V(H(u,2));P(o),U((e,n,a)=>{s=li(o,1,`report-row svelte-1fbui7h`,null,s,{unknown:e,alternate:r%2==1}),Q(c,`title`,i()),J(l,i()),f=di(d,``,f,{width:n}),J(p,`${a??``}${t.mode===`periods`?`%`:``}`)},[()=>i().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*a()/W(h))}%`,()=>g(a())]),q(e,o)}),P(n),U(()=>J(i,t.mode===`breakdown`?W(u):`QUOTA USED`)),q(e,n)},ie=e=>{q(e,bu())},ae=e=>{q(e,xu())};Y(A,e=>{W(f).length?e(re):t.mode===`breakdown`&&W(d)?.knownEmpty?e(ie,1):(W(i)&&t.mode===`breakdown`||W(a)&&t.mode===`periods`)&&e(ae,2)}),P(w),U(()=>{x.disabled=W(s)>=W(o)-1,S.disabled=W(s)===0,J(C,W(o)?`${W(s)+1} / ${W(o)}`:`NO DATA`),J(E,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),J(ee,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),gi(b,()=>W(n),e=>R(n,e)),G(`click`,x,()=>R(r,W(s)+1)),G(`click`,S,()=>R(r,W(s)-1)),q(e,_),We()}wr([`click`]);var wu=864e5;function Tu(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 Eu(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Tu(r,-t),a=new Date(i.getTime()+wu);if(e===n)return{start:a,end:r};r=i}}var Du=K(``),Ou=K(``,1),ku=K(`

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

      `),Au=K(`

      Token history unavailable; other reports may still be available.

      `),ju=K(``),Mu=K(`
      `),Nu=K(`

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

      `,1),Pu=K(`
      `,1),Fu=K(` `),Iu=K(`

      LIFETIME TOKENS

      PEAK DAY

      CURRENT STREAK

      DAYS

      LONGEST TURN

      SECONDS

      LONGEST STREAK

      DAYS

      OPENAI // UTC

      Accessible data table
      Date (UTC)Tokens

      `,1),Lu=K(`

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

      `),Ru=K(`

      USAGE // ACCOUNT HISTORY

      Account-wide history reported by Codex, not the local Sessions counter. Dates - use UTC. Allowance history is approximate where indicated; reset causes are - not provided.

      `,1);function zu(e,t){Ue(t,!0);let n=L(`daily`),r=L(12),i=L(0),a=F(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Eu(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=F(()=>Math.max(1,...W(a).map(e=>e.tokens))),s=F(()=>W(a).length?new Date(W(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=F(()=>{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=Ru(),u=H(B(l),4);Z(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],X,(e,t)=>{var r=F(()=>_(t,2));let a=()=>W(r)[0],o=()=>W(r)[1];var s=Du();let c;var l=V(s,!0);U(()=>{Q(s,`aria-pressed`,W(n)===a()),c=li(s,1,``,null,c,{active:W(n)===a()}),J(l,o())}),G(`click`,s,()=>{R(n,a(),!0),R(i,0)}),q(e,s)}),P(u);var d=H(u,2),f=z(d),p=e=>{var t=Ou(),n=B(t),a=H(z(n)),o=z(a);o.value=o.__value=6;var s=H(o);s.value=s.__value=12,P(a),hi(a),P(n);var c=H(n),l=H(c);U(()=>l.disabled=W(i)===0),G(`change`,a,()=>R(i,0)),gi(a,()=>W(r),e=>R(r,e)),G(`click`,c,()=>Kt(i)),G(`click`,l,()=>Kt(i,-1)),q(e,t)};Y(f,e=>{W(n)!==`breakdown`&&W(n)!==`periods`&&e(p)}),P(d);var m=H(d,2),h=e=>{q(e,ku())};Y(m,e=>{$.data?.usageError&&e(h)});var g=H(m,2),v=e=>{q(e,Au())};Y(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&W(n)!==`breakdown`&&W(n)!==`periods`&&e(v)});var y=H(g,2),b=e=>{var t=Fr();qr(B(t),()=>W(n),e=>{{let t=F(()=>$.data?.usage?.reports);Cu(e,{get reports(){return W(t)},get mode(){return W(n)}})}}),q(e,t)},x=e=>{var t=Iu(),r=B(t),i=z(r),l=V(H(z(i),2),!0);P(i);var u=H(i,2),d=V(H(z(u),2),!0);P(u);var f=H(u,2),p=H(z(f),2),m=z(p);xe(),P(p),P(f);var h=H(f,2),g=H(z(h),2),_=z(g);xe(),P(g),P(h);var v=H(h,2),y=H(z(v),2),b=z(y);xe(),P(y),P(v),P(r);var x=H(r,4),S=z(x),C=V(S),w=H(S,2),T=e=>{var t=Nu(),n=B(t),r=z(n),i=z(r);Z(i,17,()=>Array(W(s)),X,(e,t)=>{q(e,ju())}),Z(H(i,2),17,()=>W(a),X,(e,t)=>{var n=Mu();let r,i;U(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}: ${ma(W(t).tokens)} tokens`]),q(e,n)}),P(r),P(n),xe(2),q(e,t)},E=e=>{var t=Pu(),r=B(t);{let e=F(()=>W(c).map(e=>e.tokens)),t=F(()=>W(n)+` usage`);yo(r,{get values(){return W(e)},get label(){return W(t)}})}var i=H(r,2),a=z(i),o=V(a,!0),s=V(H(a),!0);P(i),U(e=>{J(o,W(c)[0]?.date),J(s,e)},[()=>W(c).at(-1)?.date]),q(e,t)};Y(w,e=>{W(n)===`daily`?e(T):e(E,-1)});var D=H(w,2),ee=H(z(D),2),O=z(ee),te=H(z(O));Z(te,21,()=>W(n)===`daily`?W(a):W(c),X,(e,t)=>{var n=Fu(),r=z(n),i=V(r,!0),a=V(H(r),!0);P(n),U(e=>{J(i,W(t).date),J(a,e)},[()=>ma(W(t).tokens)]),q(e,n)}),P(te),P(O),P(ee),P(D),P(x);var ne=V(H(x,2));U((e,t,n,r,i,o,s)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${r??``} `),J(b,`${i??``} `),J(C,`${W(a)[0]?.date??``} — ${o??``}`),J(ne,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>ma($.data.usage.summary.lifetimeTokens),()=>ma($.data.usage.summary.peakDailyTokens),()=>ma($.data.usage.summary.currentStreakDays),()=>ma($.data.usage.summary.longestRunningTurnSec),()=>ma($.data.usage.summary.longestStreakDays),()=>W(a).at(-1)?.date,()=>ha($.data.usageAt)]),q(e,t)},S=e=>{q(e,Lu())};Y(y,e=>{W(n)===`breakdown`||W(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),q(e,l),We()}wr([`click`,`change`]);var Bu=K(`

      Page not found

      Return to Quota

      `,1);function Vu(e){var t=Bu();xe(2),q(e,t)}var Hu=`CODEXOMETER`,Uu=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),Wu=Uu[0].length,Gu=Uu.length,Ku=0,qu=[...Hu].map(e=>{let t=e===`M`?5:3,n={start:Ku,width:t};return Ku+=t+1,n}),Ju=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Yu=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function Xu(e=Hu,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function ed(){let e=Zu[Math.floor(Math.random()*Zu.length)],t=Math.floor(Math.random()*4294967296),n=$u(t),r=[...Hu].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function td(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Hu.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=$u(e.seed^Math.floor(t/70)),r=[...Hu].map(e=>{let t;do t=Ju[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Hu[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Hu,cursor:-1,dot:!1}}var nd=Nr(``);function rd(e,t){Ue(t,!0);let n=Gi(t,`text`,3,Hu),r=Gi(t,`cursor`,19,()=>-1),i=Gi(t,`dot`,3,!1),a=F(()=>Xu(n(),r(),i()));var o=nd(),s=V(o);U(()=>{Q(o,`viewBox`,`0 0 ${Wu} ${Gu}`),Q(o,`width`,Wu),Q(o,`height`,Gu),Q(s,`d`,W(a))}),q(e,o),We()}var id=K(`
      `),ad=K(`
      `);function od(e,t){Ue(t,!0);let n=L(void 0),r=L(0),i=L(Yt({width:0,height:0,pixelRatio:1})),a=L(Yt({x:0,y:0,width:0})),o=F(()=>W(n)?td(W(n),W(r)):void 0),s=F(()=>{if(!W(n))return{x:0,y:0,width:0};let e=Qu[W(n).variant],t=Math.min(Math.max((W(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=W(i).width+(W(a).width-W(i).width)*o,c=Math.max((W(i).height-W(i).width*Gu/Wu)/2,0),l=(W(n).variant===`slide`&&W(r)Math.round(e*W(i).pixelRatio)/W(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Ki(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}R(n,ed(),!0);let o=Qu[W(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();R(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&R(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{R(r,Math.max(e-l,0),!0),W(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=ad(),l=z(c),u=e=>{var t=id();let n;rd(z(t),{get text(){return W(o).text},get cursor(){return W(o).cursor},get dot(){return W(o).dot}}),P(t),U(()=>{Q(t,`data-text`,W(o).text),Q(t,`data-cursor`,W(o).dot?W(o).cursor:void 0),n=di(t,``,n,{left:`${W(s).x}px`,top:`${W(s).y}px`,width:`${W(s).width}px`})}),q(e,t)};Y(l,e=>{W(o)&&e(u)});var d=H(l,2);P(c),U(()=>Q(c,`data-entrance`,W(n)?.variant)),G(`click`,d,function(...e){t.onfinish?.apply(this,e)}),q(e,c),We()}wr([`click`]);var sd=K(` `),cd=K(`

      `),ld=K(`

      Connecting to your local Codexometer…

      `),ud=K(``),dd=K(`

      Your quota. Your sessions. Your command centre.

      `);function fd(e,t){Ue(t,!0);let n={"/":go,"/quota/:view?":go,"/sessions/:id?":lu,"/usage":zu,"*":Vu},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=L(`hacker`),a=L(!0),o=L(void 0);vn(()=>{ca.requests&&dr().then(()=>{W(o)?.focus(),W(o)?.scrollIntoView({block:`nearest`})})});let s=L(void 0),c=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];vn(()=>{la()}),vn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Xi.location)&&(oa.tab=e)}),Ki(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&c.includes(e)&&R(i,e,!0)}catch{}return ka()});function l(){try{localStorage.setItem(`codexometer.web.theme`,W(i))}catch{}}var u=dd(),d=z(u),f=z(d),p=z(f);rd(z(p),{}),P(p),Li(p,e=>R(s,e),()=>W(s)),xe(2),P(f);var m=H(f,2),h=z(m);let g;var v=H(h,1,!0),y=V(H(v));P(m),P(d);var b=H(d,2);Z(b,21,()=>Object.entries(r),X,(e,t)=>{var n=F(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1],a=F(()=>i().test(Xi.location));var o=sd();let s;var c=V(o,!0);U(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+oa.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)}),P(b);var x=H(b,2),S=z(x),C=e=>{var t=cd(),n=V(t,!0);U(()=>J(n,$.error)),q(e,t)};Y(S,e=>{$.error&&e(C)});var w=H(S,2),T=e=>{ea(e,{get routes(){return n}})},E=e=>{q(e,ld())};Y(w,e=>{$.data?e(T):$.error||e(E,1)}),P(x);var D=H(x,2),ee=z(D),O=V(ee),te=H(ee,2),ne=V(te,!0),k=H(te,2),A=H(z(k));Z(A,21,()=>c,X,(e,t)=>{var n=ud(),r=V(n,!0),i={};U(e=>{J(r,e),i!==(i=W(t))&&(n.value=(n.__value=i)??``)},[()=>W(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),P(A),Li(A,e=>R(o,e),()=>W(o)),hi(A),P(k),P(D);var re=H(D,2),ie=e=>{od(e,{get target(){return W(s)},onfinish:()=>R(a,!1)})};Y(re,e=>{W(a)&&e(ie)}),P(u),U(()=>{Q(u,`data-theme`,W(i)),Q(u,`data-starting`,W(a)),d.inert=W(a),g=li(h,1,`lamp`,null,g,{lit:$.connected}),J(v,$.connected?`CONNECTED`:`OFFLINE`),J(y,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),b.inert=W(a),x.inert=W(a),D.inert=W(a),J(O,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(ne,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),G(`change`,A,l),gi(A,()=>W(i),e=>R(i,e)),q(e,u),We()}wr([`change`]),Vr(fd,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-C9fjTT_E.js b/internal/web/dist/assets/index-C9fjTT_E.js new file mode 100644 index 0000000..51d2eae --- /dev/null +++ b/internal/web/dist/assets/index-C9fjTT_E.js @@ -0,0 +1,54 @@ +(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,D=1<<20,O=1<<25,k=1<<21,ee=1<<22,te=1<<23,A=Symbol(`$state`),ne=Symbol(`component`),j=Symbol(`legacy props`),re=Symbol(``),ie=Symbol(`attributes`),ae=Symbol(`class`),oe=Symbol(`style`),se=Symbol(`text`),ce=Symbol(`form reset`),le=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ue=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),de={},fe=Symbol(`uninitialized`),pe=`http://www.w3.org/1999/xhtml`;function me(){console.warn(`https://svelte.dev/e/derived_inert`)}function he(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ge(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function _e(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function ve(e){M=e}var N;function P(e){if(e===null)throw he(),de;return N=e}function ye(){return P(an(N))}function F(e){if(M){if(an(N)!==null)throw he(),de;N=e}}function be(e=1){if(M){for(var t=e,n=N;t--;)n=an(n);N=n}}function xe(e=!0){for(var t=0,n=N;;){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=an(n);e&&n.remove(),n=i}}function Se(e){if(!e||e.nodeType!==8)throw he(),de;return e.data}function Ce(e){return e===this.v}function we(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Te(e){return!we(e,this.v)}function Ee(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function De(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Oe(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function ke(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ae(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function je(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Me(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ne(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Pe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Fe(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ie(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Le(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Re=!1;function ze(){Re=!0}var Be=null;function Ve(e){Be=e}function He(e,t=!1,n){Be={p:Be,i:!1,c:null,e:null,s:e,x:null,r:Wn,l:Re&&!t?{s:null,u:null,$:[]}:null}}function Ue(e){var t=Be,n=t.e;if(n!==null){t.e=null;for(var r of n)vn(r)}return e!==void 0&&(t.x=e),t.i=!0,Be=t.p,We(e)}function We(e={}){return i(e,ne,{value:!0}),e}function Ge(){return!Re||Be!==null&&Be.l===null}var Ke=[];function qe(){var e=Ke;Ke=[],m(e)}function Je(e){if(Ke.length===0&&!St){var t=Ke;queueMicrotask(()=>{t===Ke&&qe()})}Ke.push(e)}function Ye(){for(;Ke.length>0;)qe()}var Xe=~(y|b|v);function Ze(e,t){e.f=e.f&Xe|t}function Qe(e){e.f&512||e.deps===null?Ze(e,v):Ze(e,b)}function $e(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Ze(e,v)}function et(e){M&&rn(e)!==null&&on(e)}var tt=!1;function nt(){tt||(tt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ce]?.()})},{capture:!0}))}function rt(e){var t=Vn,n=Wn;Un(null),Gn(null);try{return e()}finally{Un(t),Gn(n)}}function it(e,t,n,r=n){e.addEventListener(t,()=>rt(n));let i=e[ce];e[ce]=i?()=>{i(),r(!0)}:()=>r(!0),nt()}function at(e,t,n,r){let i=Ge()?lt:ft;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=Wn,c=ot(),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){dn(e,s)}st()}}var d=ct();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>dt(e))).then(u).catch(e=>dn(e,s)).finally(d)}l?l.then(()=>{c(),f(),st()}):f()}function ot(){var e=Wn,t=Vn,n=Be,r=L;return function(i=!0){Gn(e),Un(t),Ve(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function st(e=!0){Gn(null),Un(null),Ve(null),e&&L?.deactivate()}function ct(){var e=Wn,t=e.b,n=L,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 lt(e){var t=2|y;return Wn!==null&&(Wn.f|=E),{ctx:Be,deps:null,effects:null,equals:Ce,f:t,fn:e,reactions:null,rv:0,v:fe,wv:0,parent:Wn,ac:null}}var ut=Symbol(`obsolete`);function dt(e,t,n){let r=Wn;r===null&&De();var i=void 0,a=zt(fe),o=!Vn,s=new Set;return Sn(()=>{var t=Wn,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==le&&n.reject(e)}).finally(st)}catch(e){n.reject(e),st()}var c=L;if(o){if(t.f&32768)var l=ct();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(ut);else for(let e of s.values())e.reject(ut);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==ut&&(c.activate(),t?(a.f|=te,Ut(a,t)):(a.f&8388608&&(a.f^=te),Ut(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),gn(()=>{for(let e of s)e.reject(ut)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function I(e){let t=lt(e);return qn(t),t}function ft(e){let t=lt(e);return t.equals=Te,t}function pt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(le),t.ac=null}),t.fn!==null&&(t.teardown=f),cr(t,0),Dn(t))}function _t(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&lr(t)}var vt=null,L=null,yt=null,bt=null,xt=null,St=!1,Ct=!1,wt=null,Tt=null,Et=0,Dt=1,Ot=class e{id=Dt++;#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(){vt===null?vt=this:(vt.#n=this,this.#t=vt),vt=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)Ze(r,y),t(r);for(r of n.m)Ze(r,b),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=v}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),Ze(e,y),this.schedule(e);for(let e of this.#d)Ze(e,b),this.schedule(e);this.apply();for(var t=wt=[],n=[],r=Tt=[];this.#c.length>0;){Et++>1e3&&(this.#S(),At());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw Ft(e),this.#h()||this.discard(),t}}if(L=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(wt=null,Tt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Pt(e,t);r.length>0&&L.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),yt=this,Mt(n),Mt(t),yt=null,this.#s?.resolve();var o=L;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(Lt.clear(),o.#_())}}#v(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):rr(r)&&(i&16&&this.#d.add(r),lr(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}}}#y(){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}#b(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),Ze(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),L=this,this.#_()}#x(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(L===null){let t=L=new e;!Ct&&!St&&Je(()=>{t.#e||t.flush()})}return L}apply(){bt=null}schedule(e){xt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?vt=e:t.#t=e,this.linked=!1}}};function kt(e){var t=St;St=!0;try{var n;for(e&&(L!==null&&!L.is_fork&&L.flush(),n=e());;){if(Ye(),L===null)return n;L.flush()}}finally{St=t}}function At(){try{Me()}catch(e){dn(e,xt)}}var jt=null;function Mt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Lt.clear();for(let e of jt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)jt.has(n)&&(jt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||lr(n)}}jt.clear()}}jt=null}}function Nt(e){L.schedule(e)}function Pt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Ze(e,v);for(var n=e.first;n!==null;)Pt(n,t),n=n.next}}function Ft(e){Ze(e,v);for(var t=e.first;t!==null;)Ft(t),t=t.next}var It=new Set,Lt=new Map,Rt=!1;function zt(e,t){return{f:0,v:e,reactions:null,equals:Ce,rv:0,wv:0}}function R(e,t){let n=zt(e,t);return qn(n),n}function Bt(e,t=!1,n=!0){let r=zt(e);return t||(r.equals=Te),Re&&n&&Be!==null&&Be.l!==null&&(Be.l.s??=[]).push(r),r}function z(e,t,n=!1){return Vn!==null&&(!Hn||Vn.f&131072)&&Ge()&&Vn.f&4325394&&(Kn===null||!Kn.has(e))&&Ie(),Ut(e,n?Jt(t):t,Tt)}var Vt=null,Ht=0;function Ut(e,t,n=null){if(!e.equals(t)){zn?Lt.set(e,t):Lt.has(e)||Lt.set(e,e.v);var r=Ot.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&mt(t),bt===null&&Qe(t)}e.wv=nr(),Vt=null,Ht=0,qt(e,y,n),Vt=null,Ge()&&Wn!==null&&Wn.f&1024&&!(Wn.f&96)&&(Xn===null?Zn([e]):Xn.push(e)),!r.is_fork&&It.size>0&&!Rt&&Wt()}return t}function Wt(){Rt=!1;for(let e of It){e.f&1024&&Ze(e,b);let t;try{t=rr(e)}catch{t=!0}t&&lr(e)}It.clear()}function Gt(e,t=1){var n=G(e),r=t===1?n++:n--;return z(e,n),r}function Kt(e){z(e,e.v+1)}function qt(e,t,n){var r=e.reactions;if(r!==null){var i=Ge(),a=r.length;if(Ht+=a,Ht>1e5&&Vt===null&&(Vt=new Set),Vt!==null){if(Vt.has(e))return;Vt.add(e)}for(var o=0;o{if(er===d)return e();var t=Vn,n=er;Un(null),tr(d);var r=e();return Un(t),tr(n),r};return i&&r.set(`length`,R(t.length,u)),new Proxy(t,{defineProperty(e,t,n){`value`in n&&n.configurable!==!1&&n.enumerable!==!1&&n.writable!==!1||Pe();var i=r.get(t);return i===void 0?f(()=>{var e=R(n.value,u);return r.set(t,e),e}):z(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>R(fe,u));r.set(t,e),Kt(o)}}else z(n,fe),Kt(o);return!0},get(e,n,i){if(n===A)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>R(Jt(s?e[n]:fe),u)),r.set(n,o)),o!==void 0){var c=G(o);return c===fe?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var n=Reflect.getOwnPropertyDescriptor(e,t),i=r.get(t);if(i!==void 0){var a=G(i);if(a===fe)return;if(n&&`value`in n)n.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return n},has(e,t){if(t===A)return!0;var n=r.get(t),i=n!==void 0&&n.v!==fe||Reflect.has(e,t);return(n!==void 0||Wn!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>R(i?Jt(e[t]):fe,u)),r.set(t,n)),G(n)===fe)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dR(fe,u)),r.set(d+``,p)):z(p,fe)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>R(void 0,u)),z(c,Jt(n)),r.set(t,c));else{l=c.v!==fe;var m=f(()=>Jt(n));z(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&&z(g,_+1)}Kt(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!==fe});for(var[n,i]of r)i.v!==fe&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Fe()}})}function Yt(e){try{if(typeof e==`object`&&e&&A in e)return e[A]}catch{}return e}function Xt(e,t){return Object.is(Yt(e),Yt(t))}var Zt,Qt,$t,en;function tn(){if(Zt===void 0){Zt=window,Qt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;$t=a(t,`firstChild`).get,en=a(t,`nextSibling`).get,u(e)&&(e[ae]=void 0,e[ie]=null,e[oe]=void 0,e.__e=void 0),u(n)&&(n[se]=void 0)}}function nn(e=``){return document.createTextNode(e)}function rn(e){return $t.call(e)}function an(e){return en.call(e)}function B(e,t){if(!M)return rn(e);var n=rn(N);if(n===null)n=N.appendChild(nn());else if(t&&n.nodeType!==3){var r=nn();return n?.before(r),P(r),r}return t&&ln(n),P(n),n}function V(e,t=!1){if(!M){var n=rn(e);return n instanceof Comment&&n.data===``?an(n):n}if(t){if(N?.nodeType!==3){var r=nn();return N?.before(r),P(r),r}ln(N)}return N}function H(e,t=!1){if(!M)return rn(e);var n=B(e,t);return F(e),n}function U(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=an(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=nn();return r===null?i?.after(a):r.before(a),P(a),a}ln(r)}return P(r),r}function on(e){e.textContent=``}function sn(){return!1}function cn(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 ln(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 un(e){var t=Wn;if(t===null)return Vn.f|=te,e;if(!(t.f&32768)&&!(t.f&4))throw e;dn(e,t)}function dn(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 fn(e){Wn===null&&(Vn===null&&je(e),Ae()),zn&&ke(e)}function pn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function mn(e,t){var n=Wn;n!==null&&n.f&8192&&(e|=x);var r={ctx:Be,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};L?.register_created_effect(r);var i=r;if(e&4)wt===null?Ot.ensure().schedule(r):wt.push(r);else if(t!==null){try{lr(r)}catch(e){throw kn(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&&pn(i,n),Vn!==null&&Vn.f&2&&!(e&64))){var a=Vn;(a.effects??=[]).push(i)}return r}function hn(){return Vn!==null&&!Hn}function gn(e){let t=mn(8,null);return Ze(t,v),t.teardown=e,t}function _n(e){fn(`$effect`);var t=Wn.f;if(!Vn&&t&32&&Be!==null&&!Be.i){var n=Be;(n.e??=[]).push(e)}else return vn(e)}function vn(e){return mn(4|D,e)}function yn(e){return fn(`$effect.pre`),mn(8|D,e)}function bn(e){Ot.ensure();let t=mn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Mn(t,()=>{kn(t),n(void 0)}):(kn(t),n(void 0))})}function xn(e){return mn(4,e)}function Sn(e){return mn(ee|E,e)}function Cn(e,t=0){return mn(8|t,e)}function W(e,t=[],n=[],r=[]){at(r,t,n,t=>{mn(8,()=>{e(...t.map(G))})})}function wn(e,t=0){return mn(16|t,e)}function Tn(e){return mn(32|E,e)}function En(e){var t=e.teardown;if(t!==null){let n=zn,r=Vn;Bn(!0),Un(null);try{t.call(null)}catch(t){dn(t,e.parent)}finally{Bn(n),Un(r)}}}function Dn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&rt(()=>{e.abort(le)});var r=n.next;n.f&64?n.parent=null:kn(n,t),n=r}}function On(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||kn(t),t=n}}function kn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(An(e.nodes.start,e.nodes.end),n=!0),e.f|=w,Dn(e,t&&!n),cr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();En(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&jn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function An(e,t){for(;e!==null;){var n=e===t?null:an(e);e.remove(),e=n}}function jn(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 Mn(e,t,n=!0){var r=[];e.f|=256,Nn(e,r,!0);var i=()=>{n&&kn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Nn(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);Nn(i,t,o?n:!1)}i=a}}}function Pn(e){e.f&=-257,Fn(e,!0)}function Fn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(Ze(e,y),Ot.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Fn(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 In(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:an(n);t.append(n),n=i}}var Ln=null,Rn=!1,zn=!1;function Bn(e){zn=e}var Vn=null,Hn=!1;function Un(e){Vn=e}var Wn=null;function Gn(e){Wn=e}var Kn=null;function qn(e){Vn!==null&&(Vn.f&2097152||Vn.f&2)&&(Kn??=new Set).add(e)}var Jn=null,Yn=0,Xn=null;function Zn(e){Xn=e}var Qn=1,$n=0,er=$n;function tr(e){er=e}function nr(){return++Qn}function rr(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&bt===null&&Ze(e,v)}return!1}function ir(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Kn!==null&&Kn.has(e)))for(var i=0;i{e.ac.abort(le)}),e.ac=null);try{e.f|=k;var u=e.fn,d=u();e.f|=C;var f=or(e);if(Ge()&&Xn!==null&&!Hn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Yn+Jn.length,r=0;r{s.ac.abort(le),s.ac=null,Ze(s,y)}),gt(s),cr(s,0)}}function cr(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`?(i.__removed=!1,Je(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Sr(e,t,n,r,i){var a={capture:r,passive:i},o=xr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&gn(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function K(e,t,n){(t[vr]??={})[e]=n}function Cr(e){for(var t=0;t{Tr=!1,wr=null}));var s=0,c=wr===e&&e[vr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[vr]=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=Vn,f=Wn;Un(null),Gn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[vr]?.[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[vr]=t,delete e.currentTarget,Un(d),Gn(f)}}}var Dr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Or(e){return Dr?.createHTML(e)??e}function kr(e){var t=cn(`template`);return t.innerHTML=Or(e.replaceAll(``,``)),t.content}function Ar(e,t){var n=Wn;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(M)return Ar(N,null),N;i===void 0&&(i=kr(a?e:``+e),n||(i=rn(i)));var t=r||Qt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=rn(t),s=t.lastChild;Ar(o,s)}else Ar(t,t);return t}}function jr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(M)return Ar(N,null),N;if(!o){var e=rn(kr(a));if(i)for(o=document.createDocumentFragment();rn(e);)o.appendChild(rn(e));else o=rn(e)}var t=o.cloneNode(!0);if(i){var n=rn(t),r=t.lastChild;Ar(n,r)}else Ar(t,t);return t}}function Mr(e,t){return jr(e,t,`svg`)}function Nr(e=``){if(!M){var t=nn(e+``);return Ar(t,t),t}var n=N;return n.nodeType===3?ln(n):(n.before(n=nn()),P(n)),Ar(n,n),n}function Pr(){if(M)return Ar(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=nn();return e.append(t,n),Ar(t,n),e}function J(e,t){if(M){var n=Wn;n.f&32768&&n.nodes.end!==null||(n.nodes.end=N),ye()}else e!==null&&e.before(t)}function Fr(){if(M&&N&&N.nodeType===8&&N.textContent?.startsWith(`$`)){let e=N.textContent.substring(1);return ye(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Ir(e){let t=0,n=zt(0),r;return()=>{hn()&&(G(n),Cn(()=>(t===0&&(r=pr(()=>e(()=>Kt(n)))),t+=1,()=>{Je(()=>{--t,t===0&&(r?.(),r=void 0,Kt(n))})})))}}var Lr=T|E;function Rr(e,t,n,r){new zr(e,t,n,r)}var zr=class{parent;is_pending=!1;transform_error;#e;#t=M?N: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=Ir(()=>(this.#m=zt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=Wn;t.b=this,t.f|=128,n(e)},this.parent=Wn.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=wn(()=>{if(M){let e=this.#t;ye();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()},Lr),M&&(this.#e=N)}#g(){try{this.#a=Tn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Je(r),t&&(this.#s=Tn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{t?_e():(t=!0,n&&Le(),this.#s!==null&&Mn(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){dn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Tn(()=>e(this.#e)),Je(()=>{var e=this.#c=document.createDocumentFragment(),t=nn(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return Tn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){dn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(L)):this.#u===0&&(this.#e.before(e),this.#c=null,Mn(this.#o,()=>{this.#o=null}),this.#x(L))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Tn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();In(this.#a,e);let t=this.#n.pending;this.#o=Tn(()=>t(this.#e))}else this.#x(L)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){$e(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=Wn,n=Vn,r=Be;Gn(this.#i),Un(this.#i),Ve(this.#i.ctx);try{return Ot.ensure(),e()}finally{Gn(t),Un(n),Ve(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Mn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Je(()=>{this.#d=!1,this.#m&&Ut(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),G(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;L?.is_fork?(this.#a&&L.skip_effect(this.#a),this.#o&&L.skip_effect(this.#o),this.#s&&L.skip_effect(this.#s),L.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(kn(this.#a),null),this.#o&&=(kn(this.#o),null),this.#s&&=(kn(this.#s),null),M&&(P(this.#t),be(),P(xe()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return Tn(()=>{var r=Wn;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return dn(e,this.#i.parent),null}}))};Je(()=>{var t;try{t=this.transform_error(e)}catch(e){dn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>dn(e,this.#i&&this.#i.parent)):n(t)})}};function Y(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[se]??=e.nodeValue)&&(e[se]=n,e.nodeValue=`${n}`)}function Br(e,t){return Hr(e,t)}var Vr=new Map;function Hr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){tn();var l=void 0,u=bn(()=>{var s=n??t.appendChild(nn());Rr(s,{pending:()=>{}},t=>{He({});var n=Be;if(o&&(n.c=o),a&&(i.$$events=a),M&&Ar(t,null),l=e(t,i)||We(),M&&(Wn.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw he(),de;Ue()},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=Vr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Er),r.delete(e),r.size===0&&Vr.delete(n)):r.set(e,i)}br.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Ur.set(l,u),l}var Ur=new WeakMap,Wr=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)Pn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Pn(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&&(kn(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();In(r,t),t.append(nn()),this.#n.set(e,{effect:r,fragment:t})}else kn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Mn(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)||(kn(n.effect),this.#n.delete(e))};ensure(e,t){var n=L,r=sn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=nn();i.append(a),this.#n.set(e,{effect:Tn(()=>t(a)),fragment:i})}else this.#t.set(e,Tn(()=>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 M&&(this.anchor=N),this.#a(n)}};function X(e,t,n=!1){var r;M&&(r=N,ye());var i=new Wr(e),a=n?T:0;function o(e,t){if(M){var n=Se(r);if(e!==parseInt(n.substring(1))){var a=xe();P(a),i.anchor=a,ve(!1),i.ensure(e,t),ve(!0);return}}i.ensure(e,t)}wn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Gr=Symbol(`NaN`);function Kr(e,t,n){M&&ye();var r=new Wr(e),i=!Ge();wn(()=>{var e=t();e!==e&&(e=Gr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function qr(e,t){return t}function Jr(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;Yr(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;on(d),d.append(u),e.items.clear()}Yr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Yr(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,Qr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=O,ei(d,null,c)):Pn(d):Mn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:wn(()=>{p=G(f);var e=p.length;let t=!1;M&&Se(c)===`[!`!=(e===0)&&(c=xe(),P(c),ve(!1),t=!0);for(var r=new Set,u=L,v=sn(),y=0;ys(c)):(d=Tn(()=>s(Xr??=nn())),d.f|=O)),e>r.size&&Oe(``,``,``),M&&e>0&&P(xe()),!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&&ve(!0),G(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,M&&(c=N)}function Zr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Qr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Zr(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 $r(e,t,n,r,i,a,o,s){var c=o&1?o&16?zt(n):Bt(n,!1,!1):null,l=o&2?zt(i):null;return{v:c,i:l,e:Tn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ei(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=an(r);if(a.before(r),r===i)return;r=o}}function ti(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ni(e,t,...n){var r=new Wr(e);wn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},T)}function ri(e,t,n){var r;M&&(r=N,ye());var i=new Wr(e);wn(()=>{var e=t()??null;if(M&&Se(r)===`[`!=(e!==null)){var a=xe();P(a),i.anchor=a,ve(!1),i.ensure(e,e&&(t=>n(t,e))),ve(!0)}else 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`]}),gn(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;it(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,L!==null&&r.add(L)}),xn(()=>{var a=t();if(e===document.activeElement){var o=L;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=ue?`link`:`LINK`;function Si(e){if(M){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[ce]=n,Je(n),nt()}}function Ci(e,t){var n=wi(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Q(e,t,n,r){var i=wi(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===xi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[re]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ei(e).has(t)?e[t]=n:e.setAttribute(t,n))}function wi(e){return e[ie]??={[yi]:e.nodeName.includes(`-`),[bi]:e.namespaceURI===pe}}var Ti=new Map;function Ei(e){var t=e.getAttribute(`is`)||e.nodeName,n=Ti.get(t);if(n)return n;Ti.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 Di(e,t,n=t){var r=new WeakSet;it(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Mi(e)?Ni(a):a,n(a),L!==null&&r.add(L),await ur(),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))}}}),(M&&e.defaultValue!==e.value||pr(t)==null&&e.value)&&(n(Mi(e)?Ni(e.value):e.value),L!==null&&r.add(L)),Cn(()=>{var n=t();if(e===document.activeElement){var i=L;if(r.has(i))return}Mi(e)&&n===Ni(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Oi=new Set;function ki(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),it(n,`change`,()=>{var e=n.__value;a&&(e=ji(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Cn(()=>{var e=r();M&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=Xt(n.__value,e)}),gn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Oi.has(o)||(Oi.add(o),Je(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Oi.delete(o)})),Je(()=>{if(s){var e=a?ji(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Ai(e,t,n=t){it(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(M&&e.defaultChecked!==e.checked||pr(t)==null)&&n(e.checked),Cn(()=>{e.checked=!!t()})}function ji(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 Fi(e,t,n){var r=Pi.observe(e,()=>n(e[t]));xn(()=>(pr(()=>n(e[t])),r))}function Ii(e,t){return e===t||e?.[A]===t}function Li(e=We(),t,n,r){var i=Be.r,a=Wn;return xn(()=>{var o,s;return Cn(()=>{o=s,s=r?.()||[],pr(()=>{Ii(n(...s),e)||(t(e,...s),o&&Ii(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ii(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ri(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Cn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&gn(()=>{n.removeEventListener(t,a)})}function zi(e=!1){let t=Be,n=t.l.u;if(!n)return;let r=()=>mr(t.s);if(e){let e=0,n={},i=lt(()=>{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&&yn(()=>{Bi(t,r),m(n.b)}),_n(()=>{let e=pr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&_n(()=>{Bi(t,r),m(n.a)})}function Bi(e,t){if(e.l.s)for(let t of e.l.s)G(t);t()}var Vi=!1;function Hi(e){var t=Vi;try{return Vi=!1,[e(),Vi]}finally{Vi=t}}var Ui={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===A||t===j)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 Wi(...e){return new Proxy({props:e},Ui)}function Gi(e,t,n,r){var i=!Re||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=lt(r),G(u)):(l&&(l=!1,c=s?pr(r):r),c);let f;if(o){var p=A in e||j in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=Hi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Ne(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?lt:ft)(()=>(v=!1,g()));o&&G(y);var b=Wn;return(function(e,t){if(arguments.length>0){let n=t?G(y):i&&o?Jt(e):e;return z(y,n),v=!0,c!==void 0&&(c=n),e}return zn&&v||b.f&16384?y.v:G(y)})}function Ki(e){Be===null&&Ee(`onMount`),Re&&Be.l!==null?Ji(Be).m.push(e):_n(()=>{let t=pr(e);if(typeof t==`function`)return t})}function qi(e){Be===null&&Ee(`onDestroy`),Ki(()=>()=>pr(e))}function Ji(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Yi(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 Xi=new class{#e=R(Zi());get _loc(){return G(this.#e)}set _loc(e){z(this.#e,e)}#t=I(()=>this._loc.location);get _location(){return G(this.#t)}set _location(e){z(this.#t,e)}#n=I(()=>this._loc.querystring);get _querystring(){return G(this.#n)}set _querystring(e){z(this.#n,e)}#r=R(void 0);get _params(){return G(this.#r)}set _params(e){z(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=Zi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Zi(){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}}async function Qi(e){if(!e||e.length<1||e.charAt(0)!=`/`&&e.indexOf(`#/`)!==0)throw Error(`Invalid parameter location`);await ur();let t=(e.charAt(0)==`#`?``:`#`)+e;try{let e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,``,t)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event(`hashchange`))}function $i(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function ea(e,t){He(t,!0);let n=Gi(t,`routes`,19,()=>({})),r=Gi(t,`prefix`,3,``),i=Gi(t,`restoreScrollState`,3,!1),a=Gi(t,`onConditionsFailed`,3,()=>{}),o=Gi(t,`onRouteLoaded`,3,()=>{}),s=Gi(t,`onRouteLoading`,3,()=>{}),c=Gi(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=Yi(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=R(null),f=R(null),p=R({}),m=null,h=null;_n(()=>{history.scrollRestoration=i()?`manual`:`auto`}),_n(()=>{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 ur(),e(t)}_n(()=>{let e=Xi.loc,t=!1;return pr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Pr(),y=V(v),b=e=>{let t=I(()=>G(d));var n=Pr(),r=V(n),i=e=>{var n=Pr();ri(V(n),()=>G(t),(e,t)=>{t(e,Wi({get params(){return G(f)},get onRouteEvent(){return c()}},()=>G(p)))}),J(e,n)},a=e=>{var n=Pr();ri(V(n),()=>G(t),(e,t)=>{t(e,Wi({get onRouteEvent(){return c()}},()=>G(p)))}),J(e,n)};X(r,e=>{G(f)?e(i):e(a,-1)}),J(e,n)};X(y,e=>{G(d)&&e(b)}),J(e,v),Ue()}var ta=[`bars`,`pace`,`pie`,`fuel`,`resets`,`thresholds`];function na(e){return e===`zone`||e===`consumption-pace`?`pace`:typeof e==`string`&&ta.includes(e)?e:`bars`}var ra=`codexometer.web.preferences.v1`,ia={statusLine:null,tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function aa(){try{let e=JSON.parse(localStorage.getItem(ra)||`null`);return!e||typeof e!=`object`?ia:{statusLine:Array.isArray(e.statusLine)?[...new Set(e.statusLine.filter(e=>typeof e==`string`&&e.length<64))].slice(0,32):null,tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:na(e.view),selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:[0,1,2].includes(e.defaultDetail)?e.defaultDetail:0,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 ia}}var oa=Jt(aa()),sa=Jt({open:!1}),ca=Jt({requests:0});function la(){let e=JSON.stringify(oa);try{localStorage.setItem(ra,e)}catch{}}function ua(){return oa.tab===`quota`?`/quota/`+oa.view:`/`+oa.tab}function da(e){return oa.layouts.find(t=>t.id===e)?.level??oa.defaultDetail}function fa(e){if(!e.length)return;let t=e.map(da),n=Math.max(...t);oa.defaultDetail=t.every(e=>e===n)?(n+1)%3:n;let r=new Set(e);oa.layouts=oa.layouts.filter(e=>!r.has(e.id))}function pa(e,t){oa.layouts=[...oa.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Jt({data:null,connected:!1,error:``}),ma=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ha=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ga=`codexometer.web.session`,_a=class extends Error{},va,ya=Jt({open:!1,argument:``,scope:``});function ba(e=``){ya.argument=e.trim().slice(0,160),ya.scope=$.data?.savedScope||``,ya.open=!0}var xa=Jt({ids:[],scope:``});function Sa(e){xa.ids.includes(e)||xa.ids.length>=8||(xa.ids.length||(xa.scope=$.connected&&!$.data?.sessionsError&&$.data?.savedScope||``),xa.ids=[...xa.ids,e])}var Ca,wa=Jt({root:``,kind:`agents`}),Ta,Ea,Da,Oa;async function ka(e,t,n){if(!va||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await va(e,t,n)}function Aa(){let e=new AbortController,t,n=``;async function r(t,r,i,a){let o=await fetch(t+`?`+new URLSearchParams(r),{headers:{Authorization:`Bearer ${n}`},signal:AbortSignal.any([e.signal,i,AbortSignal.timeout(a)]),cache:`no-store`});if(!o.ok)throw Error(`Session information unavailable`);return o.json()}function i(t,r,i,a=8e3){return fetch(t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(a),...i?[i]:[]]),cache:`no-store`})}Ta=async(e,t,n,i)=>{if(!$.connected||$.data?.sessionsError)throw Error(`Session unavailable`);return r(`/api/sessions/inspect`,{root:e,agent:t,kind:n},i,6500)},Oa=async(e,t,n,i,a=``)=>{if(!$.connected||$.data?.savedScope!==e)throw Error(`History unavailable`);return r(`/api/sessions/saved`,{scope:e,cursor:t,id:n,q:a},i,8e3)},Ca=(e,t,n)=>!e||!$.connected||$.data?.sessionsError||$.data?.savedScope!==e?Promise.reject(Error(`Session unavailable here.`)):r(`/api/sessions/linked`,{scope:e,id:t},n,6500),Da=async(e,t,n,r)=>{if(!$.connected||!$.data?.control||$.data.sessionsError||$.data.savedScope!==e)throw new _a(`Resume unavailable. Check the live connection.`);let a=await i(`/api/sessions/resume`,{scope:e,cursor:t,id:n,...r},void 0,14e3);if(!a.ok)throw a.status>=500?Error(`Resume outcome unknown.`):new _a((await a.text()).trim());return r?.mode===`prepare`?(await a.json()).confirmation:``},Ea=async(e,t,n,r)=>{if(!$.connected||!$.data?.control||$.data.savedScope!==e||$.data.sessionsError)throw new _a(`New sessions unavailable. Check the Codex connection.`);let a=await i(`/api/sessions/new`,{scope:e,directory:t,prompt:n,...r},void 0,14e3);if(!a.ok)throw a.status>=500?Error(`Could not verify the new session. Check Codex before trying again.`):new _a((await a.text()).trim());return a.json()},va=async(e,t,n)=>{let r=await i(`/api/control/`+e,t,n);if(!r.ok)throw r.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new _a(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return r.json()};try{n=sessionStorage.getItem(ga)||``}catch{}let a=location.hash,o=a.startsWith(`#pair=`)?a.slice(6):``;(o||!a||a===`#`)&&(history.replaceState(null,``,`/#`+ua()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function s(){if(o)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:o}),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(ga,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}n?await c():$.error=`Open the private pairing link printed by codexometer --web in your terminal.`}async function c(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(ga)}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(c,2500))}return s(),()=>{va=void 0,Oa=void 0,Da=void 0,ya.open=!1,ya.argument=``,Ta=void 0,Ca=void 0,xa.ids=[],wa.root=``,e.abort(),clearTimeout(t),$.connected=!1}}ze();var ja=q(`

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

      `),Ma=q(`

      `),Na=q(`

      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=q(`

      No threshold-based model steps were configured at launch.

      `);function Fa(e,t){He(t,!1),zi();var n=Pr(),r=V(n),i=e=>{var t=Na(),n=V(t),r=H(n),i=U(n,2),a=e=>{J(e,ja())};X(i,e=>{$.data.quotaError&&e(a)});var o=U(i,2),s=B(o),c=H(s),l=U(s,4);Z(l,5,()=>$.data.thresholds,qr,(e,t)=>{var n=Ma();let r;var i=B(n),a=H(i),o=U(i,2),s=B(o),c=H(s,!0),l=H(U(s,2));F(o);var u=U(o,2),d=H(u,!0),f=H(U(u,2));F(n),W((e,i)=>{r=li(n,1,``,null,r,{active:G(t).state===`ACTIVE`,next:G(t).state===`NEXT`}),Y(a,`${G(t).threshold??``}%`),Y(c,G(t).model),Y(l,`${e??``} REASONING // ${i??``} + SPEED`),Y(d,G(t).mode),Y(f,`${G(t).state??``}${G(t).state===`NEXT`?` // ${G(t).remaining||0} PP TO GO`:``}`)},[()=>G(t).effort.toUpperCase(),()=>G(t).speed.toUpperCase()]),J(e,n)}),F(l),F(o),W(e=>{Y(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),Y(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ha($.data.quotaAt)]),J(e,t)},a=e=>{J(e,Pa())};X(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),J(e,n),Ue()}var Ia=Mr(` `,1),La=Mr(` `,1),Ra=Mr(` `,1),za=Mr(` `,1),Ba=q(`
      `,1),Va=q(` `),Ha=q(`
      Quota observations
      Observed atPeriod elapsedConsumedTrail segment
      `),Ua=q(`
      OBSERVATION DATA
      `),Wa=q(`
      CONSUMPTIONQUOTA PERIOD ELAPSED
      `,1);function Ga(e,t){let n=Fr();He(t,!0);let r=Gi(t,`trail`,19,()=>[]),i=R(!1),a=R(!0),o=R(`window`),s=[0,25,50,75,100],c=I(()=>t.plot?.known?t.plot.elapsed:t.elapsed),l=R(400),u=R(240),d=I(()=>G(l)-24),f=I(()=>G(u)-48),p=I(()=>Math.max(1,G(d)-48)),m=I(()=>Math.max(1,G(f)-20)),h=I(()=>48+Math.max(0,Math.min(100,G(c)))/100*G(p));function g(e){return G(f)-(e-0)/100*G(m)}let _=I(()=>g(t.used)),v=I(()=>t.used-G(c)),y=I(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*G(p)} ${g(e.used)}`).join(` `)),b=I(()=>{let e=0;for(let t=r().length-1;t>0;t--)if(r()[t].break){e=t;break}return r().slice(e)}),x=I(()=>G(b).length<2?0:Math.max(0,Date.parse(G(b).at(-1).at)-Date.parse(G(b)[0].at))),S=I(()=>Object.fromEntries((t.plot?.modes||[]).map(e=>[e.id,e.available])));_n(()=>{G(o)!==`window`&&!G(S)[G(o)]&&z(o,`window`)});let C=I(()=>{let e=t.plot?.modes.find(e=>e.id===G(o));if(!e?.segment)return null;let{x1:n,y1:r,x2:i,y2:a}=e.segment,s=Math.hypot((i-n)/100*G(p),(a-r)/100*G(m)),c=Math.max(3,Math.min(9,Math.floor(s/65)+2));return{path:`M${Array.from({length:c},(e,t)=>{let o=n+(i-n)*t/(c-1),s=r+(a-r)*t/(c-1);return`${48+o/100*G(p)} ${g(s)}`}).join(` L`)}`,projected:e.projected,safe:e.safe}}),w=I(()=>{if(G(b).length===0)return`NO OBSERVATIONS`;if(G(b).length===1)return`ONE OBSERVATION`;let e=Math.floor(G(x)/6e4);if(e<60)return`${e} MIN CONTINUOUS`;let t=Math.floor(e/60);return t<24?`${t}H CONTINUOUS`:`${Math.floor(t/24)}D ${t%24}H CONTINUOUS`});var T=Wa(),E=V(T),D=B(E);let O;var k=B(D),ee=B(k),te=U(ee);F(k);var A=U(k),ne=U(A);Z(ne,17,()=>s,qr,(e,t)=>{var n=Ia(),r=V(n),i=U(r),a=H(i);W(()=>{Q(r,`x1`,48+G(t)/100*G(p)),Q(r,`x2`,48+G(t)/100*G(p)),Q(r,`y2`,G(f)),Q(i,`x`,48+G(t)/100*G(p)),Q(i,`y`,G(f)+20),Y(a,`${G(t)??``}%`)}),J(e,n)});var j=U(ne);Z(j,17,()=>s,qr,(e,t)=>{var n=La(),r=V(n),i=U(r),a=H(i);W((e,n,o)=>{Q(r,`y1`,e),Q(r,`x2`,G(d)),Q(r,`y2`,n),Q(i,`y`,o),Y(a,`${G(t)??``}%`)},[()=>g(G(t)),()=>g(G(t)),()=>g(G(t))+4]),J(e,n)});var re=U(j),ie=U(re),ae=U(ie),oe=e=>{var t=Ra(),n=V(t),i=U(n),a=U(i),o=H(B(a));F(a),W((e,t)=>{Q(n,`d`,G(y)),Q(i,`d`,G(y)),Q(a,`cx`,48+r()[0].elapsed/100*G(p)),Q(a,`cy`,e),Y(o,`First observation: ${t??``}`)},[()=>g(r()[0].used),()=>ha(r()[0].at)]),J(e,t)};X(ae,e=>{G(a)&&r().length&&e(oe)});var se=U(ae),ce=e=>{var t=za(),r=V(t),i=U(r),a=H(B(i));F(i),W(e=>{Q(r,`d`,G(C).path),Q(i,`d`,G(C).path),Q(i,`marker-mid`,`url(#${n}-trend-arrow)`),Y(a,`${G(o)===`window`?`Window-average pace`:`Recent consumption trajectory`} projects ${e??``}% at reset if continued`)},[()=>G(C).projected.toFixed(1)]),J(e,t)};X(se,e=>{G(C)&&e(ce)});var le=U(se,2),ue=U(le),de=U(ue),fe=H(B(de));F(de),F(D),F(E);var pe=U(E,2),me=B(pe),he=B(me),ge=U(he,3),_e=H(ge,!0),M=U(ge,2),ve=e=>{var t=Ba(),n=H(U(V(t)));W(e=>Y(n,`TREND // ${e??``}`),[()=>G(C).projected>=100?`QUOTA EXHAUSTION PROJECTED`:`${G(C).projected.toFixed(1)}% PROJECTED AT RESET`]),J(e,t)};X(M,e=>{G(C)&&e(ve)}),F(me);var N=U(me,2),P=B(N),ye=B(P);Si(ye),be(),F(P);var xe=U(P,2),Se=U(B(xe),2),Ce=B(Se);Ce.value=Ce.__value=`off`;var we=U(Ce),Te=H(we);we.value=we.__value=`halfHour`;var Ee=U(we),De=H(Ee);Ee.value=Ee.__value=`hour`;var Oe=U(Ee),ke=H(Oe);Oe.value=Oe.__value=`day`;var Ae=U(Oe),je=H(Ae);Ae.value=Ae.__value=`window`,F(Se),hi(Se),F(xe);var Me=H(U(xe,2));F(N),F(pe);var Ne=U(pe,2),Pe=e=>{var t=Ua(),n=U(B(t),2),a=e=>{var t=Ha(),n=B(t),i=U(B(n),2);Z(i,21,r,qr,(e,t,n)=>{var r=Va(),i=B(r),a=B(i),o=H(a,!0);F(i);var s=U(i),c=H(s),l=U(s),u=H(l),d=H(U(l),!0);F(r),W((e,r)=>{Q(a,`datetime`,G(t).at),Y(o,e),Y(c,`${r??``}%`),Y(u,`${G(t).used??``}%`),Y(d,n===0?`First observation`:G(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ha(G(t).at),()=>G(t).elapsed.toFixed(1)]),J(e,r)}),F(i),F(n),F(t),J(e,t)};X(n,e=>{G(i)&&e(a)}),F(t),Ri(`open`,`toggle`,t,e=>z(i,e),()=>G(i)),J(e,t)};X(Ne,e=>{r().length&&e(Pe)}),W((e,r,i,a,o,s)=>{Q(D,`viewBox`,`0 0 ${G(l)} ${G(u)}`),Q(D,`aria-label`,e),O=di(D,``,O,{"--trend-color":G(C)?.safe?`#115b35`:`#7f1825`}),Q(ee,`id`,n),Q(te,`id`,n+`-trend-arrow`),Q(A,`width`,G(p)),Q(A,`height`,G(m)),Q(A,`fill`,`url(#${n})`),Q(re,`d`,`M48 20 V${G(f)} H${G(d)}`),Q(ie,`y1`,r),Q(ie,`x2`,G(d)),Q(ie,`y2`,i),Q(le,`x`,48+G(p)/2),Q(le,`y`,G(u)-5),Q(ue,`cx`,G(h)),Q(ue,`cy`,G(_)),Q(de,`cx`,G(h)),Q(de,`cy`,G(_)),Y(fe,`${t.used??``}% consumed // ${a??``}% of period elapsed`),Y(he,`${t.used??``}% USED // ${o??``}% TIME ELAPSED`),Y(_e,s),we.disabled=!G(S).halfHour,Y(Te,`LAST 30 MINUTES${G(S).halfHour?``:` — UNAVAILABLE`}`),Ee.disabled=!G(S).hour,Y(De,`LAST HOUR${G(S).hour?``:` — UNAVAILABLE`}`),Oe.disabled=!G(S).day,Y(ke,`LAST 24 HOURS${G(S).day?``:` — UNAVAILABLE`}`),Ae.disabled=!G(S).window,Y(je,`FROM WINDOW START${G(S).window?``:` — NO TIME ELAPSED`}`),Y(Me,`HISTORY // ${G(w)??``}`)},[()=>`Pace: ${t.used}% consumed, ${G(c).toFixed(1)}% of quota period elapsed. ${G(v)>0?`Above`:G(v)<0?`Below`:`On`} the steady-consumption line.${G(a)&&r().length?` Trace path contains ${r().length} ${r().length===1?`observation`:`observations`}; gaps are not interpolated.`:``}`,()=>g(0),()=>g(100),()=>G(c).toFixed(1),()=>G(c).toFixed(1),()=>Math.abs(G(v))<.05?`ON PACE`:G(v)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Fi(E,`clientWidth`,e=>z(l,e)),Fi(E,`clientHeight`,e=>z(u,e)),Ai(ye,()=>G(a),e=>z(a,e)),gi(Se,()=>G(o),e=>z(o,e)),J(e,T),Ue()}var Ka=q(` `),qa=q(`

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

      `),Ja=q(`

      `),Ya=q(`

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

      `),Xa=q(`

      `),Za=q(`

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

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

      `),Qa=q(` `,1),$a=Mr(``),eo=Mr(``),to=Mr(``),no=Mr(``,1),ro=q(` `),io=q(`
      `),ao=q(`

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

      `),oo=q(`
      EMPTYFULL
      `),so=q(`

      `,1),co=q(`
      `,1),lo=q(` `),uo=q(`

      `),fo=q(`

      `),po=q(`

      No quota windows reported yet.

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

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

      `,1),go=q(` `,1);function _o(e,t){He(t,!0);let n=Gi(t,`params`,19,()=>({})),r=I(()=>ta.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=R(Jt(Date.now())),a=I(()=>G(r).includes(na(n().view))?na(n().view):`bars`);Ki(()=>{let e=setInterval(()=>z(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))))}_n(()=>{oa.view=G(a),(n().view===`zone`||n().view===`consumption-pace`)&&Qi(`/quota/pace`)});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=go(),l=V(c);Z(l,21,()=>G(r),qr,(e,t)=>{var n=Ka();let r;var i=H(n,!0);W(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)}),Y(i,e)},[()=>G(t)===`fuel`?`FUEL TANK`:G(t).toUpperCase()]),J(e,n)}),F(l);var u=U(l,2),d=e=>{var t=ho(),n=V(t),r=e=>{J(e,qa())};X(n,e=>{$.data.quotaError&&e(r)});var i=U(n,2),c=e=>{var t=Ja(),n=H(t);W(()=>Y(n,`Last usage accounting issue: + ${$.data.usageDiagnostic??``}`)),J(e,t)};X(i,e=>{$.data.usageDiagnostic&&e(c)});var l=U(i,2),u=H(l),d=U(l,2),f=e=>{Fa(e,{})},p=e=>{var t=Za(),n=B(t),r=H(n),i=U(n,4),a=e=>{J(e,Ya())};X(i,e=>{$.data.credits.length||e(a)}),Z(U(i,2),17,()=>$.data.credits,qr,(e,t)=>{var n=Xa(),r=B(n),i=H(r),a=H(U(r,2),!0);F(n),W(e=>{Y(i,`${(G(t).title||`Quota reset`)??``} // ${G(t).status??``}`),Y(a,e)},[()=>G(t).expiryKnown?G(t).expires?`EXPIRES `+ha(G(t).expires):`Does not expire`:`Expiry information unavailable`]),J(e,n)}),be(2),F(t),W(()=>Y(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),J(e,t)},m=e=>{var t=mo(),n=V(t);let r;Z(n,21,()=>$.data.meters,qr,(e,t)=>{let n=I(()=>o(G(t))),r=I(()=>G(n)===null?null:Math.round(G(n)));var i=fo(),c=B(i),l=H(c,!0),u=U(c,2);let d;var f=B(u),p=e=>{var n=Qa(),r=V(n),i=H(r),a=H(U(r));W(()=>{Y(i,`FREE ${100-G(t).used}%`),Y(a,`USED ${G(t).used??``}%`)}),J(e,n)},m=e=>{var n=Qa(),r=V(n),i=H(r),a=H(U(r));W(()=>{Y(i,`USED ${G(t).used??``}%`),Y(a,`FREE ${100-G(t).used}%`)}),J(e,n)};X(f,e=>{G(a)===`fuel`?e(p):e(m,-1)}),F(u);var h=U(u,2);let g;var _=B(h),v=e=>{var i=io(),a=B(i),o=B(a),c=U(B(o)),l=e=>{J(e,$a())},u=e=>{var n=eo();W(e=>Q(n,`d`,e),[()=>s(G(t).used)]),J(e,n)};X(c,e=>{G(t).used>=100?e(l):G(t).used>0&&e(u,1)});var d=U(c),f=e=>{var t=no(),r=U(V(t)),i=e=>{var t=to();W(()=>Q(t,`stroke-dasharray`,`${G(n)} 100`)),J(e,t)};X(r,e=>{G(n)>0&&e(i)}),J(e,t)};X(d,e=>{G(n)!==null&&e(f)}),F(o),F(a);var p=U(a,2),m=B(p),h=H(m),g=U(m,2),_=e=>{var t=ro(),n=H(t);W(()=>Y(n,`RING // ${G(r)??``}% ELAPSED`)),J(e,t)};X(g,e=>{G(r)!==null&&e(_)}),F(p),F(i),W(()=>{Q(o,`aria-label`,`${G(t).used}% quota used; ${G(r)===null?`reset cycle unavailable`:`${G(r)}% of reset cycle elapsed`}`),Y(h,`PIE  // ${G(t).used??``}% USED`)}),J(e,i)},y=e=>{var r=Pr(),i=V(r),a=e=>{{let r=I(()=>G(t).trail||[]);Ga(e,{get used(){return G(t).used},get elapsed(){return G(n)},get trail(){return G(r)},get plot(){return G(t).plot}})}},o=e=>{J(e,ao())};X(i,e=>{G(n)===null?e(o,-1):e(a)}),J(e,r)},b=e=>{var r=co(),i=V(r),o=B(i);let s;F(i);var c=U(i,2),l=e=>{J(e,oo())};X(c,e=>{G(a)===`fuel`&&e(l)});var u=U(c,2),d=e=>{var t=so(),r=V(t),i=H(r),o=U(r,2),s=B(o);let c;F(o),W(e=>{Y(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=di(s,``,c,{width:`${G(a)===`fuel`?100-G(n):G(n)}%`})},[()=>Math.floor(G(n))]),J(e,t)};X(u,e=>{G(n)!==null&&e(d)}),W(()=>{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}%`})}),J(e,r)};X(_,e=>{G(a)===`pie`?e(v):G(a)===`pace`?e(y,1):e(b,-1)}),F(h);var x=U(h,2),S=B(x),C=e=>{var t=Pr(),n=V(t),i=e=>{J(e,Nr(`RESET CYCLE UNAVAILABLE ·`))},a=e=>{var t=lo(),n=H(t);W(()=>Y(n,`RING ${G(r)??``}% ELAPSED ·`)),J(e,t)};X(n,e=>{G(r)===null?e(i):e(a,-1)}),J(e,t)};X(S,e=>{G(a)===`pie`&&e(C)});var w=U(S);F(x);var T=U(x,2),E=e=>{var n=uo(),r=H(n,!0);W(()=>Y(r,G(t).details)),J(e,n)};X(T,e=>{G(t).details&&e(E)}),F(i),W(e=>{Y(l,G(t).name),d=li(u,1,`spread`,null,d,{"pie-stats":G(a)===`pie`}),g=li(h,1,`meter-graphic`,null,g,{"bar-graphic":G(a)===`bars`||G(a)===`fuel`}),Y(w,` RESETS // ${e??``}`)},[()=>ha(G(t).reset)]),J(e,i)}),F(n);var i=U(n,2),c=e=>{J(e,po())};X(i,e=>{$.data.meters.length||e(c)}),W(()=>r=li(n,1,`quota-grid`,null,r,{radial:G(a)===`pie`,zone:G(a)===`pace`})),J(e,t)};X(d,e=>{G(a)===`thresholds`?e(f):G(a)===`resets`?e(p,1):e(m,-1)}),be(2),W(e=>Y(u,`QUOTA // OBSERVED ${e??``}`),[()=>ha($.data.quotaAt)]),J(e,t)};X(u,e=>{$.data&&e(d)}),J(e,c),Ue()}var vo=q(`
      `),yo=q(`

      `,1);function bo(e,t){He(t,!0);let n=Gi(t,`values`,19,()=>[]),r=Gi(t,`label`,3,`Token activity`),i=Gi(t,`capacity`,3,0),a=I(()=>Math.max(0,...n())),o=I(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=yo(),c=V(s),l=H(c),u=U(c,2);Z(u,21,()=>G(o),qr,(e,t)=>{var n=vo();let r;W((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))}%`]),J(e,n)}),F(u),W((e,t)=>{Y(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>G(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${G(a).toLocaleString(`en-GB`)} tokens.`]),J(e,s),Ue()}function xo(e,t=!1){return e===`require`||e!==`none`&&!t}function So(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var Co=[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer. Saved display preferences only.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`View account usage or resets. Specify daily, weekly or cumulative to open a chart.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity using Codexometer’s copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Choose a Codexometer display theme. Saved local display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave this Codexometer interface. Codex sessions continue running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit. Codex sessions continue running.`,next:`quit`},{id:`local-resume`,label:`/resume`,help:`Search saved Codex sessions, preview, or explicitly resume one in Sessions.`,next:`resume`},{id:`local-subagents`,label:`/subagents`,help:`Inspect the selected session’s linked agents and their read-only transcripts.`,next:`subagents`},{id:`local-ps`,label:`/ps`,help:`List the selected session’s background terminals without stopping anything.`,next:`ps`}],wo=[`surface`,`model`,`feature`,`task start`],To=q(` `),Eo=q(``),Do=q(`

      `),Oo=q(`

      `),ko=q(`
      `),Ao=q(`

      `),jo=q(`

      `,1),Mo=q(`

      `),No=q(`

      Loading / sending…

      `),Po=q(`
      `),Fo=q(`

      `),Io=q(`

       
      `),Lo=q(`
      `),Ro=q(`
      `),zo=q(`

      Review expired. Press Enter to review again.

      `),Bo=q(`

      `,1),Vo=q(`

      `,1),Ho=q(`

      No available matching commands.

      `),Uo=q(` `,1),Wo=q(`

      `),Go=q(`

      Review expired. Review the option again.

      `),Ko=q(``),qo=q(``),Jo=q(``),Yo=q(``),Xo=q(``),Zo=q(``),Qo=q(`
      `),$o=q(`
      `);function es(e,t){let n=Fr();He(t,!0);let r=e=>{var t=Pr();Z(V(t),19,()=>G(P),e=>e.id,(e,t,r)=>{var i=Eo();let o;var s=B(i),c=H(s,!0),l=U(s),u=H(l),d=U(l),f=e=>{var n=To(),r=H(n,!0);W(()=>Y(r,G(t).help)),J(e,n)};X(d,e=>{(G(b)?.path===``||G(pe))&&e(f)}),F(i),W((e,s)=>{Q(i,`id`,`${n}-${G(r)}`),Q(i,`role`,G(pe)?`option`:void 0),Q(i,`aria-selected`,G(pe)?G(k)===G(r):void 0),Q(i,`tabindex`,G(pe)?-1:void 0),i.disabled=G(v)||G(Se)&&!a(),Q(i,`title`,G(t).help),Q(i,`aria-label`,e),o=li(i,1,`svelte-7bfwr9`,null,o,{suggested:G(k)===G(r)}),Y(c,G(t).label),Y(u,`${(G(pe)||G(b)?.path===`permissions`)&&G(t).selected?` // CURRENT`:``}${s??``}`)},[()=>G(t).label+((G(pe)||G(b)?.path===`permissions`)&&G(t).selected?` // CURRENT`:``)+le(G(t)),()=>le(G(t))]),Sr(`focus`,i,()=>{G(pe)||we(G(r))}),K(`click`,i,()=>{we(G(r)),Oe(G(t))}),J(e,i)}),J(e,t)},i=Gi(t,`query`,3,``),a=Gi(t,`localOnly`,3,!1),o=Gi(t,`oncopy`,3,()=>{}),s=Gi(t,`onchange`,3,()=>{}),c=Gi(t,`oncomplete`,3,e=>{}),l=Co.map(e=>e.next);function u(e){return!!e.alwaysConfirm||xo($.data?.confirmationMode,!!(e.reversible||e.directInBalanced))}function d(){return Co.map(e=>[`exit`,`quit`].includes(e.next||``)?{...e,help:`Return to Sessions. The local server and Codex sessions remain running.`}:{...e})}function f(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:d()}}function p(){return{title:`/usage`,path:`usage`,revision:``,help:`Account usage and resets.`,choices:[{id:`usage-analytics`,label:`View analytics`,help:`Open account usage history.`,next:`usage/daily`},{id:`usage-resets`,label:`View resets`,help:`Inspect resets; redemption is available in the terminal.`,next:`usage/reset`}]}}function m(){z(re,null),z(S,``),z(j,``),z(C,0),z(oe,[],!0)}function h(){O++,z(v,!1),z(_,!1),z(ee,i()),m(),z(y,``),G(ge)?s()():c()(i())}async function g(e){if(e===`resume`||e.startsWith(`resume `))return h(),ba(e.slice(6)),location.hash=`/sessions`,!0;if(e.startsWith(`usage/`))return h(),location.hash=e===`usage/reset`?`/quota/resets`:`/`+e,!0;if(e===`usage`||!l.includes(e))return!1;if(e===`copy`&&!So($.data?.sessions.find(e=>e.id===t.session)))return z(y,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();h(),await e}else h(),e===`subagents`||e===`ps`?(wa.kind=e===`ps`?`terminals`:`agents`,wa.root=t.session):e===`theme`?ca.requests++:e===`statusline`?sa.open=!0:location.hash=`/sessions`;return!0}let _=R(!1),v=R(!1),y=R(``),b=R(null),x=R(null),S=R(``),C=R(0),w=R(Jt(Date.now())),T=R(``),E=R(``),D=I(()=>i().trimStart());_n(()=>{G(E)&&G(b)?.input&&G(D).startsWith(G(E))&&z(T,G(D).slice(G(E).length)||G(b).value||``,!0)});let O=0,k=R(0),ee=R(null),te=R(void 0),A=R(void 0),ne=R(void 0),j=R(``),re=R(null);function ie(){return G(re)===null||G(re)===i()}function ae(){O++,z(v,!1),z(x,null),z(b,null),z(y,``),m(),G(_)&&De(``)}_n(()=>{let e=i(),t=G(re);t!==null&&t!==e&&pr(ae)});let oe=R(Jt([])),se=I(()=>!!G(b)?.inputReview),ce=I(()=>!!G(x)&&!G(se)||!!G(j)||G(oe).length>0);function le(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:!e.action&&!e.noOp?` // HELP`:``}async function ue(e,t){/^goal\s+pause$/i.test(e)&&(e=`goal/pause/apply`),G(b)&&!(G(Ce)&&G(_e))&&z(oe,[...G(oe),{path:G(b).path,index:G(k),input:G(T),draft:t??(G(ge)?i():void 0)}],!0),await De(e,void 0,!1,t!==void 0)}async function de(){if(!G(ce))return;if(O++,z(v,!1),z(S,``),z(C,0),z(y,``),G(j)){z(j,``),G(te)?.focus();return}if(G(x)&&!G(se)){z(x,null),await ur(),G(te)?.focus();return}let e=G(oe).at(-1);e&&(z(oe,G(oe).slice(0,-1),!0),e.draft!==void 0&&e.draft!==i()&&c()(e.draft),await De(e.path,e))}function fe(){G(b)&&G(T).trim()&&!G(v)&&!G(Se)&&ue(G(b).path+`/`+encodeURIComponent(G(T).trim()))}let pe=I(()=>G(_)&&!!G(b)?.picker&&!G(x)),me=I(()=>G(_)&&!G(b)?.input&&!G(x)),he=setInterval(()=>{z(w,Date.now(),!0)},1e3);qi(()=>{clearInterval(he),O++});let ge=I(()=>G(D).startsWith(`/`)&&!G(D).startsWith(`//`)),_e=I(()=>G(b)?.path===``&&G(ge)?G(D).slice(1).split(/\s/,1)[0].toLowerCase():N().trim().toLowerCase());function M(e){let t=[e.label.replace(/^\//,``)];return e.next&&t.push(decodeURIComponent(e.next.split(`/`).at(-1))),t}function ve(e){return e===`goal/set`?`/goal `:e.startsWith(`tier/`)?(G(b)?.picker?G(b).title:i().trim().split(/\s/,1)[0])+` `:`/`+e.split(`/`).map(decodeURIComponent).join(` `)+` `}function N(){if(!G(ge)||!G(b)?.path||G(b).input||G(b).multiple||G(b).inputReview)return``;let e=ve(G(b).path);return G(D).toLowerCase().startsWith(e.toLowerCase())?G(D).slice(e.length):``}let P=I(()=>{let e=G(b)?.path===`permissions`?G(_e).split(/\s/,1)[0]:G(_e),t=(G(b)?.choices||[]).filter(t=>!e||M(t).some(t=>t.toLowerCase().startsWith(e)));return!t.length&&G(b)?.path===`goal`?(G(b).choices||[]).filter(e=>e.next===`goal/set`):t}),ye=I(()=>G(x)||G(P)[G(k)]),be=I(()=>!!G(S)&&G(w)G(P).find(e=>e.id===G(j))),Se=I(()=>!$.connected||!!$.data?.sessionsError),Ce=I(()=>G(_)&&G(ge)&&(!G(b)||G(b).path===``)&&!G(x));_n(()=>{if(!G(_)||G(v)||G(x)||!G(b)||G(b).input||G(b).multiple||G(b).inputReview||G(oe).length>=16)return;let e=G(b).path===``&&G(ge)?G(D).slice(1):N();for(let t of G(b).choices||[]){if(!t.next||l.includes(t.next))continue;let n=M(t);if(!n.some(t=>e.toLowerCase()===t.toLowerCase())){for(let r of n)if(e.slice(0,r.length).toLowerCase()===r.toLowerCase()&&/^\s/.test(e.slice(r.length))){let n=e.slice(r.length).trimStart(),a=i().slice(0,i().length-e.length+r.length);pr(()=>{c()(ve(t.next)+n),ue(t.next,a)});return}}}}),_n(()=>{i(),z(k,0)}),_n(()=>{let e=G(k);G(P),G(me)&&ur().then(()=>{let t=G(te)?.children[e];if(!t||!G(te))return;let n=G(te).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(G(te).scrollTop+=r.bottom-n.bottom)})});function we(e){G(k)!==e&&G(b)?.picker&&(z(j,``),z(S,``),z(C,0),z(y,``),O++),z(k,e,!0)}function Te(){O++,z(v,!1),z(_,!1),z(ee,i()),m(),c()(i())}function Ee(e){let t=!!G(A)?.contains(e.target);if(!G(_)||!G(me)&&!G(x)&&!G(b)?.input||!G(ge)&&!t||G(Se)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(G(b)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Te());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,o=e.key.toLowerCase()===`c`;if((o||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!o&&!r&&!n||e.key===`Tab`&&(G(x)||G(b)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!G(te)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||G(x)&&!t||G(x)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){Te();return}if(G(v)||e.repeat&&(o||e.key===`Enter`))return;if(n){G(ce)&&de();return}if(r){De(G(b)?.path||``,void 0,!0);return}if(o){(G(x)?.action||G(pe)&&G(j))&&Ae();return}if(G(x)){if(e.key===`Enter`&&G(be)&&G(b)?.path.startsWith(`approve/`)&&!u(G(x))){Ae();return}e.key===`Enter`&&G(x).action&&!G(be)&&!G(y)&&ke(G(x));return}if(e.key===`Enter`&&(G(b)?.path===``||G(b)?.path===`usage`)){let e=/^\/resume\s+(.+)$/i.exec(i().trim());if(e&&G(b)?.path===``){g(`resume `+e[1]);return}let t=/^\/usage\s+(.+)$/i.exec(i().trim());if(t){let e=t[1].toLowerCase();[`daily`,`weekly`,`cumulative`].includes(e)?g(`usage/`+e):z(y,`Usage: /usage [daily|weekly|cumulative]`);return}}if(e.key===`Enter`&&(G(b)?.path===``||G(b)?.path===`permissions`)&&/^\/permissions\s+\S/.test(i().trim())){ue(i().trim().slice(1));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){we(Math.min(Math.max(G(k)+(e.key===`ArrowUp`?-1:1),0),Math.max(G(P).length-1,0))),!G(pe)&&G(te)?.contains(e.target)&&ur().then(()=>(G(te)?.children[G(k)])?.focus());return}if(e.key===`Enter`&&(G(b)?.path===``||G(b)?.path===`plan`)&&/^\/plan\s+\S/.test(i().trim())||e.key===`Enter`&&/^\/model\s+\S/.test(i().trim())&&i().includes(`--`)&&(G(b)?.path===``||G(b)?.path===`model`||G(b)?.path.startsWith(`model/`))){ue(i().trim().slice(1));return}if(e.key===`Enter`&&(G(b)?.path===``||G(b)?.path===`goal`)&&/^\/goal\s+\S/.test(i().trim())){let e=G(b)?.path===`goal`?G(P).find(e=>M(e).some(e=>i().trim().slice(6).trim().toLowerCase()===e.toLowerCase())):void 0;if(e){Oe(e);return}ue(i().trim().slice(1));return}let s=G(P)[G(k)];s&&(e.key===`Tab`?c()(s.label):G(pe)?ke(s):Oe(s))}_n(()=>{G(Se)&&!a()&&(O++,z(v,!1),m(),G(_)&&(z(_,!1),z(ee,i())),z(b,null),z(x,null))}),_n(()=>{G(ge)&&!G(_)&&i()!==G(ee)&&(!G(Se)||a())&&(m(),z(_,!0),De(``))});async function De(e,n,r=!1,o=!1){if(!ie()){ae();return}z(re,/^(?:(permissions|model)(?: |\/apply\/)|plan(?: |\/send\/)|goal\/pause\/apply$)/.test(e)?i():null,!0);let s=++O;if(z(E,``),G(b)&&z(b,{...G(b),path:e},!0),n&&z(T,n.input,!0),z(v,!0),z(x,null),z(j,``),z(S,``),z(C,0),z(y,``),a()||e===`usage`)z(b,e===`usage`?p():f(),!0),z(k,n?.index??0,!0),z(v,!1);else try{let i=await ka(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});s===O&&ie()&&(i.choices||=[],(e===``||e===`help`)&&(i.choices=[...i.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...d()]),z(b,i,!0),z(k,n?Math.min(n.index,Math.max(i.choices.length-1,0)):i.picker?Math.max(i.choices.findIndex(e=>e.selected),0):0,!0),i.picker&&ur().then(()=>G(te)?.focus()),z(T,n?.input??i.value??``,!0),o&&i.input&&z(E,ve(i.path),!0),n&&ur().then(()=>{i.input?G(A)?.querySelector(`input`)?.focus():G(te)?.focus()}),i.inputReview&&i.choices.length===1&&(z(v,!1),Oe(i.choices[0])))}catch{s===O&&(z(y,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(z(b,f(),!0),z(y,``)):z(b,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{s===O&&z(v,!1)}}async function Oe(e){e.unavailable||G(v)||(e.noOp?(h(),z(ee,null)):e.next&&await g(e.next)||G(y)||(G(b)?.picker?(we(G(P).findIndex(t=>t.id===e.id)),e.action&&!u(e)?await ke(e):G(te)?.focus()):e.next?await ue(e.next===`plan`?`plan/activate`:e.next===`goal/pause`?`goal/pause/apply`:e.next):await ke(e)))}async function ke(e){if(G(v)||G(Se)||!G(b)||e.unavailable||G(y)||!ie())return;if(G(b).path.startsWith(`approve/`)&&G(x)?.id===e.id&&G(be)&&!u(e)){await Ae();return}let n=e.action&&!G(b).path.startsWith(`approve/`)&&!u(e);if(G(b).picker){if(G(be)&&G(j)===e.id)return;z(j,e.id,!0)}else n||(z(x,e,!0),ur().then(()=>G(ne)?.focus()));if(z(S,``),z(C,0),z(y,``),!e.action)return;let r=++O;z(v,!0);try{let n=await ka(`commands`,{session:t.session,command:{mode:`prepare`,path:G(b).path,revision:G(b).revision,choice:e.id}});if(r===O&&ie()){let e=Date.parse(n.expires);if(!n.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);z(S,n.confirmation,!0),z(C,e,!0)}}catch{r===O&&z(y,`Option changed or unavailable. Refresh before retrying.`)}finally{r===O&&z(v,!1)}n&&r===O&&G(S)&&ie()&&await Ae()}async function Ae(){if(!G(S)||!ie()||G(Se)||G(v)||Date.now()>=G(C)||!G(b)||G(b).picker&&G(j)!==G(P)[G(k)]?.id)return;let e=G(S);z(S,``),z(v,!0);let n=++O;try{let r=await ka(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:G(b).path}});n===O&&(z(y,r.message,!0),z(_,!1),z(b,null),z(x,null),m(),z(ee,null),s()())}catch{n===O&&z(y,`Change unconfirmed. Check Codex before retrying.`)}finally{n===O&&z(v,!1)}}var je={handleKey:Ee},Me=$o(),Ne=B(Me),Pe=U(Ne,2),Fe=e=>{var t=Do(),n=H(t,!0);W(()=>Y(n,G(y))),J(e,t)};X(Pe,e=>{G(y)&&!G(_)&&e(Fe)});var Ie=U(Pe,2),Le=e=>{var i=Qo();let o;var s=B(i),c=e=>{var t=jo(),n=V(t),r=H(n,!0),i=U(n,2),a=e=>{var t=ko();Z(t,21,()=>G(b).help.split(` +`),qr,(e,t)=>{var n=Oo(),r=H(n,!0);W(()=>{Q(n,`title`,G(t)),Y(r,G(t))}),J(e,n)}),F(t),J(e,t)},o=e=>{var t=Ao(),n=H(t,!0);W(()=>Y(n,G(b)?.help||`Loading live options…`)),J(e,t)};X(i,e=>{G(b)?.path===`goal`?e(a):e(o,-1)}),W(()=>Y(r,G(b)?.title||`/ COMMANDS`)),J(e,t)};X(s,e=>{G(Ce)||e(c)});var l=U(s,2),d=e=>{var t=Mo(),n=H(t,!0);W(()=>Y(n,G(y))),J(e,t)};X(l,e=>{G(y)&&e(d)});var f=U(l,2),p=e=>{J(e,No())};X(f,e=>{G(v)&&e(p)});var m=U(f,2),h=e=>{var t=Po(),r=B(t),i=B(r),o=U(i);Si(o),F(r),F(t),W(e=>{Q(t,`id`,`${n}-input`),Y(i,`${e??``} `),Q(o,`aria-label`,G(b).inputLabel||`Session name`),Q(o,`maxlength`,G(b).inputLimit||512),o.disabled=G(v)||G(Se)&&!a()},[()=>(G(b).inputLabel||`Session name`).toUpperCase()]),Sr(`submit`,t,e=>{e.preventDefault(),fe()}),Di(o,()=>G(T),e=>z(T,e)),J(e,t)},g=e=>{var n=Io(),r=B(n),i=H(r,!0),a=U(r,2),o=H(a,!0),s=U(a,2),c=e=>{var n=Fo(),r=B(n),i=U(r),a=e=>{J(e,Nr(`Only this session's saved + name changes.`))},o=I(()=>G(b)?.path.startsWith(`rename/`)),s=e=>{J(e,Nr(`Only this session’s + directory changes; project configuration is not reloaded.`))},c=I(()=>G(b)?.path.startsWith(`cd/`)),l=e=>{J(e,Nr(`Only this session's goal + changes.`))},u=I(()=>G(b)?.path.startsWith(`goal/`)),d=e=>{J(e,Nr(`Records consent for + one exact retry, not execution. The retry still goes through + Codex's native reviewer.`))},f=I(()=>G(b)?.path.startsWith(`approve/`)),p=e=>{J(e,Nr(`Changes this + session's native permissions for subsequent turns, subject to + managed policy. Review carefully.`))},m=I(()=>G(b)?.path.startsWith(`permissions`)),h=e=>{J(e,Nr(`No change sent yet. Model, reasoning and speed settings can + change token usage and cost. Changes affect subsequent turns of + this session, not global defaults. Automatic quota thresholds + may later supersede model settings.`))};X(i,e=>{G(o)?e(a):G(c)?e(s,1):G(u)?e(l,2):G(f)?e(d,3):G(m)?e(p,4):e(h,-1)}),F(n),W(()=>Y(r,`TARGET // ${t.session??``}. `)),J(e,n)};X(s,e=>{G(x).action&&e(c)}),F(n),Li(n,e=>z(ne,e),()=>G(ne)),W(()=>{Y(i,G(x).label),Y(o,G(x).help||`No additional help supplied by Codex.`)}),J(e,n)},_=e=>{var t=Uo(),i=V(t),a=e=>{var t=Lo(),i=B(t);r(i),F(t),Li(t,e=>z(te,e),()=>G(te)),W(()=>Q(t,`aria-activedescendant`,`${n}-${G(k)}`)),J(e,t)},o=e=>{var t=Ro();let n;var i=B(t);r(i),F(t),Li(t,e=>z(te,e),()=>G(te)),W(()=>n=li(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:G(Ce)})),J(e,t)};X(i,e=>{G(pe)?e(a):e(o,-1)});var s=U(i,2),c=e=>{var t=Vo(),n=V(t),r=H(n,!0),i=U(n,2),a=e=>{var t=Bo(),n=V(t),r=H(n),i=U(n,2),a=e=>{J(e,zo())};X(i,e=>{G(S)&&G(w)>=G(C)&&e(a)}),W(()=>Y(r,`REVIEW // ${G(xe).label??``}. No change sent yet.`)),J(e,t)};X(i,e=>{G(xe)&&e(a)}),W(()=>Y(r,G(P)[G(k)]?.help)),J(e,t)};X(s,e=>{G(pe)&&e(c)});var l=U(s,2),u=e=>{J(e,Ho())};X(l,e=>{!G(v)&&!G(P).length&&e(u)}),J(e,t)};X(m,e=>{G(b)?.input?e(h):G(x)?e(g,1):e(_,-1)});var E=U(m,2),D=e=>{var t=Wo(),n=H(t,!0);W(()=>Y(n,G(ye).unavailable)),J(e,t)};X(E,e=>{G(ye)?.unavailable&&e(D)});var O=U(E,2),ee=e=>{J(e,Go())};X(O,e=>{G(S)&&G(w)>=G(C)&&!G(pe)&&e(ee)});var j=U(O,2),re=B(j),ie=e=>{var t=Pr(),r=V(t),i=e=>{var t=Ko(),r=H(t,!0);W((e,i)=>{Q(t,`form`,`${n}-input`),t.disabled=e,Y(r,i)},[()=>G(v)||G(Se)||!G(T).trim(),()=>xo($.data?.confirmationMode,!!G(b).reversibleInput)?`ENTER REVIEW`:`ENTER APPLY`]),J(e,t)},o=e=>{var t=Pr(),n=V(t),r=e=>{var t=qo();W(()=>t.disabled=G(v)||G(Se)&&!a()),K(`click`,t,Ae),J(e,t)},i=I(()=>G(be)&&u(G(ye))),o=e=>{var t=Jo(),n=H(t,!0);W(e=>{t.disabled=G(v)||G(Se)&&!a(),Y(n,e)},[()=>u(G(ye))?`ENTER REVIEW`:`ENTER APPLY`]),K(`click`,t,()=>{G(ye)&&ke(G(ye))}),J(e,t)};X(n,e=>{G(i)?e(r):e(o,-1)}),J(e,t)},s=e=>{var t=Jo(),n=H(t);W(()=>{t.disabled=G(v)||G(Se)&&!a(),Y(n,`ENTER ${G(ye).next?`OPEN`:`HELP`}`)}),K(`click`,t,()=>{G(ye)&&Oe(G(ye))}),J(e,t)};X(r,e=>{G(b)?.input?e(i):G(ye)?.action&&!G(ye).unavailable?e(o,1):!G(x)&&G(ye)&&!G(ye).unavailable&&!G(ye).noOp&&e(s,2)}),J(e,t)};X(re,e=>{G(y)||e(ie)});var ae=U(re,2),oe=e=>{var t=Yo();W(()=>t.disabled=G(v)),K(`click`,t,de),J(e,t)};X(ae,e=>{G(ce)&&e(oe)});var se=U(ae,2),le=e=>{var t=Xo();W(()=>t.disabled=G(v)),K(`click`,t,()=>De(G(b)?.path||``,void 0,!0)),J(e,t)};X(se,e=>{G(Ce)||e(le)});var ue=U(se,2);F(j);var me=U(j,2),he=e=>{var t=Zo(),n=H(t);W(()=>Y(n,`↑/↓ select${G(Ce)?` · Tab complete`:``}`)),J(e,t)};X(me,e=>{!G(b)?.input&&!G(x)&&e(he)}),F(i),Li(i,e=>z(A,e),()=>G(A)),W(()=>{Q(i,`aria-label`,G(Ce)?`Slash command suggestions`:`Session command options`),o=li(i,1,`svelte-7bfwr9`,null,o,{"command-popup":G(Ce)})}),K(`keydown`,i,Ee),K(`click`,ue,Te),J(e,i)};return X(Ie,e=>{G(_)&&e(Le)}),F(Me),W(()=>Ne.disabled=G(Se)&&!a()||G(v)),K(`click`,Ne,()=>{z(_,!G(_)),z(ee,G(_)?null:i(),!0),z(S,``),G(_)?(z(oe,[],!0),De(``)):Te()}),J(e,Me),Ue(je)}Cr([`click`,`keydown`]);var ts=q(` `,1),ns=q(`
      `),rs=q(`
      /
      `);function is(e,t){He(t,!0);let n=I(()=>t.lines.filter(e=>e.kind===`addition`).length),r=I(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=rs(),a=B(i),o=B(a),s=H(o),c=H(U(o,2));F(a),Z(U(a,2),17,()=>t.lines,qr,(e,t)=>{var n=ns();let r;var i=B(n),a=e=>{var n=ts(),r=V(n),i=H(r,!0),a=H(U(r),!0);W(()=>{Y(i,G(t).old||``),Y(a,G(t).new||``)}),J(e,n)};X(i,e=>{G(t).kind!==`heading`&&G(t).kind!==`metadata`&&e(a)});var o=H(U(i),!0);F(n),W(()=>{r=li(n,1,`diff-line svelte-x4gtb6`,null,r,{added:G(t).kind===`addition`,removed:G(t).kind===`removal`,heading:G(t).kind===`heading`}),Y(o,G(t).text)}),J(e,n)}),F(i),W(()=>{Q(a,`aria-label`,`${G(n)} lines added, ${G(r)} lines removed`),Y(s,`+${G(n)??``}`),Y(c,`−${G(r)??``}`)}),J(e,i),Ue()}var as=q(`

      TOOL

       
      `,1),os=q(`

      TITLE

      `,1),ss=q(`

      APP

      `,1),cs=q(`

      MCP TOOL APPROVAL

      MCP SERVER

       

      ARGUMENTS

       
      `);function ls(e,t){He(t,!0);var n=cs(),r=U(B(n),2),i=H(r,!0),a=U(r,4),o=H(a,!0),s=U(a,2),c=e=>{var n=as(),r=H(U(V(n),2),!0);W(()=>Y(r,t.details.name)),J(e,n)};X(s,e=>{t.details.name&&e(c)});var l=U(s,2),u=e=>{var n=os(),r=H(U(V(n),2),!0);W(()=>Y(r,t.details.title)),J(e,n)};X(l,e=>{t.details.title&&e(u)});var d=U(l,2),f=e=>{var n=ss(),r=H(U(V(n),2),!0);W(()=>Y(r,t.details.connector)),J(e,n)};X(d,e=>{t.details.connector&&e(f)});var p=H(U(d,4),!0);F(n),W(()=>{Y(i,t.details.message),Y(o,t.details.server),Y(p,t.details.arguments||`—`)}),J(e,n),Ue()}var us=q(`

       
      `,1),ds=q(`

      `);function fs(e,t){He(t,!0);var n=ds(),r=B(n),i=H(r,!0);Z(U(r,2),17,()=>t.review.fields||[],qr,(e,t)=>{var n=us(),r=V(n),i=H(r,!0),a=H(U(r,2),!0);W(()=>{Y(i,G(t).label),Y(a,G(t).value)}),J(e,n)}),F(n),W(()=>{Q(n,`aria-label`,t.review.title),Y(i,t.review.title)}),J(e,n),Ue()}var ps=q(`
       
      `),ms=q(` `),hs=q(`

      `),gs=q(`

      `);function _s(e,t){He(t,!0);let n=Gi(t,`full`,3,!1);var r=gs();let i;var a=B(r),o=e=>{var n=ps(),r=H(n,!0);W(()=>Y(r,t.assessment.subject)),J(e,n)};X(a,e=>{!t.assessment.attached&&t.assessment.subject&&e(o)});var s=U(a,2),c=B(s),l=H(c,!0),u=U(c,2),d=B(u),f=U(d);F(u);var p=U(u,2),m=e=>{var n=ms(),r=H(n);W(e=>Y(r,`RISK: ${e??``}`),[()=>t.assessment.risk.toUpperCase()]),J(e,n)};X(p,e=>{t.assessment.risk&&e(m)});var h=U(p,2),g=e=>{var n=ms(),r=H(n);W(e=>Y(r,`USER AUTHORISATION: ${e??``}`),[()=>t.assessment.authorization.toUpperCase()]),J(e,n)};X(h,e=>{n()&&t.assessment.authorization&&e(g)}),F(s);var _=U(s,2),v=e=>{var n=hs(),r=H(n,!0);W(()=>Y(r,t.assessment.rationale)),J(e,n)};X(_,e=>{t.assessment.rationale&&e(v)}),F(r),W(()=>{i=li(r,1,`assessment svelte-16iojek`,null,i,{attached:t.assessment.attached}),Q(r,`aria-label`,t.assessment.title),Y(l,t.assessment.title),Q(d,`data-status`,t.assessment.status),Y(f,` ${t.assessment.decision??``}`)}),J(e,r),Ue()}var vs=q(`
       
      `),ys=q(`

      `),bs=q(``),xs=q(``),Ss=q(`

      Send this saved prompt now? This starts Codex work and consumes quota.

      `,1),Cs=q(``),ws=q(`

      In memory only. Closing Codexometer cancels pending work.

      `),Ts=q(`

      HUMAN APPROVAL REQUIRED

      Managed policy requires approval each time.

      `,1),Es=q(`

      CURRENT PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      PROPOSED PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      Applied settings remain after Codexometer closes.

      `,1),Ds=q(`

      `),Os=q(`

       
      `,1),ks=q(`

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

      `),As=q(`

      Session controls temporarily unavailable. Check Codex for current state.

      `),js=q(`

      Checking session controls…

      `),Ms=q(`

      `),Ns=q(`
      About browser controls

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

      `),Ps=q(` `,1),Fs=q(` `),Is=q(`Grants permission beyond this one action. Check the scope + carefully.`),Ls=q(``),Rs=q(``),zs=q(``),Bs=q(``),Vs=q(`

      Not before this time; when quota and idle allow.

      `),Hs=q(`

      `,1),Us=q(`

      The existing trigger remains active until saved or deleted. If + it changes or sends while you edit, saving is blocked.

      `),Ws=q(` `,1),Gs=q(``),Ks=q(``),qs=q(``),Js=q(` `,1),Ys=q(`
    • `),Xs=q(`
      View fixed choices

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

        `),Zs=q(` `,1),Qs=q(`

        `),$s=q(`

        `,1),ec=q(` `,1),tc=q(``),nc=q(`

        `,1),rc=q(`

        `);function ic(e,t){He(t,!0);let n=[],r=Gi(t,`observedCommand`,3,``),i=Gi(t,`observedFileChanges`,19,()=>[]),a=Gi(t,`review`,3,``),o=Gi(t,`suspended`,3,!1),s=Gi(t,`openScheduler`,3,!1),c=Gi(t,`onProtectedChange`,3,e=>{}),l=Gi(t,`oncopy`,3,()=>{}),u=R(null),d=R(Jt([])),f=R(null),p=R(``),m=R(0),h=R(Jt(Date.now())),g=R(!1),_=R(``),v=R(!1),y=R(!1),b=R(``),x=R(!1),S=R(``),C=R(!1),w=R(``),T=R(``),E=R(0),D=R(`now`),O=R(60),k=R(``),ee=R(!1),te=R(``),A=R(Jt([])),ne=I(()=>G(A).find(e=>e.status!==`sent`)),j=R(void 0),re=R(void 0);function ie(e){if(G(x)){ur().then(()=>G(j)?.focus());return}if(e.resumeGoal||e.status!==`pending`||G(g)||!G(u)?.id||G(u).kind!==`prompt`||G(u).questions?.length)return;z(x,!0),z(S,e.id,!0),ur().then(()=>G(j)?.focus()),z(d,[e.text],!0),z(D,e.trigger===`quota`?`quota`:`at`,!0),z(p,``),z(w,``);let t=new Date(e.at||0);e.trigger!==`quota`&&z(k,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}_n(()=>{s()&&G(ne)&&!G(ne).resumeGoal&&!G(C)&&G(u)?.id&&G(u).kind===`prompt`&&!G(u).questions?.length&&(z(C,!0),ie(G(ne)))});async function ae(){if(!a())try{z(A,await ka(`schedules`,{session:t.session},P.signal),!0),G(x)&&!G(A).some(e=>e.id===G(S)&&e.status===`pending`)&&z(p,``),G(w)&&!G(A).some(e=>e.id===G(w)&&e.status===`pending`)&&(z(p,``),z(w,``))}catch{}}async function oe(e){if(xo($.data?.confirmationMode,!0)&&(G(T)!==e||G(h)>=G(E))){z(T,e,!0),z(E,G(h)+3e4);return}z(T,``);let n=G(A).some(t=>t.id===e&&t.resumeGoal);try{z(A,await ka(`schedules`,{session:t.session,cancelId:e},P.signal),!0),z(x,!1),z(p,``),z(w,``),n||z(d,[],!0)}catch(e){z(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}_n(()=>(c()(G(g)||G(d).some(e=>e.length>0)),()=>c()(!1)));let se=I(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),ce=I(()=>!$.connected||!!$.data?.sessionsError),le=I(()=>a()!==`profile`&&G(u)?.kind===`prompt`&&!G(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),ue=I(()=>!G(ce)&&!G(y)&&!!G(u)?.id&&G(u).kind===`approval`&&G(b)!==G(u).id),de=I(()=>G(ue)?G(u).command:r()),fe=I(()=>!!G(p)&&G(h)xo($.data?.confirmationMode,G(u)?.kind===`approval`?G(f)!==null&&!G(u).choices?.[G(f)]?.persistent:G(u)?.kind===`profile`?G(f)===1:!(G(u)?.kind!==`prompt`||G(w)||G(x)||!G(u).questions?.length&&G(D)!==`now`))),me=I(()=>G(u)?.questions?.length?G(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),he=I(()=>G(u)?.kind===`approval`||G(u)?.kind===`profile`?G(f)!==null:G(d).length===G(me).length&&G(d).every((e,t)=>e.trim().length>0&&(G(me)[t].freeText||G(me)[t].options?.includes(e)))),ge=I(()=>G(u)?.kind===`prompt`&&!G(u).questions?.length&&G(D)!==`now`);_n(()=>{G(ne)?.resumeGoal&&z(D,`now`)});let _e=I(()=>G(D)===`delay`?G(h)+G(O)*6e4:Date.parse(G(k))),M=I(()=>{if(!G(ge))return``;if(G(x)&&!G(A).some(e=>e.id===G(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!G(d)[0]?.trim())return`Enter a message to schedule.`;if(G(D)===`quota`)return``;if(!Number.isFinite(G(_e))||G(_e)<=G(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(G(h));return e.setFullYear(e.getFullYear()+1),G(_e)>=e.getTime()?`Choose a time within one year.`:``});function ve(e){return e===void 0?`Not yet available`:new Date(e).toLocaleString([],{timeZoneName:`short`})}function N(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&e.at&&Date.parse(e.at)>G(h))return`Due in `+Math.ceil((Date.parse(e.at)-G(h))/6e4)+` min`;let t=G(ce)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}_n(()=>{(G(ce)||o()||G(le)||G(h)>=G(m))&&z(p,``)});let P=new AbortController;Ki(()=>{let e=e=>{!xa.ids.length&&e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&G(ne)&&!G(ne).resumeGoal&&(e.preventDefault(),ie(G(ne)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{z(h,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await ka(`offer`,{session:t.session,...a()?{review:a()}:{}},P.signal);if(P.signal.aborted)return;z(y,!1),G(u)?.id!==e.id&&(z(p,``),z(f,null),z(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),z(u,e,!0),G(v)&&e.id&&e.id!==G(b)&&(z(_,``),z(v,!1))}catch{P.signal.aborted||(z(u,null),z(y,!0),z(p,``))}finally{P.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),P.abort(),clearTimeout(n),clearInterval(r)}});async function ye(e){if(!e&&G(u)?.kind===`prompt`&&!G(u).questions?.length&&G(d)[0]?.trim().startsWith(`/`)&&!G(d)[0]?.trim().startsWith(`//`)){z(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!G(u)?.id||G(g)||G(ce)||o()||G(le)||(e?!e.canSend:!G(he)||G(M)))return;let n=G(u).id;z(g,!0),z(_,``),z(v,!1),z(p,``),z(w,e?.id||``,!0);try{let r=!e&&G(u).kind===`prompt`&&!G(u).questions?.length&&G(D)!==`now`?{trigger:G(D)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...G(D)===`quota`?{}:{at:(G(D)===`delay`?new Date(Date.now()+G(O)*6e4):new Date(G(k))).toISOString()}}:void 0;z(ee,!!r),z(te,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ve(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await ka(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&G(x)?{editId:G(S)}:{},...G(u).kind===`approval`||G(u).kind===`profile`?{choice:G(f)}:{answers:e?[e.text]:[...G(d)]}},P.signal);G(u)?.id!==n||P.signal.aborted||G(ce)||o()||G(le)||(z(p,i.confirmation,!0),z(m,Date.parse(i.expires),!0))}catch(e){P.signal.aborted||z(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{z(g,!1)}!G(pe)&&G(p)&&!P.signal.aborted&&await xe()}async function xe(){if(!G(u)?.id||G(g)||o()||G(le)||!G(fe))return;let e=G(u).id,n=G(u).kind,r=G(p);z(p,``),z(g,!0),z(b,e,!0);try{await ka(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},P.signal),z(v,!0),z(x,!1),G(ee)&&(z(b,``),await ae()),z(_,G(ee)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){z(_,e instanceof _a?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{z(g,!1),z(w,``),await ae(),z(d,[],!0),z(f,null)}}var Se=Ps(),Ce=V(Se),we=e=>{var t=Pr();Z(V(t),17,()=>G(A).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=ws(),r=B(n),i=H(r,!0),a=U(r,2),s=H(a),c=U(a,2),l=H(c,!0),d=U(c,2),f=H(d,!0),m=U(d,2),v=e=>{var n=vs(),r=H(n,!0);W(()=>Y(r,G(t).text)),J(e,n)};X(m,e=>{G(t).resumeGoal||e(v)});var y=U(m,2),b=e=>{var t=ys(),n=H(t,!0);W(()=>Y(n,G(_))),J(e,t)};X(y,e=>{G(_)&&e(b)});var x=U(y,2),S=U(B(x)),C=e=>{J(e,Nr(`Follows session model, reasoning and speed.`))};X(S,e=>{G(t).resumeGoal||e(C)}),F(x);var D=U(x,2),O=e=>{var n=bs();W(()=>n.disabled=G(g)||!G(u)?.id||G(u).kind!==`prompt`||!!G(u).questions?.length||G(t).status!==`pending`),K(`click`,n,()=>ie(G(t))),J(e,n)};X(D,e=>{G(t).resumeGoal||e(O)});var k=U(D,2),ee=H(k,!0),te=U(k,2),A=e=>{var t=xs();K(`click`,t,()=>{z(T,``)}),J(e,t)};X(te,e=>{G(T)===G(t).id&&G(h){},re=e=>{var n=Ss(),r=U(V(n),2),i=U(r,2);W(()=>r.disabled=G(g)||G(ce)||!G(t).canSend),K(`click`,r,xe),K(`click`,i,()=>{z(p,``),z(w,``)}),J(e,n)},ae=e=>{var n=Cs();W(()=>n.disabled=G(g)||G(ce)||!G(t).canSend||o()),K(`click`,n,()=>ye(G(t))),J(e,n)};X(ne,e=>{G(t).resumeGoal?e(j):G(fe)&&G(w)===G(t).id?e(re,1):e(ae,-1)}),F(n),W((e,n)=>{Y(i,G(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:G(t).resumeGoal?`SCHEDULED GOAL RESUME`:`SCHEDULED FOLLOW-UP`),Y(s,`TARGET // ${G(t).session??``}`),Y(l,e),Y(f,n),k.disabled=G(g)||G(t).status===`sending`,Y(ee,G(T)===G(t).id&&G(h)G(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ve(G(t).at)}`,()=>N(G(t))]),K(`click`,k,()=>oe(G(t).id)),J(e,n)}),J(e,t)},Te=I(()=>!a()&&G(u)?.kind!==`approval`&&!G(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(se)||``));X(Ce,e=>{G(Te)&&e(we)});var Ee=U(Ce,2),De=e=>{var r=rc(),o=B(r),s=H(o,!0),c=U(o,2),S=e=>{var t=Ts();be(2),J(e,t)};X(c,e=>{G(u)?.requiredHumanApproval&&!G(ce)&&!G(y)&&e(S)});var C=U(c,2),w=e=>{var t=Es(),n=V(t),r=H(n),i=U(n,6),a=H(i,!0),o=H(U(i,6),!0);be(2),W(()=>{Y(r,`Your ${G(u).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),Y(a,G(u).profile.current),Y(o,G(u).profile.proposed)}),J(e,t)};X(C,e=>{G(u)?.profile&&!G(ce)&&!G(y)&&e(w)});var T=U(C,2),E=e=>{var t=Ds();let n;var r=H(t,!0);W(()=>{n=li(t,1,`svelte-1oupzfc`,null,n,{notice:!G(v),sent:G(v)}),Y(r,G(_))}),J(e,t)};X(T,e=>{G(_)&&e(E)});var A=U(T,2),ie=e=>{fs(e,{get review(){return G(u).approvalReview}})},ae=e=>{ls(e,{get details(){return G(u).mcpTool}})},oe=e=>{is(e,{get lines(){return G(u).fileChanges}})},le=e=>{is(e,{get lines(){return i()}})},ge=e=>{fs(e,{get review(){return t.observedAction}})},N=e=>{var n=Os(),r=V(n),i=H(r,!0),a=U(r,2),o=H(a,!0),s=U(a,2),c=e=>{_s(e,{get assessment(){return t.observedReview},full:!0})};X(s,e=>{t.observedReview&&(!G(ue)||G(u)?.reviewId===t.observedReview.id)&&e(c)}),W(()=>{Y(i,G(ue)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),Y(o,G(de))}),J(e,n)},P=e=>{J(e,ks())};X(A,e=>{G(u)?.approvalReview&&!G(ce)&&!G(y)?e(ie):G(u)?.mcpTool&&!G(ce)&&!G(y)?e(ae,1):G(u)?.fileChanges?.length&&!G(ce)&&!G(y)?e(oe,2):i().length?e(le,3):t.observedAction&&!G(u)?.id&&!G(de)&&a()!==`profile`?e(ge,4):G(de)?e(N,5):a()!==`profile`&&G(se)===`APPROVAL NEEDED`&&!G(v)&&e(P,6)});var Se=U(A,2),Ce=e=>{J(e,As())},we=e=>{J(e,js())},Te=e=>{var t=Ps(),n=V(t),r=e=>{var t=Ms(),n=H(t,!0);W(e=>Y(n,e),[()=>G(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),J(e,t)};X(n,e=>{(G(se)===`WORKING`||!G(v)&&!G(g))&&e(r)});var i=U(n,2),a=e=>{J(e,Ns())},o=I(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(se)||``)&&!G(v));X(i,e=>{G(o)&&e(a)}),J(e,t)},Ee=e=>{var r=nc(),i=V(r),o=H(i),s=U(i,2),c=B(s),_=H(c,!0),v=U(c,2),y=e=>{var r=Pr();Z(V(r),17,()=>G(u).choices||[],qr,(e,r,i)=>{var o=Ls(),s=B(o);Si(s),s.value=s.__value=i;var c=U(s),l=U(c),u=e=>{var t=Fs(),n=H(t,!0);W(()=>Y(n,G(r).detail)),J(e,t)};X(l,e=>{G(r).detail&&e(u)});var d=U(l,2),p=e=>{J(e,Is())};X(d,e=>{G(r).persistent&&e(p)}),F(o),W(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),Y(c,` ${G(r).label??``} `)}),ki(n,[],s,()=>G(f),e=>z(f,e)),J(e,o)}),J(e,r)},b=e=>{var n=Ps(),r=V(n),i=e=>{var t=Ws(),n=V(t),r=U(B(n)),i=B(r),a=e=>{var t=Rs();t.value=t.__value=`now`,J(e,t)};X(i,e=>{G(x)||e(a)});var o=U(i);o.value=o.__value=`quota`;var s=U(o);s.value=s.__value=`delay`;var c=U(s);c.value=c.__value=`at`,F(r),hi(r),F(n);var l=U(n,2),u=e=>{var t=zs(),n=U(B(t));Si(n),F(t),Di(n,()=>G(O),e=>z(O,e)),J(e,t)};X(l,e=>{G(D)===`delay`&&e(u)});var d=U(l,2),f=e=>{var t=Bs(),n=U(B(t));Si(n),F(t),Di(n,()=>G(k),e=>z(k,e)),J(e,t)};X(d,e=>{G(D)===`at`&&e(f)});var p=U(d,2),m=e=>{var t=Hs(),n=V(t),r=H(n),i=U(n,2),a=e=>{J(e,Vs())};X(i,e=>{G(D)!==`quota`&&e(a)});var o=U(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. + One pending request per session; saving replaces it. Memory + only; Codexometer must stay running. Uses session model, + reasoning and speed.`,W(e=>Y(r,`Will send: ${e??``}`),[()=>G(D)===`quota`?`when quota is available and this session is idle`:Number.isFinite(G(_e))?ve(G(_e)):`choose a date and time`]),J(e,t)};X(p,e=>{G(D)!==`now`&&e(m)});var h=U(p,2),g=e=>{J(e,Us())};X(h,e=>{G(x)&&e(g)}),gi(r,()=>G(D),e=>z(D,e)),J(e,t)};X(r,e=>{!G(u).questions?.length&&!G(ne)?.resumeGoal&&e(i)}),Z(U(r,2),17,()=>G(me),qr,(e,n,r)=>{var i=Zs(),o=V(i),s=e=>{{let n=I(()=>G(d)[0]||``);Li(es(e,{get session(){return t.session},get oncopy(){return l()},get query(){return G(n)},oncomplete:e=>{z(d,[e],!0),ur().then(()=>G(j)?.focus())},onchange:()=>{z(d,[``],!0),ur().then(()=>G(j)?.focus())}}),e=>z(re,e,!0),()=>G(re))}};X(o,e=>{r===0&&a()!==`profile`&&G(u).kind===`prompt`&&!G(u).questions?.length&&e(s)});var c=U(o,2),f=B(c),p=U(f),m=e=>{var t=Gs();Si(t),Di(t,()=>G(d)[r],e=>G(d)[r]=e),J(e,t)},h=e=>{var t=qs(),i=B(t);i.value=i.__value=``,Z(U(i),17,()=>G(n).options||[],qr,(e,t)=>{var n=Ks(),r=H(n,!0),i={};W(()=>{Y(r,G(t)),i!==(i=G(t))&&(n.value=(n.__value=i)??``)}),J(e,n)}),F(t),hi(t),gi(t,()=>G(d)[r],e=>G(d)[r]=e),J(e,t)},g=e=>{var t=Js(),i=V(t);et(i),Li(i,e=>z(j,e),()=>G(j));var a=U(i,2),o=e=>{var t=Ms(),r=H(t);W(e=>Y(r,`Suggested answers: ${e??``}`),[()=>G(n).options.join(` · `)]),J(e,t)};X(a,e=>{G(n).options?.length&&e(o)}),K(`keydown`,i,e=>{G(u)?.kind===`prompt`&&!G(u).questions?.length&&G(re)?.handleKey(e)}),Di(i,()=>G(d)[r],e=>G(d)[r]=e),J(e,t)};X(p,e=>{G(n).secret?e(m):G(n).freeText?e(g,-1):e(h,1)}),F(c);var _=U(c,2),v=e=>{var t=Xs(),r=U(B(t),4);Z(r,21,()=>G(n).options||[],qr,(e,t)=>{var n=Ys(),r=H(n,!0);W(()=>Y(r,G(t))),J(e,n)}),F(r),F(t),J(e,t)};X(_,e=>{G(n).secret&&!G(n).freeText&&e(v)}),W(()=>Y(f,`${G(n).text??``} `)),J(e,i)}),J(e,n)};X(v,e=>{G(u).kind===`approval`||G(u).kind===`profile`?e(y):e(b,-1)}),F(s);var S=U(s,2),C=e=>{var t=$s(),n=V(t),r=e=>{var t=Qs(),n=H(t);W(()=>Y(n,`TRIGGER // ${G(te)??``}`)),J(e,t)};X(n,e=>{G(ee)&&e(r)});var i=U(n,2),a=H(i),o=U(i,2),s=H(o),c=U(o,2);W(e=>{Y(a,`Check the target and ${G(u).kind===`profile`?`profile above`:G(u).kind===`approval`?G(u).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${G(ee)?`This schedules a follow-up that will send automatically when eligible`:`This will send to Codex`}; it may start work using your quota. + Confirmation expires in ${e??``}s.`),o.disabled=G(g)||G(ce),Y(s,`CONFIRM ${(G(u).kind===`approval`||G(u).kind===`profile`?G(u).choices?.[G(f)]?.label:G(ee)?G(x)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((G(m)-G(h))/1e3))]),K(`click`,o,xe),K(`click`,c,()=>{z(p,``)}),J(e,t)},w=e=>{var t=ec(),n=V(t),r=e=>{var t=ys(),n=H(t,!0);W(()=>Y(n,G(M))),J(e,t)};X(n,e=>{G(M)&&e(r)});var i=U(n,2),a=H(i,!0);W(()=>{i.disabled=G(g)||G(ce)||!G(he)||!!G(M),Y(a,G(g)?`SENDING…`:G(pe)?G(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`:G(x)?`SAVE CHANGES`:G(u).kind===`approval`||G(u).kind===`profile`?`SEND DECISION`:G(u).kind===`prompt`&&!G(u).questions?.length&&G(D)!==`now`?`SET TRIGGER`:`SEND`)}),K(`click`,i,()=>ye()),J(e,t)};X(S,e=>{G(fe)&&G(pe)?e(C):e(w,-1)});var T=U(S,2),E=e=>{var t=tc();K(`click`,t,()=>{z(x,!1),z(p,``),z(d,[],!0)}),J(e,t)};X(T,e=>{G(x)&&e(E)}),W(()=>{Y(o,`TARGET // ${G(u).thread??``} // ${(G(u).directory||`Directory unavailable`)??``}`),s.disabled=G(g)||G(fe)||G(ce),Y(_,G(u).kind===`approval`||G(u).kind===`profile`?`Choose a decision`:G(x)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),J(e,r)};X(Se,e=>{G(ce)||G(y)?e(Ce):G(u)?G(u).id?G(b)!==G(u).id&&e(Ee,3):e(Te,2):e(we,1)}),F(r),W(()=>Y(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),J(e,r)};X(Ee,e=>{!G(le)&&(!G(ne)||G(ne).resumeGoal||G(x)||a()||G(u)?.kind!==`prompt`||G(u).questions?.length)&&e(De)}),J(e,Se),Ue()}Cr([`click`,`keydown`]);var ac=(e,t=f)=>{var n=Pr(),r=V(n),i=e=>{var n=dc(),r=H(n,!0);W(()=>Y(r,t().text)),J(e,n)},a=e=>{var n=Nr();W(()=>Y(n,t().text)),J(e,n)};X(r,e=>{t().code?e(i):e(a,-1)}),J(e,n)},oc=(e,t=f)=>{var n=Pr(),r=V(n),i=e=>{var n=fc();ac(B(n),t),F(n),J(e,n)},a=e=>{ac(e,t)};X(r,e=>{t().italic?e(i):e(a,-1)}),J(e,n)},sc=(e,t=f)=>{var n=Pr();Z(V(n),17,t,qr,(e,t)=>{var n=Pr(),r=V(n),i=e=>{var n=pc();oc(B(n),()=>G(t)),F(n),J(e,n)},a=e=>{oc(e,()=>G(t))};X(r,e=>{G(t).bold?e(i):e(a,-1)}),J(e,n)}),J(e,n)},cc=(e,t=f)=>{var n=Pr();Z(V(n),17,()=>uc(t()),qr,(e,t)=>{let n=I(()=>G(t)[0].threadId);var r=Pr(),i=V(r),a=e=>{var r=mc();sc(B(r),()=>G(t)),F(r),K(`click`,r,()=>Sa(G(n))),J(e,r)},o=e=>{sc(e,()=>G(t))};X(i,e=>{G(n)?e(a):e(o,-1)}),J(e,r)}),J(e,n)},lc=e=>e===`right`||e===`center`?e:`left`;function uc(e){let t=[];for(let n of e||[]){let e=t.at(-1);!e||n.threadStart||e[0].threadId!==n.threadId?t.push([n]):e.push(n)}return t}var dc=q(` `),fc=q(``),pc=q(``),mc=q(``),hc=q(``),gc=q(``),_c=q(``),vc=q(`
        `),yc=q(`
        `),bc=q(`
        `);function xc(e,t){He(t,!0);var n=bc();Z(n,21,()=>t.blocks,qr,(e,t)=>{var n=Pr(),r=V(n),i=e=>{var n=vc(),r=B(n),i=B(r),a=B(i);Z(a,21,()=>G(t).rows[0]||[],qr,(e,n,r)=>{var i=hc();let a;cc(B(i),()=>G(n)),F(i),W(e=>a=di(i,``,a,{"text-align":e}),[()=>lc(G(t).align?.[r])]),J(e,i)}),F(a),F(i);var o=U(i);Z(o,21,()=>G(t).rows.slice(1),qr,(e,n)=>{var r=_c();Z(r,21,()=>G(n)||[],qr,(e,n,r)=>{var i=gc();let a;cc(B(i),()=>G(n)),F(i),W(e=>a=di(i,``,a,{"text-align":e}),[()=>lc(G(t).align?.[r])]),J(e,i)}),F(r),J(e,r)}),F(o),F(r),F(n),J(e,n)},a=e=>{var n=yc();cc(B(n),()=>G(t).runs),F(n),J(e,n)};X(r,e=>{G(t).rows?.length?e(i):e(a,-1)}),J(e,n)}),F(n),J(e,n),Ue()}Cr([`click`]);var Sc=q(` `);function Cc(e,t){He(t,!0);let n=Gi(t,`stale`,3,!1),r=I(()=>n()||!!t.goal?.stale);var i=Pr(),a=V(i),o=e=>{var n=Sc();let i;var a=H(n,!0);W((e,o)=>{i=li(n,1,`goal-status svelte-1yfu3xi`,null,i,{stale:G(r),pursuing:!G(r)&&t.goal.status===`active`,blocked:e}),Q(n,`title`,o),Y(a,G(r)?`GOAL STALE`:t.goal.label)},[()=>!G(r)&&[`blocked`,`usageLimited`,`budgetLimited`].includes(t.goal.status),()=>t.goal.objective+` +`+t.goal.tokensUsed.toLocaleString()+(t.goal.tokenBudget===null?` tokens`:` / `+t.goal.tokenBudget.toLocaleString()+` tokens`)]),J(e,n)};X(a,e=>{t.goal&&e(o)}),J(e,i),Ue()}var wc=q(` `,1),Tc=q(`
        `),Ec=q(`

        STATUS LINE // CODEXOMETER

        Choose multiple fields and their order. These display preferences do not + change Codex CLI configuration. Missing values are omitted.

        `),Dc=q(`

        `,1);function Oc(e,t){He(t,!0);let n=Gi(t,`stale`,3,!1),r=R(Jt([])),i=R(!1),a=I(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??G(a).filter(e=>e.default).map(e=>e.id))].filter(e=>G(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=I(()=>[...G(r).map(e=>G(a).find(t=>t.id===e)).filter(Boolean),...G(a).filter(e=>!G(r).includes(e.id))]);_n(()=>{sa.open&&!G(i)?(z(r,o(oa.statusLine),!0),z(i,!0)):sa.open||z(i,!1)});function l(e,t){z(r,t?[...G(r),e]:G(r).filter(t=>t!==e),!0)}function u(e,t){let n=G(r).indexOf(e),i=n+t;if(n<0||i<0||i>=G(r).length)return;let a=[...G(r)];[a[n],a[i]]=[a[i],a[n]],z(r,a,!0)}var d=Dc(),p=V(d),m=e=>{var t=Ec(),n=U(B(t),4);Z(n,21,()=>G(c),e=>e.id,(e,t)=>{var n=Tc(),i=B(n),a=B(i);Si(a);var o=U(a,1,!0),s=H(U(o),!0);F(i);var c=U(i,2),d=e=>{var n=wc(),i=V(n),a=U(i,2);W((e,n)=>{Q(i,`aria-label`,`Move `+G(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+G(t).label+` later`),a.disabled=n},[()=>G(r).indexOf(G(t).id)===0,()=>G(r).indexOf(G(t).id)===G(r).length-1]),K(`click`,i,()=>u(G(t).id,-1)),K(`click`,a,()=>u(G(t).id,1)),J(e,n)},f=I(()=>G(r).includes(G(t).id));X(c,e=>{G(f)&&e(d)}),F(n),W(e=>{Q(i,`title`,G(t).help),Ci(a,e),Y(o,G(t).label),Y(s,G(t).help)},[()=>G(r).includes(G(t).id)]),K(`change`,a,e=>l(G(t).id,e.currentTarget.checked)),J(e,n)}),F(n);var i=U(n,2),a=H(i),o=U(i,2),d=U(o,2);F(t),W(e=>Y(a,`Preview // ${e??``}`),[()=>s(G(r))||`—`]),K(`click`,o,()=>{oa.statusLine=[...G(r)],la(),sa.open=!1}),K(`click`,d,()=>{sa.open=!1}),J(e,t)};X(p,e=>{sa.open&&e(m)});var h=U(p,2),g=B(h),_=H(g,!0),v=U(g,2);{let e=I(()=>n()||!$.connected||!!$.data?.sessionsError);Cc(v,{get goal(){return t.session.goal},get stale(){return G(e)}})}var y=U(v,2);ni(U(y,2),()=>t.children??f),F(h),W((e,t)=>{Q(g,`title`,e),Y(_,t)},[()=>s(oa.statusLine),()=>s(oa.statusLine)]),K(`click`,y,()=>{sa.open=!sa.open}),J(e,d),Ue()}Cr([`change`,`click`]);var kc=q(`
        `);function Ac(e,t){He(t,!0);let n=Gi(t,`active`,3,!1),r=Gi(t,`compact`,3,!1),i=I(()=>So(t.session)),a=I(()=>!!G(i)),o=R(!1),s=R(``),c=R(!1);_n(()=>{if(!G(c))return;let e=setTimeout(()=>{z(c,!1)},150);return()=>clearTimeout(e)}),_n(()=>{G(i),t.session.status,z(s,``)});async function l(){if(!G(a)||G(o))return;let e=G(i);z(o,!0),z(c,!0),z(s,``);try{await navigator.clipboard.writeText(e),G(i)===e&&z(s,`Copied.`)}catch{G(i)===e&&z(s,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{z(o,!1)}}function u(e){!n()||!G(a)||xa.ids.length||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(),l())}var d={copy:l},f=Pr();Sr(`keydown`,Zt,u);var p=V(f),m=e=>{var t=kc();let n;var i=B(t),a=H(i,!0),u=U(i,2);let d;F(t),W(()=>{n=li(t,1,`session-copy svelte-543j00`,null,n,{compact:r()}),Y(a,G(s)),u.disabled=G(o),d=li(u,1,`svelte-543j00`,null,d,{flashed:G(c)})}),K(`click`,u,l),J(e,t)};return X(p,e=>{G(a)&&e(m)}),J(e,f),Ue(d)}Cr([`click`]);var jc=q(``);function Mc(e,t){He(t,!0);let n=Gi(t,`field`,15),r=Gi(t,`value`,15,``),i=Gi(t,`disabled`,3,!1);var a=jc(),o=U(B(a),2);Si(o),Li(o,e=>n(e),()=>n()),F(a),W(()=>{Q(o,`aria-label`,t.label),Q(o,`placeholder`,t.placeholder),o.disabled=i()}),K(`keydown`,o,function(...e){t.onkeydown?.apply(this,e)}),Di(o,r),J(e,a),Ue()}Cr([`keydown`]);var Nc=q(`

        `),Pc=q(`

        View this reply in Codex.

        `),Fc=q(`

        `),Ic=q(` `,1);function Lc(e,t){He(t,!0);let n=Gi(t,`unverified`,3,!1);var r=Pr();Z(V(r),17,()=>[...t.turns||[]].reverse(),qr,(e,t)=>{var n=Ic(),r=V(n),i=e=>{var n=Nc(),r=H(n,!0);W(()=>Y(r,G(t).task)),J(e,n)};X(r,e=>{G(t).task&&e(i)});var a=U(r,2),o=e=>{J(e,Pc())},s=e=>{xc(e,{get blocks(){return G(t).prose}})},c=e=>{var n=Fc(),r=H(n,!0);W(()=>Y(r,G(t).reply)),J(e,n)};X(a,e=>{G(t).restricted?e(o):G(t).prose?.length?e(s,1):G(t).reply&&e(c,2)}),J(e,n)},e=>{var t=Fc(),r=H(t,!0);W(()=>Y(r,n()?`Could not verify which completed turns belong to this agent.`:`No completed turns available.`)),J(e,t)}),J(e,r),Ue()}var Rc=q(`

        SAVED // SESSIONS

        `,1),zc=q(`

        `),Bc=q(`
        SessionTime ago
        `),Vc=q(``),Hc=q(`

        `),Uc=q(``),Wc=q(`

        If this session has an active goal, Codex may continue it + automatically.

        `,1),Gc=q(`
        `,1),Kc=q(` `,1),qc=q(`

        Loading saved sessions…

        `),Jc=q(`

        `),Yc=q(``),Xc=q(`
        `);function Zc(e,t){He(t,!0);let n=Gi(t,`resumeBusy`,15,!1),r=R(``),i=``;_n(()=>{if(t.target||!ya.argument)return;let e=ya.argument,n=ya.scope===t.scope;pr(()=>{ya.argument=``,n&&(z(r,e,!0),i=/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e)?e.toLowerCase():``)})});let a=R(void 0),o=R(Jt([])),s=R(``),c=R(``),l=R(void 0),u=R(!1),d=R(!1),f=R(``),p=R(``),m=R(null),h=R(Jt(Date.now())),g,_,v=!1,y=I(()=>n()||!!G(f)),b=I(()=>G(o).filter(e=>!!t.target||!t.liveIDs.has(e.id)||e.id===G(f)));async function x(e,n=``,a=G(r).trim()){_?.abort();let f=new AbortController;_=f,z(c,n,!0),z(l,void 0),z(u,!0),z(d,!1);try{if(!Oa)throw Error();let u=await Oa(t.scope,e,n,f.signal,a);if(f.signal.aborted)return;if(n)z(l,u.turns||[],!0);else{let n=new Set(G(o).map(e=>e.id));if(z(o,[...G(o),...(u.sessions||[]).filter(e=>!n.has(e.id)&&n.add(e.id)).map(t=>({...t,cursor:t.listCursor||e}))],!0),z(s,u.next===e?``:u.next||``,!0),!e&&i){let e=i;i=``,G(r)===a&&a.toLowerCase()===e&&G(o).length===1&&G(o)[0].id===e&&(t.liveIDs.has(e)?(ya.open=!1,location.hash=`/sessions/`+encodeURIComponent(e)):$.data?.control&&(z(c,e,!0),C(G(o)[0])))}}}catch{f.signal.aborted||(z(d,!0),(!e||n)&&(z(o,[],!0),z(s,``)),z(l,void 0))}finally{f.signal.aborted||z(u,!1)}}Ki(()=>{G(a)?.focus();let e=setInterval(()=>z(h,Date.now(),!0),15e3);return()=>{v=!0,_?.abort(),clearTimeout(g),clearInterval(e)}});function S(e,t){if(!e||e<0)return`—`;let n=Math.floor(Math.max(t/1e3-e,0)/60);return n>=1440?`${Math.floor(n/1440)}d ago`:n>=60?`${Math.floor(n/60)}h ago`:n?`${n}m ago`:`Just now`}_n(()=>{if(t.target){z(o,[{...t.target.row,cursor:``}],!0),z(c,t.target.row.id,!0),z(l,t.target.turns||[],!0);return}let e=G(r).trim(),n=requestAnimationFrame(()=>void x(``,``,e));return pr(()=>{_?.abort(),z(u,!0),z(d,!1),z(o,[],!0),z(c,``),z(m,null),z(l,void 0),z(s,``)}),()=>cancelAnimationFrame(n)}),_n(()=>{G(f)&&t.liveIDs.has(G(f))&&(location.hash=`/sessions/`+encodeURIComponent(G(f)),t.target?xa.ids=[]:ya.open=!1)});async function C(e){if(!Da||G(y))return;let r=xo($.data?.confirmationMode,!0)&&G(m)?.id!==e.id;z(p,``),n(!0);try{if(r){let n=await Da(t.scope,e.cursor,e.id,{mode:`prepare`});!v&&G(c)===e.id&&z(m,{id:e.id,token:n},!0);return}let n=G(m)?.id===e.id?G(m).token:``;if(z(m,null),await Da(t.scope,e.cursor,e.id,n?{confirmation:n}:void 0),v)return;z(f,e.id,!0),g=setTimeout(()=>{z(p,`Resume accepted; still waiting for the session to appear.`)},15e3)}catch(t){if(v)return;!r&&!(t instanceof _a)?(z(f,e.id,!0),z(p,`Resume outcome unknown. Check Codex before trying again.`)):z(p,t instanceof _a?t.message:`Could not prepare the resume.`,!0)}finally{v||n(!1)}}var w=Xc(),T=B(w),E=e=>{var t=Rc(),i=U(V(t),2);Mc(i,{label:`Search saved sessions`,placeholder:`Search by name or full session ID`,get disabled(){return G(y)},get field(){return G(a)},set field(e){z(a,e,!0)},get value(){return G(r)},set value(e){z(r,e,!0)}});var o=U(i,2);W(()=>o.disabled=n()),K(`click`,o,()=>ya.open=!1),J(e,t)};X(T,e=>{t.target||e(E)});var D=U(T,2),O=e=>{var t=zc(),n=H(t,!0);W(()=>Y(n,G(p)||`Opening the resumed session…`)),J(e,t)};X(D,e=>{(G(f)||G(p))&&e(O)});var k=U(D,2),ee=e=>{J(e,Bc())};X(k,e=>{G(b).length&&!t.target&&e(ee)});var te=U(k,2);Z(te,17,()=>G(b),e=>e.id,(e,r)=>{var i=Kc(),a=V(i),o=e=>{var t=Vc(),n=B(t),i=H(n),a=H(U(n,2),!0);F(t),W((e,n)=>{t.disabled=G(y),Q(t,`aria-expanded`,G(c)===G(r).id),Y(i,`${e??``} // ${(G(r).name||G(r).directory)??``}`),Y(a,n)},[()=>G(r).id.slice(-5).toUpperCase(),()=>S(G(r).updatedAt,G(h))]),K(`click`,t,()=>{z(m,null),G(c)===G(r).id?(_?.abort(),z(c,``),z(u,!1),z(d,!1)):x(G(r).cursor,G(r).id)}),J(e,t)};X(a,e=>{t.target||e(o)});var s=U(a,2),f=e=>{var i=Gc(),a=V(i);Lc(B(a),{get turns(){return G(l)}}),F(a);var o=U(a,2),s=e=>{var t=Wc(),i=U(V(t),2),a=e=>{var t=Hc(),i=B(t),a=H(i),o=U(i,2),s=U(o,2);F(t),W(()=>{Y(a,`Resume ${(G(r).name||G(r).directory||G(r).id)??``}?`),o.disabled=n()}),K(`click`,o,()=>void C(G(r))),K(`click`,s,()=>z(m,null)),J(e,t)},o=e=>{var t=Uc();W(()=>t.disabled=G(y)),K(`click`,t,()=>void C(G(r))),J(e,t)};X(i,e=>{G(m)?.id===G(r).id?e(a):e(o,-1)}),J(e,t)};X(o,e=>{$.data?.control&&e(s)}),W(()=>a.inert=!!t.target&&n()),J(e,i)};X(s,e=>{G(c)===G(r).id&&G(l)&&e(f)}),J(e,i)});var A=U(te,2),ne=e=>{J(e,qc())},j=e=>{var t=zc(),n=H(t,!0);W(()=>Y(n,G(s)?`Could not load older sessions. Try again.`:`Saved history unavailable. Live filtering still works.`)),J(e,t)},re=e=>{var t=Jc(),n=H(t,!0);W(e=>Y(n,e),[()=>G(r).trim()?`No saved session names match this search.`:`No saved sessions to show.`]),J(e,t)};X(A,e=>{G(u)?e(ne):G(d)?e(j,1):!G(b).length&&!G(s)&&e(re,2)});var ie=U(A,2),ae=e=>{var t=Yc(),n=H(t,!0);W(e=>{t.disabled=G(u)||G(y),Y(n,e)},[()=>G(r).trim()?`Search older sessions`:`Load more saved sessions`]),K(`click`,t,()=>x(G(s))),J(e,t)};X(ie,e=>{G(s)&&e(ae)}),F(w),J(e,w),Ue()}Cr([`click`]);var Qc=q(`

        Start a new Codex session and send this message?

        `,1),$c=q(` `,1),el=q(``),tl=q(`

        `),nl=q(`

        NEW SESSION

        `);function rl(e,t){He(t,!0);let n=R(``),r=R(``),i=R(void 0),a=R(!1),o=R(!1),s=R(``),c=R(``),l=R(``),u=R(!1),d,f=I(()=>$.connected&&$.data?.control&&!$.data.sessionsError&&$.data.savedScope===t.scope),p=I(()=>G(a)||!!G(l)||!!G(c)||G(o)),m=I(()=>!!G(l)&&G(f)&&t.liveIDs.has(G(l)));Ki(()=>(G(i)?.focus(),()=>clearTimeout(d))),_n(()=>{ya.open||ur().then(()=>G(i)?.focus())}),_n(()=>{G(m)&&!G(u)&&h()});function h(){location.hash=`/sessions/`+encodeURIComponent(G(l)),t.onclose()}async function g(){if(!G(f)||!Ea||G(a)||G(l)||G(o))return;let e=G(r).trim();if(/^\/resume(?:\s|$)/i.test(e)){ba(e.slice(7));return}if(!e||e.startsWith(`/`)&&!e.startsWith(`//`)){z(s,`Type a first message, or use /resume to open a saved session.`);return}if(!G(n)){z(s,`Enter an absolute working directory on the Codex machine.`);return}let i=xo($.data?.confirmationMode,!0)&&!G(c),p=G(c);z(a,!0),z(s,``);try{let e=await Ea(t.scope,G(n),G(r),i?{mode:`prepare`}:p?{confirmation:p}:void 0);if(i&&e.confirmation)z(c,e.confirmation,!0);else if(e.id)z(u,e.firstMessageRejected===!0),z(l,e.id,!0),G(u)?z(s,`Session created, but Codex rejected the first message. Copy your draft before opening the session to try again.`):(z(s,`Opening the new session…`),d=setTimeout(()=>{z(s,`First message sent; still waiting for the session to appear.`)},15e3));else throw Error(`Could not verify the new session. Check Codex.`)}catch(e){z(o,!i&&!(e instanceof _a),!0),z(s,G(o)?`Could not verify the new session. Check Codex before trying again.`:e instanceof Error?e.message:`Could not start the new session.`,!0)}finally{z(a,!1),i||z(c,``)}}var _=nl(),v=B(_),y=U(B(v),2);F(v);var b=U(v,2),x=U(B(b));Si(x),F(b);var S=U(b,2),C=U(B(S));et(C),Q(C,`maxlength`,4096),Li(C,e=>z(i,e),()=>G(i)),F(S);var w=U(S,2),T=e=>{var t=Qc(),n=U(V(t),2),r=U(n,2);W(()=>{n.disabled=G(a)||!G(f),r.disabled=G(a)}),K(`click`,n,()=>void g()),K(`click`,r,()=>z(c,``)),J(e,t)},E=e=>{var t=$c(),n=V(t),r=U(n,2);W(()=>{n.disabled=G(p)||!G(f),r.disabled=G(p)||!G(f)}),K(`click`,n,()=>void g()),K(`click`,r,()=>ba()),J(e,t)};X(w,e=>{G(c)?e(T):e(E,-1)});var D=U(w,2),O=e=>{var t=el();K(`click`,t,h),J(e,t)};X(D,e=>{G(u)&&G(m)&&e(O)});var k=U(D,2),ee=e=>{var t=tl(),n=H(t,!0);W(()=>Y(n,G(s))),J(e,t)};X(k,e=>{G(s)&&e(ee)}),F(_),W(()=>{Q(_,`hidden`,ya.open),y.disabled=G(a),x.readOnly=G(p),C.readOnly=G(p)}),K(`click`,y,function(...e){t.onclose?.apply(this,e)}),Di(x,()=>G(n),e=>z(n,e)),K(`keydown`,C,e=>{G(p)||(e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),e.repeat||g()),e.key===`Escape`&&!G(p)&&t.onclose())}),Di(C,()=>G(r),e=>z(r,e)),J(e,_),Ue()}Cr([`click`,`keydown`]);var il=q(``),al=q(`

        Loading…

        `),ol=q(`

        Session information unavailable.

        `),sl=q(`

        `,1),cl=q(`

        No background terminals reported.

        `),ll=q(`

        Additional background terminals are not shown.

        `),ul=q(` `,1),dl=q(``),fl=q(`

        No linked agents observed.

        `),pl=q(`

        `);function ml(e,t){He(t,!0);let n=R(Jt({})),r=R(``),i=R(!1),a=R(!1),o,s=R(void 0);async function c(e){o?.abort();let s=new AbortController;o=s,z(r,e,!0),z(n,{},!0),z(a,!1),z(i,!0);try{if(!Ta)throw Error();let r=await Ta(t.root,e,t.kind,s.signal);s.signal.aborted||z(n,r,!0)}catch{s.signal.aborted||z(a,!0)}finally{s.signal.aborted||z(i,!1)}}Ki(()=>(G(s)?.focus(),c(``),()=>o?.abort()));var l=pl(),u=B(l),d=B(u),f=H(d),p=U(d,2),m=e=>{var t=il();W(()=>t.disabled=G(i)),K(`click`,t,()=>void c(``)),J(e,t)};X(p,e=>{t.kind===`terminals`&&e(m)});var h=U(p,2),g=H(h,!0);Li(h,e=>z(s,e),()=>G(s)),F(u);var _=U(u,2),v=e=>{J(e,al())},y=e=>{J(e,ol())},b=e=>{var t=ul(),r=V(t);Z(r,17,()=>G(n).terminals||[],qr,(e,t)=>{var n=sl(),r=V(n),i=H(r),a=U(r,2),o=H(B(a),!0);F(a),W(()=>{Y(i,`${G(t).id??``}${G(t).pid?` // PID ${G(t).pid}`:``}${G(t).directory?` // ${G(t).directory}`:``}`),Y(o,G(t).command)}),J(e,n)},e=>{J(e,cl())});var i=U(r,2),a=e=>{J(e,ll())};X(i,e=>{G(n).more&&e(a)}),J(e,t)},x=e=>{Lc(e,{get turns(){return G(n).turns},get unverified(){return G(n).unverifiedTurns}})},S=e=>{var t=Pr();Z(V(t),17,()=>G(n).agents||[],e=>e.id,(e,t)=>{var n=dl(),r=H(n);W(e=>Y(r,`${e??``} // ${G(t).status??``}`),[()=>G(t).name||G(t).id.slice(-5)]),K(`click`,n,()=>void c(G(t).id)),J(e,n)},e=>{J(e,fl())}),J(e,t)};X(_,e=>{G(i)?e(v):G(a)?e(y,1):t.kind===`terminals`?e(b,2):G(r)?e(x,3):e(S,-1)}),F(l),W(e=>{Q(l,`aria-label`,t.kind===`terminals`?`Background terminals`:`Linked agents`),Y(f,`${t.kind===`terminals`?`Background terminals`:G(r)?`Agent transcript`:`Linked agents`} // ${e??``}`),Y(g,G(r)?`Back to agents`:`Close`)},[()=>t.root.slice(-5)]),K(`click`,h,()=>G(r)?void c(``):wa.root=``),J(e,l),Ue()}Cr([`click`]);var hl=q(`

        Loading…

        `),gl=q(`

        Session unavailable here.

        `),_l=q(``),vl=q(`

        `);function yl(e,t){He(t,!0);let n=I(()=>xa.ids.at(-1)),r=R(void 0),i=R(void 0),a=R(void 0),o=R(void 0),s=R(!1),c=R(!1),l=R(!1),u,d=``,f=new Map;function p(){G(l)||(xa.ids=xa.ids.slice(0,-1))}function m(){G(o)&&(location.hash=`/sessions/`+encodeURIComponent(G(o).root.id),xa.ids=[])}_n(()=>{let e=G(n),p=G(r),m=xa.scope,h=t.scope;if(p){if(e&&m!==h)xa.ids=[];else if(!e)p.open&&p.close(),z(l,!1),u?.focus({preventScroll:!0}),u=void 0,f.clear(),d=``;else return p.open||(document.activeElement instanceof HTMLElement&&(u=document.activeElement),p.showModal()),pr(()=>{d&&G(i)&&f.set(d,G(i).scrollTop),d=e,z(c,!1),z(l,!1),z(o,void 0),z(s,!0),G(a)?.focus({preventScroll:!0});let n=new AbortController;return(async()=>{try{let r=await Ca?.(m,e,n.signal);n.signal.aborted||(z(c,!!r&&!r.agent&&!t.liveIDs.has(r.root.id)&&!!$.data?.control,!0),z(o,r,!0))}catch{}finally{n.signal.aborted||z(s,!1)}await ur(),!n.signal.aborted&&G(i)&&(G(i).scrollTop=f.get(e)||0)})(),()=>n.abort()})}}),qi(()=>{xa.ids=[]});var h=vl(),g=B(h),_=B(g),v=H(_),y=U(_,2);Li(y,e=>z(a,e),()=>G(a)),F(g);var b=U(g,2),x=B(b),S=e=>{J(e,hl())},C=e=>{J(e,gl())},w=e=>{{let n=I(()=>({row:G(o).root,turns:G(o).turns}));Zc(e,{get scope(){return t.scope},get liveIDs(){return t.liveIDs},get target(){return G(n)},get resumeBusy(){return G(l)},set resumeBusy(e){z(l,e,!0)}})}},T=e=>{Lc(e,{get turns(){return G(o).turns},get unverified(){return G(o).unverifiedTurns}})};X(x,e=>{G(s)?e(S):G(o)?G(c)?e(w,2):e(T,-1):e(C,1)}),F(b),Li(b,e=>z(i,e),()=>G(i));var E=U(b,2),D=e=>{var t=_l();K(`click`,t,m),J(e,t)},O=I(()=>G(o)&&!G(o).agent&&!G(c)&&t.liveIDs.has(G(o).root.id));X(E,e=>{G(O)&&e(D)}),F(h),Li(h,e=>z(r,e),()=>G(r)),W(e=>{Y(v,`${G(o)?.agent?`Agent transcript`:`Session preview`}${e??``}`),y.disabled=G(l)},[()=>G(o)?` // ${G(o).agent?.name||(G(o).agent?G(o).agent.id.slice(-5):G(o).root.name||G(o).root.id.slice(-5))}`:``]),Sr(`cancel`,h,e=>{e.preventDefault(),p()}),K(`keydown`,h,e=>e.stopPropagation()),K(`click`,y,p),J(e,h),Ue()}Cr([`keydown`,`click`]);function bl(e,t){let n=e.trim().toLowerCase();return!n||[t.id,t.name,t.directory].some(e=>e?.toLowerCase().includes(n))}var xl=q(`

        `),Sl=q(`

         
        `,1),Cl=q(`

        LATEST GUIDANCE

         
        `,1),wl=q(`

        CONTEXT

         

        `,1),Tl=q(`

        `),El=q(`

        `),Dl=q(`
         
        `),Ol=q(`

         
        `,1),kl=q(`
         
        `),Al=q(`

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

        `),jl=q(`

        `,1),Ml=q(` `,1),Nl=q(`

        `),Pl=q(``),Fl=q(``),Il=q(`
        `),Ll=q(`
        `),Rl=q(`

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

        `),zl=q(`

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

        `),Bl=q(` `),Vl=q(` `),Hl=q(` `),Ul=q(``),Wl=q(`

        Read only — reply or approve in Codex.

        `),Gl=q(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Kl=q(`
        `),ql=q(` `,1),Jl=q(`
        `),Yl=q(`

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

        `),Xl=q(`

        No live sessions match the filter.

        `),Zl=q(`

        `),Ql=q(``),$l=q(``),eu=q(`

        `),tu=q(` `),nu=q(`

        `),ru=q(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),iu=q(`

        `),au=q(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),ou=q(`

        TOKENS

        FULL DETAIL →
        `),su=q(`

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

        `),cu=q(`

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

        `,1),lu=q(`

        SESSION TOTALS

        `,1);function uu(e,t){He(t,!0);let n=(e,t=f,n,r)=>{let i=ft(()=>g(n?.(),!0)),a=ft(()=>g(r?.(),!1));var o=Ml(),s=V(o),c=e=>{var n=xl(),r=H(n);W(()=>Y(r,`DEFAULT REVIEW // ${t().reviewer===`auto_review`?`AUTO`:`HUMAN`}`)),J(e,n)};X(s,e=>{(t().reviewer===`user`||t().reviewer===`auto_review`)&&e(c)});var l=U(s,2),u=e=>{var n=Sl(),r=V(n),i=H(r,!0),a=H(U(r,2),!0);W(()=>{Y(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),Y(a,t().currentTask)}),J(e,n)};X(l,e=>{t().currentTask&&e(u)});var d=U(l,2),p=e=>{var n=Cl(),r=H(U(V(n),2),!0);W(()=>Y(r,t().latestGuidance)),J(e,n)};X(d,e=>{t().latestGuidance&&e(p)});var m=U(d,2),h=e=>{var n=wl(),r=H(U(V(n),2),!0);be(2),W(()=>Y(r,t().approvalContext)),J(e,n)};X(m,e=>{G(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(h)});var _=U(m,2),v=e=>{var n=Tl();let r;var i=H(n,!0);W(e=>{r=li(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),Y(i,e)},[()=>ve(t())]),J(e,n)},y=I(()=>ve(t())&&(!G(a)||G(E)||t().status===`CHECK SESSION`||D(t())));X(_,e=>{G(y)&&e(v)});var b=U(_,2),x=e=>{var n=El(),r=H(n,!0);W(e=>Y(r,e),[()=>N(t())]),J(e,n)};X(b,e=>{G(i)&&e(x)});var S=U(b,2),C=e=>{fs(e,{get review(){return t().approvalReview}})},w=e=>{ls(e,{get details(){return t().mcpTool}})},T=e=>{var n=Pr(),r=V(n),i=e=>{xc(e,{get blocks(){return t().prose}})},a=e=>{var n=Dl(),r=H(n,!0);W(()=>Y(r,t().text||`No session context available.`)),J(e,n)};X(r,e=>{t().prose?.length?e(i):e(a,-1)}),J(e,n)};X(S,e=>{t().approvalReview&&(!G(a)||!$.data?.control)?e(C):t().mcpTool&&(!G(a)||!$.data?.control)?e(w,1):t().approvalReview||!t().text&&t().workingCommand||e(T,2)});var O=U(S,2),k=e=>{var n=Ol(),r=U(V(n),2),i=B(r),a=U(i),o=e=>{var n=Nr();W(()=>Y(n,`// ${t().commandTiming??``}`)),J(e,n)};X(a,e=>{t().commandTiming&&e(o)});var s=U(a,2),c=e=>{var n=Nr();W(()=>Y(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),J(e,n)};X(s,e=>{!G(E)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(c)});var l=U(s,2),u=e=>{J(e,Nr(`+`))};X(l,e=>{t().runningLimited&&e(u)}),F(r);var d=H(U(r,2),!0);W(e=>{Y(i,`COMMAND // ${e??``} `),Y(d,t().workingCommand)},[()=>G(E)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),J(e,n)};X(O,e=>{t().workingCommand&&e(k)});var ee=U(O,2),te=e=>{is(e,{get lines(){return t().fileChanges}})},A=e=>{var n=jl(),r=U(V(n),2),i=H(r,!0),a=U(r,2),o=e=>{var n=kl(),r=H(n,!0);W(()=>Y(r,t().command)),J(e,n)},s=e=>{J(e,Al())};X(a,e=>{t().command?e(o):e(s,-1)}),W(()=>Y(i,G(E)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),J(e,n)};X(ee,e=>{(!G(a)||!$.data?.control)&&t().fileChanges?.length?e(te):G(a)&&$.data?.control||t().mcpTool||t().approvalReview||!t().command&&t().status!==`APPROVAL NEEDED`||e(A,1)});var ne=U(ee,2),j=e=>{_s(e,{get assessment(){return t().autoReview},get full(){return G(a)}})};X(ne,e=>{t().autoReview&&!(G(a)&&$.data?.control&&t().command&&t().autoReview.attached)&&e(j)});var re=U(ne,2),ie=e=>{var n=xl(),r=H(n);W(()=>Y(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),J(e,n)};X(re,e=>{G(a)||e(ie)}),J(e,o)},r=R(void 0),i=Gi(t,`params`,19,()=>({})),a=I(()=>$.data?.sessions||[]),o=R(``),s=R(``),c=R(void 0),l=I(()=>$.connected&&!$.data?.sessionsError&&$.data?.savedScope||``),u=R(``);_n(()=>{i().id&&z(u,``)});let d=``;_n(()=>{ya.open?!G(l)||d&&d!==G(l)?ya.open=!1:d=G(l):d=``});let p=I(()=>new Set(G(a).map(e=>e.id))),m=I(()=>G(a).filter(e=>bl(G(o),e)&&(!G(s)||e.status===G(s)))),h=I(()=>$.data?.control&&$.data.profiles||[]),v=I(()=>($.data?.triggers||[]).filter(e=>G(a).some(t=>t.id===e.session)));function y(e,t){i().id&&i().id!==t&&G(x)?e.preventDefault():he(t)}function b(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&G(v).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let x=R(!1);function S(e,t){i().id&&i().id!==t&&G(x)?e.preventDefault():he(t)}_n(()=>{let e=i().id;e&&pr(()=>{oa.selected=e,pa(e,2)})});let C=I(()=>G(a).find(e=>e.id===i().id)),w=I(()=>new URLSearchParams(Xi.querystring).get(`review`)===`profile`&&G(h).some(e=>e.session===i().id&&e.pending)),T=I(()=>G(m).some(e=>e.id===oa.selected)?oa.selected:G(m)[0]?.id),E=I(()=>!$.connected||!!$.data?.sessionsError);function D(e){return e.status!==`STALE`&&e.failed===!0}let O=I(()=>[[`OBSERVED TOKENS`,ma(G(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,ma(G(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`ERRORS`,`ERRORS`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,G(E)?`—`:ma(G(a).filter(e=>t===`ERRORS`?D(e):e.status===t).length)])]),k=I(()=>G(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`].includes(e.status)||D(e)).sort((e,t)=>ee(e)-ee(t)));function ee(e){return e.status===`APPROVAL NEEDED`?0:e.status===`INPUT NEEDED`?1:2}let te=I(()=>G(a).filter(e=>e.status===`TURN COMPLETE`&&(!e.readStateKnown||e.unread)&&!G(v).some(t=>t.session===e.id)&&!G(h).some(t=>t.session===e.id&&t.pending))),A=R(``),ne=new Set,j=0,re=R(void 0);function ie(e){return $.data?.control&&!xa.ids.length&&!G(E)&&e.unread&&e.readRevision&&e.replyTurn&&!e.streaming&&e.contextKind===`LAST REPLY`&&!!e.text&&!G(w)&&!G(h).some(t=>t.session===e.id&&t.pending)}function ae(e){let t=document.getElementById(`content`),n=t?.getBoundingClientRect(),r=n?n.left+t.clientLeft:0,i=n?n.top+t.clientTop:0,a=r+(t?.clientWidth||0),o=i+(t?.clientHeight||0);return Array.from(document.querySelectorAll(`[data-result-session]`)).some(n=>{let s=n.querySelector(`[data-reply-text]`);if(!s)return!1;let c=s.getBoundingClientRect();return t?.contains(n)&&n.dataset.resultSession===e.id&&n.dataset.resultTurn===e.replyTurn&&!n.closest(`[inert], [hidden]`)&&document.visibilityState===`visible`&&c.leftMath.max(0,r)&&c.topMath.max(0,i)&&c.width>0&&c.height>0})}function oe(){G(re)&&clearTimeout(G(re).timer),z(re,void 0)}function se(e){return!i().id&&G(T)===e.id&&da(e.id)===2&&ie(e)}function ce(){if(!G(re))return;let e=G(a).find(e=>e.id===G(re).id);e&&se(e)&&e.replyTurn===G(re).turn&&e.readRevision===G(re).revision&&ae(e)||oe()}function le(e){if(ce(),!se(e)||!ae(e)||G(re))return;let t=e.id,n=e.replyTurn,r=e.readRevision,i=++j;z(re,{sequence:i,id:t,turn:n,revision:r,timer:setTimeout(()=>{if(ce(),!G(re)||G(re).sequence!==i||G(re).id!==t||G(re).turn!==n||G(re).revision!==r)return;let e=G(a).find(e=>e.id===t);oe(),e&&ue(e)},3e3)},!0)}_n(()=>{ce()}),Ki(()=>(document.addEventListener(`scroll`,ce,!0),document.addEventListener(`visibilitychange`,ce),window.addEventListener(`resize`,ce),()=>{oe(),document.removeEventListener(`scroll`,ce,!0),document.removeEventListener(`visibilitychange`,ce),window.removeEventListener(`resize`,ce)}));async function ue(e){if(!ie(e))return;let t=e.id,n=e.readRevision,r=e.replyTurn,i=JSON.stringify([t,n,r]);if(!ne.has(i)){ne.add(i);try{await ur();let e=G(a).find(e=>e.id===t);if(!e||!ie(e)||!ae(e)||e.readRevision!==n||e.replyTurn!==r)return;await ka(`read`,{session:t,read:{turn:r,revision:n}}),z(A,``)}catch{z(A,`Result changed or could not be marked read. Open it again to retry.`)}finally{ne.delete(i)}}}function de(e){i().id===e.id?ue(e):le(e)}function fe(e){if(oe(),he(e,!1),i().id===e){let t=G(a).find(t=>t.id===e);t&&ue(t)}}let pe=R(Jt(pr(()=>i().id||``))),me=R(``);_n(()=>{let e=i().id||``;e!==G(pe)&&(z(pe,e,!0),z(me,e,!0))}),_n(()=>{if(G(me)&&G(C)?.id===G(me)){let e=G(C);z(me,``),pr(()=>{ue(e)})}});function he(e,t=!0){let n=G(a).find(t=>t.id===e);n&&!bl(G(o),n)&&z(o,``),n&&G(s)&&n.status!==G(s)&&z(s,``),e!==G(T)&&oe(),oa.selected=e,ur().then(()=>{document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`});let n=G(a).find(t=>t.id===e);t&&n&&le(n)})}function ge(e,t){if(he(e),i().id){t<0&&(pa(e,2),location.hash=`/sessions`);return}let n=da(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):pa(e,n)}function _e(){oe(),i().id||fa(G(m).map(e=>e.id))}function M(e){let t=e.target;if(!(G(u)||xa.ids.length||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key.toLowerCase()===`f`&&!i().id)e.preventDefault(),G(c)?.focus();else if(!t.closest(`section[aria-label="Saved sessions"], [data-session-inspector]`)){if(e.key.toLowerCase()===`y`&&!i().id)e.preventDefault(),e.repeat||_e();else if(e.key===`Escape`&&i().id)e.preventDefault(),ge(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||G(T)))e.preventDefault(),ge(i().id||G(T),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&G(m).length){e.preventDefault();let t=G(m).findIndex(e=>e.id===G(T));he(G(m)[Math.max(0,Math.min(G(m).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}}function ve(e){return G(E)?`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.`:D(e)&&e.status.endsWith(` SPEND CAP`)?`CONFIRMED TURN FAILURE — check the reported API spend cap. This is separate from ChatGPT subscription quota. No automatic retry.`:D(e)?e.status===`MODEL BUSY`?`CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry when ready. This is not a quota-exhaustion signal.`:e.status===`MODEL UNAVAILABLE`?`CONFIRMED TURN FAILURE — the provider could not find the selected model. Choose an available model with /model. No automatic retry or model change.`:e.status===`CAPACITY RESTRICTED`?`CONFIRMED TURN FAILURE — capacity is unavailable on a policy-restricted route. Inspect the error before changing settings or retrying. This is not a quota-exhaustion signal; no automatic retry or policy change.`:`CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.`:$.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.`:``}function N(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var P=lu();Sr(`keydown`,Zt,M);var ye=V(P);yl(ye,{get scope(){return G(l)},get liveIDs(){return G(p)}});var xe=U(ye,2),Se=e=>{var t=Nl(),n=H(t,!0);W(()=>Y(n,G(A))),J(e,t)};X(xe,e=>{G(A)&&e(Se)});var Ce=U(xe,2),we=U(B(Ce),2),Te=e=>{var t=Il(),n=B(t);Mc(n,{label:`Filter sessions`,placeholder:`Filter sessions (F)`,onkeydown:e=>{e.key===`Escape`&&(e.preventDefault(),z(o,``),G(c)?.blur()),(e.key===`Enter`||e.key===`ArrowDown`)&&(e.preventDefault(),G(m)[0]&&(he(G(m)[0].id,!1),document.querySelector(`.session-row button,.session-row a`)?.focus()))},get field(){return G(c)},set field(e){z(c,e,!0)},get value(){return G(o)},set value(e){z(o,e,!0)}});var r=U(n,2),i=B(r);i.value=i.__value=``,Z(U(i),17,()=>[...new Set([...G(a).map(e=>e.status),...G(s)?[G(s)]:[]])].sort(),qr,(e,t)=>{var n=Pl(),r=H(n,!0),i={};W(()=>{Y(r,G(t)),i!==(i=G(t))&&(n.value=(n.__value=i)??``)}),J(e,n)}),F(r),hi(r);var d=U(r,2),f=U(d,2),p=e=>{var t=Fl();K(`click`,t,()=>{ya.open=!1,z(u,G(l),!0)}),J(e,t)};X(f,e=>{$.data?.control&&G(l)&&e(p)}),F(t),W(()=>{d.disabled=!G(l),Q(d,`aria-expanded`,ya.open&&!!G(l))}),gi(r,()=>G(s),e=>z(s,e)),K(`click`,d,()=>ya.open=!ya.open),J(e,t)};X(we,e=>{!i().id&&!G(u)&&e(Te)});var Ee=H(U(we,2));F(Ce);var De=U(Ce,2);let Oe;Z(De,21,()=>G(O),qr,(e,t)=>{var n=I(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=Ll();let o;var s=B(a),c=H(s,!0),l=H(U(s,2),!0);F(a),W(()=>{o=li(a,1,`svelte-mm4wfe`,null,o,{failed:r()===`ERRORS`&&i()!==`0`&&i()!==`—`}),Y(c,r()),Y(l,i())}),J(e,a)}),F(De);var ke=U(De,2),Ae=e=>{var t=Pr();Kr(V(t),()=>wa.root+`:`+wa.kind,e=>{ml(e,{get root(){return wa.root},get kind(){return wa.kind}})}),J(e,t)},je=I(()=>wa.root&&(!i().id||i().id===wa.root)&&G(a).some(e=>e.id===wa.root));X(ke,e=>{G(je)&&e(Ae)});var Me=U(ke,2),Ne=H(Me),Pe=U(Me,2),Fe=e=>{J(e,Rl())};X(Pe,e=>{G(E)&&e(Fe)});var Ie=U(Pe,2),Le=e=>{J(e,zl())};X(Ie,e=>{$.data?.profileError&&e(Le)});var Re=U(Ie,2),ze=e=>{var t=Ul(),n=B(t);Z(n,17,()=>G(k),qr,(e,t)=>{var n=Bl();let r;var i=H(n);W((e,a,o)=>{r=li(n,1,`button`,null,r,{approval:e}),Q(n,`href`,a),Y(i,`${G(t).status??``} + ${o??``} // ${(G(t).name||G(t).directory||G(t).id)??``}`)},[()=>G(t).status===`APPROVAL NEEDED`||G(t).status===`INPUT NEEDED`||D(G(t)),()=>`#/sessions/`+encodeURIComponent(G(t).id),()=>Array.from(G(t).id).slice(-5).join(``).toUpperCase()]),K(`click`,n,()=>he(G(t).id)),J(e,n)});var r=U(n,2);Z(r,17,()=>G(h).filter(e=>e.pending&&G(a).some(t=>t.id===e.session)),qr,(e,t)=>{var n=Vl(),r=H(n);W((e,a,o)=>{Q(n,`title`,i().id&&i().id!==G(t).session&&G(x)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),Y(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session)+`?review=profile`,()=>Array.from(G(t).session).slice(-5).join(``).toUpperCase(),()=>G(a).find(e=>e.id===G(t).session)?.name||G(a).find(e=>e.id===G(t).session)?.directory||G(t).session]),K(`click`,n,e=>S(e,G(t).session)),J(e,n)});var o=U(r,2);Z(o,17,()=>G(te),qr,(e,t)=>{var n=Hl(),r=H(n);W((e,i)=>{Q(n,`href`,e),Y(r,`TURN COMPLETE ${i??``} // + ${(G(t).name||G(t).directory||G(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id),()=>Array.from(G(t).id).slice(-5).join(``).toUpperCase()]),K(`click`,n,()=>he(G(t).id)),J(e,n)}),Z(U(o,2),17,()=>G(v),qr,(e,t)=>{var n=Hl(),r=H(n);W((e,t,i)=>{Q(n,`href`,e),Y(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session),()=>Array.from(G(t).session).slice(-5).join(``).toUpperCase(),()=>G(a).find(e=>e.id===G(t).session)?.name||G(a).find(e=>e.id===G(t).session)?.directory]),K(`click`,n,e=>y(e,G(t).session)),J(e,n)}),F(t),J(e,t)},Be=I(()=>(G(k).length||G(te).length||G(h).some(e=>e.pending)||G(v).length)&&!G(E));X(Re,e=>{G(Be)&&e(ze)});var Ve=U(Re,2),We=e=>{var t=Pr(),a=V(t),o=e=>{var t=Jl(),a=B(t),o=B(a);let s;var c=B(o);let l;var u=U(c);F(o);var d=U(o,2);F(a);var f=U(a,2),p=e=>{var t=xl(),n=H(t,!0);W(()=>Y(n,G(C).directory)),J(e,t)};X(f,e=>{G(C).name&&G(C).directory&&e(p)});var m=U(f,2),g=H(m),_=U(m,2);let v;var y=B(_),S=B(y);n(S,()=>G(C),()=>!0,()=>!0),F(y);var T=U(y,2),O=e=>{var t=Pr();Kr(V(t),()=>G(C).id,e=>{{let t=I(()=>new URLSearchParams(Xi.querystring).get(`schedule`)===`edit`),n=I(()=>G(C).approvalReview??void 0),i=I(()=>G(C).command&&G(C).autoReview?.attached?G(C).autoReview:void 0),a=I(()=>G(C).fileChanges||[]);ic(e,{get session(){return G(C).id},oncopy:()=>G(r)?.copy(),get openScheduler(){return G(t)},get observedCommand(){return G(C).command},get observedAction(){return G(n)},get observedReview(){return G(i)},get observedFileChanges(){return G(a)},get suspended(){return G(w)},onProtectedChange:e=>{z(x,e,!0)}})}}),J(e,t)},k=e=>{var t=Wl();Kr(U(B(t),2),()=>G(C).id,e=>{es(e,{get session(){return G(C).id},localOnly:!0,oncopy:()=>G(r)?.copy()})}),F(t),J(e,t)};X(T,e=>{$.data?.control?e(O):e(k,-1)}),F(_);var ee=U(_,2);Z(ee,17,()=>G(h).filter(e=>e.session===G(C).id),e=>e.session,(e,t)=>{var n=Kl(),r=B(n),i=e=>{var n=Nl(),r=H(n,!0);W(()=>Y(r,G(t).notice)),J(e,n)};X(r,e=>{G(t).notice&&e(i)});var a=U(r,2),o=e=>{ic(e,{get session(){return G(C).id},review:`profile`})},s=e=>{var t=Gl();W(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(C).id)+`?review=profile`]),J(e,t)};X(a,e=>{G(t).pending&&G(w)?e(o):G(t).pending&&e(s,1)}),F(n),W(()=>Q(n,`id`,`quota-profile-`+G(C).id)),J(e,n)});var te=U(ee,2),A=e=>{var t=Pr();Kr(V(t),()=>G(C).id,e=>{Oc(e,{get session(){return G(C)},get stale(){return G(E)},children:e=>{var t=Pr(),n=V(t),i=e=>{Li(Ac(e,{get session(){return G(C)},active:!0,compact:!0}),e=>z(r,e,!0),()=>G(r))};X(n,e=>{G(w)||e(i)}),J(e,t)},$$slots:{default:!0}})}),J(e,t)},ne=e=>{var t=ql(),n=V(t),i=e=>{var t=Pr();Kr(V(t),()=>G(C).id,e=>{Li(Ac(e,{get session(){return G(C)},active:!0}),e=>z(r,e,!0),()=>G(r))}),J(e,t)};X(n,e=>{G(w)||e(i)}),Kr(U(n,2),()=>G(C).id,e=>{Oc(e,{get session(){return G(C)},get stale(){return G(E)}})}),J(e,t)};X(te,e=>{G(C).goal?e(A):e(ne,-1)}),F(t),W((e,t,n,r)=>{s=li(o,1,`svelte-mm4wfe`,null,s,{failed:e,reviewed:G(C).status===`TURN COMPLETE`&&G(C).readStateKnown&&!G(C).unread}),l=li(c,1,`lamp lit svelte-mm4wfe`,null,l,{failed:t,working:G(C).status===`WORKING`&&!G(E)}),Y(u,`${n??``} // ${(G(C).name||G(C).directory)??``}`),Y(g,`${r??``} TOKENS // ${G(C).id??``} // CONTEXT SOURCE // ${(G(C).source||`LOCAL`)??``}`),v=di(_,``,v,{display:G(w)?`none`:void 0}),Q(y,`data-result-session`,G(C).id),Q(y,`data-result-turn`,G(C).replyTurn)},[()=>D(G(C))&&!G(E)&&!G(w),()=>D(G(C))&&!G(E),()=>G(E)?`STALE`:G(w)?`QUOTA THRESHOLD`:b(G(C)),()=>ma(G(C).tokens)]),K(`click`,d,()=>{he(i().id),pa(i().id,2)}),Sr(`wheel`,y,()=>{de(G(C))}),J(e,t)},s=e=>{J(e,Yl())};X(a,e=>{G(C)?e(o):e(s,-1)}),J(e,t)},Ge=e=>{var t=ql(),n=V(t);rl(n,{get scope(){return G(u)},get liveIDs(){return G(p)},onclose:()=>z(u,``)});var r=U(n,2),i=e=>{var t=Pr();Kr(V(t),()=>G(l),e=>{Zc(e,{get scope(){return G(l)},get liveIDs(){return G(p)}})}),J(e,t)};X(r,e=>{G(l)&&ya.open&&e(i)}),J(e,t)},Ke=e=>{var t=cu(),r=V(t),i=H(U(B(r),2));F(r);var o=U(r,2),s=e=>{var t=Pr();Kr(V(t),()=>G(l),e=>{Zc(e,{get scope(){return G(l)},get liveIDs(){return G(p)}})}),J(e,t)};X(o,e=>{G(l)&&ya.open&&e(s)});var c=U(o,2),u=e=>{J(e,Xl())};X(c,e=>{!G(m).length&&G(a).length&&e(u)});var d=U(c,2);Z(d,17,()=>G(m),e=>e.id,(e,t)=>{let r=I(()=>da(G(t).id));var i=ou();let a;var o=B(i),s=B(o),c=e=>{var n=Zl(),r=B(n),i=H(r);F(n),W(e=>{Q(r,`aria-pressed`,G(T)===G(t).id),Y(i,`${e??``} // ${G(t).name??``}`)},[()=>Array.from(G(t).id).slice(-5).join(``).toUpperCase()]),K(`click`,r,()=>he(G(t).id)),J(e,n)};X(s,e=>{G(t).name&&e(c)});var l=U(s,2),u=B(l);let d;var f=B(u);let p;var m=U(f,1,!0);F(u),F(l);var g=U(l,2),_=e=>{var n=Ql(),r=H(n,!0);W(()=>{Q(n,`aria-pressed`,G(T)===G(t).id),Y(r,G(t).directory||G(t).id)}),K(`click`,n,()=>he(G(t).id)),J(e,n)};X(g,e=>{G(t).name||e(_)});var v=U(g,2),y=B(v);be(),F(v);var x=U(v,2),C=e=>{var n=xl(),r=H(n,!0);W(()=>Y(r,G(t).directory)),J(e,n)};X(x,e=>{G(t).name&&G(t).directory&&e(C)});var w=U(x,2),O=e=>{var n=$l(),r=H(n);W(()=>Y(r,`${G(t).agents??``} LINKED AGENTS`)),K(`click`,n,()=>{wa.kind=`agents`,wa.root=G(t).id}),J(e,n)};X(w,e=>{G(t).agents>0&&e(O)});var k=U(w,2),ee=H(k),te=U(k,2);Cc(te,{get goal(){return G(t).goal},get stale(){return G(E)}});var A=U(te,2),ne=B(A),j=U(ne,2),re=H(j,!0),ie=U(j,2);F(A);var ae=U(A,2),oe=U(ae,2),se=e=>{var n=eu(),r=H(n,!0);W(e=>Y(r,e),[()=>G(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:D(G(t))?`OPEN DETAIL FOR THE TURN ERROR`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:G(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`]),J(e,n)},ce=I(()=>!G(E)&&([`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(G(t).status)||D(G(t))));X(oe,e=>{G(ce)&&e(se)}),F(o);var le=U(o,2),ue=e=>{var r=iu(),i=B(r),a=B(i),o=H(a,!0),s=U(a,2),c=e=>{var n=tu(),r=H(n,!0);W(e=>{Q(n,`href`,e),Y(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),J(e,n)};X(s,e=>{!G(E)&&G(t).status===`APPROVAL NEEDED`&&e(c)}),F(i);var l=U(i,2),u=B(l);n(u,()=>G(t),()=>!1),F(l);var d=U(l,2);Z(d,17,()=>G(h).filter(e=>e.session===G(t).id),qr,(e,n)=>{var r=ql(),i=V(r),a=e=>{var t=nu(),r=H(t,!0);W(()=>Y(r,G(n).notice)),J(e,t)};X(i,e=>{G(n).notice&&e(a)});var o=U(i,2),s=e=>{var n=ru();W(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(t).id)+`?review=profile`]),K(`click`,n,e=>S(e,G(t).id)),J(e,n)};X(o,e=>{G(n).pending&&e(s)}),J(e,r)});var f=U(d,2);{let e=I(()=>G(T)===G(t).id);Ac(f,{get session(){return G(t)},get active(){return G(e)}})}F(r),W(e=>{Y(o,e),Q(l,`data-result-session`,G(t).id),Q(l,`data-result-turn`,G(t).replyTurn)},[()=>N(G(t))]),Sr(`wheel`,l,()=>{de(G(t))}),J(e,r)};X(le,e=>{G(r)>0&&e(ue)});var pe=U(le,2),me=e=>{var n=au(),r=U(B(n),2);{let e=I(()=>(G(t).samples||[]).map(e=>e.tokens));bo(r,{get values(){return G(e)},capacity:120})}var i=H(U(r,2));F(n),W(()=>Y(i,`LAST ${(G(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),J(e,n)};X(pe,e=>{G(r)<2&&e(me)}),F(i),W((e,n,o,s,c,l,h)=>{a=li(i,1,`session-row`,null,a,{selected:G(T)===G(t).id,wide:G(r)===2,split:G(r)===1}),Q(i,`aria-label`,`Session `+(G(t).name||G(t).directory||G(t).id)),d=li(u,1,`status-detail svelte-mm4wfe`,null,d,{reviewed:G(t).status===`TURN COMPLETE`&&G(t).readStateKnown&&!G(t).unread,failed:e}),Q(u,`href`,n),p=li(f,1,`lamp lit svelte-mm4wfe`,null,p,{failed:o,working:G(t).status===`WORKING`&&!G(E)}),Y(m,s),Y(y,`${c??``} `),Y(ee,`ACTIVE // ${l??``}`),ne.disabled=G(r)===0,Q(j,`aria-expanded`,G(r)>0),Y(re,G(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ae,`href`,h)},[()=>D(G(t))&&!G(E),()=>`#/sessions/`+encodeURIComponent(G(t).id),()=>D(G(t))&&!G(E),()=>G(E)?`STALE`:b(G(t)),()=>ma(G(t).tokens),()=>ha(G(t).activity),()=>`#/sessions/`+encodeURIComponent(G(t).id)]),K(`click`,u,()=>fe(G(t).id)),K(`click`,ne,()=>ge(G(t).id,-1)),K(`click`,j,()=>{let e=G(r)===0;he(G(t).id),pa(G(t).id,+!!e)}),K(`click`,ie,()=>ge(G(t).id,1)),K(`click`,ae,()=>fe(G(t).id)),J(e,i)});var f=U(d,2),g=e=>{J(e,su())};X(f,e=>{G(a).length||e(g)}),W(()=>i.disabled=!G(m).length),K(`click`,i,_e),J(e,t)};X(Ve,e=>{i().id?e(We):G(u)?e(Ge,1):e(Ke,-1)}),W(e=>{Y(Ee,`OBSERVED ${e??``}`),Oe=li(De,1,`session-totals`,null,Oe,{stale:G(E)}),Y(Ne,`${G(E)?`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.`)},[()=>ha($.data?.sessionsAt)]),J(e,P),Ue()}Cr([`click`]);var du=q(``),fu=q(`

        `),pu=q(`

        Relative usage/credits are not tokens or quota percentages. Groupings + describe the same usage, not additional consumption.

        `,1),mu=q(`// APPROXIMATE`),hu=q(`

        Partial accounting: totals may still change.

        `),gu=q(`

        Percentage of this period's historical allowance, not today's limit. May + exceed 100%. This is not a manual/automatic reset log.

        `,1),_u=q(`

        `,1),vu=q(`

        This optional account report is unavailable. Token history remains + available; missing data does not mean zero usage.

        `),yu=q(`
        `),bu=q(`
        `),xu=q(`

        No usage reported for this day.

        `),Su=q(`

        Selected breakdown unavailable; missing does not mean zero.

        `),Cu=q(`

        `,1);function wu(e,t){He(t,!0);let n=R(Jt(wo[0])),r=R(0),i=I(()=>t.reports?.daily),a=I(()=>t.reports?.plan),o=I(()=>t.mode===`breakdown`?G(i)?.days?.length||0:G(a)?.periods?.length||0),s=I(()=>Math.min(G(r),Math.max(0,G(o)-1))),c=I(()=>G(i)?.days?.[(G(i)?.days?.length||0)-1-G(s)]),l=I(()=>G(a)?.periods?.[G(s)]),u=I(()=>t.mode===`breakdown`?G(i)?.units||``:`%`),d=I(()=>(t.mode===`breakdown`?G(c):G(l))?.views?.[G(n)]),f=I(()=>G(d)?.rows||[]),p=I(()=>G(d)?.total),m=I(()=>G(d)?.level||`unknown`),h=I(()=>G(d)?.peak||1),g=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var _=Cu(),v=V(_),y=B(v),b=U(B(y));Z(b,21,()=>wo,qr,(e,t)=>{var n=du(),r=H(n,!0),i={};W(e=>{Y(r,e),i!==(i=G(t))&&(n.value=(n.__value=i)??``)},[()=>G(t).charAt(0).toUpperCase()+G(t).slice(1)]),J(e,n)}),F(b),hi(b),F(y);var x=U(y,2),S=U(x,2),C=H(U(S,2),!0);F(v);var w=U(v,2),T=B(w),E=H(T,!0),D=U(T,2),O=H(D),k=U(D,2),ee=e=>{var t=pu(),n=V(t),r=H(n),a=U(n,2),o=e=>{var t=fu(),n=H(t);W(()=>Y(n,`Data as of ${G(i).dataAsOf??``}`)),J(e,t)};X(a,e=>{G(i).dataAsOf&&e(o)});var s=H(U(a,2));be(2),W((e,t)=>{Y(r,`Latest fetch ${e??``} // queried ${G(i).from??``} → ${G(i).through??``}. + Reports are fetched from OpenAI and are not saved between runs.`),Y(s,`${(G(c)?.date||`No daily buckets reported`)??``} // ${t??``} + ${G(u)??``}`)},[()=>ha(G(i).fetchedAt),()=>g(G(p))]),J(e,t)},te=e=>{var t=_u(),n=V(t),r=B(n);let i;var o=H(r,!0),s=U(r),c=e=>{J(e,mu())};X(s,e=>{G(a).approximate&&e(c)});var u=U(s);F(n);var d=U(n,2),f=B(d),h=U(f),_=e=>{var t=Nr();W(()=>Y(t,`// Boundary tolerance ${G(a).boundary_tolerance_seconds??``}s`)),J(e,t)};X(h,e=>{G(a).boundary_tolerance_seconds!=null&&e(_)}),F(d);var v=U(d,2),y=e=>{var t=gu(),n=V(t),r=B(n),i=U(r);let a;var o=H(i);F(n);var s=U(n,2),c=H(s),u=U(s,2),d=e=>{J(e,hu())};X(u,e=>{G(l).accounting_complete||e(d)}),be(2),W(e=>{Y(r,`${G(l).window_minutes??``} MIN // ${G(l).plan_type??``} // `),a=li(i,1,`svelte-1fbui7h`,null,a,{muted:G(m)===`unknown`,"quota-near":G(m)===`near`,"quota-full":G(m)===`full`}),Y(o,`USED ${e??``}${G(p)==null?``:`%`}`),Y(c,`${G(l).starts_at??``} → ${G(l).ends_at??``}`)},[()=>g(G(p))]),J(e,t)};X(v,e=>{G(l)&&e(y)}),W(e=>{i=li(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!G(a).coverage_complete}),Y(o,G(a).coverage_complete?`Reported range complete`:`Partial coverage`),Y(u,` // Latest fetch ${e??``}`),Y(f,`Coverage starts ${(G(a).coverage_start||`unknown`)??``} // Data as of ${(G(a).data_as_of||`unknown`)??``}`)},[()=>ha(G(a).fetchedAt)]),J(e,t)},A=e=>{J(e,vu())};X(k,e=>{t.mode===`breakdown`&&G(i)?e(ee):t.mode===`periods`&&G(a)?e(te,1):e(A,-1)});var ne=U(k,2),j=e=>{var n=bu(),r=B(n),i=H(U(B(r),2),!0);F(r),Z(U(r,2),17,()=>G(f),qr,(e,n,r)=>{let i=()=>G(n).name,a=()=>G(n).value;var o=yu();let s;var c=B(o),l=H(c,!0),u=U(c,2),d=B(u);let f;F(u);var p=H(U(u,2));F(o),W((e,n,a)=>{s=li(o,1,`report-row svelte-1fbui7h`,null,s,{unknown:e,alternate:r%2==1}),Q(c,`title`,i()),Y(l,i()),f=di(d,``,f,{width:n}),Y(p,`${a??``}${t.mode===`periods`?`%`:``}`)},[()=>i().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*a()/G(h))}%`,()=>g(a())]),J(e,o)}),F(n),W(()=>Y(i,t.mode===`breakdown`?G(u):`QUOTA USED`)),J(e,n)},re=e=>{J(e,xu())},ie=e=>{J(e,Su())};X(ne,e=>{G(f).length?e(j):t.mode===`breakdown`&&G(d)?.knownEmpty?e(re,1):(G(i)&&t.mode===`breakdown`||G(a)&&t.mode===`periods`)&&e(ie,2)}),F(w),W(()=>{x.disabled=G(s)>=G(o)-1,S.disabled=G(s)===0,Y(C,G(o)?`${G(s)+1} / ${G(o)}`:`NO DATA`),Y(E,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),Y(O,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),gi(b,()=>G(n),e=>z(n,e)),K(`click`,x,()=>z(r,G(s)+1)),K(`click`,S,()=>z(r,G(s)-1)),J(e,_),Ue()}Cr([`click`]);var Tu=864e5;function Eu(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 Du(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Eu(r,-t),a=new Date(i.getTime()+Tu);if(e===n)return{start:a,end:r};r=i}}var Ou=q(``),ku=q(``,1),Au=q(`

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

        `),ju=q(`

        Token history unavailable; other reports may still be available.

        `),Mu=q(``),Nu=q(`
        `),Pu=q(`

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

        `,1),Fu=q(`
        `,1),Iu=q(` `),Lu=q(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        LONGEST TURN

        SECONDS

        LONGEST STREAK

        DAYS

        OPENAI // UTC

        Accessible data table
        Date (UTC)Tokens

        `,1),Ru=q(`

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

        `),zu=q(`

        USAGE // ACCOUNT HISTORY

        Account-wide history reported by Codex, not the local Sessions counter. Dates + use UTC. Allowance history is approximate where indicated; reset causes are + not provided.

        `,1);function Bu(e,t){He(t,!0);let n=R(`daily`),r=R(12),i=R(0);_n(()=>{z(n,t.params?.[1]||`daily`,!0),z(i,0)});let a=I(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Du(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=I(()=>Math.max(1,...G(a).map(e=>e.tokens))),s=I(()=>G(a).length?new Date(G(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=I(()=>{if(G(n)===`monthly`||G(n)===`weekly`){let e=new Map;for(let t of G(a)){let r=new Date(t.date+`T00:00:00Z`);r.setUTCDate(r.getUTCDate()-r.getUTCDay());let i=G(n)===`weekly`?r.toISOString().slice(0,10):t.date.slice(0,7);e.set(i,(e.get(i)||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=zu(),u=U(V(l),4);Z(u,20,()=>[[`daily`,`Daily`],[`weekly`,`Weekly`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],qr,(e,t)=>{var r=I(()=>_(t,2));let a=()=>G(r)[0],o=()=>G(r)[1];var s=Ou();let c;var l=H(s,!0);W(()=>{Q(s,`aria-pressed`,G(n)===a()),c=li(s,1,``,null,c,{active:G(n)===a()}),Y(l,o())}),K(`click`,s,()=>{z(n,a(),!0),z(i,0)}),J(e,s)}),F(u);var d=U(u,2),f=B(d),p=e=>{var t=ku(),n=V(t),a=U(B(n)),o=B(a);o.value=o.__value=6;var s=U(o);s.value=s.__value=12,F(a),hi(a),F(n);var c=U(n),l=U(c);W(()=>l.disabled=G(i)===0),K(`change`,a,()=>z(i,0)),gi(a,()=>G(r),e=>z(r,e)),K(`click`,c,()=>Gt(i)),K(`click`,l,()=>Gt(i,-1)),J(e,t)};X(f,e=>{G(n)!==`breakdown`&&G(n)!==`periods`&&e(p)}),F(d);var m=U(d,2),h=e=>{J(e,Au())};X(m,e=>{$.data?.usageError&&e(h)});var g=U(m,2),v=e=>{J(e,ju())};X(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&G(n)!==`breakdown`&&G(n)!==`periods`&&e(v)});var y=U(g,2),b=e=>{var t=Pr();Kr(V(t),()=>G(n),e=>{{let t=I(()=>$.data?.usage?.reports);wu(e,{get reports(){return G(t)},get mode(){return G(n)}})}}),J(e,t)},x=e=>{var t=Lu(),r=V(t),i=B(r),l=H(U(B(i),2),!0);F(i);var u=U(i,2),d=H(U(B(u),2),!0);F(u);var f=U(u,2),p=U(B(f),2),m=B(p);be(),F(p),F(f);var h=U(f,2),g=U(B(h),2),_=B(g);be(),F(g),F(h);var v=U(h,2),y=U(B(v),2),b=B(y);be(),F(y),F(v),F(r);var x=U(r,4),S=B(x),C=H(S),w=U(S,2),T=e=>{var t=Pu(),n=V(t),r=B(n),i=B(r);Z(i,17,()=>Array(G(s)),qr,(e,t)=>{J(e,Mu())}),Z(U(i,2),17,()=>G(a),qr,(e,t)=>{var n=Nu();let r,i;W(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}: ${ma(G(t).tokens)} tokens`]),J(e,n)}),F(r),F(n),be(2),J(e,t)},E=e=>{var t=Fu(),r=V(t);{let e=I(()=>G(c).map(e=>e.tokens)),t=I(()=>G(n)+` usage`);bo(r,{get values(){return G(e)},get label(){return G(t)}})}var i=U(r,2),a=B(i),o=H(a,!0),s=H(U(a),!0);F(i),W(e=>{Y(o,G(c)[0]?.date),Y(s,e)},[()=>G(c).at(-1)?.date]),J(e,t)};X(w,e=>{G(n)===`daily`?e(T):e(E,-1)});var D=U(w,2),O=U(B(D),2),k=B(O),ee=U(B(k));Z(ee,21,()=>G(n)===`daily`?G(a):G(c),qr,(e,t)=>{var n=Iu(),r=B(n),i=H(r,!0),a=H(U(r),!0);F(n),W(e=>{Y(i,G(t).date),Y(a,e)},[()=>ma(G(t).tokens)]),J(e,n)}),F(ee),F(k),F(O),F(D),F(x);var te=H(U(x,2));W((e,t,n,r,i,o,s)=>{Y(l,e),Y(d,t),Y(m,`${n??``} `),Y(_,`${r??``} `),Y(b,`${i??``} `),Y(C,`${G(a)[0]?.date??``} — ${o??``}`),Y(te,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>ma($.data.usage.summary.lifetimeTokens),()=>ma($.data.usage.summary.peakDailyTokens),()=>ma($.data.usage.summary.currentStreakDays),()=>ma($.data.usage.summary.longestRunningTurnSec),()=>ma($.data.usage.summary.longestStreakDays),()=>G(a).at(-1)?.date,()=>ha($.data.usageAt)]),J(e,t)},S=e=>{J(e,Ru())};X(y,e=>{G(n)===`breakdown`||G(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),J(e,l),Ue()}Cr([`click`,`change`]);var Vu=q(`

        Page not found

        Return to Quota

        `,1);function Hu(e){var t=Vu();be(2),J(e,t)}var Uu=`CODEXOMETER`,Wu=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),Gu=Wu[0].length,Ku=Wu.length,qu=0,Ju=[...Uu].map(e=>{let t=e===`M`?5:3,n={start:qu,width:t};return qu+=t+1,n}),Yu=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Xu=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function Zu(e=Uu,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function td(){let e=Qu[Math.floor(Math.random()*Qu.length)],t=Math.floor(Math.random()*4294967296),n=ed(t),r=[...Uu].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function nd(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Uu.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=ed(e.seed^Math.floor(t/70)),r=[...Uu].map(e=>{let t;do t=Yu[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Uu[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Uu,cursor:-1,dot:!1}}var rd=Mr(``);function id(e,t){He(t,!0);let n=Gi(t,`text`,3,Uu),r=Gi(t,`cursor`,19,()=>-1),i=Gi(t,`dot`,3,!1),a=I(()=>Zu(n(),r(),i()));var o=rd(),s=H(o);W(()=>{Q(o,`viewBox`,`0 0 ${Gu} ${Ku}`),Q(o,`width`,Gu),Q(o,`height`,Ku),Q(s,`d`,G(a))}),J(e,o),Ue()}var ad=q(`
        `),od=q(`
        `);function sd(e,t){He(t,!0);let n=R(void 0),r=R(0),i=R(Jt({width:0,height:0,pixelRatio:1})),a=R(Jt({x:0,y:0,width:0})),o=I(()=>G(n)?nd(G(n),G(r)):void 0),s=I(()=>{if(!G(n))return{x:0,y:0,width:0};let e=$u[G(n).variant],t=Math.min(Math.max((G(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=G(i).width+(G(a).width-G(i).width)*o,c=Math.max((G(i).height-G(i).width*Ku/Gu)/2,0),l=(G(n).variant===`slide`&&G(r)Math.round(e*G(i).pixelRatio)/G(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Ki(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}z(n,td(),!0);let o=$u[G(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();z(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&z(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{z(r,Math.max(e-l,0),!0),G(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=od(),l=B(c),u=e=>{var t=ad();let n;id(B(t),{get text(){return G(o).text},get cursor(){return G(o).cursor},get dot(){return G(o).dot}}),F(t),W(()=>{Q(t,`data-text`,G(o).text),Q(t,`data-cursor`,G(o).dot?G(o).cursor:void 0),n=di(t,``,n,{left:`${G(s).x}px`,top:`${G(s).y}px`,width:`${G(s).width}px`})}),J(e,t)};X(l,e=>{G(o)&&e(u)});var d=U(l,2);F(c),W(()=>Q(c,`data-entrance`,G(n)?.variant)),K(`click`,d,function(...e){t.onfinish?.apply(this,e)}),J(e,c),Ue()}Cr([`click`]);var cd=q(` `),ld=q(`

        `),ud=q(`

        Connecting to your local Codexometer…

        `),dd=q(``),fd=q(`

        Your quota. Your sessions. Your command centre.

        `);function pd(e,t){He(t,!0);let n=/^\/usage(?:\/(daily|weekly|cumulative))?\/?$/,r=new Map([[`/`,_o],[`/quota/:view?`,_o],[`/sessions/:id?`,uu],[n,Bu],[`*`,Hu]]),i={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:n},a=R(`hacker`),o=R(!0),s=R(void 0);_n(()=>{ca.requests&&ur().then(()=>{G(s)?.focus(),G(s)?.scrollIntoView({block:`nearest`})})});let c=R(void 0),l=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];_n(()=>{la()}),_n(()=>{if($.data)for(let[e,t]of Object.entries(i))t.test(Xi.location)&&(oa.tab=e)}),Ki(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&l.includes(e)&&z(a,e,!0)}catch{}return Aa()});function u(){try{localStorage.setItem(`codexometer.web.theme`,G(a))}catch{}}var d=fd(),f=B(d),p=B(f),m=B(p);id(B(m),{}),F(m),Li(m,e=>z(c,e),()=>G(c)),be(2),F(p);var h=U(p,2),g=B(h);let v;var y=U(g,1,!0),b=H(U(y));F(h),F(f);var x=U(f,2);Z(x,21,()=>Object.entries(i),qr,(e,t)=>{var n=I(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1],a=I(()=>i().test(Xi.location));var o=cd();let s;var c=H(o,!0);W(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+oa.view:`#/`+r()),Q(o,`aria-current`,G(a)?`page`:void 0),s=li(o,1,``,null,s,{active:G(a)}),Y(c,e)},[()=>r().toUpperCase()]),J(e,o)}),F(x);var S=U(x,2),C=B(S),w=e=>{var t=ld(),n=H(t,!0);W(()=>Y(n,$.error)),J(e,t)};X(C,e=>{$.error&&e(w)});var T=U(C,2),E=e=>{ea(e,{get routes(){return r}})},D=e=>{J(e,ud())};X(T,e=>{$.data?e(E):$.error||e(D,1)}),F(S);var O=U(S,2),k=B(O),ee=H(k),te=U(k,2),A=H(te,!0),ne=U(te,2),j=U(B(ne));Z(j,21,()=>l,qr,(e,t)=>{var n=dd(),r=H(n,!0),i={};W(e=>{Y(r,e),i!==(i=G(t))&&(n.value=(n.__value=i)??``)},[()=>G(t).replace(`-`,` `).toUpperCase()]),J(e,n)}),F(j),Li(j,e=>z(s,e),()=>G(s)),hi(j),F(ne),F(O);var re=U(O,2),ie=e=>{sd(e,{get target(){return G(c)},onfinish:()=>z(o,!1)})};X(re,e=>{G(o)&&e(ie)}),F(d),W(()=>{Q(d,`data-theme`,G(a)),Q(d,`data-starting`,G(o)),f.inert=G(o),v=li(g,1,`lamp`,null,v,{lit:$.connected}),Y(y,$.connected?`CONNECTED`:`OFFLINE`),Y(b,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),x.inert=G(o),S.inert=G(o),O.inert=G(o),Y(ee,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),Y(A,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),K(`change`,j,u),gi(j,()=>G(a),e=>z(a,e)),J(e,d),Ue()}Cr([`change`]),Br(pd,{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 a452443..eab5311 100644 --- a/internal/web/dist/index.html +++ b/internal/web/dist/index.html @@ -5,7 +5,7 @@ Codexometer // Experimental web - + diff --git a/main.go b/main.go index 0054955..daf786a 100644 --- a/main.go +++ b/main.go @@ -390,7 +390,7 @@ func run(args []string, stdout, stderr io.Writer, deps dependencies) int { codexPath = flags.String("codex", "codex", "path to the Codex CLI") errorLog = flags.String("error-log", "", "write bounded operational diagnostics to this file (off by default)") verbose = flags.Bool("verbose", false, "include diagnostic context in --error-log (never raw payloads)") - confirmationOption = flags.String("confirmation", "balanced", "confirmation policy: balanced, none or require (quota resets and folder trust always require confirmation)") + confirmationOption = flags.String("confirmation", "balanced", "confirmation policy: balanced, none or require (quota resets, folder trust and Full Access always require confirmation)") refresh = flags.Duration("refresh", time.Minute, "quota refresh interval") demo = flags.Bool("demo", false, "show the UI with simulated quota data") inline = flags.Bool("inline", false, "render inline instead of using the alternate screen") diff --git a/web/src/App.svelte b/web/src/App.svelte index 9c32d00..8931e26 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -1,5 +1,6 @@