From fba1fef429c8b9aea1701b84af1843de7b86a837 Mon Sep 17 00:00:00 2001 From: caigee-cmd <210803857+caigee-cmd@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:03:14 +0800 Subject: [PATCH 1/6] fix(overview): make selecting queue + slot fly-in visible again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root causes: 2.5s /api/live poll missed the 500ms selecting dwell, and live queue jobs (request id) never matched slot jobs (live-${account}), so queue→slot fly never fired. - Keep account_id on dwell SelectingRequests; expose on LiveJob - Bump display dwell to 1.6s (Acquire still immediate) - Poll /api/live at 400ms while InflightLiveCard is expanded - Fly wait-rail departures to bind account (or single newly busy slot) --- .../unreleased/inflight-queue-visible.md | 9 +++ frontend/scripts/mockInflight.test.ts | 29 ++++++++ frontend/src/api/live.ts | 2 + .../components/overview/InflightLiveCard.tsx | 74 ++++++++++++++----- frontend/src/hooks/useLive.ts | 20 +++-- frontend/src/lib/mockInflight.ts | 13 +++- frontend/src/pages/OverviewPage.tsx | 6 +- internal/console/live.go | 4 + internal/logs/recent_completions_test.go | 10 +-- internal/logs/recorder.go | 13 ++-- ...-BeHZaEQO.js => CartesianGrid-CVf7FMre.js} | 2 +- ...hart-DJ7HsYbU.js => CostChart-DFXT-jhI.js} | 2 +- ...-PuUDnhVB.js => LiveSparkline-DEWBslJX.js} | 2 +- ...t-BycQ9SfL.js => TrafficChart-BzzCMmSh.js} | 2 +- .../{index-BtHZePN5.js => index-CYQcpZwf.js} | 14 ++-- internal/webui/static/index.html | 2 +- 16 files changed, 154 insertions(+), 50 deletions(-) create mode 100644 changelog/unreleased/inflight-queue-visible.md rename internal/webui/static/assets/{CartesianGrid-BeHZaEQO.js => CartesianGrid-CVf7FMre.js} (99%) rename internal/webui/static/assets/{CostChart-DJ7HsYbU.js => CostChart-DFXT-jhI.js} (96%) rename internal/webui/static/assets/{LiveSparkline-PuUDnhVB.js => LiveSparkline-DEWBslJX.js} (80%) rename internal/webui/static/assets/{TrafficChart-BycQ9SfL.js => TrafficChart-BzzCMmSh.js} (99%) rename internal/webui/static/assets/{index-BtHZePN5.js => index-CYQcpZwf.js} (94%) diff --git a/changelog/unreleased/inflight-queue-visible.md b/changelog/unreleased/inflight-queue-visible.md new file mode 100644 index 00000000..960439cb --- /dev/null +++ b/changelog/unreleased/inflight-queue-visible.md @@ -0,0 +1,9 @@ +### English + +- Overview InflightLiveCard selecting (选号) wait rail is visible again: expanded `/api/live` poll speeds up to 400ms, selecting display dwell is 1.6s (Acquire still immediate), and bound-within-dwell queue items keep `account_id` so pills can fly into the account slot. +- Live queue→slot fly-in no longer depends on matching mock job ids — leaving the wait rail targets the bind account (or a single newly busy slot). + +### 中文 + +- Overview「实时进行中」选号/排队重新可见:面板展开时 `/api/live` 轮询加快到 400ms,选号展示保留约 1.6s(Acquire 仍不拖延),dwell 内已 Bind 的队列项保留 `account_id`,便于飞入账号槽位。 +- 排队→槽位飞入不再依赖 mock 同 id;离开等待轨时按 Bind 账号(或唯一新忙槽)落点。 diff --git a/frontend/scripts/mockInflight.test.ts b/frontend/scripts/mockInflight.test.ts index a7528f2a..4f67ce57 100644 --- a/frontend/scripts/mockInflight.test.ts +++ b/frontend/scripts/mockInflight.test.ts @@ -341,6 +341,35 @@ run('applyLiveProjection maps queue onto queued MockJobStatus', () => { assert.equal(queued[1].id, 'req-2') }) +run('applyLiveProjection keeps queue accountId for slot handoff', () => { + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 1, + rpm: 1, + workers: [ + { + id: 'acc-x', + name: 'wb-x', + provider: 'workbuddy', + busy: true, + progress: 0.5, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + queue: [ + { id: 'req-dwell', name: 'gpt · dwell', status: 'started', account_id: 'acc-x' }, + ], + }) + const queued = snap.jobs.filter((j) => j.status === 'queued') + assert.equal(queued.length, 1) + assert.equal(queued[0].id, 'req-dwell') + assert.equal(queued[0].accountId, 'acc-x') + const running = snap.jobs.filter((j) => j.status === 'running') + assert.equal(running.length, 1) + assert.equal(running[0].name, 'gpt · dwell') +}) + run('liveHasSignal true when only queue present', () => { assert.equal( liveHasSignal({ diff --git a/frontend/src/api/live.ts b/frontend/src/api/live.ts index e4100c1f..3a30f247 100644 --- a/frontend/src/api/live.ts +++ b/frontend/src/api/live.ts @@ -37,6 +37,8 @@ export type LiveJob = { status: string /** RFC3339 Prepare/Start time. */ started_at?: string + /** Set during selectingMinDwell after Bind — queue→slot fly target. */ + account_id?: string } /** Active cooldown window from AccountView.DownUntil / model_cooldowns. */ diff --git a/frontend/src/components/overview/InflightLiveCard.tsx b/frontend/src/components/overview/InflightLiveCard.tsx index 81cd25f7..62244e0b 100644 --- a/frontend/src/components/overview/InflightLiveCard.tsx +++ b/frontend/src/components/overview/InflightLiveCard.tsx @@ -891,32 +891,43 @@ export function InflightLiveCard({ const cache = rectCache.current - // Queue → worker: was queued, now running on a slot. + // Queue → worker handoff. + // Mock keeps the same job id (queued→running). Live /api/live uses request + // ids on the wait rail and synthetic live-${accountId} on slots, so we also + // fly when a queued job leaves and we know its bind target (accountId from + // selectingMinDwell) — or a single newly-busy slot heuristic. const flewFromQueue = new Set() - for (const [id, job] of nextJobs) { - const before = prevJobs.get(id) - if (!before || before.status !== 'queued' || job.status !== 'running') continue - const workerId = nextWorkerOf.get(id) - if (!workerId) continue + const flyQueueToSlot = ( + id: string, + label: string, + kind: MockJobKind, + workerId: string, + ) => { + if (!workerId || flewFromQueue.has(id)) return flewFromQueue.add(id) const fromRect = cache.wait[id] const toEl = root.querySelector(`[data-slot-id="${CSS.escape(workerId)}"]`) const toRect = toEl?.getBoundingClientRect() ?? cache.slot[workerId] - // Hide occupy chrome until land (AffectUI receive/occupy on land). + const wasBusy = Boolean(prev.workers.find((w) => w.id === workerId)?.busy) const landPill = toEl?.querySelector('[data-slot-job-pill]') ?? null const landFills = toEl ? Array.from(toEl.querySelectorAll('[data-slot-fill]')) : [] - if (landPill) gsap.set(landPill, { opacity: 0, scale: 0.85 }) - landFills.forEach((el) => gsap.set(el, { opacity: 0, scaleX: 0.35, transformOrigin: 'left center' })) - flyGhost(fromRect, toRect, job.name, job.kind, 'run', null, () => { + // Only hide occupy chrome when the slot was idle — dwell already shows busy. + if (!wasBusy) { + if (landPill) gsap.set(landPill, { opacity: 0, scale: 0.85 }) + landFills.forEach((el) => + gsap.set(el, { opacity: 0, scaleX: 0.35, transformOrigin: 'left center' }), + ) + } + flyGhost(fromRect, toRect, label, kind, 'run', null, () => { if (!toEl) return gsap.fromTo( toEl, { filter: 'brightness(1.35)' }, { filter: 'brightness(1)', duration: motionDuration(0.42), ease: ease.soft }, ) - if (landPill) { + if (!wasBusy && landPill) { gsap.to(landPill, { opacity: 1, scale: 1, @@ -924,18 +935,43 @@ export function InflightLiveCard({ ease: queueEase, }) } - landFills.forEach((el, i) => { - gsap.to(el, { - opacity: 1, - scaleX: 1, - duration: motionDuration(0.56), - ease: queueEase, - delay: motionDuration(i * 0.03), + if (!wasBusy) { + landFills.forEach((el, i) => { + gsap.to(el, { + opacity: 1, + scaleX: 1, + duration: motionDuration(0.56), + ease: queueEase, + delay: motionDuration(i * 0.03), + }) }) - }) + } }) } + for (const [id, job] of nextJobs) { + const before = prevJobs.get(id) + if (!before || before.status !== 'queued' || job.status !== 'running') continue + const workerId = nextWorkerOf.get(id) || job.accountId || before.accountId + if (!workerId) continue + flyQueueToSlot(id, job.name, job.kind, workerId) + } + + const newlyBusy = snap.workers.filter( + (w) => w.busy && !prev.workers.some((p) => p.id === w.id && p.busy), + ) + for (const [id, before] of prevJobs) { + if (before.status !== 'queued') continue + if (nextJobs.has(id)) continue + let workerId = (before.accountId || '').trim() + if (!workerId && newlyBusy.length === 1) workerId = newlyBusy[0].id + if (!workerId) continue + // Prefer a visible busy slot; skip if target never appears. + const target = snap.workers.find((w) => w.id === workerId) + if (target && !target.busy && newlyBusy.every((w) => w.id !== workerId)) continue + flyQueueToSlot(id, before.name, before.kind, workerId) + } + // Queue vacancy FLIP — remaining pills/dots close the gap after fly-out (560ms). if (flewFromQueue.size) { const waitEls = root.querySelectorAll('[data-wait-pill][data-wait-id]') diff --git a/frontend/src/hooks/useLive.ts b/frontend/src/hooks/useLive.ts index 35eb3a63..acfbc08a 100644 --- a/frontend/src/hooks/useLive.ts +++ b/frontend/src/hooks/useLive.ts @@ -7,11 +7,17 @@ export const LIVE_SAMPLES = Math.round(60_000 / LIVE_POLL_MS) export type LiveSample = { at: number; value: number } +/** Faster poll while InflightLiveCard is expanded — selecting dwell is ~1.6s. */ +export const LIVE_POLL_EXPANDED_MS = 400 + /** - * Polls /api/live every 2.5s while the document is visible. Keeps the last - * good snapshot on error so the strip never flashes back to a placeholder. + * Polls /api/live while the document is visible. Keeps the last good snapshot + * on error so the strip never flashes back to a placeholder. + * Pass a shorter `intervalMs` while the inflight card is open so selecting / + * queue→slot handoffs are not missed between the default 2.5s ticks. */ -export function useLive() { +export function useLive(opts?: { intervalMs?: number }) { + const intervalMs = opts?.intervalMs ?? LIVE_POLL_MS const [live, setLive] = useState(null) const [samples, setSamples] = useState([]) @@ -24,14 +30,16 @@ export function useLive() { .then((data) => { if (cancelled) return setLive(data) - setSamples((prev) => [...prev, { at: Date.now(), value: data.in_flight }].slice(-LIVE_SAMPLES)) + // Keep ~60s of sparkline history even when expanded poll is faster. + const keep = Math.max(LIVE_SAMPLES, Math.round(60_000 / intervalMs)) + setSamples((prev) => [...prev, { at: Date.now(), value: data.in_flight }].slice(-keep)) }) .catch(() => { /* keep last good snapshot */ }) } const start = () => { if (timer || document.hidden) return tick() - timer = setInterval(tick, LIVE_POLL_MS) + timer = setInterval(tick, intervalMs) } const stop = () => { if (timer) clearInterval(timer) @@ -45,7 +53,7 @@ export function useLive() { stop() document.removeEventListener('visibilitychange', onVisibility) } - }, []) + }, [intervalMs]) return { live, samples } } diff --git a/frontend/src/lib/mockInflight.ts b/frontend/src/lib/mockInflight.ts index 0b2a6752..11dfae05 100644 --- a/frontend/src/lib/mockInflight.ts +++ b/frontend/src/lib/mockInflight.ts @@ -416,6 +416,8 @@ export type LiveQueueJobLike = { /** RequestStatus* — UI maps selecting onto MockJobStatus queued. */ status: string started_at?: string + /** Bind target while dwell still projects onto the waiting rail. */ + account_id?: string } export type LiveProjectionInput = { @@ -484,6 +486,13 @@ export function applyLiveProjection( } }) + const dwellNameByAccount = new Map() + for (const q of live.queue ?? []) { + const acc = (q.account_id || '').trim() + const label = (q.name || '').trim() + if (acc && label && !dwellNameByAccount.has(acc)) dwellNameByAccount.set(acc, label) + } + const runningJobs: MockInflightJob[] = workers .filter((w) => w.busy && w.jobId) .map((w) => { @@ -504,7 +513,7 @@ export function applyLiveProjection( } return { id, - name: w.name, + name: dwellNameByAccount.get(w.id) ?? w.name, kind: 'chat' as const, status: 'running' as const, accountId: w.id, @@ -532,11 +541,13 @@ export function applyLiveProjection( startedAtMs = now } const name = (q.name || '').trim() || id + const accountId = (q.account_id || '').trim() || undefined return { id, name, kind: 'chat' as const, status: 'queued' as const, + accountId, progress: 0, startedAtMs, elapsedMs: Math.max(0, now - startedAtMs), diff --git a/frontend/src/pages/OverviewPage.tsx b/frontend/src/pages/OverviewPage.tsx index f779913e..f21c461f 100644 --- a/frontend/src/pages/OverviewPage.tsx +++ b/frontend/src/pages/OverviewPage.tsx @@ -31,7 +31,7 @@ import { accountProviderFamilyLabel, accountProviderLabel } from '@/lib/provider import { ProviderMark } from '@/components/ProviderMark' import { LiveStrip } from '@/components/overview/LiveStrip' import { InflightLiveCard } from '@/components/overview/InflightLiveCard' -import { useLive } from '@/hooks/useLive' +import { LIVE_POLL_EXPANDED_MS, LIVE_POLL_MS, useLive } from '@/hooks/useLive' type AccountRow = NonNullable[number] @@ -139,8 +139,10 @@ export function OverviewPage() { const [modelCount, setModelCount] = useState(0) const [resources, setResources] = useState(null) const [now, setNow] = useState(() => Date.now()) - const { live, samples: liveSamples } = useLive() const [inflightOpen, setInflightOpen] = useState(false) + const { live, samples: liveSamples } = useLive({ + intervalMs: inflightOpen ? LIVE_POLL_EXPANDED_MS : LIVE_POLL_MS, + }) const liveById = new Map((live?.accounts ?? []).map((item) => [item.id, item])) const proxyOk = Boolean(overview?.proxy?.ok) diff --git a/internal/console/live.go b/internal/console/live.go index 5ce445d5..1bdb1aed 100644 --- a/internal/console/live.go +++ b/internal/console/live.go @@ -74,6 +74,9 @@ type LiveJob struct { Name string `json:"name"` Status string `json:"status"` StartedAt string `json:"started_at,omitempty"` + // AccountID set when Bind already happened but selectingMinDwell still + // projects the job on the waiting rail (queue→slot fly target). + AccountID string `json:"account_id,omitempty"` } type LiveSnapshot struct { @@ -232,6 +235,7 @@ func (h *Handler) HandleLive(w http.ResponseWriter, r *http.Request) { Name: name, Status: status, StartedAt: q.StartedAt.UTC().Format(time.RFC3339), + AccountID: strings.TrimSpace(q.AccountID), }) } } diff --git a/internal/logs/recent_completions_test.go b/internal/logs/recent_completions_test.go index 8f268484..b4128948 100644 --- a/internal/logs/recent_completions_test.go +++ b/internal/logs/recent_completions_test.go @@ -94,8 +94,8 @@ func TestSelectingMinDwellDisplayOnly(t *testing.T) { }) r.BindAccount("fresh", "acc-x") got := r.SelectingRequests() - if len(got) != 1 || got[0].ID != "fresh" || got[0].AccountID != "" { - t.Fatalf("bound but within dwell must still project as selecting, got %+v", got) + if len(got) != 1 || got[0].ID != "fresh" || got[0].AccountID != "acc-x" { + t.Fatalf("bound but within dwell must still project as selecting with AccountID, got %+v", got) } old := now.Add(-(selectingMinDwell + time.Millisecond)) @@ -107,9 +107,6 @@ func TestSelectingMinDwellDisplayOnly(t *testing.T) { ids := map[string]bool{} for _, o := range got { ids[o.ID] = true - if o.AccountID != "" { - t.Fatalf("projection must clear AccountID, got %+v", o) - } } if !ids["fresh"] { t.Fatalf("fresh still in dwell missing: %+v", got) @@ -117,4 +114,7 @@ func TestSelectingMinDwellDisplayOnly(t *testing.T) { if ids["aged"] { t.Fatalf("aged past dwell must leave selecting projection: %+v", got) } + if got[0].AccountID != "acc-x" { + t.Fatalf("fresh must keep bind target for fly handoff, got %+v", got[0]) + } } diff --git a/internal/logs/recorder.go b/internal/logs/recorder.go index bc7b5566..3c9de223 100644 --- a/internal/logs/recorder.go +++ b/internal/logs/recorder.go @@ -121,7 +121,8 @@ type RecentCompletion struct { // AccountID empty ⇒ still selecting (pre-Acquire); set by BindAccount on // Pool.Acquire; cleared by UnbindAccount on Release; entry removed on // terminal Finish. SelectingRequests may still project a bound request as -// selecting until selectingMinDwell after StartedAt (display-only). +// selecting until selectingMinDwell after StartedAt (display-only), keeping +// AccountID so the UI can hand off queue→slot. type OpenRequest struct { ID string RequestedModel string @@ -275,7 +276,9 @@ const openRequestCap = 512 // selectingMinDwell keeps a request in the /api/live selecting (queue) // projection for at least this long after Start, even after BindAccount. // Display-only: BindAccount / Acquire / pickNext are not delayed. -const selectingMinDwell = 500 * time.Millisecond +// ~1.6s so Overview's expanded ~400ms /api/live poll can catch several frames +// (collapsed poll is 2.5s and would miss a 500ms window). +const selectingMinDwell = 1600 * time.Millisecond func (r *RequestRecorder) noteOpen(log accounts.RequestLog) { if r == nil { @@ -364,9 +367,10 @@ func (r *RequestRecorder) clearOpen(requestID string) { } // SelectingRequests returns open requests still in 选号 for the InflightLiveCard -// waiting queue (FIFO by StartedAt). Real binds still clear AccountID on the +// waiting queue (FIFO by StartedAt). Real binds still set AccountID on the // open map immediately; this projection also keeps recently-bound requests // until selectingMinDwell after StartedAt so the UI can see the wait rail. +// Bound-within-dwell entries keep AccountID so the card can fly queue→slot. // Does not block Pool.Acquire / pickNext. func (r *RequestRecorder) SelectingRequests() []OpenRequest { if r == nil { @@ -385,8 +389,7 @@ func (r *RequestRecorder) SelectingRequests() []OpenRequest { if !now.Before(cp.StartedAt.Add(selectingMinDwell)) { continue } - // Project as still selecting for display only. - cp.AccountID = "" + // Still selecting for display; keep AccountID for queue→slot handoff. } out = append(out, cp) } diff --git a/internal/webui/static/assets/CartesianGrid-BeHZaEQO.js b/internal/webui/static/assets/CartesianGrid-CVf7FMre.js similarity index 99% rename from internal/webui/static/assets/CartesianGrid-BeHZaEQO.js rename to internal/webui/static/assets/CartesianGrid-CVf7FMre.js index e2875897..57da38a7 100644 --- a/internal/webui/static/assets/CartesianGrid-BeHZaEQO.js +++ b/internal/webui/static/assets/CartesianGrid-CVf7FMre.js @@ -1,4 +1,4 @@ -import{$t as e,A as t,At as n,Bt as r,Cn as i,Ct as a,Dt as o,E as s,Et as c,F as l,Ft as u,Gt as d,H as f,Ht as p,I as m,It as h,J as g,Jt as _,K as v,Kt as y,L as b,Lt as x,M as S,Mt as C,N as w,Nt as T,O as E,Ot as D,P as O,Pt as k,R as ee,Rt as te,Sn as A,St as j,Tn as M,Tt as ne,Ut as re,Vt as ie,W as N,Wt as ae,X as oe,Xt as se,Y as P,Yt as ce,Z as le,Zt as ue,an as F,bt as de,cn as fe,ct as I,dn as pe,dt as me,en as L,et as he,fn as ge,gt as _e,ht as ve,it as ye,j as be,jt as xe,k as Se,kt as Ce,l as we,ln as Te,nn as Ee,nt as De,on as Oe,ot as ke,pn as Ae,q as R,qt as je,rt as Me,sn as Ne,st as Pe,tn as z,tt as Fe,u as Ie,ut as Le,vt as Re,wn as ze,wt as Be,xt as Ve,yt as B,z as He,zt as Ue}from"./index-BtHZePN5.js";function We(e,t){let n=new Map;for(let r=0;rvoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;evoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;ee.length)&&(t=e.length);for(var n=0,r=Array(t);nW||Math.abs(e.left-t.left)>W||Math.abs(e.top-t.top)>W||Math.abs(e.width-t.width)>W}function wt(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Tt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=_t((0,U.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,U.useRef)(null),a=(0,U.useRef)(n);a.current=n;var o=(0,U.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=wt(e);if(Ct(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=wt(e);Ct(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,U.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=t.separator,r=n===void 0?K.separator:n,i=t.contentStyle,a=t.itemStyle,o=t.labelStyle,s=o===void 0?K.labelStyle:o,c=t.payload,l=t.formatter,u=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,m=t.labelFormatter,h=t.accessibilityLayer,g=h===void 0?K.accessibilityLayer:h,_=()=>{if(c&&c.length){var e={padding:0,margin:0},t=Rt(c,u).map((e,t)=>{if(!e||e.type===`none`)return null;var n=e.formatter||l||Lt,i=e.value,o=e.name,s=i,u=o;if(n){var d=n(i,o,e,t,c);if(Array.isArray(d)){var f=jt(d,2);s=f[0],u=f[1]}else if(d!=null)s=d;else return null}var p=G(G({},K.itemStyle),{},{color:e.color||K.itemStyle.color},a);return U.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-separator`},r):null,U.createElement(`span`,{className:`recharts-tooltip-item-value`},s),U.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return U.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},v=G(G({},K.contentStyle),i),y=G({margin:0},s),b=!e(p),x=b?p:``,S=A(`recharts-default-tooltip`,d),C=A(`recharts-tooltip-label`,f);b&&m&&c!=null&&(x=m(p,c));var w=g?{role:`status`,"aria-live":`assertive`}:{};return U.createElement(`div`,Et({className:S,style:v},w),U.createElement(`p`,{className:C,style:y},U.isValidElement(x)?x:`${x}`),_())},q=`recharts-tooltip-wrapper`,Bt={visibility:`hidden`};function Vt(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return A(q,{[`${q}-right`]:z(n)&&t&&z(t.x)&&n>=t.x,[`${q}-left`]:z(n)&&t&&z(t.x)&&n=t.y,[`${q}-top`]:z(r)&&t&&z(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function Ut(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function Wt(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=Ht({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Ht({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Ut({translateX:d,translateY:f,useTranslate3d:c})):u=Bt,{cssProperties:u,cssClasses:Vt({translateX:d,translateY:f,coordinate:n})}}function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),2),r=n[0],i=n[1];U.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(J(J({},r),{},{dismissed:!1}));var a=Wt({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=J(J({},e.hasPortalFromProps?{}:J(J({transition:tn({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return U.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var rn=U.memo(nn),an=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,hn=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=fn(e,an),h=cn({x:n,y:i,top:o,left:c,width:u,height:f},m);return!z(n)||!z(i)||!z(u)||!z(f)||!z(o)||!z(c)?null:U.createElement(`path`,on({},pe(h),{className:A(`recharts-cross`,p),d:mn(n,i,u,f,o,c)}))};function gn(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function _n(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[R(t,n,r,i),R(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var vn,yn,bn,xn,Sn,Cn,wn;function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(t-e)*Math.min(Math.abs(t-e),359.999),X=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/v,d=c?i:i+a*u,f=R(t,n,l,d),p=R(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:R(t,n,l*Math.cos(u*v),m),theta:u}},Dn=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=En(a,o),c=a+s,l=R(t,n,i,a),u=R(t,n,i,c),d=F(vn||=Y([`M `,`,`,` diff --git a/internal/webui/static/assets/CostChart-DJ7HsYbU.js b/internal/webui/static/assets/CostChart-DFXT-jhI.js similarity index 96% rename from internal/webui/static/assets/CostChart-DJ7HsYbU.js rename to internal/webui/static/assets/CostChart-DFXT-jhI.js index df90532c..17d5d043 100644 --- a/internal/webui/static/assets/CostChart-DJ7HsYbU.js +++ b/internal/webui/static/assets/CostChart-DFXT-jhI.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-BeHZaEQO.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-BtHZePN5.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-CVf7FMre.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-CYQcpZwf.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/LiveSparkline-PuUDnhVB.js b/internal/webui/static/assets/LiveSparkline-DEWBslJX.js similarity index 80% rename from internal/webui/static/assets/LiveSparkline-PuUDnhVB.js rename to internal/webui/static/assets/LiveSparkline-DEWBslJX.js index 2e490ad2..d49942cd 100644 --- a/internal/webui/static/assets/LiveSparkline-PuUDnhVB.js +++ b/internal/webui/static/assets/LiveSparkline-DEWBslJX.js @@ -1 +1 @@ -import{a as e,at as t,r as n,t as r,xn as i}from"./index-BtHZePN5.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file +import{a as e,at as t,r as n,t as r,xn as i}from"./index-CYQcpZwf.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrafficChart-BycQ9SfL.js b/internal/webui/static/assets/TrafficChart-BzzCMmSh.js similarity index 99% rename from internal/webui/static/assets/TrafficChart-BycQ9SfL.js rename to internal/webui/static/assets/TrafficChart-BzzCMmSh.js index 3b332cbd..28eae298 100644 --- a/internal/webui/static/assets/TrafficChart-BycQ9SfL.js +++ b/internal/webui/static/assets/TrafficChart-BzzCMmSh.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-BeHZaEQO.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-BtHZePN5.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-CVf7FMre.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-CYQcpZwf.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-BtHZePN5.js b/internal/webui/static/assets/index-CYQcpZwf.js similarity index 94% rename from internal/webui/static/assets/index-BtHZePN5.js rename to internal/webui/static/assets/index-CYQcpZwf.js index a9a020fb..b422623e 100644 --- a/internal/webui/static/assets/index-BtHZePN5.js +++ b/internal/webui/static/assets/index-CYQcpZwf.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-BycQ9SfL.js","assets/CartesianGrid-BeHZaEQO.js","assets/CostChart-DJ7HsYbU.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-BzzCMmSh.js","assets/CartesianGrid-CVf7FMre.js","assets/CostChart-DFXT-jhI.js"])))=>i.map(i=>d[i]); var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(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 u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function ee(e,t){B++,z[B]=e.current,e.current=t}var te=V(null),ne=V(null),re=V(null),ie=V(null);function ae(e,t){switch(ee(re,t),ee(ne,e),ee(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(te),ee(te,e)}function oe(){H(te),H(ne),H(re)}function se(e){e.memoizedState!==null&&ee(ie,e);var t=te.current,n=Xd(t,e.type);t!==n&&(ee(ne,e),ee(te,n))}function ce(e){ne.current===e&&(H(te),H(ne)),ie.current===e&&(H(ie),op._currentValue=R)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1)`:-1 to {let e=a.current,t=o.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){Z.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),a=r.getBoundingClientRect();Z.to(t,{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,autoAlpha:1,duration:n?MV(kV.base):0,ease:AV.out,overwrite:!0})};n(s.current),s.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),Z.killTweensOf(t)}},[e,n]),(0,G.jsxs)(`div`,{ref:a,className:`filter-toggle relative inline-flex ${i??``}`,children:[(0,G.jsx)(`span`,{ref:o,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,G.jsx)(iM,{"aria-label":r,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,G.jsxs)(qA,{id:e.id,className:`relative z-[1]`,style:hce,children:[e.icon,e.label]},e.id))})]})}function mH(e,t=!1){if(!e)return;let n=e.toDate(Qw());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function hH(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return vT(Gne(new Date(t).toISOString()))}catch{return null}}function gH({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,G.jsx)(SA,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(lk.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,G.jsx)(lk.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,G.jsx)(lk.Segment,{segment:e})}),(0,G.jsx)(SA.RangeSeparator,{}),(0,G.jsx)(lk.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,G.jsx)(lk.Segment,{segment:e})}),(0,G.jsx)(lk.Suffix,{children:(0,G.jsx)(SA.Trigger,{children:(0,G.jsx)(SA.TriggerIndicator,{})})})]}),(0,G.jsxs)(SA.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,G.jsxs)(CI,{"aria-label":n,children:[(0,G.jsxs)(CI.Header,{children:[(0,G.jsxs)(CI.YearPickerTrigger,{children:[(0,G.jsx)(CI.YearPickerTriggerHeading,{}),(0,G.jsx)(CI.YearPickerTriggerIndicator,{})]}),(0,G.jsx)(CI.NavButton,{slot:`previous`}),(0,G.jsx)(CI.NavButton,{slot:`next`})]}),(0,G.jsxs)(CI.Grid,{children:[(0,G.jsx)(CI.GridHeader,{children:e=>(0,G.jsx)(CI.HeaderCell,{children:e})}),(0,G.jsx)(CI.GridBody,{children:e=>(0,G.jsx)(CI.Cell,{date:e})})]}),(0,G.jsx)(CI.YearPickerGrid,{children:(0,G.jsx)(CI.YearPickerGridBody,{children:({year:e})=>(0,G.jsx)(CI.YearPickerCell,{year:e})})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(IN,{className:`text-xs`,children:r}),(0,G.jsx)(LA,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,G.jsx)(LA.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(LA.Input,{children:e=>(0,G.jsx)(LA.Segment,{segment:e})})})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(IN,{className:`text-xs`,children:i}),(0,G.jsx)(LA,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,G.jsx)(LA.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(LA.Input,{children:e=>(0,G.jsx)(LA.Segment,{segment:e})})})})]})]})]})]})})}var _H={today:`statsWindowToday`,1:`statsWindow1h`,24:`statsWindow24h`,168:`statsWindow7d`,720:`statsWindow30d`,custom:`statsWindowCustom`};function vH(e,t){if(e===`today`){let e=new Date;return e.setHours(0,0,0,0),{from:e.toISOString()}}if(e===`custom`){let e=mH(t?.start),n=mH(t?.end,!0);return e&&n?{from:e,to:n}:null}if(e===`720`){let e=new Date;return{from:new Date(e.getTime()-2592e6).toISOString(),to:e.toISOString()}}return{hours:Number(e)}}function yH({value:e,onChange:t,custom:n,onCustomChange:r,onBusy:i,t:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{value:e,onChange:r=>{let a=r;e!==a&&((a!==`custom`||n)&&i?.(),t(a))},ariaLabel:a(`statsTraffic`),options:Object.keys(_H).map(e=>({id:e,label:a(_H[e])}))}),e===`custom`?(0,G.jsx)(gH,{className:`w-[min(100%,24rem)]`,value:n,onChange:e=>{e&&i?.(),r(e)},ariaLabel:a(`statsWindowCustom`),fromLabel:a(`logsTimeFrom`),toLabel:a(`logsTimeTo`)}):null]})}function bH(e,t,n){let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n&&r.set(t,n);let i=Date.parse(t),a=Date.parse(n);return Number.isFinite(i)&&Number.isFinite(a)&&(r.set(`from`,new Date(Math.floor(i/6e4)*6e4).toISOString()),r.set(`to`,new Date(Math.ceil(a/6e4)*6e4-6e4).toISOString())),`/logs?${r}`}function xH(e){let t=String(e||``).toLowerCase();return!t||t===`qoder`||t===`qoder-global`||t===`qoder-cn`}function SH(e){return String(e||``).toLowerCase()===`workbuddy`}function CH(e){return String(e||``).toLowerCase()===`trae`}function wH(e){return String(e||``).toLowerCase()===`devin`}function TH(e){return String(e||``).toLowerCase()===`command`}function EH(e){return String(e||``).toLowerCase()===`zhipu`}function DH(e){return String(e||``).toLowerCase()===`qwenwork`}function OH(e){return String(e||``).toLowerCase()===`kimi`}function kH(e){let t=String(e||``).toLowerCase();return t===`meta`||t===`muse`}function AH(e,t){let n=String(e||``).toLowerCase();return SH(n)?`WorkBuddy`:CH(n)?`Trae`:wH(n)?`Devin`:TH(n)?`Command Code`:EH(n)?`Zhipu GLM`:DH(n)?`QwenWork`:OH(n)?`Kimi Code`:kH(n)?`Muse (Meta)`:xH(n)?`Qoder`:e||t(`account`)}function jH(e,t,n){let r=String(e||``).toLowerCase(),i=String(t||``).toLowerCase();return SH(r)?n(i===`global`?`accountTypeWorkBuddyGlobal`:`accountTypeWorkBuddyCN`):CH(r)?n(`accountTypeTraeCN`):wH(r)?n(`accountTypeDevinGlobal`):TH(r)?n(`accountTypeCommandGlobal`):EH(r)?n(`accountTypeZhipuCN`):DH(r)?n(i===`cn`?`accountTypeQwenworkCN`:`accountTypeQwenworkGlobal`):OH(r)?n(`accountTypeKimiCN`):kH(r)?n(`accountTypeMetaGlobal`):xH(r)?n(i===`cn`?`accountTypeQoderCN`:`accountTypeQoderGlobal`):e||n(`account`)}function gce(e,t){let n=t??!!e.max_mode,r=e.catalog_context_length||e.default_context_length||e.context_length||0,i=e.catalog_context_length_max||0;return n&&i>0?{context_length:i,prompt_max_tokens:e.prompt_max_tokens_max||e.prompt_max_tokens,max_output_tokens:e.max_output_tokens_max||e.max_output_tokens}:{context_length:r,prompt_max_tokens:e.prompt_max_tokens,max_output_tokens:e.max_output_tokens}}function _ce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#0a84ff] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`C`})}function vce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.1 6.1 0 0 1 3.046-.415q2 .23 3.564 1.7a.12.12 0 0 0 .107.029q2.112-.519 4.061.366l.063.03l.154.076q2.036 1.055 2.918 3.198a5.6 5.6 0 0 1 .421 2.126 5.7 5.7 0 0 1-.18 1.631.17.17 0 0 0 .04.155 6 6 0 0 1 1.578 2.891q.577 2.852-1.183 5.14l-.182.22a6.06 6.06 0 0 1-2.934 1.851.16.16 0 0 0-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451q-2.374-.012-4.21-1.736a.14.14 0 0 0-.14-.032 5.9 5.9 0 0 1-1.604-.185 5.9 5.9 0 0 1-2.595-.622 6.06 6.06 0 0 1-2.146-1.781c-.203-.269-.404-.522-.551-.821a8 8 0 0 1-.495-1.283 6.1 6.1 0 0 1-.017-3.064.2.2 0 0 0 .008-.074.1.1 0 0 0-.037-.064 6 6 0 0 1-1.38-2.202 5.2 5.2 0 0 1-.333-1.589 6.9 6.9 0 0 1 .188-2.132q.675-2.226 2.577-3.493.424-.282.802-.438.429-.179.861-.304a.13.13 0 0 0 .087-.087A6 6 0 0 1 5.635 2.31Q6.655 1.04 8.086.457m-.804 7.85a.848.848 0 0 0-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 0 0 1.46.864l1.94-3.272a.85.85 0 0 0 .007-.854zm5.446 6.24a.849.849 0 0 0 0 1.695h4.848a.849.849 0 0 0 0-1.696z`})})}function yce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`D`})}function bce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,d:`M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79Z`})})}function xce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M8 6a4 4 0 0 0 0 8c.9 0 1.7-.3 2.4-.8L14 16.8A4 4 0 1 0 16 8a3.9 3.9 0 0 0-2.4.8L10 5.2A4 4 0 0 0 8 6Zm0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm8 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z`,clipRule:`evenodd`})})}var Sce=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAJ5ElEQVR42u2dXUxUZxrH/wKDDDCM4CJBZJZNxMpGDMGYXsAWeikapF6Jqc02kUhWTWsTIQHjNk22yWCyN5INrk22rbsc71ZNpXfb0sJ+Gcxmma2mNpt1XMsaLd2ZoY7D5164btfiBx8zzDnv+f1uiWeG9/x8eN7neT9WFRaunROAIWQwBIDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAA35LFEDyZ6uotKi8PqL6+ToFAuQoK/PL7/fL7CyRJ4fBNRaMRhcM3FQ6HFQqFNDoaUiQSYfDSxCqO031U4Lq6OjU1Nam6eov8fv+inxGJRDQ6GtLAwIAs6xxyI/TK0tTUpJ07d6iurk6BQCCpz45EIurrO62+vtOIjdCpIxAIqLPzWEokRmyEXjHq6+vU0dGh+vq6tHw+YiN00iJyb++ptImM2Aid1NSitbXVlt8vEomoq+u4LMvCRIR+Oq2trersPLYiOfJyCYfD6u4+rkuXBjASoZ0VlZ/G0NCwenp6NDQ0jJkI/aCOfPbs+46IyogtWt9Po739oAYHP3a8zNKDaszFixd08eIF20xkidArSGdnhzo7O4x9SZZlKRg8qXA4jLGmC/322z9Te/tBV7ysvr7TCgZ7KPWZKnRv7ynt29fqqhdGDdtQod0oM2IbKrSb0gzEXhyZXm/um06bAL7++muY/F9ycnJUX1+nPXteUiQSVSgUIkI75cvu29eq3t5TWKyndx0PHz7i2hq2Y4QOBAIaHPxoSYvu3YhbmzOOENrv92tw8CMjmiaILTqFnZ0dyKzldx2rq7cQoe3yQkB0HZ0uNKlG6ggGe4ws9dlaaOrNSyM2e0+3pu4oOntPX07dnffzzasDKvMUazY2ZVwN27ZCV1dv0eDgx9i5AK4lbuhy/Joux6/q1vRdXUvcWNC/K8sq1nbvZpXeX6N/9X+m3/zyrOPFtq3QLJ18egT+c/yqfjcx8j+Jk8GmyfWaOPOFRt4bRGgmgqnnfPRTnY99osvxayn9nJmxuKI/v6r7g7cRmuicXG5N3dEvxn+b1Ei8UCZHxvXvt/6qmbE4QhOdkyPy+dinaf0ec7Fpxd65rm+sf4jDGpdAR0eH3L4Ww7LO6Z2KQWVvK0p/xPNlqeBolTLyPYqduS46hVpc3dnNqYZlWWpublEw2GO775bftlFrTmwlQmuRG13dGpWDwZO2P3DGu6tMM2NxW0dqhE4zo6Mh7d//imNa0fltGyXJtlJn2Gky6LalocFgjxoaGh23riK/baMt8ntbC93U1OQqmbu6um2ZKy+UNSe2KsPnQWg98Sy6vXLLHsD9+19RX99pR/8emaVe5R/YiNB6wm4UN6QbkUhEzc27jTmUMa+1QpmlXoSen27scI3Mo6NmbWL1tVUitB6zss50TJRZelDKs1OUtoXQdXVmN1MOHz5ipMwPyWksQWj9X3fQ5B0pwWCP+vvNPqE/b28FQn87ISw39kX391uOLs1pERUPz6YChJak8vKAse3s7u7jcgvZtUUIbWqEflhrdtNZczkNJQj9MIc2MW82eRL4OEg5DBV6aGjY8V1ALXHddOZ6L0L7/QUyrUTnVrJKcxHatFTDzfeg2KHBgtBJPng8aS/GhivZENpl0TmZVY1VviwGFaGVtpqzGyeCRGiZe91a0l9MvoeBRej05M6WdS65L8XnIeVA6PRF52R3BO22aB6hSTdkQtcNoeW++0tSsV4ja5OPwUVopeGko3MyeV0EQrtsMjgwkJrNrp5KhEboFWZ4ODXpRva2IiocCJ2e/DkVrK5dy+Ai9MozMPBhSp5r1yO2EFpmt7pTsaouw+exzVYmhHYRoVDI+N3TCE3+LFP25SG061KOmynJnWmoILQxKYfdzohDaLmrqaIkL0ZiMojQxghNdDZI6Egk6riSXbKjs3dXGSaaI3TE1S9gzU+3YiFCm0H2tiJyZ9OETkUJzEkX74BhQkej7ozQvrZKtlqZKLTbDjWUHizgf3iBJRiYQ7tJ6gyfR/4T1Zhnch06FBp1zYDnt21ki5XpQg8N/d4Vg+3dVcaKOjcIPTw8LDfkzf6jP8Q4NwgdDodTtuFUNjnzrfBkLXsF3bSW49KlD42VeW3f85To3Ca0ZVnGHRaOzC5fbRcMnkRmMEdoU6I0MiO0MVEamRF6XpS2LGfejZ3XWqHiX9cjM0LPj9JOSz0K3qhSwdEqSnMIrcfWpZubWxyxVjqz1Kt1FxrpACL0QqTebWupfW2VWnehkRQDobXgpaXd3cdtJ3Xurg1ad6GRJaAIvXj6+y01N++2TU6dWeqV/0Q1URmhlxepm5tbUnYEFyB02nLqrq5u1+8UB4MOmunrO62amtqkX0UMCK10btsKBnvSInZBZh7WIHRqxW5oeHHFuou+jFysQejU59eHDh1RTU3tikwcN6/+PuYg9MpNHJubd6dU7LKs72EOQmtFT9hPpdjPrQ5gDkKbI/Z2bxXmIHT6xT506EhSOo5V5NAILZusta6pqV12c8aXkavt3s3Yg9AypjnT4nsBexBaxjRniNAI7QixF0qZp1gtvh9hEELbX+yFdh1/UvQSA4fQckTXsaGh8ZmlPqI0QjuGB2uwn13DJkojtExqzpR5ipEaoZ0t9nebM4eK9rC+Q9LMWByhnSh2TU3tvK7jr8q6XC+1HYTO9Hpz30RTLekCe8s6p0QioerqLSrOLdJ2b5U+nPijJuembP3d52LTWrU6I+nPjAT/prnJWYR2KolEQsPDw3r33feUSCT0Yk29NuSV6HL8qm2ljn9wS18f/4vuf3JbWaW5ylyfnN3r37z/dyX+cCftv9+qwsK1c6iZHPx+v9rbD6rx1R16baJXsdl7tkoHIm+NKjHylb57m63vQKWytxUt69l3Xx7WbGwKoU0V++U3XtVnLfd1LXEj7SJPnPlC9z745zPPG8ndtUF5eysWdT7fzFhcXx+7oqnPo7YYe4ROIYUb1ir/QKWmmwpX/LMnR8YVv3TrmSI/7h7FvL0VCxJ7Ziyur9r/ZIvJIEKvID94/jlFf7xmWX/WFxotJ0fGFTtzfdmSZfg88u4sU05DiTybCh6Re6n/WRDaMLK3FSmnoUS5Ozck7djdyZFx3R+8rckr4yn9s/9w8jjzZdzWY4zQSs/1yFmbfMppKFHOCyULrjTMxaY19XlUU9ejmhwZ1+SVcVtMxBAa5gmeWepVZqlXGT7PIz+bjU1pbmJa02P3bB8dERqA1jcAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQgNABCAyA0AEIDIDQgNABCAyA0AEIDLIj/ABWOKFxbGBRBAAAAAElFTkSuQmCC`;function Cce({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Sce,alt:``,width:e,height:e,className:`block shrink-0 rounded-[22%] ${t}`.trim(),draggable:!1})}function wce({size:e=16,className:t=``}){let n=Math.max(2,Math.round(e*.14));return(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-baseline justify-center rounded-[22%] bg-[#18181B] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.5)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:[(0,G.jsx)(`span`,{style:{alignSelf:`center`},children:`Q`}),(0,G.jsx)(`span`,{style:{alignSelf:`center`,width:n,height:n,marginLeft:Math.max(0,Math.round(e*.03)),borderRadius:`50%`,background:`#22D3EE`}})]})}function Tce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`T`})}var Ece=`/assets/workbuddy-mark-D1Gu2IKl.svg`;function Dce({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Ece,alt:``,width:e,height:e,className:`block shrink-0 ${t}`.trim(),draggable:!1})}function Oce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M11.991 23.503a.24.24 0 0 0-.244.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.22-.247zM9.671 5.365a1.697 1.697 0 0 1 1.099 2.132l-.071.172l-.016.04l-.018.054c-.07.16-.104.32-.104.498c-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523c-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368c0 .124.018.23.053.337c.209.373.54.658.96.8c.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711c.854.284 1.378 1.226 1.099 2.167a1.66 1.66 0 0 1-2.077 1.102a1.7 1.7 0 0 1-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 0 0-1.954.746a1.66 1.66 0 0 1-1.065.764a1.677 1.677 0 0 1-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.5 1.5 0 0 1 .296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.3 1.3 0 0 0-.227-.693a2.5 2.5 0 0 1-.366-1.403a2.4 2.4 0 0 1 .366-1.208c.14-.195.21-.444.227-.693c.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.4 1.4 0 0 1-.299-.07l-.05-.019a1.7 1.7 0 0 1-1.047-2.114a1.68 1.68 0 0 1 2.094-1.101m-5.575 10.11c.26-.264.639-.367.994-.27s.633.379.728.74c.095.362-.007.748-.267 1.013c-.402.41-1.053.41-1.455 0a1.06 1.06 0 0 1 0-1.482zm14.845-.294c.359-.09.738.024.992.297c.254.274.344.665.237 1.025s-.396.634-.756.718c-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 0 1 .757-1.26zm-.064-4.39c.314.32.49.753.49 1.206s-.176.886-.49 1.206c-.315.32-.74.5-1.185.5c-.444 0-.87-.18-1.184-.5a1.727 1.727 0 0 1 0-2.412a1.654 1.654 0 0 1 2.369 0m-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 0 1-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 0 1 1.33-1.038a1.66 1.66 0 0 1 1.547.652m11.545-4.221c.368 0 .708.2.892.524s.184.724 0 1.048a1.03 1.03 0 0 1-.892.524a1.04 1.04 0 0 1-1.03-1.048a1.04 1.04 0 0 1 1.03-1.048m-14.358 0c.368 0 .707.2.891.524s.184.724 0 1.048a1.03 1.03 0 0 1-.891.524a1.04 1.04 0 0 1-1.03-1.048c0-.579.461-1.048 1.03-1.048m10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705s-1.674-.763-1.674-1.705s.75-1.706 1.674-1.706m-2.626-.684c.362-.082.653-.356.761-.718a1.06 1.06 0 0 0-.238-1.028a1.02 1.02 0 0 0-.996-.294c-.547.14-.881.7-.752 1.257c.13.558.675.907 1.225.783m0 16.876c.359-.087.644-.36.75-.72a1.06 1.06 0 0 0-.237-1.019a1.02 1.02 0 0 0-.985-.301a1.04 1.04 0 0 0-.762.717c-.108.361-.017.754.239 1.028c.245.263.606.377.953.305zM17.19 3.5a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64a.63.63 0 0 0-.628.64c0 .355.28.64.628.64m-10.38 0a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64a.63.63 0 0 0-.628.64c0 .355.279.64.628.64m-5.182 7.852a.63.63 0 0 0-.628.64c0 .354.28.639.628.639a.63.63 0 0 0 .627-.606l.001-.034a.62.62 0 0 0-.628-.64zm5.182 9.13a.63.63 0 0 0-.628.64c0 .355.279.64.628.64a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64m10.38.018a.63.63 0 0 0-.628.64c0 .355.28.64.628.64a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64m5.182-9.148a.63.63 0 0 0-.628.64c0 .354.279.639.628.639a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 0 0 .244-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249c0 .142.122.249.244.249M11.991.497a.24.24 0 0 0 .245-.248A.24.24 0 0 0 11.99 0a.24.24 0 0 0-.244.249c0 .133.108.236.223.247zM2.011 6.36a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249a.24.24 0 0 0 .244.249zm0 11.263a.24.24 0 0 0-.243.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .244-.249a.25.25 0 0 0-.244-.248zm19.995-.018a.24.24 0 0 0-.245.248a.24.24 0 0 0 .245.25a.24.24 0 0 0 .244-.25a.25.25 0 0 0-.244-.248z`})})}function MH({provider:e,size:t=16,className:n=``}){let r=String(e||``).toLowerCase();return r===`workbuddy`?(0,G.jsx)(Dce,{size:t,className:n}):r===`trae`?(0,G.jsx)(Tce,{size:t,className:n}):r===`devin`?(0,G.jsx)(yce,{size:t,className:n}):r===`command`?(0,G.jsx)(_ce,{size:t,className:n}):r===`codex`?(0,G.jsx)(vce,{size:t,className:n}):r===`zhipu`?(0,G.jsx)(Oce,{size:t,className:n}):r===`qwenwork`?(0,G.jsx)(wce,{size:t,className:n}):r===`kimi`?(0,G.jsx)(bce,{size:t,className:n}):r===`meta`||r===`muse`?(0,G.jsx)(xce,{size:t,className:n}):(0,G.jsx)(Cce,{size:t,className:n})}var kce=(0,v.lazy)(()=>C(()=>import(`./LiveSparkline-PuUDnhVB.js`).then(e=>({default:e.LiveSparkline})),[]));function Ace({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,G.jsxs)(G.Fragment,{children:[n(`liveConcurrency`),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,G.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,G.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,G.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center`,children:(0,G.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,G.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-md text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,G.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,G.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`span`,{className:`inline-block h-6 w-[120px]`}),children:(0,G.jsx)(kce,{samples:t,capacity:a,label:n(`liveTrace`)})})]})]})}var jce=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Mce=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,Nce=Math.PI/180;180/Math.PI;var NH=Math.sin,PH=Math.cos,FH=Math.abs,IH=Math.sqrt,Pce=function(e){return typeof e==`number`},LH=1e5,RH=function(e){return Math.round(e*LH)/LH||0},zH=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001};function Fce(e,t,n,r,i,a,o){for(var s=e.length,c,l,u,d,f;--s>-1;)for(c=e[s],l=c.length,u=0;u1&&(n=IH(b)*n,r=IH(b)*r);var x=n*n,S=r*r,C=(x*S-x*y-S*v)/(x*y+S*v);C<0&&(C=0);var w=(a===o?-1:1)*IH(C),T=w*(n*_/r),E=w*-(r*g/n),D=(e+s)/2,O=(t+c)/2,k=D+(u*T-d*E),A=O+(d*T+u*E),j=(g-T)/n,M=(_-E)/r,N=(-g-T)/n,P=(-_-E)/r,F=j*j+M*M,I=(M<0?-1:1)*Math.acos(j/IH(F)),L=(j*P-M*N<0?-1:1)*Math.acos((j*N+M*P)/IH(F*(N*N+P*P)));isNaN(L)&&(L=f),!o&&L>0?L-=p:o&&L<0&&(L+=p),I%=p,L%=p;var R=Math.ceil(FH(L)/(p/4)),z=[],B=L/R,V=4/3*NH(B/2)/(1+PH(B/2)),H=u*n,ee=d*n,te=d*-r,ne=u*r,re;for(re=0;re-1e-4?0:t}).match(jce)||[],n=[],r=0,i=0,a=2/3,o=t.length,s=0,c=`ERROR: malformed path: `+e,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w=function(e,t,n,r){v=(n-e)/3,y=(r-t)/3,h.push(e+v,t+y,n-v,r-y,n,r)};if(!e||!isNaN(t[0])||isNaN(t[1]))return console.log(c),n;for(l=0;l.5||FH(i-f)>.5)&&(w(r,i,d,f),p===`L`&&(l+=2)),r=d,i=f;else if(p===`A`){if(S=t[l+4],C=t[l+5],v=t[l+6],y=t[l+7],u=7,S.length>1&&(S.length<3?(y=v,v=C,u--):(y=C,v=S.substr(2),u-=2),C=S.charAt(1),S=S.charAt(0)),b=Ice(r,i,+t[l+1],+t[l+2],+t[l+3],+S,+C,(m?r:0)+v*1,(m?i:0)+y*1),l+=u,b)for(u=0;ul*(w*w+T*T)&&(O=u.length,e(t,n,f,p,v,y,S,C,l,u,d),e(S,C,b,x,g,_,s,c,l,u,d+1+(u.length-O))),u},GH=function(){function e(e,t,n){VH||UH(),this.id=e,Bce&&this.setData(t,n)}var t=e.prototype;return t.setData=function(e,t){t||={},e||=`0,0,1,1`;var n=e.match(Vce),r=1,i=[],a=[],o=t.precision||1,s=o<=1,c,l,u,d,f,p,m,h,g;if(this.data=e,(Hce.test(e)||~e.indexOf(`M`)&&e.indexOf(`C`)<0)&&(n=Lce(e)[0]),c=n.length,c===4)n.unshift(0,0),n.push(1,1),c=8;else if((c-2)%6)throw`Invalid CustomEase`;for((+n[0]!=0||+n[c-2]!=1)&&Wce(n,t.height,t.originY),this.segment=n,d=2;dh.x||h.y!==m.y&&h.x===m.x||m===h)&&m.x<=1?(h.cx=m.x-h.x,h.cy=m.y-h.y,h.n=m,h.nx=m.x,s&&d>1&&Math.abs(h.cy/h.cx-i[d-2].cy/i[d-2].cx)>2&&(s=0),h.cxh||u===m-1)&&(c.push(g,_),l=(p-_)/(f-g)),g=f,_=p;c=`M`+c.join(`,`)}return s&&s.setAttribute(`d`,c),c},e}();GH.version=`3.15.0`,GH.headless=!0,HH()&&BH.registerPlugin(GH);var Kce=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function KH(e){return typeof e==`string`&&Kce.includes(e)}var qce=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function qH(e){return typeof e==`string`&&qce.has(e)}function JH(e){return typeof e==`string`&&e.startsWith(`data-`)}function YH(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qH(n)||JH(n))&&(t[n]=e[n]);return t}function XH(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return YH(t)}return typeof e==`object`&&!Array.isArray(e)?YH(e):null}function ZH(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qH(n)||JH(n)||KH(n))&&(t[n]=e[n]);return t}function Jce(e){return e==null?null:(0,v.isValidElement)(e)?ZH(e.props):typeof e==`object`&&!Array.isArray(e)?ZH(e):null}var Yce=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function QH(){return QH=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Xce(e,Yce),d=a||{width:r,height:i,x:0,y:0},f=xs(`recharts-surface`,o);return v.createElement(`svg`,QH({},ZH(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),Qce=[`children`,`className`];function eU(){return eU=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=$ce(e,Qce),a=xs(`recharts-layer`,r);return v.createElement(`g`,eU({className:a},ZH(i),{ref:t}),n)});function nU(e){return e===`__proto__`}var tle=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function rU(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:tle.test(e);default:return!1}}function iU(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function aU(e){return typeof e==`symbol`||e instanceof Symbol}function nle(e){return e==null?``:oU(e)}function oU(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(oU).join(`,`);if(aU(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function sU(e){if(Array.isArray(e))return e.map(iU);if(typeof e==`symbol`)return[e];e=nle(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ile),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function uU(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+lU(i)+n},``)}var dU=e=>e===0?0:e>0?1:-1,fU=e=>typeof e==`number`&&e!=+e,pU=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,mU=e=>(typeof e==`number`||e instanceof Number)&&!fU(e),hU=e=>mU(e)||typeof e==`string`,ale=0,gU=e=>{var t=++ale;return`${e||``}${t}`},_U=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!mU(e)&&typeof e!=`string`)return n;var i;if(pU(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return fU(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},vU=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):cU(e,t))===n)}var xU=e=>e==null,SU=e=>xU(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function CU(e){return e!=null}function wU(){}function TU(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function EU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DU(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=TU(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?DU({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?DU({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?DU({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?DU({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?DU({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?DU({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?DU({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?DU({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(mU(n.x)||pU(n.x))&&(mU(n.y)||pU(n.y))?DU({x:c+_U(n.x,g),y:l+_U(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):DU({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ule=[`top`,`left`,`right`,`bottom`];function dle(e){return e==null?!1:typeof e==`object`||ule.includes(e)}var fle=(0,v.createContext)(null);function OU(e){return function(){return e}}var kU=Math.PI,AU=2*kU,jU=1e-6,ple=AU-jU;function MU(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return MU;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tjU){if(!(Math.abs(u*s-c*l)>jU)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((kU-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>jU&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>jU||Math.abs(this._y1-l)>jU)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%AU+AU),d>ple?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>jU&&this._append`A${n},${n},0,${+(d>=kU)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};NU.prototype;function PU(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new NU(t)}Array.prototype.slice;function FU(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function IU(e){this._context=e}IU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function LU(e){return new IU(e)}function RU(e){return e[0]}function zU(e){return e[1]}function BU(e,t){var n=OU(!0),r=null,i=LU,a=null,o=PU(s);e=typeof e==`function`?e:e===void 0?RU:OU(e),t=typeof t==`function`?t:t===void 0?zU:OU(t);function s(s){var c,l=(s=FU(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return BU().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:OU(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:OU(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:OU(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:OU(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:OU(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:OU(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:OU(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var HU=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function hle(e){return new HU(e,!0)}function gle(e){return new HU(e,!1)}function UU(){}function WU(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function GU(e){this._context=e}GU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:WU(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _le(e){return new GU(e)}function KU(e){this._context=e}KU.prototype={areaStart:UU,areaEnd:UU,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vle(e){return new KU(e)}function qU(e){this._context=e}qU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yle(e){return new qU(e)}function JU(e){this._context=e}JU.prototype={areaStart:UU,areaEnd:UU,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ble(e){return new JU(e)}function YU(e){return e<0?-1:1}function XU(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(YU(a)+YU(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ZU(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function QU(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function $U(e){this._context=e}$U.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:QU(this,this._t0,ZU(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,QU(this,ZU(this,n=XU(this,e,t)),n);break;default:QU(this,this._t0,n=XU(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function eW(e){this._context=new tW(e)}(eW.prototype=Object.create($U.prototype)).point=function(e,t){$U.prototype.point.call(this,t,e)};function tW(e){this._context=e}tW.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function xle(e){return new $U(e)}function Sle(e){return new eW(e)}function nW(e){this._context=e}nW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=rW(e),i=rW(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function wle(e){return new iW(e,.5)}function Tle(e){return new iW(e,0)}function Ele(e){return new iW(e,1)}function aW(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Dle(e,t){return e[t]}function Ole(e){let t=[];return t.key=e,t}function kle(){var e=OU([]),t=oW,n=aW,r=Dle;function i(i){var a=Array.from(e.apply(this,arguments),Ole),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,sW=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{KH(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Ple=(e,t,n)=>r=>(e(t,n,r),null),Fle=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];KH(i)&&typeof a==`function`&&(r||={},r[i]=Ple(a,t,n))}),r};function cW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ile(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Ble(e){return Number.isSafeInteger(e)&&e>=0}function uW(e){return e!=null&&typeof e!=`function`&&Ble(e.length)}function dW(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function fW(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var pW=`[object RegExp]`,mW=`[object String]`,hW=`[object Number]`,gW=`[object Boolean]`,Vle=`[object Arguments]`,_W=`[object Symbol]`,vW=`[object Date]`,yW=`[object Map]`,bW=`[object Set]`,xW=`[object Array]`,Hle=`[object Function]`,SW=`[object ArrayBuffer]`,CW=`[object Object]`,Ule=`[object Error]`,wW=`[object DataView]`,TW=`[object Uint8Array]`,EW=`[object Uint8ClampedArray]`,DW=`[object Uint16Array]`,OW=`[object Uint32Array]`,Wle=`[object BigUint64Array]`,kW=`[object Int8Array]`,AW=`[object Int16Array]`,jW=`[object Int32Array]`,Gle=`[object BigInt64Array]`,MW=`[object Float32Array]`,NW=`[object Float64Array]`,PW=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function FW(e){return PW.Buffer!==void 0&&PW.Buffer.isBuffer(e)}function IW(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function LW(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var Kle=/^(?:0|[1-9]\d*)$/;function RW(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=d(),n=K_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Jle=o(((e,t)=>{t.exports=qle()})),zW=(0,v.createContext)(null),Yle=Jle(),Xle=e=>e,BW=()=>{var e=(0,v.useContext)(zW);return e?e.store.dispatch:Xle},VW=()=>{},Zle=()=>VW,Qle=(e,t)=>e===t;function HW(e){var t=(0,v.useContext)(zW),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:VW,[t,e]);return(0,Yle.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Zle,t?t.store.getState:VW,t?t.store.getState:VW,n,Qle)}function $le(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function eue(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var UW=e=>Array.isArray(e)?e:[e];function tue(e){let t=Array.isArray(e[0])?e[0]:e;return eue(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function nue(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?rue:WeakRef,iue=0,GW=1;function KW(){return{s:iue,v:void 0,o:null,p:null}}function aue(e){return e instanceof WW?e.deref():e}function qW(e,t={}){let n=KW(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=KW(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function oue(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),$le(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=qW,argsMemoizeOptions:u=[]}={...n,...a},d=UW(c),f=UW(u),p=tue(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=nue(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=oue(qW);function sue(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=YW(e),i=YW(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},lue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,uue=/^\w*$/;function due(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||aU(e)?!0:typeof e==`string`&&(uue.test(e)||!lue.test(e))||t!=null&&Object.hasOwn(t,e)}function fue(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=uW(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||due(e)?e:{key:e,path:sU(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function XW(e,...t){let n=t.length;return n>1&&JW(e,t[0],t[1])?t=[]:n>2&&JW(t[0],t[1],t[2])&&(t=[t[0]]),fue(e,sue(t),[`asc`])}var ZW=e=>e.legend.settings,pue=e=>e.legend.size;$([e=>e.legend.payload,ZW],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?XW(r,n):r});function QW(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $W=typeof Symbol==`function`&&Symbol.observable||`@@observable`,eG=()=>Math.random().toString(36).substring(7).split(``).join(`.`),tG={INIT:`@@redux/INIT${eG()}`,REPLACE:`@@redux/REPLACE${eG()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${eG()}`};function nG(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rG(e,t,n){if(typeof e!=`function`)throw Error(QW(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(QW(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(QW(1));return n(rG)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(QW(3));return i}function d(e){if(typeof e!=`function`)throw Error(QW(4));if(c)throw Error(QW(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(QW(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!nG(e))throw Error(QW(7));if(e.type===void 0)throw Error(QW(8));if(typeof e.type!=`string`)throw Error(QW(17));if(c)throw Error(QW(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(QW(10));r=e,f({type:tG.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(QW(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[$W](){return this}}}return f({type:tG.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[$W]:m}}function mue(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:tG.INIT})===void 0)throw Error(QW(12));if(n(void 0,{type:tG.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(QW(13))})}function iG(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function hue(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(QW(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=aG(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function oG(e){return nG(e)&&`type`in e&&typeof e.type==`string`}var sG=Symbol.for(`immer-nothing`),cG=Symbol.for(`immer-draftable`),lG=Symbol.for(`immer-state`);function uG(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dG=Object,fG=dG.getPrototypeOf,pG=`constructor`,mG=`prototype`,hG=`configurable`,gG=`enumerable`,_G=`writable`,vG=`value`,yG=e=>!!e&&!!e[lG];function bG(e){return e?SG(e)||OG(e)||!!e[cG]||!!e[pG]?.[cG]||kG(e)||AG(e):!1}var gue=dG[mG][pG].toString(),xG=new WeakMap;function SG(e){if(!e||!jG(e))return!1;let t=fG(e);if(t===null||t===dG[mG])return!0;let n=dG.hasOwnProperty.call(t,pG)&&t[pG];if(n===Object)return!0;if(!MG(n))return!1;let r=xG.get(n);return r===void 0&&(r=Function.toString.call(n),xG.set(n,r)),r===gue}function CG(e,t,n=!0){wG(e)===0?(n?Reflect.ownKeys(e):dG.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function wG(e){let t=e[lG];return t?t.type_:OG(e)?1:kG(e)?2:AG(e)?3:0}var TG=(e,t,n=wG(e))=>n===2?e.has(t):dG[mG].hasOwnProperty.call(e,t),EG=(e,t,n=wG(e))=>n===2?e.get(t):e[t],DG=(e,t,n,r=wG(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function _ue(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var OG=Array.isArray,kG=e=>e instanceof Map,AG=e=>e instanceof Set,jG=e=>typeof e==`object`,MG=e=>typeof e==`function`,NG=e=>typeof e==`boolean`;function vue(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var PG=e=>e.copy_||e.base_,FG=e=>e.modified_?e.copy_:e.base_;function IG(e,t){if(kG(e))return new Map(e);if(AG(e))return new Set(e);if(OG(e))return Array[mG].slice.call(e);let n=SG(e);if(t===!0||t===`class_only`&&!n){let t=dG.getOwnPropertyDescriptors(e);delete t[lG];let n=Reflect.ownKeys(t);for(let r=0;r1&&dG.defineProperties(e,{set:RG,add:RG,clear:RG,delete:RG}),dG.freeze(e),t&&CG(e,(e,t)=>{LG(t,!0)},!1),e)}function yue(){uG(2)}var RG={[vG]:yue};function zG(e){return e===null||!jG(e)||dG.isFrozen(e)}var BG=`MapSet`,VG=`Patches`,HG=`ArrayMethods`,UG={};function WG(e){let t=UG[e];return t||uG(0,e),t}var GG=e=>!!UG[e],KG,qG=()=>KG,bue=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:GG(BG)?WG(BG):void 0,arrayMethodsPlugin_:GG(HG)?WG(HG):void 0});function JG(e,t){t&&(e.patchPlugin_=WG(VG),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function YG(e){XG(e),e.drafts_.forEach(xue),e.drafts_=null}function XG(e){e===KG&&(KG=e.parent_)}var ZG=e=>KG=bue(KG,e);function xue(e){let t=e[lG];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function QG(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[lG].modified_&&(YG(t),uG(4)),bG(e)&&(e=$G(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[lG].base_,e,t)}else e=$G(t,n);return Sue(t,e,!0),YG(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===sG?void 0:e}function $G(e,t){if(zG(t))return t;let n=t[lG];if(!n)return iK(t,e.handledSet_,e);if(!tK(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);rK(n,e)}return n.copy_}function Sue(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&LG(t,n)}function eK(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var tK=(e,t)=>e.scope_===t,Cue=[];function nK(e,t,n,r){let i=PG(e),a=e.type_;if(r!==void 0&&EG(i,r,a)===t){DG(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;CG(i,(e,n)=>{if(yG(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Cue;for(let e of o)DG(i,e,n,a)}function wue(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!tK(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=FG(i);nK(e,i.draft_??i,a,n),rK(i,r)})}function rK(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}eK(e)}}function Tue(e,t,n){let{scope_:r}=e;if(yG(n)){let i=n[lG];tK(i,r)&&i.callbacks_.push(function(){uK(e),nK(e,n,FG(i),t)})}else bG(n)&&e.callbacks_.push(function(){let i=PG(e);e.type_===3?i.has(n)&&iK(n,r.handledSet_,r):EG(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&iK(EG(e.copy_,t,e.type_),r.handledSet_,r)})}function iK(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||yG(e)||t.has(e)||!bG(e)||zG(e)?e:(t.add(e),CG(e,(r,i)=>{if(yG(i)){let t=i[lG];tK(t,n)&&(DG(e,r,FG(t),e.type_),eK(t))}else bG(i)&&iK(i,t,n)}),e)}function Eue(e,t){let n=OG(e),r={type_:+!!n,scope_:t?t.scope_:qG(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=aK;n&&(i=[r],a=oK);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var aK={get(e,t){if(t===lG)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=PG(e);if(!TG(i,t,e.type_))return Oue(e,i,t);let a=i[t];if(e.finalized_||!bG(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&vue(t))return a;if(a===sK(e.base_,t)||Due(e,t,a)){uK(e);let n=e.type_===1?+t:t,r=dK(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in PG(e)},ownKeys(e){return Reflect.ownKeys(PG(e))},set(e,t,n){let r=cK(PG(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=sK(PG(e),t),i=r?.[lG];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(_ue(n,r)&&(n!==void 0||TG(e.base_,t,e.type_)))return!0;uK(e),lK(e)}return e.copy_[t]===n&&(n!==void 0||TG(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Tue(e,t,n),!0)},deleteProperty(e,t){return uK(e),sK(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),lK(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=PG(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[_G]:!0,[hG]:e.type_!==1||t!==`length`,[gG]:r[gG],[vG]:n[t]}},defineProperty(){uG(11)},getPrototypeOf(e){return fG(e.base_)},setPrototypeOf(){uG(12)}},oK={};for(let e in aK){let t=aK[e];oK[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}oK.deleteProperty=function(e,t){return oK.set.call(this,e,t,void 0)},oK.set=function(e,t,n){return aK.set.call(this,e[0],t,n,e[0])};function sK(e,t){let n=e[lG];return(n?PG(n):e)[t]}function Due(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!bG(n)||n[lG]?!1:e.baseRefs_.has(n)}function Oue(e,t,n){let r=cK(t,n);return r?vG in r?r[vG]:r.get?.call(e.draft_):void 0}function cK(e,t){if(!(t in e))return;let n=fG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=fG(n)}}function lK(e){e.modified_||(e.modified_=!0,e.parent_&&lK(e.parent_))}function uK(e){e.copy_||=(e.assigned_=new Map,IG(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kue=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(MG(e)&&!MG(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}MG(t)||uG(6),n!==void 0&&!MG(n)&&uG(7);let r;if(bG(e)){let i=ZG(this),a=dK(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?YG(i):XG(i)}return JG(i,n),QG(r,i)}if(!e||!jG(e)){if(r=t(e),r===void 0&&(r=e),r===sG&&(r=void 0),this.autoFreeze_&&LG(r,!0),n){let t=[],i=[];WG(VG).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}uG(1,e)},this.produceWithPatches=(e,t)=>{if(MG(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},NG(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),NG(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),NG(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){bG(e)||uG(8),yG(e)&&(e=fK(e));let t=ZG(this),n=dK(t,e,void 0);return n[lG].isManual_=!0,XG(t),n}finishDraft(e,t){let n=e&&e[lG];(!n||!n.isManual_)&&uG(9);let{scope_:r}=n;return JG(r,t),QG(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=WG(VG).applyPatches_;return yG(e)?r(e,t):this.produce(e,e=>r(e,t))}};function dK(e,t,n,r){let[i,a]=kG(t)?WG(BG).proxyMap_(t,n):AG(t)?WG(BG).proxySet_(t,n):Eue(t,n);return(n?.scope_??qG()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?wue(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function fK(e){return yG(e)||uG(10,e),pK(e)}function pK(e){if(!bG(e)||zG(e))return e;let t=e[lG],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=IG(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=IG(e,!0);return CG(n,(e,t)=>{DG(n,e,pK(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var mK=new kue().produce,hK=e=>e;function gK(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Aue=gK(),jue=gK,Mue=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?aG:aG.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function _K(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(QK(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>oG(t)&&t.type===e,n}var vK=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function yK(e){return bG(e)?mK(e,()=>{}):e}function bK(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Nue(e){return typeof e==`boolean`}var Pue=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new vK;return t&&(Nue(t)?a.push(Aue):a.push(jue(t.extraArgument))),a},xK=`RTK_autoBatch`,SK=()=>e=>({payload:e,meta:{[xK]:!0}}),CK=e=>t=>{setTimeout(t,e)},Fue=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},wK=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?Fue(window.requestAnimationFrame,100):CK(10):e.type===`callback`?e.queueNotification:CK(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[xK],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Iue=e=>function(t){let{autoBatch:n=!0}=t??{},r=new vK(e);return n&&r.push(wK(typeof n==`object`?n:void 0)),r};function Lue(e){let t=Pue(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(nG(n))c=iG(n);else throw Error(QK(1));let l;l=typeof r==`function`?r(t):t();let u=aG;i&&(u=Mue({trace:!1,...typeof i==`object`&&i}));let d=Iue(hue(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return rG(c,o,p)}function TK(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(QK(28));if(r in t)throw Error(QK(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Rue(e){return typeof e==`function`}function zue(e,t){let[n,r,i]=TK(t),a;if(Rue(e))a=()=>yK(e());else{let t=yK(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(yG(e)){let r=n(e,t);return r===void 0?e:r}if(bG(e))return mK(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var Bue=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Vue=(e=21)=>{let t=``,n=e;for(;n--;)t+=Bue[Math.random()*64|0];return t},Hue=Symbol.for(`rtk-slice-createasyncthunk`);function Uue(e,t){return`${e}/${t}`}function Wue({creators:e}={}){let t=e?.asyncThunk?.[Hue];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(QK(11));let i=(typeof e.reducers==`function`?e.reducers(Kue()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(QK(12));if(n in o.sliceCaseReducersByType)throw Error(QK(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:Uue(n,r),createNotation:typeof e.reducers==`function`};Jue(a)?Xue(o,a,s,t):que(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?TK(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return zue(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=bK(d,r,m)),i}function i(t=l){return bK(bK(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=Gue(a,t,()=>bK(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function Gue(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var EK=Wue();function Kue(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function que({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Yue(r))throw Error(QK(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?_K(e,o):_K(e))}function Jue(e){return e._reducerDefinitionType===`asyncThunk`}function Yue(e){return e._reducerDefinitionType===`reducerWithPrepare`}function Xue({type:e,reducerName:t},n,r,i){if(!i)throw Error(QK(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||DK,pending:s||DK,rejected:c||DK,settled:l||DK})}function DK(){}var Zue=`task`,OK=`listener`,kK=`completed`,AK=`cancelled`,Que=`task-${AK}`,$ue=`task-${kK}`,jK=`${OK}-${AK}`,ede=`${OK}-${kK}`,MK=class{constructor(e){this.code=e,this.message=`${Zue} ${AK} (reason: ${e})`}code;name=`TaskAbortError`;message},NK=(e,t)=>{if(typeof e!=`function`)throw TypeError(QK(32))},PK=()=>{},FK=(e,t=PK)=>(e.catch(t),e),IK=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),LK=e=>{if(e.aborted)throw new MK(e.reason)};function RK(e,t){let n=PK;return new Promise((r,i)=>{let a=()=>i(new MK(e.reason));if(e.aborted){a();return}n=IK(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=PK})}var tde=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof MK?`cancelled`:`rejected`,error:e}}finally{t?.()}},zK=e=>t=>FK(RK(e,t).then(t=>(LK(e),t))),BK=e=>{let t=zK(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:VK}=Object,HK={},UK=`listenerMiddleware`,nde=(e,t)=>{let n=t=>IK(e,()=>t.abort(e.reason));return(r,i)=>{NK(r,`taskExecutor`);let a=new AbortController;n(a);let o=tde(async()=>{LK(e),LK(a.signal);let t=await r({pause:zK(a.signal),delay:BK(a.signal),signal:a.signal});return LK(a.signal),t},()=>a.abort($ue));return i?.autoJoin&&t.push(o.catch(PK)),{result:zK(e)(o),cancel(){a.abort(Que)}}}},rde=(e,t)=>{let n=async(n,r)=>{LK(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await RK(t,Promise.race(a));return LK(t),e}finally{i()}};return((e,t)=>FK(n(e,t)))},WK=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=_K(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(QK(21));return NK(a,`options.listener`),{predicate:i,type:t,effect:a}},GK=VK(e=>{let{type:t,predicate:n,effect:r}=WK(e);return{id:Vue(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(QK(22))}}},{withTypes:()=>GK}),KK=(e,t)=>{let{type:n,effect:r,predicate:i}=WK(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},qK=e=>{e.pending.forEach(e=>{e.abort(jK)})},ide=(e,t)=>()=>{for(let e of t.keys())qK(e);e.clear()},JK=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},YK=VK(_K(`${UK}/add`),{withTypes:()=>YK}),ade=_K(`${UK}/removeAll`),XK=VK(_K(`${UK}/remove`),{withTypes:()=>XK}),ode=(...e)=>{console.error(`${UK}/error`,...e)},ZK=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=ode}=e;NK(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&qK(e)}),c=(e=>{let n=KK(t,e)??GK(e);return s(n)});VK(c,{withTypes:()=>c});let l=e=>{let n=KK(t,e);return n&&(n.unsubscribe(),e.cancelActive&&qK(n)),!!n};VK(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=rde(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,VK({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:BK(u.signal),pause:zK(u.signal),extra:a,signal:u.signal,fork:nde(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(jK),n.delete(e))})},cancel:()=>{u.abort(jK),e.pending.delete(u)},throwIfCancelled:()=>{LK(u.signal)}})))}catch(e){e instanceof MK||JK(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(ede),i(e),e.pending.delete(u)}},d=ide(t,n);return{middleware:e=>n=>r=>{if(!oG(r))return n(r);if(YK.match(r))return c(r.payload);if(ade.match(r)){d();return}if(XK.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===HK)throw Error(QK(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,JK(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=HK}return s},startListening:c,stopListening:l,clearListeners:d}};function QK(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $K=EK({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),eq=$K.actions,sde=eq.setMargin,cde=eq.setLayout,lde=eq.setChartSize,ude=eq.setScale,dde=$K.reducer;function tq(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function nq(e){return Number.isFinite(e)}function rq(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function iq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aq(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(dle(c)){if(c===`top`&&mU(e.top))return aq(aq({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&mU(e.bottom))return aq(aq({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&mU(e.left))return aq(aq({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&mU(e.right))return aq(aq({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&mU(e[a]))return aq(aq({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&mU(e[o]))return aq(aq({},e),{},{[o]:e[o]+(i||0)})}return e},sq=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,cq=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},lq=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?dU(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return nq(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(CU):c&&l?l.map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(CU):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(CU):o.domain().map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(CU)},uq={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Ale,none:aW,silhouette:jle,wiggle:Mle,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},dq=(e,t,n)=>{var r=uq[n]??aW,i=kle().keys(t).value((e,t)=>Number(oq(e,t,0))).order(oW).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=oq(e[i],t[r],0);Array.isArray(a)&&a.length===2&&mU(a[0])&&mU(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function fq(e){return e==null?void 0:String(e)}function pq(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!xU(i[t.dataKey])){var s=bU(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=oq(i,xU(o)?t.dataKey:o),l=t.scale.map(c);return mU(l)?l:null}var mq=e=>{var t=e.flat(2).filter(mU);return[Math.min(...t),Math.max(...t)]},hq=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],gq=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return hq(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=mq(tq(r,t,n));return!nq(i[0])||!nq(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},_q=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yq=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=XW(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function bq(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return aq(aq({},t),{},{dataKey:n,payload:r,value:i,name:a})}function xq(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Sq=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Cq=(e,t)=>t===`centric`?e.angle:e.radius,wq=e=>e.layout.width,Tq=e=>e.layout.height,Eq=e=>e.layout.scale,Dq=e=>e.layout.margin,Oq=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),kq=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Aq=`data-recharts-item-index`;function jq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mq(e){for(var t=1;te.brush.height;function Lq(e){return kq(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Rq(e){return kq(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function zq(e){return Oq(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Bq(e){return Oq(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Vq=$([wq,Tq,Dq,Iq,Lq,Rq,zq,Bq,ZW,pue],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Mq(Mq({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=hde(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Mq(Mq({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Hq=$(Vq,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Uq=$(wq,Tq,(e,t)=>({x:0,y:0,width:e,height:t})),Wq=(0,v.createContext)(null),Gq=()=>(0,v.useContext)(Wq)!=null,Kq=e=>e.brush,qq=$([Kq,Vq,Dq],(e,t,n)=>({height:e.height,x:mU(e.x)?e.x:t.left,y:mU(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:mU(e.width)?e.width:t.width}));function Jq(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Yq(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=Jq(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Xq(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Yq(e,t,{leading:r,maxWait:t,trailing:i})}var Zq=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},Qq={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},$q=(e,t,n)=>{var r=n.width,i=r===void 0?Qq.width:r,a=n.height,o=a===void 0?Qq.height:a,s=n.aspect,c=n.maxHeight,l=pU(i)?e:Number(i),u=pU(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},eJ={width:0,height:0,overflow:`visible`},tJ={width:0,overflowX:`visible`},nJ={height:0,overflowY:`visible`},rJ={},iJ=e=>{var t=e.width,n=e.height,r=pU(t),i=pU(n);return r&&i?eJ:r?tJ:i?nJ:rJ};function aJ(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=Qq.width,a=Qq.height):i===void 0?i=r&&r>0?void 0:Qq.width:a===void 0&&(a=r&&r>0?void 0:Qq.height),{width:i,height:a}}var oJ=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function sJ(){return sJ=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let e=a.current,t=o.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){Z.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),a=r.getBoundingClientRect();Z.to(t,{x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height,autoAlpha:1,duration:n?MV(kV.base):0,ease:AV.out,overwrite:!0})};n(s.current),s.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),Z.killTweensOf(t)}},[e,n]),(0,G.jsxs)(`div`,{ref:a,className:`filter-toggle relative inline-flex ${i??``}`,children:[(0,G.jsx)(`span`,{ref:o,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,G.jsx)(iM,{"aria-label":r,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,G.jsxs)(qA,{id:e.id,className:`relative z-[1]`,style:hce,children:[e.icon,e.label]},e.id))})]})}function mH(e,t=!1){if(!e)return;let n=e.toDate(Qw());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function hH(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return vT(Gne(new Date(t).toISOString()))}catch{return null}}function gH({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,G.jsx)(SA,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(lk.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,G.jsx)(lk.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,G.jsx)(lk.Segment,{segment:e})}),(0,G.jsx)(SA.RangeSeparator,{}),(0,G.jsx)(lk.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,G.jsx)(lk.Segment,{segment:e})}),(0,G.jsx)(lk.Suffix,{children:(0,G.jsx)(SA.Trigger,{children:(0,G.jsx)(SA.TriggerIndicator,{})})})]}),(0,G.jsxs)(SA.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,G.jsxs)(CI,{"aria-label":n,children:[(0,G.jsxs)(CI.Header,{children:[(0,G.jsxs)(CI.YearPickerTrigger,{children:[(0,G.jsx)(CI.YearPickerTriggerHeading,{}),(0,G.jsx)(CI.YearPickerTriggerIndicator,{})]}),(0,G.jsx)(CI.NavButton,{slot:`previous`}),(0,G.jsx)(CI.NavButton,{slot:`next`})]}),(0,G.jsxs)(CI.Grid,{children:[(0,G.jsx)(CI.GridHeader,{children:e=>(0,G.jsx)(CI.HeaderCell,{children:e})}),(0,G.jsx)(CI.GridBody,{children:e=>(0,G.jsx)(CI.Cell,{date:e})})]}),(0,G.jsx)(CI.YearPickerGrid,{children:(0,G.jsx)(CI.YearPickerGridBody,{children:({year:e})=>(0,G.jsx)(CI.YearPickerCell,{year:e})})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(IN,{className:`text-xs`,children:r}),(0,G.jsx)(LA,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,G.jsx)(LA.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(LA.Input,{children:e=>(0,G.jsx)(LA.Segment,{segment:e})})})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(IN,{className:`text-xs`,children:i}),(0,G.jsx)(LA,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,G.jsx)(LA.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,G.jsx)(LA.Input,{children:e=>(0,G.jsx)(LA.Segment,{segment:e})})})})]})]})]})]})})}var _H={today:`statsWindowToday`,1:`statsWindow1h`,24:`statsWindow24h`,168:`statsWindow7d`,720:`statsWindow30d`,custom:`statsWindowCustom`};function vH(e,t){if(e===`today`){let e=new Date;return e.setHours(0,0,0,0),{from:e.toISOString()}}if(e===`custom`){let e=mH(t?.start),n=mH(t?.end,!0);return e&&n?{from:e,to:n}:null}if(e===`720`){let e=new Date;return{from:new Date(e.getTime()-2592e6).toISOString(),to:e.toISOString()}}return{hours:Number(e)}}function yH({value:e,onChange:t,custom:n,onCustomChange:r,onBusy:i,t:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{value:e,onChange:r=>{let a=r;e!==a&&((a!==`custom`||n)&&i?.(),t(a))},ariaLabel:a(`statsTraffic`),options:Object.keys(_H).map(e=>({id:e,label:a(_H[e])}))}),e===`custom`?(0,G.jsx)(gH,{className:`w-[min(100%,24rem)]`,value:n,onChange:e=>{e&&i?.(),r(e)},ariaLabel:a(`statsWindowCustom`),fromLabel:a(`logsTimeFrom`),toLabel:a(`logsTimeTo`)}):null]})}function bH(e,t,n){let r=new URLSearchParams;for(let[t,n]of Object.entries(e))n&&r.set(t,n);let i=Date.parse(t),a=Date.parse(n);return Number.isFinite(i)&&Number.isFinite(a)&&(r.set(`from`,new Date(Math.floor(i/6e4)*6e4).toISOString()),r.set(`to`,new Date(Math.ceil(a/6e4)*6e4-6e4).toISOString())),`/logs?${r}`}function xH(e){let t=String(e||``).toLowerCase();return!t||t===`qoder`||t===`qoder-global`||t===`qoder-cn`}function SH(e){return String(e||``).toLowerCase()===`workbuddy`}function CH(e){return String(e||``).toLowerCase()===`trae`}function wH(e){return String(e||``).toLowerCase()===`devin`}function TH(e){return String(e||``).toLowerCase()===`command`}function EH(e){return String(e||``).toLowerCase()===`zhipu`}function DH(e){return String(e||``).toLowerCase()===`qwenwork`}function OH(e){return String(e||``).toLowerCase()===`kimi`}function kH(e){let t=String(e||``).toLowerCase();return t===`meta`||t===`muse`}function AH(e,t){let n=String(e||``).toLowerCase();return SH(n)?`WorkBuddy`:CH(n)?`Trae`:wH(n)?`Devin`:TH(n)?`Command Code`:EH(n)?`Zhipu GLM`:DH(n)?`QwenWork`:OH(n)?`Kimi Code`:kH(n)?`Muse (Meta)`:xH(n)?`Qoder`:e||t(`account`)}function jH(e,t,n){let r=String(e||``).toLowerCase(),i=String(t||``).toLowerCase();return SH(r)?n(i===`global`?`accountTypeWorkBuddyGlobal`:`accountTypeWorkBuddyCN`):CH(r)?n(`accountTypeTraeCN`):wH(r)?n(`accountTypeDevinGlobal`):TH(r)?n(`accountTypeCommandGlobal`):EH(r)?n(`accountTypeZhipuCN`):DH(r)?n(i===`cn`?`accountTypeQwenworkCN`:`accountTypeQwenworkGlobal`):OH(r)?n(`accountTypeKimiCN`):kH(r)?n(`accountTypeMetaGlobal`):xH(r)?n(i===`cn`?`accountTypeQoderCN`:`accountTypeQoderGlobal`):e||n(`account`)}function gce(e,t){let n=t??!!e.max_mode,r=e.catalog_context_length||e.default_context_length||e.context_length||0,i=e.catalog_context_length_max||0;return n&&i>0?{context_length:i,prompt_max_tokens:e.prompt_max_tokens_max||e.prompt_max_tokens,max_output_tokens:e.max_output_tokens_max||e.max_output_tokens}:{context_length:r,prompt_max_tokens:e.prompt_max_tokens,max_output_tokens:e.max_output_tokens}}function _ce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#0a84ff] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`C`})}function vce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.1 6.1 0 0 1 3.046-.415q2 .23 3.564 1.7a.12.12 0 0 0 .107.029q2.112-.519 4.061.366l.063.03l.154.076q2.036 1.055 2.918 3.198a5.6 5.6 0 0 1 .421 2.126 5.7 5.7 0 0 1-.18 1.631.17.17 0 0 0 .04.155 6 6 0 0 1 1.578 2.891q.577 2.852-1.183 5.14l-.182.22a6.06 6.06 0 0 1-2.934 1.851.16.16 0 0 0-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451q-2.374-.012-4.21-1.736a.14.14 0 0 0-.14-.032 5.9 5.9 0 0 1-1.604-.185 5.9 5.9 0 0 1-2.595-.622 6.06 6.06 0 0 1-2.146-1.781c-.203-.269-.404-.522-.551-.821a8 8 0 0 1-.495-1.283 6.1 6.1 0 0 1-.017-3.064.2.2 0 0 0 .008-.074.1.1 0 0 0-.037-.064 6 6 0 0 1-1.38-2.202 5.2 5.2 0 0 1-.333-1.589 6.9 6.9 0 0 1 .188-2.132q.675-2.226 2.577-3.493.424-.282.802-.438.429-.179.861-.304a.13.13 0 0 0 .087-.087A6 6 0 0 1 5.635 2.31Q6.655 1.04 8.086.457m-.804 7.85a.848.848 0 0 0-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 0 0 1.46.864l1.94-3.272a.85.85 0 0 0 .007-.854zm5.446 6.24a.849.849 0 0 0 0 1.695h4.848a.849.849 0 0 0 0-1.696z`})})}function yce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`D`})}function bce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,d:`M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79Z`})})}function xce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M8 6a4 4 0 0 0 0 8c.9 0 1.7-.3 2.4-.8L14 16.8A4 4 0 1 0 16 8a3.9 3.9 0 0 0-2.4.8L10 5.2A4 4 0 0 0 8 6Zm0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm8 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z`,clipRule:`evenodd`})})}var Sce=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAJ5ElEQVR42u2dXUxUZxrH/wKDDDCM4CJBZJZNxMpGDMGYXsAWeikapF6Jqc02kUhWTWsTIQHjNk22yWCyN5INrk22rbsc71ZNpXfb0sJ+Gcxmma2mNpt1XMsaLd2ZoY7D5164btfiBx8zzDnv+f1uiWeG9/x8eN7neT9WFRaunROAIWQwBIDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAACA0IDYDQAAgNgNAA35LFEDyZ6uotKi8PqL6+ToFAuQoK/PL7/fL7CyRJ4fBNRaMRhcM3FQ6HFQqFNDoaUiQSYfDSxCqO031U4Lq6OjU1Nam6eov8fv+inxGJRDQ6GtLAwIAs6xxyI/TK0tTUpJ07d6iurk6BQCCpz45EIurrO62+vtOIjdCpIxAIqLPzWEokRmyEXjHq6+vU0dGh+vq6tHw+YiN00iJyb++ptImM2Aid1NSitbXVlt8vEomoq+u4LMvCRIR+Oq2trersPLYiOfJyCYfD6u4+rkuXBjASoZ0VlZ/G0NCwenp6NDQ0jJkI/aCOfPbs+46IyogtWt9Po739oAYHP3a8zNKDaszFixd08eIF20xkidArSGdnhzo7O4x9SZZlKRg8qXA4jLGmC/322z9Te/tBV7ysvr7TCgZ7KPWZKnRv7ynt29fqqhdGDdtQod0oM2IbKrSb0gzEXhyZXm/um06bAL7++muY/F9ycnJUX1+nPXteUiQSVSgUIkI75cvu29eq3t5TWKyndx0PHz7i2hq2Y4QOBAIaHPxoSYvu3YhbmzOOENrv92tw8CMjmiaILTqFnZ0dyKzldx2rq7cQoe3yQkB0HZ0uNKlG6ggGe4ws9dlaaOrNSyM2e0+3pu4oOntPX07dnffzzasDKvMUazY2ZVwN27ZCV1dv0eDgx9i5AK4lbuhy/Joux6/q1vRdXUvcWNC/K8sq1nbvZpXeX6N/9X+m3/zyrOPFtq3QLJ18egT+c/yqfjcx8j+Jk8GmyfWaOPOFRt4bRGgmgqnnfPRTnY99osvxayn9nJmxuKI/v6r7g7cRmuicXG5N3dEvxn+b1Ei8UCZHxvXvt/6qmbE4QhOdkyPy+dinaf0ec7Fpxd65rm+sf4jDGpdAR0eH3L4Ww7LO6Z2KQWVvK0p/xPNlqeBolTLyPYqduS46hVpc3dnNqYZlWWpublEw2GO775bftlFrTmwlQmuRG13dGpWDwZO2P3DGu6tMM2NxW0dqhE4zo6Mh7d//imNa0fltGyXJtlJn2Gky6LalocFgjxoaGh23riK/baMt8ntbC93U1OQqmbu6um2ZKy+UNSe2KsPnQWg98Sy6vXLLHsD9+19RX99pR/8emaVe5R/YiNB6wm4UN6QbkUhEzc27jTmUMa+1QpmlXoSen27scI3Mo6NmbWL1tVUitB6zss50TJRZelDKs1OUtoXQdXVmN1MOHz5ipMwPyWksQWj9X3fQ5B0pwWCP+vvNPqE/b28FQn87ISw39kX391uOLs1pERUPz6YChJak8vKAse3s7u7jcgvZtUUIbWqEflhrdtNZczkNJQj9MIc2MW82eRL4OEg5DBV6aGjY8V1ALXHddOZ6L0L7/QUyrUTnVrJKcxHatFTDzfeg2KHBgtBJPng8aS/GhivZENpl0TmZVY1VviwGFaGVtpqzGyeCRGiZe91a0l9MvoeBRej05M6WdS65L8XnIeVA6PRF52R3BO22aB6hSTdkQtcNoeW++0tSsV4ja5OPwUVopeGko3MyeV0EQrtsMjgwkJrNrp5KhEboFWZ4ODXpRva2IiocCJ2e/DkVrK5dy+Ai9MozMPBhSp5r1yO2EFpmt7pTsaouw+exzVYmhHYRoVDI+N3TCE3+LFP25SG061KOmynJnWmoILQxKYfdzohDaLmrqaIkL0ZiMojQxghNdDZI6Egk6riSXbKjs3dXGSaaI3TE1S9gzU+3YiFCm0H2tiJyZ9OETkUJzEkX74BhQkej7ozQvrZKtlqZKLTbDjWUHizgf3iBJRiYQ7tJ6gyfR/4T1Zhnch06FBp1zYDnt21ki5XpQg8N/d4Vg+3dVcaKOjcIPTw8LDfkzf6jP8Q4NwgdDodTtuFUNjnzrfBkLXsF3bSW49KlD42VeW3f85To3Ca0ZVnGHRaOzC5fbRcMnkRmMEdoU6I0MiO0MVEamRF6XpS2LGfejZ3XWqHiX9cjM0LPj9JOSz0K3qhSwdEqSnMIrcfWpZubWxyxVjqz1Kt1FxrpACL0QqTebWupfW2VWnehkRQDobXgpaXd3cdtJ3Xurg1ad6GRJaAIvXj6+y01N++2TU6dWeqV/0Q1URmhlxepm5tbUnYEFyB02nLqrq5u1+8UB4MOmunrO62amtqkX0UMCK10btsKBnvSInZBZh7WIHRqxW5oeHHFuou+jFysQejU59eHDh1RTU3tikwcN6/+PuYg9MpNHJubd6dU7LKs72EOQmtFT9hPpdjPrQ5gDkKbI/Z2bxXmIHT6xT506EhSOo5V5NAILZusta6pqV12c8aXkavt3s3Yg9AypjnT4nsBexBaxjRniNAI7QixF0qZp1gtvh9hEELbX+yFdh1/UvQSA4fQckTXsaGh8ZmlPqI0QjuGB2uwn13DJkojtExqzpR5ipEaoZ0t9nebM4eK9rC+Q9LMWByhnSh2TU3tvK7jr8q6XC+1HYTO9Hpz30RTLekCe8s6p0QioerqLSrOLdJ2b5U+nPijJuembP3d52LTWrU6I+nPjAT/prnJWYR2KolEQsPDw3r33feUSCT0Yk29NuSV6HL8qm2ljn9wS18f/4vuf3JbWaW5ylyfnN3r37z/dyX+cCftv9+qwsK1c6iZHPx+v9rbD6rx1R16baJXsdl7tkoHIm+NKjHylb57m63vQKWytxUt69l3Xx7WbGwKoU0V++U3XtVnLfd1LXEj7SJPnPlC9z745zPPG8ndtUF5eysWdT7fzFhcXx+7oqnPo7YYe4ROIYUb1ir/QKWmmwpX/LMnR8YVv3TrmSI/7h7FvL0VCxJ7Ziyur9r/ZIvJIEKvID94/jlFf7xmWX/WFxotJ0fGFTtzfdmSZfg88u4sU05DiTybCh6Re6n/WRDaMLK3FSmnoUS5Ozck7djdyZFx3R+8rckr4yn9s/9w8jjzZdzWY4zQSs/1yFmbfMppKFHOCyULrjTMxaY19XlUU9ejmhwZ1+SVcVtMxBAa5gmeWepVZqlXGT7PIz+bjU1pbmJa02P3bB8dERqA1jcAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQAQgNCAyA0AEIDIDQgNABCAyA0AEIDIDQgNABCAyA0AEIDLIj/ABWOKFxbGBRBAAAAAElFTkSuQmCC`;function Cce({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Sce,alt:``,width:e,height:e,className:`block shrink-0 rounded-[22%] ${t}`.trim(),draggable:!1})}function wce({size:e=16,className:t=``}){let n=Math.max(2,Math.round(e*.14));return(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-baseline justify-center rounded-[22%] bg-[#18181B] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.5)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:[(0,G.jsx)(`span`,{style:{alignSelf:`center`},children:`Q`}),(0,G.jsx)(`span`,{style:{alignSelf:`center`,width:n,height:n,marginLeft:Math.max(0,Math.round(e*.03)),borderRadius:`50%`,background:`#22D3EE`}})]})}function Tce({size:e=16,className:t=``}){return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-[22%] bg-[#1a1a1a] text-white ${t}`.trim(),style:{width:e,height:e,fontSize:Math.max(9,Math.round(e*.55)),fontWeight:650,lineHeight:1},"aria-hidden":`true`,children:`T`})}var Ece=`/assets/workbuddy-mark-D1Gu2IKl.svg`;function Dce({size:e=16,className:t=``}){return(0,G.jsx)(`img`,{src:Ece,alt:``,width:e,height:e,className:`block shrink-0 ${t}`.trim(),draggable:!1})}function Oce({size:e=16,className:t=``}){return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`block shrink-0 text-foreground ${t}`.trim(),"aria-hidden":`true`,children:(0,G.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M11.991 23.503a.24.24 0 0 0-.244.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.22-.247zM9.671 5.365a1.697 1.697 0 0 1 1.099 2.132l-.071.172l-.016.04l-.018.054c-.07.16-.104.32-.104.498c-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523c-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368c0 .124.018.23.053.337c.209.373.54.658.96.8c.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711c.854.284 1.378 1.226 1.099 2.167a1.66 1.66 0 0 1-2.077 1.102a1.7 1.7 0 0 1-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 0 0-1.954.746a1.66 1.66 0 0 1-1.065.764a1.677 1.677 0 0 1-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.5 1.5 0 0 1 .296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.3 1.3 0 0 0-.227-.693a2.5 2.5 0 0 1-.366-1.403a2.4 2.4 0 0 1 .366-1.208c.14-.195.21-.444.227-.693c.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.4 1.4 0 0 1-.299-.07l-.05-.019a1.7 1.7 0 0 1-1.047-2.114a1.68 1.68 0 0 1 2.094-1.101m-5.575 10.11c.26-.264.639-.367.994-.27s.633.379.728.74c.095.362-.007.748-.267 1.013c-.402.41-1.053.41-1.455 0a1.06 1.06 0 0 1 0-1.482zm14.845-.294c.359-.09.738.024.992.297c.254.274.344.665.237 1.025s-.396.634-.756.718c-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 0 1 .757-1.26zm-.064-4.39c.314.32.49.753.49 1.206s-.176.886-.49 1.206c-.315.32-.74.5-1.185.5c-.444 0-.87-.18-1.184-.5a1.727 1.727 0 0 1 0-2.412a1.654 1.654 0 0 1 2.369 0m-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 0 1-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 0 1 1.33-1.038a1.66 1.66 0 0 1 1.547.652m11.545-4.221c.368 0 .708.2.892.524s.184.724 0 1.048a1.03 1.03 0 0 1-.892.524a1.04 1.04 0 0 1-1.03-1.048a1.04 1.04 0 0 1 1.03-1.048m-14.358 0c.368 0 .707.2.891.524s.184.724 0 1.048a1.03 1.03 0 0 1-.891.524a1.04 1.04 0 0 1-1.03-1.048c0-.579.461-1.048 1.03-1.048m10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705s-1.674-.763-1.674-1.705s.75-1.706 1.674-1.706m-2.626-.684c.362-.082.653-.356.761-.718a1.06 1.06 0 0 0-.238-1.028a1.02 1.02 0 0 0-.996-.294c-.547.14-.881.7-.752 1.257c.13.558.675.907 1.225.783m0 16.876c.359-.087.644-.36.75-.72a1.06 1.06 0 0 0-.237-1.019a1.02 1.02 0 0 0-.985-.301a1.04 1.04 0 0 0-.762.717c-.108.361-.017.754.239 1.028c.245.263.606.377.953.305zM17.19 3.5a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64a.63.63 0 0 0-.628.64c0 .355.28.64.628.64m-10.38 0a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64a.63.63 0 0 0-.628.64c0 .355.279.64.628.64m-5.182 7.852a.63.63 0 0 0-.628.64c0 .354.28.639.628.639a.63.63 0 0 0 .627-.606l.001-.034a.62.62 0 0 0-.628-.64zm5.182 9.13a.63.63 0 0 0-.628.64c0 .355.279.64.628.64a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64m10.38.018a.63.63 0 0 0-.628.64c0 .355.28.64.628.64a.63.63 0 0 0 .628-.64a.63.63 0 0 0-.628-.64m5.182-9.148a.63.63 0 0 0-.628.64c0 .354.279.639.628.639a.63.63 0 0 0 .628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 0 0 .244-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249c0 .142.122.249.244.249M11.991.497a.24.24 0 0 0 .245-.248A.24.24 0 0 0 11.99 0a.24.24 0 0 0-.244.249c0 .133.108.236.223.247zM2.011 6.36a.24.24 0 0 0 .245-.249a.24.24 0 0 0-.244-.249a.24.24 0 0 0-.244.249a.24.24 0 0 0 .244.249zm0 11.263a.24.24 0 0 0-.243.248a.24.24 0 0 0 .244.249a.24.24 0 0 0 .244-.249a.25.25 0 0 0-.244-.248zm19.995-.018a.24.24 0 0 0-.245.248a.24.24 0 0 0 .245.25a.24.24 0 0 0 .244-.25a.25.25 0 0 0-.244-.248z`})})}function MH({provider:e,size:t=16,className:n=``}){let r=String(e||``).toLowerCase();return r===`workbuddy`?(0,G.jsx)(Dce,{size:t,className:n}):r===`trae`?(0,G.jsx)(Tce,{size:t,className:n}):r===`devin`?(0,G.jsx)(yce,{size:t,className:n}):r===`command`?(0,G.jsx)(_ce,{size:t,className:n}):r===`codex`?(0,G.jsx)(vce,{size:t,className:n}):r===`zhipu`?(0,G.jsx)(Oce,{size:t,className:n}):r===`qwenwork`?(0,G.jsx)(wce,{size:t,className:n}):r===`kimi`?(0,G.jsx)(bce,{size:t,className:n}):r===`meta`||r===`muse`?(0,G.jsx)(xce,{size:t,className:n}):(0,G.jsx)(Cce,{size:t,className:n})}var kce=(0,v.lazy)(()=>C(()=>import(`./LiveSparkline-DEWBslJX.js`).then(e=>({default:e.LiveSparkline})),[]));function Ace({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,G.jsxs)(G.Fragment,{children:[n(`liveConcurrency`),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,G.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,G.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,G.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex items-center`,children:(0,G.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,G.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-md text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,G.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,G.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,G.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`span`,{className:`inline-block h-6 w-[120px]`}),children:(0,G.jsx)(kce,{samples:t,capacity:a,label:n(`liveTrace`)})})]})]})}var jce=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Mce=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,Nce=Math.PI/180;180/Math.PI;var NH=Math.sin,PH=Math.cos,FH=Math.abs,IH=Math.sqrt,Pce=function(e){return typeof e==`number`},LH=1e5,RH=function(e){return Math.round(e*LH)/LH||0},zH=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001};function Fce(e,t,n,r,i,a,o){for(var s=e.length,c,l,u,d,f;--s>-1;)for(c=e[s],l=c.length,u=0;u1&&(n=IH(b)*n,r=IH(b)*r);var x=n*n,S=r*r,C=(x*S-x*y-S*v)/(x*y+S*v);C<0&&(C=0);var w=(a===o?-1:1)*IH(C),T=w*(n*_/r),E=w*-(r*g/n),D=(e+s)/2,O=(t+c)/2,k=D+(u*T-d*E),A=O+(d*T+u*E),j=(g-T)/n,M=(_-E)/r,N=(-g-T)/n,P=(-_-E)/r,F=j*j+M*M,I=(M<0?-1:1)*Math.acos(j/IH(F)),L=(j*P-M*N<0?-1:1)*Math.acos((j*N+M*P)/IH(F*(N*N+P*P)));isNaN(L)&&(L=f),!o&&L>0?L-=p:o&&L<0&&(L+=p),I%=p,L%=p;var R=Math.ceil(FH(L)/(p/4)),z=[],B=L/R,V=4/3*NH(B/2)/(1+PH(B/2)),H=u*n,ee=d*n,te=d*-r,ne=u*r,re;for(re=0;re-1e-4?0:t}).match(jce)||[],n=[],r=0,i=0,a=2/3,o=t.length,s=0,c=`ERROR: malformed path: `+e,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w=function(e,t,n,r){v=(n-e)/3,y=(r-t)/3,h.push(e+v,t+y,n-v,r-y,n,r)};if(!e||!isNaN(t[0])||isNaN(t[1]))return console.log(c),n;for(l=0;l.5||FH(i-f)>.5)&&(w(r,i,d,f),p===`L`&&(l+=2)),r=d,i=f;else if(p===`A`){if(S=t[l+4],C=t[l+5],v=t[l+6],y=t[l+7],u=7,S.length>1&&(S.length<3?(y=v,v=C,u--):(y=C,v=S.substr(2),u-=2),C=S.charAt(1),S=S.charAt(0)),b=Ice(r,i,+t[l+1],+t[l+2],+t[l+3],+S,+C,(m?r:0)+v*1,(m?i:0)+y*1),l+=u,b)for(u=0;ul*(w*w+T*T)&&(O=u.length,e(t,n,f,p,v,y,S,C,l,u,d),e(S,C,b,x,g,_,s,c,l,u,d+1+(u.length-O))),u},GH=function(){function e(e,t,n){VH||UH(),this.id=e,Bce&&this.setData(t,n)}var t=e.prototype;return t.setData=function(e,t){t||={},e||=`0,0,1,1`;var n=e.match(Vce),r=1,i=[],a=[],o=t.precision||1,s=o<=1,c,l,u,d,f,p,m,h,g;if(this.data=e,(Hce.test(e)||~e.indexOf(`M`)&&e.indexOf(`C`)<0)&&(n=Lce(e)[0]),c=n.length,c===4)n.unshift(0,0),n.push(1,1),c=8;else if((c-2)%6)throw`Invalid CustomEase`;for((+n[0]!=0||+n[c-2]!=1)&&Wce(n,t.height,t.originY),this.segment=n,d=2;dh.x||h.y!==m.y&&h.x===m.x||m===h)&&m.x<=1?(h.cx=m.x-h.x,h.cy=m.y-h.y,h.n=m,h.nx=m.x,s&&d>1&&Math.abs(h.cy/h.cx-i[d-2].cy/i[d-2].cx)>2&&(s=0),h.cxh||u===m-1)&&(c.push(g,_),l=(p-_)/(f-g)),g=f,_=p;c=`M`+c.join(`,`)}return s&&s.setAttribute(`d`,c),c},e}();GH.version=`3.15.0`,GH.headless=!0,HH()&&BH.registerPlugin(GH);var Kce=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function KH(e){return typeof e==`string`&&Kce.includes(e)}var qce=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function qH(e){return typeof e==`string`&&qce.has(e)}function JH(e){return typeof e==`string`&&e.startsWith(`data-`)}function YH(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qH(n)||JH(n))&&(t[n]=e[n]);return t}function XH(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return YH(t)}return typeof e==`object`&&!Array.isArray(e)?YH(e):null}function ZH(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(qH(n)||JH(n)||KH(n))&&(t[n]=e[n]);return t}function Jce(e){return e==null?null:(0,v.isValidElement)(e)?ZH(e.props):typeof e==`object`&&!Array.isArray(e)?ZH(e):null}var Yce=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function QH(){return QH=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Xce(e,Yce),d=a||{width:r,height:i,x:0,y:0},f=xs(`recharts-surface`,o);return v.createElement(`svg`,QH({},ZH(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),Qce=[`children`,`className`];function eU(){return eU=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=$ce(e,Qce),a=xs(`recharts-layer`,r);return v.createElement(`g`,eU({className:a},ZH(i),{ref:t}),n)});function nU(e){return e===`__proto__`}var tle=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function rU(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:tle.test(e);default:return!1}}function iU(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function aU(e){return typeof e==`symbol`||e instanceof Symbol}function nle(e){return e==null?``:oU(e)}function oU(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(oU).join(`,`);if(aU(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function sU(e){if(Array.isArray(e))return e.map(iU);if(typeof e==`symbol`)return[e];e=nle(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ile),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function uU(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+lU(i)+n},``)}var dU=e=>e===0?0:e>0?1:-1,fU=e=>typeof e==`number`&&e!=+e,pU=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,mU=e=>(typeof e==`number`||e instanceof Number)&&!fU(e),hU=e=>mU(e)||typeof e==`string`,ale=0,gU=e=>{var t=++ale;return`${e||``}${t}`},_U=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!mU(e)&&typeof e!=`string`)return n;var i;if(pU(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return fU(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},vU=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):cU(e,t))===n)}var xU=e=>e==null,SU=e=>xU(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function CU(e){return e!=null}function wU(){}function TU(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function EU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DU(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=TU(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?DU({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?DU({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?DU({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?DU({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?DU({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?DU({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?DU({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?DU({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(mU(n.x)||pU(n.x))&&(mU(n.y)||pU(n.y))?DU({x:c+_U(n.x,g),y:l+_U(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):DU({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ule=[`top`,`left`,`right`,`bottom`];function dle(e){return e==null?!1:typeof e==`object`||ule.includes(e)}var fle=(0,v.createContext)(null);function OU(e){return function(){return e}}var kU=Math.PI,AU=2*kU,jU=1e-6,ple=AU-jU;function MU(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return MU;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tjU){if(!(Math.abs(u*s-c*l)>jU)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((kU-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>jU&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>jU||Math.abs(this._y1-l)>jU)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%AU+AU),d>ple?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>jU&&this._append`A${n},${n},0,${+(d>=kU)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};NU.prototype;function PU(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new NU(t)}Array.prototype.slice;function FU(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function IU(e){this._context=e}IU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function LU(e){return new IU(e)}function RU(e){return e[0]}function zU(e){return e[1]}function BU(e,t){var n=OU(!0),r=null,i=LU,a=null,o=PU(s);e=typeof e==`function`?e:e===void 0?RU:OU(e),t=typeof t==`function`?t:t===void 0?zU:OU(t);function s(s){var c,l=(s=FU(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return BU().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:OU(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:OU(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:OU(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:OU(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:OU(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:OU(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:OU(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var HU=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function hle(e){return new HU(e,!0)}function gle(e){return new HU(e,!1)}function UU(){}function WU(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function GU(e){this._context=e}GU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:WU(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function _le(e){return new GU(e)}function KU(e){this._context=e}KU.prototype={areaStart:UU,areaEnd:UU,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vle(e){return new KU(e)}function qU(e){this._context=e}qU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:WU(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yle(e){return new qU(e)}function JU(e){this._context=e}JU.prototype={areaStart:UU,areaEnd:UU,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ble(e){return new JU(e)}function YU(e){return e<0?-1:1}function XU(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(YU(a)+YU(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ZU(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function QU(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function $U(e){this._context=e}$U.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:QU(this,this._t0,ZU(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,QU(this,ZU(this,n=XU(this,e,t)),n);break;default:QU(this,this._t0,n=XU(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function eW(e){this._context=new tW(e)}(eW.prototype=Object.create($U.prototype)).point=function(e,t){$U.prototype.point.call(this,t,e)};function tW(e){this._context=e}tW.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function xle(e){return new $U(e)}function Sle(e){return new eW(e)}function nW(e){this._context=e}nW.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=rW(e),i=rW(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function wle(e){return new iW(e,.5)}function Tle(e){return new iW(e,0)}function Ele(e){return new iW(e,1)}function aW(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Dle(e,t){return e[t]}function Ole(e){let t=[];return t.key=e,t}function kle(){var e=OU([]),t=oW,n=aW,r=Dle;function i(i){var a=Array.from(e.apply(this,arguments),Ole),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,sW=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{KH(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Ple=(e,t,n)=>r=>(e(t,n,r),null),Fle=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];KH(i)&&typeof a==`function`&&(r||={},r[i]=Ple(a,t,n))}),r};function cW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ile(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Ble(e){return Number.isSafeInteger(e)&&e>=0}function uW(e){return e!=null&&typeof e!=`function`&&Ble(e.length)}function dW(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function fW(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var pW=`[object RegExp]`,mW=`[object String]`,hW=`[object Number]`,gW=`[object Boolean]`,Vle=`[object Arguments]`,_W=`[object Symbol]`,vW=`[object Date]`,yW=`[object Map]`,bW=`[object Set]`,xW=`[object Array]`,Hle=`[object Function]`,SW=`[object ArrayBuffer]`,CW=`[object Object]`,Ule=`[object Error]`,wW=`[object DataView]`,TW=`[object Uint8Array]`,EW=`[object Uint8ClampedArray]`,DW=`[object Uint16Array]`,OW=`[object Uint32Array]`,Wle=`[object BigUint64Array]`,kW=`[object Int8Array]`,AW=`[object Int16Array]`,jW=`[object Int32Array]`,Gle=`[object BigInt64Array]`,MW=`[object Float32Array]`,NW=`[object Float64Array]`,PW=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function FW(e){return PW.Buffer!==void 0&&PW.Buffer.isBuffer(e)}function IW(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function LW(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var Kle=/^(?:0|[1-9]\d*)$/;function RW(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=d(),n=K_();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Jle=o(((e,t)=>{t.exports=qle()})),zW=(0,v.createContext)(null),Yle=Jle(),Xle=e=>e,BW=()=>{var e=(0,v.useContext)(zW);return e?e.store.dispatch:Xle},VW=()=>{},Zle=()=>VW,Qle=(e,t)=>e===t;function HW(e){var t=(0,v.useContext)(zW),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:VW,[t,e]);return(0,Yle.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Zle,t?t.store.getState:VW,t?t.store.getState:VW,n,Qle)}function $le(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function eue(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var UW=e=>Array.isArray(e)?e:[e];function tue(e){let t=Array.isArray(e[0])?e[0]:e;return eue(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function nue(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?rue:WeakRef,iue=0,GW=1;function KW(){return{s:iue,v:void 0,o:null,p:null}}function aue(e){return e instanceof WW?e.deref():e}function qW(e,t={}){let n=KW(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=KW(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function oue(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),$le(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=qW,argsMemoizeOptions:u=[]}={...n,...a},d=UW(c),f=UW(u),p=tue(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=nue(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=oue(qW);function sue(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=YW(e),i=YW(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},lue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,uue=/^\w*$/;function due(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||aU(e)?!0:typeof e==`string`&&(uue.test(e)||!lue.test(e))||t!=null&&Object.hasOwn(t,e)}function fue(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=uW(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||due(e)?e:{key:e,path:sU(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function XW(e,...t){let n=t.length;return n>1&&JW(e,t[0],t[1])?t=[]:n>2&&JW(t[0],t[1],t[2])&&(t=[t[0]]),fue(e,sue(t),[`asc`])}var ZW=e=>e.legend.settings,pue=e=>e.legend.size;$([e=>e.legend.payload,ZW],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?XW(r,n):r});function QW(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $W=typeof Symbol==`function`&&Symbol.observable||`@@observable`,eG=()=>Math.random().toString(36).substring(7).split(``).join(`.`),tG={INIT:`@@redux/INIT${eG()}`,REPLACE:`@@redux/REPLACE${eG()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${eG()}`};function nG(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rG(e,t,n){if(typeof e!=`function`)throw Error(QW(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(QW(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(QW(1));return n(rG)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(QW(3));return i}function d(e){if(typeof e!=`function`)throw Error(QW(4));if(c)throw Error(QW(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(QW(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!nG(e))throw Error(QW(7));if(e.type===void 0)throw Error(QW(8));if(typeof e.type!=`string`)throw Error(QW(17));if(c)throw Error(QW(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(QW(10));r=e,f({type:tG.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(QW(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[$W](){return this}}}return f({type:tG.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[$W]:m}}function mue(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:tG.INIT})===void 0)throw Error(QW(12));if(n(void 0,{type:tG.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(QW(13))})}function iG(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function hue(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(QW(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=aG(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function oG(e){return nG(e)&&`type`in e&&typeof e.type==`string`}var sG=Symbol.for(`immer-nothing`),cG=Symbol.for(`immer-draftable`),lG=Symbol.for(`immer-state`);function uG(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dG=Object,fG=dG.getPrototypeOf,pG=`constructor`,mG=`prototype`,hG=`configurable`,gG=`enumerable`,_G=`writable`,vG=`value`,yG=e=>!!e&&!!e[lG];function bG(e){return e?SG(e)||OG(e)||!!e[cG]||!!e[pG]?.[cG]||kG(e)||AG(e):!1}var gue=dG[mG][pG].toString(),xG=new WeakMap;function SG(e){if(!e||!jG(e))return!1;let t=fG(e);if(t===null||t===dG[mG])return!0;let n=dG.hasOwnProperty.call(t,pG)&&t[pG];if(n===Object)return!0;if(!MG(n))return!1;let r=xG.get(n);return r===void 0&&(r=Function.toString.call(n),xG.set(n,r)),r===gue}function CG(e,t,n=!0){wG(e)===0?(n?Reflect.ownKeys(e):dG.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function wG(e){let t=e[lG];return t?t.type_:OG(e)?1:kG(e)?2:AG(e)?3:0}var TG=(e,t,n=wG(e))=>n===2?e.has(t):dG[mG].hasOwnProperty.call(e,t),EG=(e,t,n=wG(e))=>n===2?e.get(t):e[t],DG=(e,t,n,r=wG(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function _ue(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var OG=Array.isArray,kG=e=>e instanceof Map,AG=e=>e instanceof Set,jG=e=>typeof e==`object`,MG=e=>typeof e==`function`,NG=e=>typeof e==`boolean`;function vue(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var PG=e=>e.copy_||e.base_,FG=e=>e.modified_?e.copy_:e.base_;function IG(e,t){if(kG(e))return new Map(e);if(AG(e))return new Set(e);if(OG(e))return Array[mG].slice.call(e);let n=SG(e);if(t===!0||t===`class_only`&&!n){let t=dG.getOwnPropertyDescriptors(e);delete t[lG];let n=Reflect.ownKeys(t);for(let r=0;r1&&dG.defineProperties(e,{set:RG,add:RG,clear:RG,delete:RG}),dG.freeze(e),t&&CG(e,(e,t)=>{LG(t,!0)},!1),e)}function yue(){uG(2)}var RG={[vG]:yue};function zG(e){return e===null||!jG(e)||dG.isFrozen(e)}var BG=`MapSet`,VG=`Patches`,HG=`ArrayMethods`,UG={};function WG(e){let t=UG[e];return t||uG(0,e),t}var GG=e=>!!UG[e],KG,qG=()=>KG,bue=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:GG(BG)?WG(BG):void 0,arrayMethodsPlugin_:GG(HG)?WG(HG):void 0});function JG(e,t){t&&(e.patchPlugin_=WG(VG),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function YG(e){XG(e),e.drafts_.forEach(xue),e.drafts_=null}function XG(e){e===KG&&(KG=e.parent_)}var ZG=e=>KG=bue(KG,e);function xue(e){let t=e[lG];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function QG(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[lG].modified_&&(YG(t),uG(4)),bG(e)&&(e=$G(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[lG].base_,e,t)}else e=$G(t,n);return Sue(t,e,!0),YG(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===sG?void 0:e}function $G(e,t){if(zG(t))return t;let n=t[lG];if(!n)return iK(t,e.handledSet_,e);if(!tK(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);rK(n,e)}return n.copy_}function Sue(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&LG(t,n)}function eK(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var tK=(e,t)=>e.scope_===t,Cue=[];function nK(e,t,n,r){let i=PG(e),a=e.type_;if(r!==void 0&&EG(i,r,a)===t){DG(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;CG(i,(e,n)=>{if(yG(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Cue;for(let e of o)DG(i,e,n,a)}function wue(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!tK(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=FG(i);nK(e,i.draft_??i,a,n),rK(i,r)})}function rK(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}eK(e)}}function Tue(e,t,n){let{scope_:r}=e;if(yG(n)){let i=n[lG];tK(i,r)&&i.callbacks_.push(function(){uK(e),nK(e,n,FG(i),t)})}else bG(n)&&e.callbacks_.push(function(){let i=PG(e);e.type_===3?i.has(n)&&iK(n,r.handledSet_,r):EG(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&iK(EG(e.copy_,t,e.type_),r.handledSet_,r)})}function iK(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||yG(e)||t.has(e)||!bG(e)||zG(e)?e:(t.add(e),CG(e,(r,i)=>{if(yG(i)){let t=i[lG];tK(t,n)&&(DG(e,r,FG(t),e.type_),eK(t))}else bG(i)&&iK(i,t,n)}),e)}function Eue(e,t){let n=OG(e),r={type_:+!!n,scope_:t?t.scope_:qG(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=aK;n&&(i=[r],a=oK);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var aK={get(e,t){if(t===lG)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=PG(e);if(!TG(i,t,e.type_))return Oue(e,i,t);let a=i[t];if(e.finalized_||!bG(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&vue(t))return a;if(a===sK(e.base_,t)||Due(e,t,a)){uK(e);let n=e.type_===1?+t:t,r=dK(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in PG(e)},ownKeys(e){return Reflect.ownKeys(PG(e))},set(e,t,n){let r=cK(PG(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=sK(PG(e),t),i=r?.[lG];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(_ue(n,r)&&(n!==void 0||TG(e.base_,t,e.type_)))return!0;uK(e),lK(e)}return e.copy_[t]===n&&(n!==void 0||TG(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Tue(e,t,n),!0)},deleteProperty(e,t){return uK(e),sK(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),lK(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=PG(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[_G]:!0,[hG]:e.type_!==1||t!==`length`,[gG]:r[gG],[vG]:n[t]}},defineProperty(){uG(11)},getPrototypeOf(e){return fG(e.base_)},setPrototypeOf(){uG(12)}},oK={};for(let e in aK){let t=aK[e];oK[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}oK.deleteProperty=function(e,t){return oK.set.call(this,e,t,void 0)},oK.set=function(e,t,n){return aK.set.call(this,e[0],t,n,e[0])};function sK(e,t){let n=e[lG];return(n?PG(n):e)[t]}function Due(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!bG(n)||n[lG]?!1:e.baseRefs_.has(n)}function Oue(e,t,n){let r=cK(t,n);return r?vG in r?r[vG]:r.get?.call(e.draft_):void 0}function cK(e,t){if(!(t in e))return;let n=fG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=fG(n)}}function lK(e){e.modified_||(e.modified_=!0,e.parent_&&lK(e.parent_))}function uK(e){e.copy_||=(e.assigned_=new Map,IG(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kue=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(MG(e)&&!MG(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}MG(t)||uG(6),n!==void 0&&!MG(n)&&uG(7);let r;if(bG(e)){let i=ZG(this),a=dK(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?YG(i):XG(i)}return JG(i,n),QG(r,i)}if(!e||!jG(e)){if(r=t(e),r===void 0&&(r=e),r===sG&&(r=void 0),this.autoFreeze_&&LG(r,!0),n){let t=[],i=[];WG(VG).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}uG(1,e)},this.produceWithPatches=(e,t)=>{if(MG(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},NG(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),NG(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),NG(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){bG(e)||uG(8),yG(e)&&(e=fK(e));let t=ZG(this),n=dK(t,e,void 0);return n[lG].isManual_=!0,XG(t),n}finishDraft(e,t){let n=e&&e[lG];(!n||!n.isManual_)&&uG(9);let{scope_:r}=n;return JG(r,t),QG(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=WG(VG).applyPatches_;return yG(e)?r(e,t):this.produce(e,e=>r(e,t))}};function dK(e,t,n,r){let[i,a]=kG(t)?WG(BG).proxyMap_(t,n):AG(t)?WG(BG).proxySet_(t,n):Eue(t,n);return(n?.scope_??qG()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?wue(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function fK(e){return yG(e)||uG(10,e),pK(e)}function pK(e){if(!bG(e)||zG(e))return e;let t=e[lG],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=IG(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=IG(e,!0);return CG(n,(e,t)=>{DG(n,e,pK(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var mK=new kue().produce,hK=e=>e;function gK(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Aue=gK(),jue=gK,Mue=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?aG:aG.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function _K(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(QK(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>oG(t)&&t.type===e,n}var vK=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function yK(e){return bG(e)?mK(e,()=>{}):e}function bK(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Nue(e){return typeof e==`boolean`}var Pue=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new vK;return t&&(Nue(t)?a.push(Aue):a.push(jue(t.extraArgument))),a},xK=`RTK_autoBatch`,SK=()=>e=>({payload:e,meta:{[xK]:!0}}),CK=e=>t=>{setTimeout(t,e)},Fue=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},wK=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?Fue(window.requestAnimationFrame,100):CK(10):e.type===`callback`?e.queueNotification:CK(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[xK],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Iue=e=>function(t){let{autoBatch:n=!0}=t??{},r=new vK(e);return n&&r.push(wK(typeof n==`object`?n:void 0)),r};function Lue(e){let t=Pue(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(nG(n))c=iG(n);else throw Error(QK(1));let l;l=typeof r==`function`?r(t):t();let u=aG;i&&(u=Mue({trace:!1,...typeof i==`object`&&i}));let d=Iue(hue(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return rG(c,o,p)}function TK(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(QK(28));if(r in t)throw Error(QK(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Rue(e){return typeof e==`function`}function zue(e,t){let[n,r,i]=TK(t),a;if(Rue(e))a=()=>yK(e());else{let t=yK(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(yG(e)){let r=n(e,t);return r===void 0?e:r}if(bG(e))return mK(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var Bue=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Vue=(e=21)=>{let t=``,n=e;for(;n--;)t+=Bue[Math.random()*64|0];return t},Hue=Symbol.for(`rtk-slice-createasyncthunk`);function Uue(e,t){return`${e}/${t}`}function Wue({creators:e}={}){let t=e?.asyncThunk?.[Hue];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(QK(11));let i=(typeof e.reducers==`function`?e.reducers(Kue()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(QK(12));if(n in o.sliceCaseReducersByType)throw Error(QK(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:Uue(n,r),createNotation:typeof e.reducers==`function`};Jue(a)?Xue(o,a,s,t):que(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?TK(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return zue(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=bK(d,r,m)),i}function i(t=l){return bK(bK(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=Gue(a,t,()=>bK(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function Gue(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var EK=Wue();function Kue(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function que({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Yue(r))throw Error(QK(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?_K(e,o):_K(e))}function Jue(e){return e._reducerDefinitionType===`asyncThunk`}function Yue(e){return e._reducerDefinitionType===`reducerWithPrepare`}function Xue({type:e,reducerName:t},n,r,i){if(!i)throw Error(QK(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||DK,pending:s||DK,rejected:c||DK,settled:l||DK})}function DK(){}var Zue=`task`,OK=`listener`,kK=`completed`,AK=`cancelled`,Que=`task-${AK}`,$ue=`task-${kK}`,jK=`${OK}-${AK}`,ede=`${OK}-${kK}`,MK=class{constructor(e){this.code=e,this.message=`${Zue} ${AK} (reason: ${e})`}code;name=`TaskAbortError`;message},NK=(e,t)=>{if(typeof e!=`function`)throw TypeError(QK(32))},PK=()=>{},FK=(e,t=PK)=>(e.catch(t),e),IK=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),LK=e=>{if(e.aborted)throw new MK(e.reason)};function RK(e,t){let n=PK;return new Promise((r,i)=>{let a=()=>i(new MK(e.reason));if(e.aborted){a();return}n=IK(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=PK})}var tde=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof MK?`cancelled`:`rejected`,error:e}}finally{t?.()}},zK=e=>t=>FK(RK(e,t).then(t=>(LK(e),t))),BK=e=>{let t=zK(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:VK}=Object,HK={},UK=`listenerMiddleware`,nde=(e,t)=>{let n=t=>IK(e,()=>t.abort(e.reason));return(r,i)=>{NK(r,`taskExecutor`);let a=new AbortController;n(a);let o=tde(async()=>{LK(e),LK(a.signal);let t=await r({pause:zK(a.signal),delay:BK(a.signal),signal:a.signal});return LK(a.signal),t},()=>a.abort($ue));return i?.autoJoin&&t.push(o.catch(PK)),{result:zK(e)(o),cancel(){a.abort(Que)}}}},rde=(e,t)=>{let n=async(n,r)=>{LK(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await RK(t,Promise.race(a));return LK(t),e}finally{i()}};return((e,t)=>FK(n(e,t)))},WK=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=_K(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(QK(21));return NK(a,`options.listener`),{predicate:i,type:t,effect:a}},GK=VK(e=>{let{type:t,predicate:n,effect:r}=WK(e);return{id:Vue(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(QK(22))}}},{withTypes:()=>GK}),KK=(e,t)=>{let{type:n,effect:r,predicate:i}=WK(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},qK=e=>{e.pending.forEach(e=>{e.abort(jK)})},ide=(e,t)=>()=>{for(let e of t.keys())qK(e);e.clear()},JK=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},YK=VK(_K(`${UK}/add`),{withTypes:()=>YK}),ade=_K(`${UK}/removeAll`),XK=VK(_K(`${UK}/remove`),{withTypes:()=>XK}),ode=(...e)=>{console.error(`${UK}/error`,...e)},ZK=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=ode}=e;NK(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&qK(e)}),c=(e=>{let n=KK(t,e)??GK(e);return s(n)});VK(c,{withTypes:()=>c});let l=e=>{let n=KK(t,e);return n&&(n.unsubscribe(),e.cancelActive&&qK(n)),!!n};VK(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=rde(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,VK({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:BK(u.signal),pause:zK(u.signal),extra:a,signal:u.signal,fork:nde(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(jK),n.delete(e))})},cancel:()=>{u.abort(jK),e.pending.delete(u)},throwIfCancelled:()=>{LK(u.signal)}})))}catch(e){e instanceof MK||JK(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(ede),i(e),e.pending.delete(u)}},d=ide(t,n);return{middleware:e=>n=>r=>{if(!oG(r))return n(r);if(YK.match(r))return c(r.payload);if(ade.match(r)){d();return}if(XK.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===HK)throw Error(QK(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,JK(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=HK}return s},startListening:c,stopListening:l,clearListeners:d}};function QK(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $K=EK({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),eq=$K.actions,sde=eq.setMargin,cde=eq.setLayout,lde=eq.setChartSize,ude=eq.setScale,dde=$K.reducer;function tq(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function nq(e){return Number.isFinite(e)}function rq(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function iq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aq(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(dle(c)){if(c===`top`&&mU(e.top))return aq(aq({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&mU(e.bottom))return aq(aq({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&mU(e.left))return aq(aq({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&mU(e.right))return aq(aq({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&mU(e[a]))return aq(aq({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&mU(e[o]))return aq(aq({},e),{},{[o]:e[o]+(i||0)})}return e},sq=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,cq=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},lq=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?dU(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return nq(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(CU):c&&l?l.map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(CU):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(CU):o.domain().map((e,t)=>{var n=o.map(e);return nq(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(CU)},uq={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Ale,none:aW,silhouette:jle,wiggle:Mle,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},dq=(e,t,n)=>{var r=uq[n]??aW,i=kle().keys(t).value((e,t)=>Number(oq(e,t,0))).order(oW).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=oq(e[i],t[r],0);Array.isArray(a)&&a.length===2&&mU(a[0])&&mU(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function fq(e){return e==null?void 0:String(e)}function pq(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!xU(i[t.dataKey])){var s=bU(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=oq(i,xU(o)?t.dataKey:o),l=t.scale.map(c);return mU(l)?l:null}var mq=e=>{var t=e.flat(2).filter(mU);return[Math.min(...t),Math.max(...t)]},hq=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],gq=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return hq(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=mq(tq(r,t,n));return!nq(i[0])||!nq(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},_q=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yq=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=XW(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function bq(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return aq(aq({},t),{},{dataKey:n,payload:r,value:i,name:a})}function xq(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Sq=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Cq=(e,t)=>t===`centric`?e.angle:e.radius,wq=e=>e.layout.width,Tq=e=>e.layout.height,Eq=e=>e.layout.scale,Dq=e=>e.layout.margin,Oq=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),kq=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Aq=`data-recharts-item-index`;function jq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mq(e){for(var t=1;te.brush.height;function Lq(e){return kq(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Rq(e){return kq(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function zq(e){return Oq(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Bq(e){return Oq(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Vq=$([wq,Tq,Dq,Iq,Lq,Rq,zq,Bq,ZW,pue],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Mq(Mq({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=hde(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Mq(Mq({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Hq=$(Vq,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Uq=$(wq,Tq,(e,t)=>({x:0,y:0,width:e,height:t})),Wq=(0,v.createContext)(null),Gq=()=>(0,v.useContext)(Wq)!=null,Kq=e=>e.brush,qq=$([Kq,Vq,Dq],(e,t,n)=>({height:e.height,x:mU(e.x)?e.x:t.left,y:mU(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:mU(e.width)?e.width:t.width}));function Jq(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Yq(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=Jq(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Xq(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Yq(e,t,{leading:r,maxWait:t,trailing:i})}var Zq=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},Qq={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},$q=(e,t,n)=>{var r=n.width,i=r===void 0?Qq.width:r,a=n.height,o=a===void 0?Qq.height:a,s=n.aspect,c=n.maxHeight,l=pU(i)?e:Number(i),u=pU(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},eJ={width:0,height:0,overflow:`visible`},tJ={width:0,overflowX:`visible`},nJ={height:0,overflowY:`visible`},rJ={},iJ=e=>{var t=e.width,n=e.height,r=pU(t),i=pU(n);return r&&i?eJ:r?tJ:i?nJ:rJ};function aJ(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=Qq.width,a=Qq.height):i===void 0?i=r&&r>0?void 0:Qq.width:a===void 0&&(a=r&&r>0?void 0:Qq.height),{width:i,height:a}}var oJ=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function sJ(){return sJ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return SJ(i)?v.createElement(xJ.Provider,{value:i},t):null}var wJ=()=>(0,v.useContext)(xJ),TJ=(0,v.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?Qq.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?Qq.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,f=e.debounce,p=f===void 0?Qq.debounce:f,m=e.id,h=e.className,g=e.onResize,_=e.style,y=_===void 0?{}:_,b=yJ(e,oJ),x=(0,v.useRef)(null),S=(0,v.useRef)();S.current=g,(0,v.useImperativeHandle)(t,()=>x.current);var C=pJ((0,v.useState)({containerWidth:i.width,containerHeight:i.height}),2),w=C[0],T=C[1],E=(0,v.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(x.current==null||typeof ResizeObserver>`u`)return wU;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=S.current)==null||t.call(S,i,a)}};p>0&&(e=Xq(e,p,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=x.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(x.current),()=>{t.disconnect()}},[E,p]);var D=w.containerWidth,O=w.containerHeight;Zq(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=$q(D,O,{width:a,height:o,aspect:n,maxHeight:u}),A=k.calculatedWidth,j=k.calculatedHeight;return Zq(D<0||O<0||A!=null&&A>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the @@ -115,7 +115,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lve(e,t){if(e){if(typeof e==`string`)return c8(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c8(e,t):void 0}}function c8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=Fve((0,v.useState)(`${gU(`recharts`)}-clip`),1)[0],r=$6();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return v.createElement(l8.Provider,{value:n},v.createElement(`defs`,null,v.createElement(`clipPath`,{id:n},v.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},u8=()=>(0,v.useContext)(l8),d8=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};function f8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p8(e){for(var t=1;t{var n;if(v.isValidElement(e))n=v.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!nq(t.x1)||!nq(t.y1)||!nq(t.x2)||!nq(t.y2))return null;n=v.createElement(`line`,m8({},t,{className:`recharts-reference-line-line`}))}return n},Gve=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!nq(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},Kve=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!nq(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},qve=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},Jve=(e,t,n,r,i,a,o)=>{var s=o.x,c=o.y,l=o.segment,u=o.ifOverflow,d=hU(s);return hU(c)?Gve(c,u,r,a,t,n):d?Kve(s,u,r,i,e,n):l!=null&&l.length===2?qve(l,u,r,new d8({x:e,y:t})):null};function Yve(e){var t=BW();return(0,v.useEffect)(()=>(t(Mve(e)),()=>{t(Nve(e))})),null}function Xve(e){var t=e.xAxisId,n=e.yAxisId,r=e.shape,i=e.className,a=e.ifOverflow,o=Gq(),s=u8(),c=HW(e=>X0(e,t)),l=HW(e=>$0(e,n)),u=HW(e=>$2(e,`xAxis`,t,o)),d=HW(e=>$2(e,`yAxis`,n,o)),f=DJ();if(!s||!f||c==null||l==null||u==null||d==null)return null;var p=Jve(u,d,f,e.position,c.orientation,l.orientation,e);if(!p)return null;var m=p[0],h=p[1];if(m==null||h==null)return null;var g=m.x,_=m.y,y=h.x,b=h.y,x=p8(p8({clipPath:a===`hidden`?`url(#${s})`:void 0},ZH(e)),{},{x1:g,y1:_,x2:y,y2:b}),S=Dve({x1:g,y1:_,x2:y,y2:b});return v.createElement(h3,{zIndex:e.zIndex},v.createElement(tU,{className:xs(`recharts-reference-line`,i)},Wve(r,x),v.createElement(s6,m8({},S,{lowerWidth:S.width,upperWidth:S.width}),v.createElement(f6,{label:e.label}),e.children)))}var Zve={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:JZ.line};function h8(e){var t=lW(e,Zve);return v.createElement(v.Fragment,null,v.createElement(Yve,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),v.createElement(Xve,t))}h8.displayName=`ReferenceLine`;function g8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _8(e){for(var t=1;t{var s=o.x1,c=o.x2,l=o.y1,u=o.y2;if(i==null||a==null)return null;var d=new d8({x:i,y:a}),f={x:e?i.map(s,{position:`start`})??null:i.rangeMin(),y:n?a.map(l,{position:`start`})??null:a.rangeMin()},p={x:t?i.map(c,{position:`end`})??null:i.rangeMax(),y:r?a.map(u,{position:`end`})??null:a.rangeMax()};return o.ifOverflow===`discard`&&(!d.isInRange(f)||!d.isInRange(p))?null:a8(f,p)},nye=(e,t)=>v.isValidElement(e)?v.cloneElement(e,t):typeof e==`function`?e(t):v.createElement(WX,v8({},t,{className:`recharts-reference-area-rect`}));function rye(e){var t=BW();return(0,v.useEffect)(()=>(t(Ave(e)),()=>{t(jve(e))})),null}function iye(e){var t=e.x1,n=e.x2,r=e.y1,i=e.y2,a=e.className,o=e.shape,s=e.xAxisId,c=e.yAxisId,l=u8(),u=Gq(),d=HW(e=>$2(e,`xAxis`,s,u)),f=HW(e=>$2(e,`yAxis`,c,u));if(d==null||f==null)return null;var p=hU(t),m=hU(n),h=hU(r),g=hU(i);if(!p&&!m&&!h&&!g&&!o)return null;var _=tye(p,m,h,g,d,f,e);if(!_&&!o)return null;var y=e.ifOverflow===`hidden`?`url(#${l})`:void 0;return v.createElement(h3,{zIndex:e.zIndex},v.createElement(tU,{className:xs(`recharts-reference-area`,a)},nye(o,_8(_8({clipPath:y},ZH(e)),_)),_!=null&&v.createElement(s6,v8({},_,{lowerWidth:_.width,upperWidth:_.width}),v.createElement(f6,{label:e.label}),e.children)))}var aye={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:JZ.area};function y8(e){var t=lW(e,aye);return v.createElement(v.Fragment,null,v.createElement(rye,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),v.createElement(iye,t))}y8.displayName=`ReferenceArea`;function oye(){}function b8(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function sye(e,t,n){return x8(e,t,void 0,void 0,void 0,void 0,n)}function x8(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return S8(e,t,a,o)}return S8(e,t,a,o)}function S8(e,t,n,r){if(Object.is(e,t))return!0;let i=fW(e),a=fW(t);if(i===`[object Arguments]`&&(i=CW),a===`[object Arguments]`&&(a=CW),i!==a)return!1;switch(i){case mW:return e.toString()===t.toString();case hW:return IW(e.valueOf(),t.valueOf());case gW:case vW:case _W:return Object.is(e.valueOf(),t.valueOf());case pW:return e.source===t.source&&e.flags===t.flags;case Hle:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case yW:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!x8(a,t.get(i),i,e,t,n,r))return!1;return!0;case bW:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;ox8(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case xW:case TW:case EW:case DW:case OW:case Wle:case kW:case AW:case jW:case Gle:case MW:case NW:if(FW(e)!==FW(t)||e.length!==t.length)return!1;for(let i=0;ie*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function dye(e,t){return C8(e,t+1)}function fye(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:C8(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||w8(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function pye(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var o=t.start,s=t.end,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||w8(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=E8(E8({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=E8(E8({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&w8(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=E8(E8({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function vye(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=E8(E8({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&w8(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=E8(E8({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=E8(E8({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=E8(E8({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&w8(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=E8(E8({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?lye(M3(i,{fontSize:t,letterSpacing:n}),m,d):M3(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?dU(_.coordinate-g.coordinate):1,y=uye(a,v,p);return c===`equidistantPreserveStart`?fye(v,y,h,i,o):c===`equidistantPreserveEnd`?pye(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?vye(v,y,h,i,o,c===`preserveStartEnd`):_ye(v,y,h,i,o),f.filter(e=>e.isShow))}var yye=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>l&&(l=t.width)}});var u=n?n.getBoundingClientRect().width:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},bye=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.height>l&&(l=t.height)}});var u=n?n.getBoundingClientRect().height:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},O8=EK({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId,a=n.ticks;e[r][i]=hK(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),k8=O8.actions,xye=k8.setRenderedTicks,Sye=k8.removeRenderedTicks,Cye=O8.reducer,wye=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function A8(e,t){return Oye(e)||Dye(e,t)||Eye(e,t)||Tye()}function Tye(){throw TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eye(e,t){if(e){if(typeof e==`string`)return j8(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j8(e,t):void 0}}function j8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&cye(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(xye({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,v.useEffect)(()=>r==null||n==null?wU:()=>{i(Sye({axisId:r,axisType:n}))},[i,r,n]),null}var Bye=(0,v.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,o=e.stroke,s=e.tickFormatter,c=e.unit,l=e.padding,u=e.tickTextProps,d=e.orientation,f=e.mirror,p=e.x,m=e.y,h=e.width,g=e.height,_=e.tickSize,y=e.tickMargin,b=e.fontSize,x=e.letterSpacing,S=e.getTicksConfig,C=e.events,w=e.axisType,T=e.axisId,E=D8(P8(P8({},S),{},{ticks:r}),b,x),D=YH(S),O=XH(i),k=Y3(D.textAnchor)?D.textAnchor:Iye(d,f),A=Lye(d,f),j={};typeof a==`object`&&(j=a);var M=P8(P8({},D),{},{fill:`none`},j),N=E.map(e=>P8({entry:e},Fye(e,p,m,h,g,d,_,f,y))),P=N.map(e=>{var t=e.entry,n=e.line;return v.createElement(tU,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&v.createElement(`line`,M8({},M,n,{className:xs(`recharts-cartesian-axis-tick-line`,cU(a,`className`))})))}),F=N.map((e,t)=>{var n=e.entry,r=e.tick,a=P8(P8({},P8(P8(P8(P8({verticalAnchor:A},D),{},{textAnchor:k,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:E.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??D.angle??0})),O);return v.createElement(tU,M8({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Fle(C,n,t)),i&&v.createElement(Rye,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return v.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${w}-ticks`},v.createElement(zye,{ticks:E,axisId:T,axisType:w}),F.length>0&&v.createElement(h3,{zIndex:JZ.label},v.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${w}-tick-labels`,ref:t},F)),P.length>0&&v.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${w}-tick-lines`},P))}),Vye=(0,v.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,o=e.hide,s=e.ticks,c=e.axisType,l=e.axisId,u=kye(e,wye),d=A8((0,v.useState)(``),2),f=d[0],p=d[1],m=A8((0,v.useState)(``),2),h=m[0],g=m[1],_=(0,v.useRef)(null);(0,v.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>yye({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>bye({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var y=(0,v.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==h)&&(p(i),g(a))}}},[f,h]);return o||r!=null&&r<=0||i!=null&&i<=0?null:v.createElement(h3,{zIndex:e.zIndex},v.createElement(tU,{className:xs(`recharts-cartesian-axis`,a)},v.createElement(Pye,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:YH(e)}),v.createElement(Bye,{ref:y,axisType:c,events:u,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),v.createElement(s6,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement(f6,{label:e.label,labelRef:e.labelRef}),e.children)))}),I8=v.forwardRef((e,t)=>{var n=lW(e,F8);return v.createElement(Vye,M8({},n,{ref:t}))});I8.displayName=`CartesianAxis`;var L8=EK({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),R8=L8.actions;R8.addErrorBar,R8.replaceErrorBar,R8.removeErrorBar;var Hye=L8.reducer;function z8(e,t){var n=HW(t=>X0(t,e)),r=HW(e=>$0(e,t)),i=n?.allowDataOverflow??J0.allowDataOverflow,a=r?.allowDataOverflow??Z0.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function B8(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=$6(),a=z8(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=HW(e=>K2(e,t,!1)),u=HW(e=>q2(e,n,!1));if(!c||!i)return null;var d=i.x,f=i.y,p=i.width,m=i.height,h=o&&l?Math.min(l[0],l[1]):d-p/2,g=s&&u?Math.min(u[0],u[1]):f-m/2,_=o&&l?Math.abs(l[1]-l[0]):p*2,y=s&&u?Math.abs(u[1]-u[0]):m*2;return v.createElement(`clipPath`,{id:`clipPath-${r}`},v.createElement(`rect`,{x:h,y:g,width:_,height:y}))}function V8(e){var t=XH(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}function H8(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function U8(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var W8=(e,t,n)=>c4(e,`xAxis`,H8(e,t),n),G8=(e,t,n)=>s4(e,`xAxis`,H8(e,t),n),K8=(e,t,n)=>c4(e,`yAxis`,U8(e,t),n),q8=(e,t,n)=>s4(e,`yAxis`,U8(e,t),n),Uye=$([MJ,W8,K8,G8,q8],(e,t,n,r,i)=>sq(e,`xAxis`)?yq(t,r,!1):yq(n,i,!1)),J8=$([a2,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),Y8=e=>sq(MJ(e),`xAxis`)?`yAxis`:`xAxis`,Wye=(e,t)=>Y8(e)===`yAxis`?U8(e,t):H8(e,t),X8=(e,t,n)=>C2(e,Y8(e),Wye(e,t),n),Gye=$([MJ,W8,K8,G8,q8,$([J8,X8],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=_Q(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),dZ,Uye,J8,qZ,$([J8,X8],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(CU)}})],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return gbe({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),Kye=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],qye=[`id`,`baseLine`];function Z8(){return Z8=Object.assign?Object.assign.bind():function(e){for(var t=1;te.y||0));return mU(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),mU(c)?v.createElement(`rect`,{x:ae.x||0));return mU(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),mU(c)?v.createElement(`rect`,{x:0,y:ae==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[n5(n5({},e.next),{},{x:yU(e.prev.x,e.next.x,t),y:yU(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:Qye,xAxisId:0,yAxisId:0,zIndex:JZ.area};function i5(e,t){return e&&e!==`none`?e:t}var abe=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:i5(r,i),value:xq(n,t),payload:e}]},obe=v.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:wU,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:xq(o,t),hide:s,type:u,color:i5(r,a),unit:c,formatter:l,graphicalItemId:d}};return v.createElement(k6,{tooltipEntrySettings:f})});function sbe(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=YH(r);return v.createElement(J6,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function cbe(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return n5(n5({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return v.createElement(g6,{value:t?r:void 0},n)}function lbe(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,s=e.isAnimating,c=e.isEntrance,l=a.layout,u=a.type,d=a.stroke,f=a.connectNulls,p=a.isRange,m=a.shape,h=a.id,g=e5(a,$ye),_=n5(n5({},ZH(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return v.createElement(v.Fragment,null,t?.length>1&&v.createElement(tU,{clipPath:r?`url(#clipPath-${i})`:void 0},v.createElement(O6,{option:m,DefaultShape:r5.shape,shapeProps:_})),v.createElement(sbe,{points:t,props:g,clipPathId:i}))}function ube(e,t,n){return mU(e)?yU(mU(t)?t:void 0,e,n):xU(e)||fU(e)?yU(mU(t)?t:void 0,0,n):e}function dbe(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,u=r.animationDuration,d=r.animationEasing,f=r.animationMatchBy,p=r.animationInterpolateFn,m=(0,v.useMemo)(()=>({points:o,baseLine:s}),[o,s]),h=F6(m,a),g=PJ(),_=L6(r.onAnimationStart,r.onAnimationEnd),y=_.isAnimating,b=_.handleAnimationStart,x=_.handleAnimationEnd,S=h.startValue;if(g==null)return null;var C=Array.isArray(s)&&Array.isArray(S)?P6(S,s,f):Array.isArray(s)?P6(null,s,f):null;return v.createElement(R6,{animationInput:m,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,onAnimationStart:b,onAnimationEnd:x,animationInterpolateFn:p,animationMatchBy:f,layout:g},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?p(C,i,g):a?s:ube(s,S,i);return h.syncStepValue(c,i),v.createElement(cbe,{showLabels:!y,points:o},r.children,v.createElement(lbe,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:y||i<1,isEntrance:a}),v.createElement(y6,{label:r.label}))})}function fbe(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,v.useRef)(null),a=(0,v.useRef)();return v.createElement(dbe,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var pbe=class extends v.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.needClip,c=e.xAxisId,l=e.yAxisId,u=e.width,d=e.height,f=e.id,p=e.baseLine,m=e.zIndex;if(t)return null;var h=xs(`recharts-area`,i),g=f,_=V8(n),y=_.r,b=_.strokeWidth,x=w6(n),S=y*2+b,C=s?`url(#clipPath-${x?``:`dots-`}${g})`:void 0;return v.createElement(h3,{zIndex:m},v.createElement(tU,{className:h},s&&v.createElement(`defs`,null,v.createElement(B8,{clipPathId:g,xAxisId:c,yAxisId:l}),!x&&v.createElement(`clipPath`,{id:`clipPath-dots-${g}`},v.createElement(`rect`,{x:o-S/2,y:a-S/2,width:u+S,height:d+S}))),v.createElement(fbe,{needClip:s,clipPathId:g,props:this.props})),v.createElement(n8,{points:r,mainColor:i5(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(p)&&v.createElement(n8,{points:p,mainColor:i5(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}};function mbe(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,s=e.fill,c=e.fillOpacity,l=e.hide,u=e.isAnimationActive,d=e.legendType,f=e.stroke,p=e.xAxisId,m=e.yAxisId,h=e5(e,ebe),g=NJ(),_=t3(),y=z8(p,m).needClip,b=Gq(),x=HW(t=>Gye(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=$6();if(g!==`horizontal`&&g!==`vertical`||T==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:v.createElement(pbe,$8({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:E,hide:l,layout:g,isAnimationActive:u,isRange:C,legendType:d,needClip:y,points:S,stroke:f,width:D,left:O,top:k,xAxisId:p,yAxisId:m}))}var hbe=(e,t,n,r,i)=>{var a=n??t;if(mU(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function gbe(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=hbe(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=oq(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=oq(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>oq(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:pq({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:pq({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function _be(e){var t=lW(e,r5),n=Gq();return v.createElement(V6,{id:t.id,type:`area`},e=>v.createElement(v.Fragment,null,v.createElement(A6,{legendPayload:abe(t)}),v.createElement(obe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),v.createElement(W6,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:fq(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),v.createElement(mbe,$8({},t,{id:e}))))}var a5=v.memo(_be,cY);a5.displayName=`Area`;var vbe=[`domain`,`range`],ybe=[`domain`,`range`];function o5(e,t){if(e==null)return{};var n,r,i=bbe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return d5(d5({},a),{},{type:o})},[a,o]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(uve(s)):n.current!==s&&t(dve({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(fve(n.current)),null)},[t]),null}var kbe=e=>{var t=e.xAxisId,n=e.className,r=e.height,i=e.label,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=HW(Uq),c=Gq(),l=BW(),u=`xAxis`,d=HW(e=>o4(e,u,t,c)),f=HW(e=>Ame(e,t)),p=HW(e=>Fme(e,t)),m=HW(e=>Y0(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||l6(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedHeight();Math.round(f.height)!==Math.round(n)&&l(_ve({id:t,height:n}))}}},[d,f,l,i,t,r,m]),f==null||p==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=f5(e,Sbe);m.id,m.scale;var g=f5(m,Cbe);return v.createElement(I8,l5({},h,g,{ref:a,labelRef:o,x:p.x,y:p.y,width:f.width,height:f.height,className:xs(`recharts-${u} ${u}`,n),viewBox:s,ticks:d,axisType:u,axisId:t}))},Abe={allowDataOverflow:J0.allowDataOverflow,allowDecimals:J0.allowDecimals,allowDuplicatedCategory:J0.allowDuplicatedCategory,angle:J0.angle,axisLine:F8.axisLine,height:J0.height,hide:!1,includeHidden:J0.includeHidden,interval:J0.interval,label:!1,minTickGap:J0.minTickGap,mirror:J0.mirror,orientation:J0.orientation,padding:J0.padding,reversed:J0.reversed,scale:J0.scale,tick:J0.tick,tickCount:J0.tickCount,tickLine:F8.tickLine,tickSize:F8.tickSize,type:J0.type,niceTicks:J0.niceTicks,xAxisId:0},p5=v.memo(e=>{var t=lW(e,Abe);return v.createElement(v.Fragment,null,v.createElement(Obe,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),v.createElement(kbe,t))},c5);p5.displayName=`XAxis`;var jbe=[`type`],Mbe=[`dangerouslySetInnerHTML`,`ticks`,`scale`],Nbe=[`id`,`scale`];function m5(){return m5=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return g5(g5({},a),{},{type:o})},[o,a]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(pve(s)):n.current!==s&&t(mve({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(hve(n.current)),null)},[t]),null}function zbe(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=HW(Uq),c=Gq(),l=BW(),u=`yAxis`,d=HW(e=>Lme(e,t)),f=HW(e=>Ime(e,t)),p=HW(e=>o4(e,u,t,c)),m=HW(e=>Q0(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||l6(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(gve({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=_5(e,Mbe);m.id,m.scale;var g=_5(m,Nbe);return v.createElement(I8,m5({},h,g,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:xs(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var Bbe={allowDataOverflow:Z0.allowDataOverflow,allowDecimals:Z0.allowDecimals,allowDuplicatedCategory:Z0.allowDuplicatedCategory,angle:Z0.angle,axisLine:F8.axisLine,hide:!1,includeHidden:Z0.includeHidden,interval:Z0.interval,label:!1,minTickGap:Z0.minTickGap,mirror:Z0.mirror,orientation:Z0.orientation,padding:Z0.padding,reversed:Z0.reversed,scale:Z0.scale,tick:Z0.tick,tickCount:Z0.tickCount,tickLine:F8.tickLine,tickSize:F8.tickSize,type:Z0.type,niceTicks:Z0.niceTicks,width:Z0.width,yAxisId:0},v5=v.memo(e=>{var t=lW(e,Bbe);return v.createElement(v.Fragment,null,v.createElement(Rbe,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),v.createElement(zbe,t))},c5);v5.displayName=`YAxis`;var y5=$([(e,t)=>t,MJ,mQ,CQ,H4,W4,Ahe,Vq],Lhe);function Vbe(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function b5(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(Vbe(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var x5=_K(`mouseClick`),S5=ZK();S5.startListening({actionCreator:x5,effect:(e,t)=>{var n=e.payload,r=y5(t.getState(),b5(n));r?.activeIndex!=null&&t.dispatch(qme({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var C5=_K(`mouseMove`),w5=ZK(),T5=null,E5=null,D5=null;w5.startListening({actionCreator:C5,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);T5!==null&&(cancelAnimationFrame(T5),T5=null),E5!==null&&(typeof i!=`number`||!o)&&(clearTimeout(E5),E5=null),D5=b5(n);var s=()=>{var e=t.getState(),n=f4(e,e.tooltip.settings.shared);if(!D5){T5=null,E5=null;return}if(n===`axis`){var r=y5(e,D5);r?.activeIndex==null?t.dispatch(_4()):t.dispatch(v4({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}T5=null,E5=null};if(!o){s();return}i===`raf`?T5=requestAnimationFrame(s):typeof i==`number`&&E5===null&&(E5=setTimeout(s,i))}});function Hbe(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var O5={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},k5=EK({name:`rootProps`,initialState:O5,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??O5.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Ube=k5.reducer,Wbe=k5.actions.updateOptions,A5=EK({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}});A5.actions.updatePolarOptions;var Gbe=A5.reducer,j5=_K(`keyDown`),M5=_K(`focus`),N5=_K(`blur`),P5=ZK(),F5=null,I5=null,L5=null;P5.startListening({actionCreator:j5,effect:(e,t)=>{L5=e.payload,F5!==null&&(cancelAnimationFrame(F5),F5=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);I5!==null&&(typeof r!=`number`||!a)&&(clearTimeout(I5),I5=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=L5;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=w4(n,I4(e),x2(e),B4(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=W4(e),c=I4(e),l=f4(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=c3(e,l,`hover`,String(n.index));t.dispatch(b4({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=zme(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=x2(e),h=B4(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v=0;y--)if(w4(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=c3(e,l,`hover`,String(p));t.dispatch(b4({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{F5=null,I5=null}};if(!a){o();return}r===`raf`?F5=requestAnimationFrame(o):typeof r==`number`&&I5===null&&(o(),L5=null,I5=setTimeout(()=>{L5?o():(I5=null,F5=null)},r))}}),P5.startListening({actionCreator:M5,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=c3(n,f4(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(b4({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),P5.startListening({actionCreator:N5,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(b4({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function R5(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var z5=_K(`externalEvent`),B5=ZK(),V5=new Map,H5=new Map,U5=new Map;B5.startListening({actionCreator:z5,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=R5(i);U5.set(a,{handler:r,reactEvent:o});var s=V5.get(a);s!==void 0&&(cancelAnimationFrame(s),V5.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=H5.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),H5.delete(a));var p=()=>{var e=U5.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:xhe(i),activeDataKey:yhe(i),activeIndex:Y4(i),activeLabel:X4(i),activeTooltipIndex:Y4(i),isTooltipActive:She(i)};n&&n(o,r)}finally{V5.delete(a),H5.delete(a),U5.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);V5.set(a,m)}else if(typeof l==`number`){if(!H5.has(a)){p();var h=setTimeout(p,l);H5.set(a,h)}}else p()}}});var Kbe=$([$([O4],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),W5=_K(`touchMove`),G5=ZK(),K5=null,q5=null,J5=null,Y5=null;G5.startListening({actionCreator:W5,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){Y5=R5(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);K5!==null&&(cancelAnimationFrame(K5),K5=null),q5!==null&&(typeof i!=`number`||!o)&&(clearTimeout(q5),q5=null),J5=Array.from(n.touches).map(e=>b5({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(Y5!=null){var e=t.getState(),n=f4(e,e.tooltip.settings.shared);if(n===`axis`){var r=J5?.[0];if(r==null){K5=null,q5=null;return}var i=y5(e,r);i?.activeIndex!=null&&t.dispatch(v4({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=Y5.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(Aq),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=P4(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=Kbe(e,s,c);t.dispatch(Kme({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}K5=null,q5=null}};if(!o){s();return}i===`raf`?K5=requestAnimationFrame(s):typeof i==`number`&&q5===null&&(s(),Y5=null,q5=setTimeout(()=>{Y5?s():(q5=null,K5=null)},i))}}});var X5={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},Z5=EK({name:`eventSettings`,initialState:X5,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=hK(t.payload.throttledEvents))}}}),qbe=Z5.actions.setEventSettings,Jbe=Z5.reducer,Ybe=iG({brush:Eve,cartesianAxis:vve,chartData:nge,errorBars:Hye,eventSettings:Jbe,graphicalItems:Q_e,layout:dde,legend:UJ,options:Qhe,polarAxis:v_e,polarOptions:Gbe,referenceElements:Pve,renderedTicks:Cye,rootProps:Ube,tooltip:Jme,zIndex:Yhe}),Xbe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return Lue({reducer:Ybe,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([S5.middleware,w5.middleware,P5.middleware,B5.middleware,G5.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(wK({type:`raf`}))},devTools:lY.devToolsEnabled&&{serialize:{replacer:Hbe},name:`recharts-${t}`}})};function Zbe(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=Gq(),a=(0,v.useRef)(null);if(i)return n;a.current??=Xbe(t,r);var o=zW;return v.createElement(aY,{context:o,store:a.current},n)}function Qbe(e){var t=e.layout,n=e.margin,r=BW(),i=Gq();return(0,v.useEffect)(()=>{i||(r(cde(t)),r(sde(n)))},[r,i,t,n]),null}var $be=(0,v.memo)(Qbe,cY);function exe(e){var t=BW();return(0,v.useEffect)(()=>{t(Wbe(e))},[t,e]),null}var txe=(0,v.memo)(e=>{var t=BW();return(0,v.useEffect)(()=>{t(qbe(e))},[t,e]),null},cY);function Q5(e){var t=e.zIndex,n=e.isPanorama,r=(0,v.useRef)(null),i=BW();return(0,v.useLayoutEffect)(()=>(r.current&&i(qhe({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Jhe({zIndex:t,isPanorama:n}))}),[i,t,n]),v.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function $5(e){var t=e.children,n=e.isPanorama,r=HW(zhe);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return v.createElement(v.Fragment,null,i.map(e=>v.createElement(Q5,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>v.createElement(Q5,{key:e,zIndex:e,isPanorama:n})))}var nxe=[`children`];function rxe(e,t){if(e==null)return{};var n,r,i=ixe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=AJ(),r=jJ(),i=_Y();if(!rq(n)||!rq(r))return null;var a=e.children,o=e.otherAttributes,s=e.title,c=e.desc,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),v.createElement($H,e7({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:axe,ref:t}),a)}),sxe=e=>{var t=e.children,n=HW(qq);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return v.createElement($H,{width:r,height:i,x:o,y:a},t)},t7=(0,v.forwardRef)((e,t)=>{var n=e.children,r=rxe(e,nxe);return Gq()?v.createElement(sxe,null,v.createElement($5,{isPanorama:!0},n)):v.createElement(oxe,e7({ref:t},r),v.createElement($5,{isPanorama:!1},n))});function cxe(e,t){return fxe(e)||dxe(e,t)||uxe(e,t)||lxe()}function lxe(){throw TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uxe(e,t){if(e){if(typeof e==`string`)return n7(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?n7(e,t):void 0}}function n7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;nq(t)&&t!==i&&e(ude(t))}},[n,e,i]),r}function r7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mxe(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(dge(),null);function s7(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Cxe=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),r=a7((0,v.useState)({containerWidth:s7(e.style?.width),containerHeight:s7(e.style?.height)}),2),i=r[0],a=r[1],o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[o]),v.createElement(v.Fragment,null,v.createElement(LJ,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,i7({ref:s},e)))}),wxe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=a7((0,v.useState)({containerWidth:s7(n),containerHeight:s7(r)}),2),a=i[0],o=i[1],s=(0,v.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return v.createElement(v.Fragment,null,v.createElement(LJ,{width:a.containerWidth,height:a.containerHeight}),v.createElement(`div`,i7({ref:c},e)))}),Txe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(`div`,i7({ref:t},e)))}),Exe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?v.createElement(wxe,i7({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(Txe,i7({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(`div`,i7({ref:t},e)))});function c7(e){return e?Cxe:Exe}var Dxe=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,y=e.responsive,b=e.dispatchTouchEvents,x=b===void 0||b,S=(0,v.useRef)(null),C=BW(),w=a7((0,v.useState)(null),2),T=w[0],E=w[1],D=a7((0,v.useState)(null),2),O=D[0],k=D[1],A=pxe(),j=wJ(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,v.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(S.current=e)},[A,t,E,k]),F=(0,v.useCallback)(e=>{C(x5(e)),C(z5({handler:a,reactEvent:e}))},[C,a]),I=(0,v.useCallback)(e=>{C(C5(e)),C(z5({handler:l,reactEvent:e}))},[C,l]),L=(0,v.useCallback)(e=>{C(_4()),C(z5({handler:u,reactEvent:e}))},[C,u]),R=(0,v.useCallback)(e=>{C(C5(e)),C(z5({handler:d,reactEvent:e}))},[C,d]),z=(0,v.useCallback)(()=>{C(M5())},[C]),B=(0,v.useCallback)(()=>{C(N5())},[C]),V=(0,v.useCallback)(e=>{C(j5(e.key))},[C]),H=(0,v.useCallback)(e=>{C(z5({handler:o,reactEvent:e}))},[C,o]),ee=(0,v.useCallback)(e=>{C(z5({handler:s,reactEvent:e}))},[C,s]),te=(0,v.useCallback)(e=>{C(z5({handler:c,reactEvent:e}))},[C,c]),ne=(0,v.useCallback)(e=>{C(z5({handler:f,reactEvent:e}))},[C,f]),re=(0,v.useCallback)(e=>{C(z5({handler:h,reactEvent:e}))},[C,h]),ie=(0,v.useCallback)(e=>{x&&C(W5(e)),C(z5({handler:m,reactEvent:e}))},[C,x,m]),ae=(0,v.useCallback)(e=>{C(z5({handler:p,reactEvent:e}))},[C,p]),oe=c7(y);return v.createElement(g3.Provider,{value:T},v.createElement(fle.Provider,{value:O},v.createElement(oe,{width:M??g?.width,height:N??g?.height,className:xs(`recharts-wrapper`,r),style:mxe({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:H,onDoubleClick:ee,onFocus:z,onBlur:B,onKeyDown:V,onMouseDown:te,onMouseEnter:I,onMouseLeave:L,onMouseMove:R,onMouseUp:ne,onTouchEnd:ae,onTouchMove:ie,onTouchStart:re,ref:P},v.createElement(Sxe,null),n)))}),Oxe=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function kxe(e,t){if(e==null)return{};var n,r,i=Axe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=YH(kxe(e,Oxe));return c?v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(t7,{otherAttributes:d,title:l,desc:u},a)):v.createElement(Dxe,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(t7,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(Bve,null,a)))});function l7(){return l7=Object.assign?Object.assign.bind():function(e){for(var t=1;tv.createElement(d7,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Lxe,tooltipPayloadSearcher:b3,categoricalChartProps:e,ref:t})),p7={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`wb-a1`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3},{id:`acc-wb-a2`,name:`wb-a2`,provider:`workbuddy`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1},{id:`acc-qd-b1`,name:`qd-b1`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1},{id:`acc-qd-b2`,name:`qd-b2`,provider:`qoder`,busy:!1,progress:0,concurrency:4,inFlight:0},{id:`acc-trae-c1`,name:`trae-c1`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2},{id:`acc-codex-d1`,name:`codex-d1`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0}],jobs:[{id:`j1`,name:`chat · sonnet`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j2`,name:`embed · batch`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`chat · gpt`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`tools · patch`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j5`,name:`chat · wait`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`retry · cool`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`chat · sticky`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`embed · docs`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`tools · apply`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`chat · flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`embed · idx`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`chat · opus`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`wb-a2 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`codex-d1 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},m7=[{name:`chat · opus`,kind:`chat`},{name:`embed · idx`,kind:`embed`},{name:`tools · apply`,kind:`tools`},{name:`chat · flash`,kind:`chat`,sticky:!0},{name:`chat · wait`,kind:`chat`},{name:`embed · docs`,kind:`embed`}],h7=100;function g7(e=p7){return{...e,workers:e.workers.map(e=>({...e})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function Rxe(){return g7()}function zxe(e,t){let n=Math.max(16,Math.min(500,t)),r=g7(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`wb-a2`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`codex-d1`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(!e.busy||!e.jobId)continue;let t=i.get(e.jobId);if(!t||t.status!==`running`||(t.elapsedMs+=n,e.rateLimited))continue;let r=.045+e.id.charCodeAt(e.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*r),t.progress=e.progress}let a=[];for(let e of r.workers){if(!e.busy||!e.jobId||e.rateLimited||e.progress<.995)continue;let t=(e.jobId.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:e.jobId,workerId:e.id,ok:t})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.busy=!1,n.progress=0,n.jobId=void 0,n.inFlight=0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.busy||e.rateLimited)continue;let t=s.shift();if(!t)break;t.status=`running`,t.accountId=e.id,t.progress=.04,t.elapsedMs=0,e.busy=!0,e.progress=.04,e.jobId=t.id;let n=_7(e.concurrency??1);e.inFlight=Math.min(n,Math.max(1,e.inFlight??1))}if(r.jobs.filter(e=>e.status===`queued`).length<6&&r.generatedAt%2800e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(h7%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function _7(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function Bxe(e){let t=e.jobs.filter(e=>e.status===`running`).length,n=e.jobs.filter(e=>e.status===`queued`).length,r=e.workers.filter(e=>e.busy).length,i=0,a=0;for(let t of e.workers){let e=_7(t.concurrency??1);i+=e;let n=t.inFlight==null?+!!t.busy:Math.max(0,Math.min(e,Math.floor(t.inFlight)));a+=n}let o=e.depthSeries[e.depthSeries.length-1]??n;return{running:t,waiting:n,busyWorkers:r,occupiedSlots:a,workerSlots:i,rateLimitActive:e.rateLimits.length,depthNow:o}}function Vxe(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=t.workers.map(e=>{let t=_7(e.max_inflight??4),n=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,r=Math.min(t,n);return{id:e.id,name:e.name,provider:e.provider,busy:e.busy||r>0,progress:e.busy||r>0?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:e.busy||r>0?`live-${e.id}`:void 0,concurrency:t,inFlight:r}}),a=Math.max(1,p7.depthSeries.length),o=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),s=i.filter(e=>e.busy&&e.jobId).map(e=>{let i=e.jobId,a=r.get(i),o=t.workers.find(t=>t.id===e.id),s,c=o?.started_at?.trim();if(c){let e=Date.parse(c);Number.isNaN(e)||(s=e)}return s==null&&a?.startedAtMs!=null&&(s=a.startedAtMs),s??=n,{id:i,name:e.name,kind:`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:s,elapsedMs:Math.max(0,n-s)}}),c=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),l=[...s,...c],u=e.waitP95Ms===0,d=u?e.depthSeries.slice(1):Array.from({length:Math.max(0,a-1)},()=>0);for(d.push(Math.max(0,t.in_flight));d.lengthe.id)),m=[];for(let n of e.jobs){if(n.status!==`running`||p.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=f.get(e),i=!0;if(r&&r.length>0)i=r.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(i=!1)}m.push({id:n.id,name:n.name,kind:n.kind,ok:i})}let h=0,g=0;if(u){h=e.totals.done,g=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?h+=1:g+=1;else for(let e of m)e.ok?h+=1:g+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:h,failed:g},workers:i,rateLimits:o,jobs:l,depthSeries:d.slice(-a),completions:m.length>0?m:void 0}}Z.registerPlugin(GH);var v7=GH.get(`inflightQueue`)||GH.create(`inflightQueue`,`0.22, 1, 0.36, 1`),y7=3,Hxe=4;function b7(e){let t=Math.max(0,e/1e3);if(t>=60){let e=Math.floor(t/60),n=Math.floor(t%60);return`${e}m ${String(n).padStart(2,`0`)}s`}return t>=10?`${t.toFixed(0)}s`:`${t.toFixed(1)}s`}function x7(e,t){return e?e.startedAtMs==null?Math.max(0,e.elapsedMs):Math.max(0,t-e.startedAtMs):0}function S7(e){switch(e){case`chat`:return`bg-[var(--chart-1)]`;case`embed`:return`bg-[var(--chart-6)]`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_92%,var(--surface))]`;default:return`bg-foreground/40`}}function C7(e){switch(e){case`chat`:return`bg-[color-mix(in_oklab,var(--chart-1)_30%,var(--surface))] text-foreground/94`;case`embed`:return`bg-[color-mix(in_oklab,var(--chart-6)_30%,var(--surface))] text-foreground/94`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_24%,var(--surface))] text-foreground/90`;default:return`bg-[color-mix(in_oklab,var(--foreground)_6%,var(--surface))] text-foreground/80`}}function Uxe({series:e,bands:t,backpressure:n,label:r}){let i=Math.max(n,...e,1),a=(0,v.useRef)(i),[o,s]=(0,v.useState)(i);(0,v.useEffect)(()=>{if(jV()){a.current=i,s(i);return}let e=a.current,t=i;if(Math.abs(t-e)<.01)return;let n=0,r=performance.now(),o=MV(.56)*1e3,c=i=>{let l=Math.min(1,(i-r)/o),u=1-(1-l)**3,d=e+(t-e)*u;a.current=d,s(d),l<1&&(n=requestAnimationFrame(c))};return n=requestAnimationFrame(c),()=>cancelAnimationFrame(n)},[i]);let c=(0,v.useMemo)(()=>e.map((e,t)=>({i:t,v:e,bp:n})),[e,n]),l=(0,v.useMemo)(()=>t.map((t,n)=>{let r=Math.max(1,e.length-1);return{key:n,x1:t.from*r,x2:Math.max(t.from*r+.35,t.until*r)}}),[t,e.length]),u=Math.max(o,n,1);return(0,G.jsx)(`div`,{className:`h-11 w-full overflow-hidden`,role:`img`,"aria-label":r,"data-depth-chart":!0,children:(0,G.jsx)(EJ,{width:`100%`,height:`100%`,children:(0,G.jsxs)(f7,{data:c,margin:{top:4,right:2,bottom:2,left:2},children:[(0,G.jsx)(v5,{hide:!0,domain:[0,u],allowDataOverflow:!0}),(0,G.jsx)(p5,{hide:!0,dataKey:`i`,type:`number`,domain:[0,Math.max(0,e.length-1)]}),l.map(e=>(0,G.jsx)(y8,{x1:e.x1,x2:e.x2,y1:0,y2:u,fill:`var(--il-warn, var(--warning))`,fillOpacity:.14,ifOverflow:`extendDomain`},e.key)),(0,G.jsx)(h8,{y:n,stroke:`var(--il-faint, var(--foreground))`,strokeOpacity:.35,strokeDasharray:`3 3`,ifOverflow:`extendDomain`}),(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:`il-depth-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.28}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.04})]})}),(0,G.jsx)(a5,{type:`monotone`,dataKey:`v`,stroke:`var(--il-depth, var(--chart-1))`,strokeOpacity:.95,strokeWidth:1.85,fill:`url(#il-depth-fill)`,fillOpacity:1,isAnimationActive:!jV(),animationDuration:Math.round(MV(.56)*1e3),animationEasing:`linear`,dot:!1,activeDot:!1})]})})})}function Wxe({slot:e,job:t,clockMs:n,idleLabel:r}){let i=_7(e.concurrency??1),a=e.inFlight==null?+!!e.busy:Math.max(0,Math.floor(e.inFlight)),o=Math.min(i,a),s=o>0,c=t?.name??r,l=x7(t,n),u=Array.from({length:i},(e,t)=>t(0,G.jsx)(`div`,{"data-slot-cell":``,"data-slot-fill":e?``:void 0,className:`relative min-w-0 flex-1 overflow-hidden rounded-[2px] ${e?`bg-[var(--il-busy-fill)]`:`bg-[var(--il-track)] opacity-55`}`,children:s&&e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[62%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--surface)_92%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.35s_linear_infinite]`}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[42%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_58%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.9s_linear_infinite]`,style:{animationDelay:`-0.55s`}}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[28%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_34%,var(--foreground))] to-transparent opacity-70 motion-safe:animate-[inflight-shimmer_1.55s_linear_infinite]`,style:{animationDelay:`-1.05s`}})]}):null},t))}),(0,G.jsx)(`span`,{className:`relative z-[1] mono w-[3.6rem] shrink-0 text-right text-[11px] leading-none tabular text-muted`,children:t||o>0?b7(l):(0,G.jsx)(`span`,{className:`text-muted/45`,children:`—`})})]})}function Gxe({t:e,snapshot:t,live:n=null,expanded:r,onExpandedChange:i,defaultExpanded:a=!1}){let o=t!==void 0,[s,c]=(0,v.useState)(a),l=r??s,u=e=>{i?.(e),r===void 0&&c(e)},[d,f]=(0,v.useState)(()=>g7(t??Rxe())),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(()=>Date.now()),b=o?t:d,x=(0,v.useMemo)(()=>Bxe(b),[b]),S=(0,v.useRef)(null),C=(0,v.useRef)(!1),w=(0,v.useRef)(b),T=(0,v.useRef)({wait:{},slot:{},outcome:{}}),E=(0,v.useMemo)(()=>new Map(b.jobs.map(e=>[e.id,e])),[b.jobs]),D=b.jobs.filter(e=>e.status===`queued`),O=D.slice(0,y7),k=D.slice(y7),A=(0,v.useMemo)(()=>{let e=b.workers.filter(e=>e.busy),t=b.workers.filter(e=>!e.busy),n=[],r=new Set;for(let i of[...e,...t])if(!r.has(i.id)&&(r.add(i.id),n.push(i),n.length>=Hxe))break;return n},[b.workers]),j=x.waiting>=b.backpressure,M=(0,v.useRef)(!1);(0,v.useLayoutEffect)(()=>{if(o){f(g7(t)),m(!1),g(null),M.current=!1;return}if(!l){m(!1),M.current=!1;return}if(n!==null){m(!1),g(n.sticky),y(Date.now()),f(e=>{let t=M.current?e:{...g7(e),waitP95Ms:1,totals:{done:0,failed:0}};return M.current=!0,Vxe(t,n)});return}g(null),m(!0),M.current=!1},[o,t,l,n]),(0,v.useEffect)(()=>{if(o||!l||!p||n!==null||jV())return;let e=0,t=performance.now(),r=!0,i=n=>{if(!r)return;let a=n-t;!document.hidden&&a>=260&&(t=n,f(e=>zxe(e,a))),e=requestAnimationFrame(i)};return e=requestAnimationFrame(i),()=>{r=!1,cancelAnimationFrame(e)}},[o,l,p,n]),(0,v.useEffect)(()=>{if(!l)return;if(jV()){y(Date.now());return}let e=0,t=0,n=!0,r=i=>{n&&(!document.hidden&&i-t>=150&&(t=i,y(Date.now())),e=requestAnimationFrame(r))};return y(Date.now()),e=requestAnimationFrame(r),()=>{n=!1,cancelAnimationFrame(e)}},[l]),(0,v.useEffect)(()=>{l||(C.current=!1)},[l]),(0,v.useLayoutEffect)(()=>{let e=S.current;if(!e||jV()||C.current)return;C.current=!0;let t=Z.context(()=>{let t=e.querySelectorAll(`[data-wait-pill]`),n=e.querySelectorAll(`[data-wait-token]`),r=e.querySelectorAll(`[data-slot]`),i=e.querySelectorAll(`[data-slot-fill]`),a=e.querySelectorAll(`[data-depth]`);t.length&&Z.fromTo(t,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:MV(.52),ease:v7,stagger:.045,force3D:!0}),n.length&&Z.fromTo(n,{opacity:0,scale:.6},{opacity:1,scale:1,duration:MV(.42),ease:AV.soft,stagger:.02,delay:MV(.18)}),r.length&&Z.fromTo(r,{opacity:0,x:-8},{opacity:1,x:0,duration:MV(.42),ease:v7,stagger:.05,delay:MV(.06),force3D:!0}),i.length&&i.forEach((e,t)=>{Z.fromTo(e,{opacity:0,scaleX:.35},{opacity:1,scaleX:1,duration:MV(.56),ease:v7,delay:MV(.18+t*.03),transformOrigin:`left center`})});let o=e.querySelector(`[data-outcome="ok"]`),s=e.querySelector(`[data-outcome="danger"]`);o&&Z.fromTo(o,{opacity:0,y:8,scale:.92,filter:`brightness(1.6)`},{opacity:1,y:0,scale:1,filter:`brightness(1)`,duration:MV(.48),ease:AV.soft,delay:MV(.42)}),s&&Z.fromTo(s,{opacity:0,x:0},{opacity:1,duration:MV(.28),delay:MV(.5),onComplete:()=>{jV()||Z.fromTo(s,{x:-3},{x:3,duration:MV(.07),yoyo:!0,repeat:5,ease:`power1.inOut`,onComplete:()=>{Z.set(s,{x:0})}})}}),a.length&&Z.fromTo(a,{opacity:0,y:6},{opacity:1,y:0,duration:MV(kV.base),ease:v7,delay:MV(.35),force3D:!0})},e);return()=>t.revert()},[l]),(0,v.useLayoutEffect)(()=>{let e=S.current,t=w.current;w.current=b;let n=()=>{if(!e)return;let t={};e.querySelectorAll(`[data-wait-id]`).forEach(e=>{let n=e.getAttribute(`data-wait-id`);n&&(t[n]=e.getBoundingClientRect())});let n={};e.querySelectorAll(`[data-slot-id]`).forEach(e=>{let t=e.getAttribute(`data-slot-id`);t&&(n[t]=e.getBoundingClientRect())}),T.current={wait:t,slot:n,outcome:{ok:e.querySelector(`[data-outcome="ok"]`)?.getBoundingClientRect(),danger:e.querySelector(`[data-outcome="danger"]`)?.getBoundingClientRect()}}};if(!e||jV()||!C.current){n();return}if(t===b){n();return}let r=new Map(t.jobs.map(e=>[e.id,e])),i=new Map(b.jobs.map(e=>[e.id,e])),a=new Map(t.workers.filter(e=>e.jobId).map(e=>[e.jobId,e.id])),o=new Map(b.workers.filter(e=>e.jobId).map(e=>[e.jobId,e.id])),s=(e,t,n,r,i,a,o)=>{let s=e instanceof HTMLElement?e.getBoundingClientRect():e,c=t instanceof HTMLElement?t.getBoundingClientRect():t;if(!s||!c||s.width<2||c.width<2)return;let l=r===`chat`?`var(--chart-1)`:r===`embed`?`var(--chart-6)`:r===`tools`?`var(--chart-5)`:`var(--foreground)`,u=i===`ok`?`color-mix(in oklab, var(--success) 24%, var(--surface))`:i===`danger`?`color-mix(in oklab, var(--danger) 22%, var(--surface))`:i===`retry`?`color-mix(in oklab, var(--warning) 16%, var(--surface))`:r===`chat`?`color-mix(in oklab, var(--chart-1) 32%, var(--surface))`:r===`embed`?`color-mix(in oklab, var(--chart-6) 32%, var(--surface))`:r===`tools`?`color-mix(in oklab, var(--chart-5) 26%, var(--surface))`:`var(--surface)`,d=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:`var(--foreground)`,f=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:l,p=l,m=`inset 0 1px 0 var(--surface-rim), inset 0 0 0 1px var(--surface-edge), var(--surface-contact), 0 0 0 1px color-mix(in oklab, ${f} 28%, transparent), 0 6px 18px color-mix(in oklab, ${f} 36%, transparent), 0 12px 32px color-mix(in oklab, var(--foreground) 16%, transparent)`,h=`inset 0 1px 0 var(--surface-rim), 0 0 14px color-mix(in oklab, ${f} 48%, transparent), 0 0 28px color-mix(in oklab, ${f} 28%, transparent)`,g=Math.max(s.width,88),_=Math.max(s.height,26),v=c.left+Math.max(0,(c.width-g*.92)/2),y=c.top+Math.max(0,(c.height-_)/2),b=i===`ok`||i===`danger`?.86:1,x=s.left+(v-s.left)*b,S=s.top+(y-s.top)*b,C=MV(.72),w=MV(.16),T=MV(.14),E=e=>{let t=document.createElement(`div`);t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{position:`fixed`,left:`${s.left}px`,top:`${s.top}px`,width:`${g}px`,height:`${_}px`,zIndex:e.asTrail?`78`:`80`,pointerEvents:`none`,display:`flex`,alignItems:`center`,gap:`6px`,padding:`0 8px`,borderRadius:`8px`,fontSize:`11px`,fontWeight:`500`,lineHeight:`1`,color:d,background:u,boxShadow:e.asTrail?h:m,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,opacity:String(e.opacity),willChange:`transform, left, top, opacity, filter`,transform:e.asTrail?`scaleX(1.12)`:`none`,filter:e.asTrail?`blur(0.9px) brightness(1.18) saturate(1.25)`:`none`});let r=document.createElement(`span`);Object.assign(r.style,{width:`6px`,height:`6px`,borderRadius:`2px`,flexShrink:`0`,background:p});let i=document.createElement(`span`);return i.textContent=n,Object.assign(i.style,{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:`0`,flex:`1`}),t.append(r,i),document.body.appendChild(t),t},D=i===`ok`||i===`danger`,O=D?g*.55:g*.92,k=i===`run`||i===`retry`?.96:.42,A=i===`run`||i===`retry`?.9:.28,j=E({opacity:1});Z.set(j,{transformOrigin:`center center`}),[.72,.46,.26].map((e,t)=>{let n=E({opacity:e,asTrail:!0});return Z.set(n,{transformOrigin:`center center`}),Z.to(n,{left:x,top:S,width:O,...D?{scale:k*(.92-t*.08)}:{scaleX:1.28+t*.1},opacity:0,duration:C,delay:MV(.04+t*.045),ease:v7,force3D:!0,onComplete:()=>n.remove()}),n}),Z.to(j,{left:x,top:S,width:O,scale:k,opacity:1,duration:C,ease:v7,force3D:!0,onComplete:()=>{let e=a;if(e&&(i===`ok`||i===`danger`)){let t=i===`ok`?`inset 0 0 0 1px color-mix(in oklab, var(--success) 28%, transparent)`:`inset 0 0 0 1px color-mix(in oklab, var(--danger) 28%, transparent)`,n=i===`ok`?`inset 0 0 0 1.5px color-mix(in oklab, var(--success) 52%, transparent), 0 0 10px color-mix(in oklab, var(--success) 20%, transparent)`:`inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 52%, transparent), 0 0 10px color-mix(in oklab, var(--danger) 20%, transparent)`;Z.set(e,{transformOrigin:`center center`});let r=Z.timeline({onComplete:()=>{Z.set(e,{clearProps:`boxShadow,transform,x,scale`})}});r.fromTo(e,{boxShadow:t},{boxShadow:n,duration:MV(.16),ease:`power1.inOut`,yoyo:!0,repeat:1}),r.to(e,{keyframes:[{x:2.8,scale:1.07,duration:MV(.07)},{x:-3.2,scale:.93,duration:MV(.09)},{x:2.2,scale:1.05,duration:MV(.08)},{x:-1.2,scale:.98,duration:MV(.07)},{x:0,scale:1,duration:MV(.1)}],ease:`power1.inOut`})}o?.(),Z.to(j,{opacity:0,scale:A,duration:T,delay:w,ease:`power1.out`,onComplete:()=>j.remove()})}})},c=T.current,l=new Set;for(let[t,n]of i){let i=r.get(t);if(!i||i.status!==`queued`||n.status!==`running`)continue;let a=o.get(t);if(!a)continue;l.add(t);let u=c.wait[t],d=e.querySelector(`[data-slot-id="${CSS.escape(a)}"]`),f=d?.getBoundingClientRect()??c.slot[a],p=d?.querySelector(`[data-slot-job-pill]`)??null,m=d?Array.from(d.querySelectorAll(`[data-slot-fill]`)):[];p&&Z.set(p,{opacity:0,scale:.85}),m.forEach(e=>Z.set(e,{opacity:0,scaleX:.35,transformOrigin:`left center`})),s(u,f,n.name,n.kind,`run`,null,()=>{d&&(Z.fromTo(d,{filter:`brightness(1.35)`},{filter:`brightness(1)`,duration:MV(.42),ease:AV.soft}),p&&Z.to(p,{opacity:1,scale:1,duration:MV(.42),ease:v7}),m.forEach((e,t)=>{Z.to(e,{opacity:1,scaleX:1,duration:MV(.56),ease:v7,delay:MV(t*.03)})}))})}l.size&&(e.querySelectorAll(`[data-wait-pill][data-wait-id]`).forEach(e=>{let t=e.dataset.waitId;if(!t||l.has(t))return;let n=c.wait[t];if(!n)return;let r=e.getBoundingClientRect(),i=n.left-r.left,a=n.top-r.top;Math.abs(i)<.5&&Math.abs(a)<.5||Z.fromTo(e,{x:i,y:a},{x:0,y:0,duration:MV(.56),ease:v7,force3D:!0})}),e.querySelectorAll(`[data-wait-token][data-wait-id]`).forEach(e=>{let t=e.dataset.waitId;if(!t)return;let n=c.wait[t];if(!n)return;let r=e.getBoundingClientRect(),i=n.left-r.left,a=n.top-r.top;Math.abs(i)<.5&&Math.abs(a)<.5||Z.fromTo(e,{x:i,y:a,scale:1.15},{x:0,y:0,scale:1,duration:MV(.56),ease:v7})}));for(let[n,o]of r){if(o.status!==`running`)continue;let r=i.get(n),l=a.get(n),u=l?c.slot[l]:void 0;if(r&&r.status===`queued`){let t=(e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`)??e.querySelector(`[data-queue-col]`))?.getBoundingClientRect();s(u,t,o.name,o.kind,`retry`,null,()=>{let t=e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`);t&&Z.fromTo(t,{opacity:.4,scale:.85},{opacity:1,scale:1,duration:MV(.42),ease:v7})});continue}if(r&&r.status===`running`)continue;let d=b.completions?.find(e=>e.id===n),f;if(d)f=d.ok?`ok`:`danger`;else if(r?.status===`failed`)f=`danger`;else if(r?.status===`done`)f=`ok`;else{let e=b.totals.done>t.totals.done;f=b.totals.failed>t.totals.failed&&!e?`danger`:`ok`}let p=e.querySelector(f===`ok`?`[data-outcome="ok"]`:`[data-outcome="danger"]`);s(u,p?.getBoundingClientRect()??c.outcome[f],o.name,o.kind,f,p)}for(let[t,n]of i){if(n.status!==`queued`||r.has(t))continue;let i=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);i&&Z.fromTo(i,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:MV(.52),ease:v7})}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=b.jobs.filter(e=>e.status===`queued`).map(e=>e.id);if(n.length===r.length&&n.some((e,t)=>e!==r[t]))for(let t of r){let n=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);if(!n)continue;let r=c.wait[t];if(!r)continue;let i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;Math.abs(a)<.5&&Math.abs(o)<.5||Z.fromTo(n,{x:a,y:o},{x:0,y:0,duration:MV(.56),ease:v7,force3D:!0})}}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=b.jobs.filter(e=>e.status===`queued`).map(e=>e.id);for(let t=0;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(dge(),null);function s7(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Cxe=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),r=a7((0,v.useState)({containerWidth:s7(e.style?.width),containerHeight:s7(e.style?.height)}),2),i=r[0],a=r[1],o=(0,v.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,v.useEffect)(()=>()=>{n.current?.disconnect()},[o]),v.createElement(v.Fragment,null,v.createElement(LJ,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,i7({ref:s},e)))}),wxe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=a7((0,v.useState)({containerWidth:s7(n),containerHeight:s7(r)}),2),a=i[0],o=i[1],s=(0,v.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,v.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return v.createElement(v.Fragment,null,v.createElement(LJ,{width:a.containerWidth,height:a.containerHeight}),v.createElement(`div`,i7({ref:c},e)))}),Txe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(`div`,i7({ref:t},e)))}),Exe=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?v.createElement(wxe,i7({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(Txe,i7({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(`div`,i7({ref:t},e)))});function c7(e){return e?Cxe:Exe}var Dxe=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,y=e.responsive,b=e.dispatchTouchEvents,x=b===void 0||b,S=(0,v.useRef)(null),C=BW(),w=a7((0,v.useState)(null),2),T=w[0],E=w[1],D=a7((0,v.useState)(null),2),O=D[0],k=D[1],A=pxe(),j=wJ(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,v.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(S.current=e)},[A,t,E,k]),F=(0,v.useCallback)(e=>{C(x5(e)),C(z5({handler:a,reactEvent:e}))},[C,a]),I=(0,v.useCallback)(e=>{C(C5(e)),C(z5({handler:l,reactEvent:e}))},[C,l]),L=(0,v.useCallback)(e=>{C(_4()),C(z5({handler:u,reactEvent:e}))},[C,u]),R=(0,v.useCallback)(e=>{C(C5(e)),C(z5({handler:d,reactEvent:e}))},[C,d]),z=(0,v.useCallback)(()=>{C(M5())},[C]),B=(0,v.useCallback)(()=>{C(N5())},[C]),V=(0,v.useCallback)(e=>{C(j5(e.key))},[C]),H=(0,v.useCallback)(e=>{C(z5({handler:o,reactEvent:e}))},[C,o]),ee=(0,v.useCallback)(e=>{C(z5({handler:s,reactEvent:e}))},[C,s]),te=(0,v.useCallback)(e=>{C(z5({handler:c,reactEvent:e}))},[C,c]),ne=(0,v.useCallback)(e=>{C(z5({handler:f,reactEvent:e}))},[C,f]),re=(0,v.useCallback)(e=>{C(z5({handler:h,reactEvent:e}))},[C,h]),ie=(0,v.useCallback)(e=>{x&&C(W5(e)),C(z5({handler:m,reactEvent:e}))},[C,x,m]),ae=(0,v.useCallback)(e=>{C(z5({handler:p,reactEvent:e}))},[C,p]),oe=c7(y);return v.createElement(g3.Provider,{value:T},v.createElement(fle.Provider,{value:O},v.createElement(oe,{width:M??g?.width,height:N??g?.height,className:xs(`recharts-wrapper`,r),style:mxe({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:H,onDoubleClick:ee,onFocus:z,onBlur:B,onKeyDown:V,onMouseDown:te,onMouseEnter:I,onMouseLeave:L,onMouseMove:R,onMouseUp:ne,onTouchEnd:ae,onTouchMove:ie,onTouchStart:re,ref:P},v.createElement(Sxe,null),n)))}),Oxe=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function kxe(e,t){if(e==null)return{};var n,r,i=Axe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=YH(kxe(e,Oxe));return c?v.createElement(v.Fragment,null,v.createElement(LJ,{width:n,height:r}),v.createElement(t7,{otherAttributes:d,title:l,desc:u},a)):v.createElement(Dxe,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(t7,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(Bve,null,a)))});function l7(){return l7=Object.assign?Object.assign.bind():function(e){for(var t=1;tv.createElement(d7,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Lxe,tooltipPayloadSearcher:b3,categoricalChartProps:e,ref:t})),p7={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`wb-a1`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3},{id:`acc-wb-a2`,name:`wb-a2`,provider:`workbuddy`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1},{id:`acc-qd-b1`,name:`qd-b1`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1},{id:`acc-qd-b2`,name:`qd-b2`,provider:`qoder`,busy:!1,progress:0,concurrency:4,inFlight:0},{id:`acc-trae-c1`,name:`trae-c1`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2},{id:`acc-codex-d1`,name:`codex-d1`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0}],jobs:[{id:`j1`,name:`chat · sonnet`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j2`,name:`embed · batch`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`chat · gpt`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`tools · patch`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j5`,name:`chat · wait`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`retry · cool`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`chat · sticky`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`embed · docs`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`tools · apply`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`chat · flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`embed · idx`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`chat · opus`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`wb-a2 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`codex-d1 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},m7=[{name:`chat · opus`,kind:`chat`},{name:`embed · idx`,kind:`embed`},{name:`tools · apply`,kind:`tools`},{name:`chat · flash`,kind:`chat`,sticky:!0},{name:`chat · wait`,kind:`chat`},{name:`embed · docs`,kind:`embed`}],h7=100;function g7(e=p7){return{...e,workers:e.workers.map(e=>({...e})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function Rxe(){return g7()}function zxe(e,t){let n=Math.max(16,Math.min(500,t)),r=g7(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`wb-a2`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`codex-d1`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(!e.busy||!e.jobId)continue;let t=i.get(e.jobId);if(!t||t.status!==`running`||(t.elapsedMs+=n,e.rateLimited))continue;let r=.045+e.id.charCodeAt(e.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*r),t.progress=e.progress}let a=[];for(let e of r.workers){if(!e.busy||!e.jobId||e.rateLimited||e.progress<.995)continue;let t=(e.jobId.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:e.jobId,workerId:e.id,ok:t})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.busy=!1,n.progress=0,n.jobId=void 0,n.inFlight=0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.busy||e.rateLimited)continue;let t=s.shift();if(!t)break;t.status=`running`,t.accountId=e.id,t.progress=.04,t.elapsedMs=0,e.busy=!0,e.progress=.04,e.jobId=t.id;let n=_7(e.concurrency??1);e.inFlight=Math.min(n,Math.max(1,e.inFlight??1))}if(r.jobs.filter(e=>e.status===`queued`).length<6&&r.generatedAt%2800e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(h7%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function _7(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function Bxe(e){let t=e.jobs.filter(e=>e.status===`running`).length,n=e.jobs.filter(e=>e.status===`queued`).length,r=e.workers.filter(e=>e.busy).length,i=0,a=0;for(let t of e.workers){let e=_7(t.concurrency??1);i+=e;let n=t.inFlight==null?+!!t.busy:Math.max(0,Math.min(e,Math.floor(t.inFlight)));a+=n}let o=e.depthSeries[e.depthSeries.length-1]??n;return{running:t,waiting:n,busyWorkers:r,occupiedSlots:a,workerSlots:i,rateLimitActive:e.rateLimits.length,depthNow:o}}function Vxe(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=t.workers.map(e=>{let t=_7(e.max_inflight??4),n=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,r=Math.min(t,n);return{id:e.id,name:e.name,provider:e.provider,busy:e.busy||r>0,progress:e.busy||r>0?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:e.busy||r>0?`live-${e.id}`:void 0,concurrency:t,inFlight:r}}),a=Math.max(1,p7.depthSeries.length),o=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),s=new Map;for(let e of t.queue??[]){let t=(e.account_id||``).trim(),n=(e.name||``).trim();t&&n&&!s.has(t)&&s.set(t,n)}let c=i.filter(e=>e.busy&&e.jobId).map(e=>{let i=e.jobId,a=r.get(i),o=t.workers.find(t=>t.id===e.id),c,l=o?.started_at?.trim();if(l){let e=Date.parse(l);Number.isNaN(e)||(c=e)}return c==null&&a?.startedAtMs!=null&&(c=a.startedAtMs),c??=n,{id:i,name:s.get(e.id)??e.name,kind:`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:c,elapsedMs:Math.max(0,n-c)}}),l=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,accountId:(e.account_id||``).trim()||void 0,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),u=[...c,...l],d=e.waitP95Ms===0,f=d?e.depthSeries.slice(1):Array.from({length:Math.max(0,a-1)},()=>0);for(f.push(Math.max(0,t.in_flight));f.lengthe.id)),h=[];for(let n of e.jobs){if(n.status!==`running`||m.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=p.get(e),i=!0;if(r&&r.length>0)i=r.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(i=!1)}h.push({id:n.id,name:n.name,kind:n.kind,ok:i})}let g=0,_=0;if(d){g=e.totals.done,_=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?g+=1:_+=1;else for(let e of h)e.ok?g+=1:_+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:g,failed:_},workers:i,rateLimits:o,jobs:u,depthSeries:f.slice(-a),completions:h.length>0?h:void 0}}Z.registerPlugin(GH);var v7=GH.get(`inflightQueue`)||GH.create(`inflightQueue`,`0.22, 1, 0.36, 1`),y7=3,Hxe=4;function b7(e){let t=Math.max(0,e/1e3);if(t>=60){let e=Math.floor(t/60),n=Math.floor(t%60);return`${e}m ${String(n).padStart(2,`0`)}s`}return t>=10?`${t.toFixed(0)}s`:`${t.toFixed(1)}s`}function x7(e,t){return e?e.startedAtMs==null?Math.max(0,e.elapsedMs):Math.max(0,t-e.startedAtMs):0}function S7(e){switch(e){case`chat`:return`bg-[var(--chart-1)]`;case`embed`:return`bg-[var(--chart-6)]`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_92%,var(--surface))]`;default:return`bg-foreground/40`}}function C7(e){switch(e){case`chat`:return`bg-[color-mix(in_oklab,var(--chart-1)_30%,var(--surface))] text-foreground/94`;case`embed`:return`bg-[color-mix(in_oklab,var(--chart-6)_30%,var(--surface))] text-foreground/94`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_24%,var(--surface))] text-foreground/90`;default:return`bg-[color-mix(in_oklab,var(--foreground)_6%,var(--surface))] text-foreground/80`}}function Uxe({series:e,bands:t,backpressure:n,label:r}){let i=Math.max(n,...e,1),a=(0,v.useRef)(i),[o,s]=(0,v.useState)(i);(0,v.useEffect)(()=>{if(jV()){a.current=i,s(i);return}let e=a.current,t=i;if(Math.abs(t-e)<.01)return;let n=0,r=performance.now(),o=MV(.56)*1e3,c=i=>{let l=Math.min(1,(i-r)/o),u=1-(1-l)**3,d=e+(t-e)*u;a.current=d,s(d),l<1&&(n=requestAnimationFrame(c))};return n=requestAnimationFrame(c),()=>cancelAnimationFrame(n)},[i]);let c=(0,v.useMemo)(()=>e.map((e,t)=>({i:t,v:e,bp:n})),[e,n]),l=(0,v.useMemo)(()=>t.map((t,n)=>{let r=Math.max(1,e.length-1);return{key:n,x1:t.from*r,x2:Math.max(t.from*r+.35,t.until*r)}}),[t,e.length]),u=Math.max(o,n,1);return(0,G.jsx)(`div`,{className:`h-11 w-full overflow-hidden`,role:`img`,"aria-label":r,"data-depth-chart":!0,children:(0,G.jsx)(EJ,{width:`100%`,height:`100%`,children:(0,G.jsxs)(f7,{data:c,margin:{top:4,right:2,bottom:2,left:2},children:[(0,G.jsx)(v5,{hide:!0,domain:[0,u],allowDataOverflow:!0}),(0,G.jsx)(p5,{hide:!0,dataKey:`i`,type:`number`,domain:[0,Math.max(0,e.length-1)]}),l.map(e=>(0,G.jsx)(y8,{x1:e.x1,x2:e.x2,y1:0,y2:u,fill:`var(--il-warn, var(--warning))`,fillOpacity:.14,ifOverflow:`extendDomain`},e.key)),(0,G.jsx)(h8,{y:n,stroke:`var(--il-faint, var(--foreground))`,strokeOpacity:.35,strokeDasharray:`3 3`,ifOverflow:`extendDomain`}),(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:`il-depth-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.28}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.04})]})}),(0,G.jsx)(a5,{type:`monotone`,dataKey:`v`,stroke:`var(--il-depth, var(--chart-1))`,strokeOpacity:.95,strokeWidth:1.85,fill:`url(#il-depth-fill)`,fillOpacity:1,isAnimationActive:!jV(),animationDuration:Math.round(MV(.56)*1e3),animationEasing:`linear`,dot:!1,activeDot:!1})]})})})}function Wxe({slot:e,job:t,clockMs:n,idleLabel:r}){let i=_7(e.concurrency??1),a=e.inFlight==null?+!!e.busy:Math.max(0,Math.floor(e.inFlight)),o=Math.min(i,a),s=o>0,c=t?.name??r,l=x7(t,n),u=Array.from({length:i},(e,t)=>t(0,G.jsx)(`div`,{"data-slot-cell":``,"data-slot-fill":e?``:void 0,className:`relative min-w-0 flex-1 overflow-hidden rounded-[2px] ${e?`bg-[var(--il-busy-fill)]`:`bg-[var(--il-track)] opacity-55`}`,children:s&&e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[62%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--surface)_92%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.35s_linear_infinite]`}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[42%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_58%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.9s_linear_infinite]`,style:{animationDelay:`-0.55s`}}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[28%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_34%,var(--foreground))] to-transparent opacity-70 motion-safe:animate-[inflight-shimmer_1.55s_linear_infinite]`,style:{animationDelay:`-1.05s`}})]}):null},t))}),(0,G.jsx)(`span`,{className:`relative z-[1] mono w-[3.6rem] shrink-0 text-right text-[11px] leading-none tabular text-muted`,children:t||o>0?b7(l):(0,G.jsx)(`span`,{className:`text-muted/45`,children:`—`})})]})}function Gxe({t:e,snapshot:t,live:n=null,expanded:r,onExpandedChange:i,defaultExpanded:a=!1}){let o=t!==void 0,[s,c]=(0,v.useState)(a),l=r??s,u=e=>{i?.(e),r===void 0&&c(e)},[d,f]=(0,v.useState)(()=>g7(t??Rxe())),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(()=>Date.now()),b=o?t:d,x=(0,v.useMemo)(()=>Bxe(b),[b]),S=(0,v.useRef)(null),C=(0,v.useRef)(!1),w=(0,v.useRef)(b),T=(0,v.useRef)({wait:{},slot:{},outcome:{}}),E=(0,v.useMemo)(()=>new Map(b.jobs.map(e=>[e.id,e])),[b.jobs]),D=b.jobs.filter(e=>e.status===`queued`),O=D.slice(0,y7),k=D.slice(y7),A=(0,v.useMemo)(()=>{let e=b.workers.filter(e=>e.busy),t=b.workers.filter(e=>!e.busy),n=[],r=new Set;for(let i of[...e,...t])if(!r.has(i.id)&&(r.add(i.id),n.push(i),n.length>=Hxe))break;return n},[b.workers]),j=x.waiting>=b.backpressure,M=(0,v.useRef)(!1);(0,v.useLayoutEffect)(()=>{if(o){f(g7(t)),m(!1),g(null),M.current=!1;return}if(!l){m(!1),M.current=!1;return}if(n!==null){m(!1),g(n.sticky),y(Date.now()),f(e=>{let t=M.current?e:{...g7(e),waitP95Ms:1,totals:{done:0,failed:0}};return M.current=!0,Vxe(t,n)});return}g(null),m(!0),M.current=!1},[o,t,l,n]),(0,v.useEffect)(()=>{if(o||!l||!p||n!==null||jV())return;let e=0,t=performance.now(),r=!0,i=n=>{if(!r)return;let a=n-t;!document.hidden&&a>=260&&(t=n,f(e=>zxe(e,a))),e=requestAnimationFrame(i)};return e=requestAnimationFrame(i),()=>{r=!1,cancelAnimationFrame(e)}},[o,l,p,n]),(0,v.useEffect)(()=>{if(!l)return;if(jV()){y(Date.now());return}let e=0,t=0,n=!0,r=i=>{n&&(!document.hidden&&i-t>=150&&(t=i,y(Date.now())),e=requestAnimationFrame(r))};return y(Date.now()),e=requestAnimationFrame(r),()=>{n=!1,cancelAnimationFrame(e)}},[l]),(0,v.useEffect)(()=>{l||(C.current=!1)},[l]),(0,v.useLayoutEffect)(()=>{let e=S.current;if(!e||jV()||C.current)return;C.current=!0;let t=Z.context(()=>{let t=e.querySelectorAll(`[data-wait-pill]`),n=e.querySelectorAll(`[data-wait-token]`),r=e.querySelectorAll(`[data-slot]`),i=e.querySelectorAll(`[data-slot-fill]`),a=e.querySelectorAll(`[data-depth]`);t.length&&Z.fromTo(t,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:MV(.52),ease:v7,stagger:.045,force3D:!0}),n.length&&Z.fromTo(n,{opacity:0,scale:.6},{opacity:1,scale:1,duration:MV(.42),ease:AV.soft,stagger:.02,delay:MV(.18)}),r.length&&Z.fromTo(r,{opacity:0,x:-8},{opacity:1,x:0,duration:MV(.42),ease:v7,stagger:.05,delay:MV(.06),force3D:!0}),i.length&&i.forEach((e,t)=>{Z.fromTo(e,{opacity:0,scaleX:.35},{opacity:1,scaleX:1,duration:MV(.56),ease:v7,delay:MV(.18+t*.03),transformOrigin:`left center`})});let o=e.querySelector(`[data-outcome="ok"]`),s=e.querySelector(`[data-outcome="danger"]`);o&&Z.fromTo(o,{opacity:0,y:8,scale:.92,filter:`brightness(1.6)`},{opacity:1,y:0,scale:1,filter:`brightness(1)`,duration:MV(.48),ease:AV.soft,delay:MV(.42)}),s&&Z.fromTo(s,{opacity:0,x:0},{opacity:1,duration:MV(.28),delay:MV(.5),onComplete:()=>{jV()||Z.fromTo(s,{x:-3},{x:3,duration:MV(.07),yoyo:!0,repeat:5,ease:`power1.inOut`,onComplete:()=>{Z.set(s,{x:0})}})}}),a.length&&Z.fromTo(a,{opacity:0,y:6},{opacity:1,y:0,duration:MV(kV.base),ease:v7,delay:MV(.35),force3D:!0})},e);return()=>t.revert()},[l]),(0,v.useLayoutEffect)(()=>{let e=S.current,t=w.current;w.current=b;let n=()=>{if(!e)return;let t={};e.querySelectorAll(`[data-wait-id]`).forEach(e=>{let n=e.getAttribute(`data-wait-id`);n&&(t[n]=e.getBoundingClientRect())});let n={};e.querySelectorAll(`[data-slot-id]`).forEach(e=>{let t=e.getAttribute(`data-slot-id`);t&&(n[t]=e.getBoundingClientRect())}),T.current={wait:t,slot:n,outcome:{ok:e.querySelector(`[data-outcome="ok"]`)?.getBoundingClientRect(),danger:e.querySelector(`[data-outcome="danger"]`)?.getBoundingClientRect()}}};if(!e||jV()||!C.current){n();return}if(t===b){n();return}let r=new Map(t.jobs.map(e=>[e.id,e])),i=new Map(b.jobs.map(e=>[e.id,e])),a=new Map(t.workers.filter(e=>e.jobId).map(e=>[e.jobId,e.id])),o=new Map(b.workers.filter(e=>e.jobId).map(e=>[e.jobId,e.id])),s=(e,t,n,r,i,a,o)=>{let s=e instanceof HTMLElement?e.getBoundingClientRect():e,c=t instanceof HTMLElement?t.getBoundingClientRect():t;if(!s||!c||s.width<2||c.width<2)return;let l=r===`chat`?`var(--chart-1)`:r===`embed`?`var(--chart-6)`:r===`tools`?`var(--chart-5)`:`var(--foreground)`,u=i===`ok`?`color-mix(in oklab, var(--success) 24%, var(--surface))`:i===`danger`?`color-mix(in oklab, var(--danger) 22%, var(--surface))`:i===`retry`?`color-mix(in oklab, var(--warning) 16%, var(--surface))`:r===`chat`?`color-mix(in oklab, var(--chart-1) 32%, var(--surface))`:r===`embed`?`color-mix(in oklab, var(--chart-6) 32%, var(--surface))`:r===`tools`?`color-mix(in oklab, var(--chart-5) 26%, var(--surface))`:`var(--surface)`,d=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:`var(--foreground)`,f=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:l,p=l,m=`inset 0 1px 0 var(--surface-rim), inset 0 0 0 1px var(--surface-edge), var(--surface-contact), 0 0 0 1px color-mix(in oklab, ${f} 28%, transparent), 0 6px 18px color-mix(in oklab, ${f} 36%, transparent), 0 12px 32px color-mix(in oklab, var(--foreground) 16%, transparent)`,h=`inset 0 1px 0 var(--surface-rim), 0 0 14px color-mix(in oklab, ${f} 48%, transparent), 0 0 28px color-mix(in oklab, ${f} 28%, transparent)`,g=Math.max(s.width,88),_=Math.max(s.height,26),v=c.left+Math.max(0,(c.width-g*.92)/2),y=c.top+Math.max(0,(c.height-_)/2),b=i===`ok`||i===`danger`?.86:1,x=s.left+(v-s.left)*b,S=s.top+(y-s.top)*b,C=MV(.72),w=MV(.16),T=MV(.14),E=e=>{let t=document.createElement(`div`);t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{position:`fixed`,left:`${s.left}px`,top:`${s.top}px`,width:`${g}px`,height:`${_}px`,zIndex:e.asTrail?`78`:`80`,pointerEvents:`none`,display:`flex`,alignItems:`center`,gap:`6px`,padding:`0 8px`,borderRadius:`8px`,fontSize:`11px`,fontWeight:`500`,lineHeight:`1`,color:d,background:u,boxShadow:e.asTrail?h:m,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,opacity:String(e.opacity),willChange:`transform, left, top, opacity, filter`,transform:e.asTrail?`scaleX(1.12)`:`none`,filter:e.asTrail?`blur(0.9px) brightness(1.18) saturate(1.25)`:`none`});let r=document.createElement(`span`);Object.assign(r.style,{width:`6px`,height:`6px`,borderRadius:`2px`,flexShrink:`0`,background:p});let i=document.createElement(`span`);return i.textContent=n,Object.assign(i.style,{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:`0`,flex:`1`}),t.append(r,i),document.body.appendChild(t),t},D=i===`ok`||i===`danger`,O=D?g*.55:g*.92,k=i===`run`||i===`retry`?.96:.42,A=i===`run`||i===`retry`?.9:.28,j=E({opacity:1});Z.set(j,{transformOrigin:`center center`}),[.72,.46,.26].map((e,t)=>{let n=E({opacity:e,asTrail:!0});return Z.set(n,{transformOrigin:`center center`}),Z.to(n,{left:x,top:S,width:O,...D?{scale:k*(.92-t*.08)}:{scaleX:1.28+t*.1},opacity:0,duration:C,delay:MV(.04+t*.045),ease:v7,force3D:!0,onComplete:()=>n.remove()}),n}),Z.to(j,{left:x,top:S,width:O,scale:k,opacity:1,duration:C,ease:v7,force3D:!0,onComplete:()=>{let e=a;if(e&&(i===`ok`||i===`danger`)){let t=i===`ok`?`inset 0 0 0 1px color-mix(in oklab, var(--success) 28%, transparent)`:`inset 0 0 0 1px color-mix(in oklab, var(--danger) 28%, transparent)`,n=i===`ok`?`inset 0 0 0 1.5px color-mix(in oklab, var(--success) 52%, transparent), 0 0 10px color-mix(in oklab, var(--success) 20%, transparent)`:`inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 52%, transparent), 0 0 10px color-mix(in oklab, var(--danger) 20%, transparent)`;Z.set(e,{transformOrigin:`center center`});let r=Z.timeline({onComplete:()=>{Z.set(e,{clearProps:`boxShadow,transform,x,scale`})}});r.fromTo(e,{boxShadow:t},{boxShadow:n,duration:MV(.16),ease:`power1.inOut`,yoyo:!0,repeat:1}),r.to(e,{keyframes:[{x:2.8,scale:1.07,duration:MV(.07)},{x:-3.2,scale:.93,duration:MV(.09)},{x:2.2,scale:1.05,duration:MV(.08)},{x:-1.2,scale:.98,duration:MV(.07)},{x:0,scale:1,duration:MV(.1)}],ease:`power1.inOut`})}o?.(),Z.to(j,{opacity:0,scale:A,duration:T,delay:w,ease:`power1.out`,onComplete:()=>j.remove()})}})},c=T.current,l=new Set,u=(n,r,i,a)=>{if(!a||l.has(n))return;l.add(n);let o=c.wait[n],u=e.querySelector(`[data-slot-id="${CSS.escape(a)}"]`),d=u?.getBoundingClientRect()??c.slot[a],f=!!t.workers.find(e=>e.id===a)?.busy,p=u?.querySelector(`[data-slot-job-pill]`)??null,m=u?Array.from(u.querySelectorAll(`[data-slot-fill]`)):[];f||(p&&Z.set(p,{opacity:0,scale:.85}),m.forEach(e=>Z.set(e,{opacity:0,scaleX:.35,transformOrigin:`left center`}))),s(o,d,r,i,`run`,null,()=>{u&&(Z.fromTo(u,{filter:`brightness(1.35)`},{filter:`brightness(1)`,duration:MV(.42),ease:AV.soft}),!f&&p&&Z.to(p,{opacity:1,scale:1,duration:MV(.42),ease:v7}),f||m.forEach((e,t)=>{Z.to(e,{opacity:1,scaleX:1,duration:MV(.56),ease:v7,delay:MV(t*.03)})}))})};for(let[e,t]of i){let n=r.get(e);if(!n||n.status!==`queued`||t.status!==`running`)continue;let i=o.get(e)||t.accountId||n.accountId;i&&u(e,t.name,t.kind,i)}let d=b.workers.filter(e=>e.busy&&!t.workers.some(t=>t.id===e.id&&t.busy));for(let[e,t]of r){if(t.status!==`queued`||i.has(e))continue;let n=(t.accountId||``).trim();if(!n&&d.length===1&&(n=d[0].id),!n)continue;let r=b.workers.find(e=>e.id===n);r&&!r.busy&&d.every(e=>e.id!==n)||u(e,t.name,t.kind,n)}l.size&&(e.querySelectorAll(`[data-wait-pill][data-wait-id]`).forEach(e=>{let t=e.dataset.waitId;if(!t||l.has(t))return;let n=c.wait[t];if(!n)return;let r=e.getBoundingClientRect(),i=n.left-r.left,a=n.top-r.top;Math.abs(i)<.5&&Math.abs(a)<.5||Z.fromTo(e,{x:i,y:a},{x:0,y:0,duration:MV(.56),ease:v7,force3D:!0})}),e.querySelectorAll(`[data-wait-token][data-wait-id]`).forEach(e=>{let t=e.dataset.waitId;if(!t)return;let n=c.wait[t];if(!n)return;let r=e.getBoundingClientRect(),i=n.left-r.left,a=n.top-r.top;Math.abs(i)<.5&&Math.abs(a)<.5||Z.fromTo(e,{x:i,y:a,scale:1.15},{x:0,y:0,scale:1,duration:MV(.56),ease:v7})}));for(let[n,o]of r){if(o.status!==`running`)continue;let r=i.get(n),l=a.get(n),u=l?c.slot[l]:void 0;if(r&&r.status===`queued`){let t=(e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`)??e.querySelector(`[data-queue-col]`))?.getBoundingClientRect();s(u,t,o.name,o.kind,`retry`,null,()=>{let t=e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`);t&&Z.fromTo(t,{opacity:.4,scale:.85},{opacity:1,scale:1,duration:MV(.42),ease:v7})});continue}if(r&&r.status===`running`)continue;let d=b.completions?.find(e=>e.id===n),f;if(d)f=d.ok?`ok`:`danger`;else if(r?.status===`failed`)f=`danger`;else if(r?.status===`done`)f=`ok`;else{let e=b.totals.done>t.totals.done;f=b.totals.failed>t.totals.failed&&!e?`danger`:`ok`}let p=e.querySelector(f===`ok`?`[data-outcome="ok"]`:`[data-outcome="danger"]`);s(u,p?.getBoundingClientRect()??c.outcome[f],o.name,o.kind,f,p)}for(let[t,n]of i){if(n.status!==`queued`||r.has(t))continue;let i=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);i&&Z.fromTo(i,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:MV(.52),ease:v7})}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=b.jobs.filter(e=>e.status===`queued`).map(e=>e.id);if(n.length===r.length&&n.some((e,t)=>e!==r[t]))for(let t of r){let n=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);if(!n)continue;let r=c.wait[t];if(!r)continue;let i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;Math.abs(a)<.5&&Math.abs(o)<.5||Z.fromTo(n,{x:a,y:o},{x:0,y:0,duration:MV(.56),ease:v7,force3D:!0})}}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=b.jobs.filter(e=>e.status===`queued`).map(e=>e.id);for(let t=0;tu(!l),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,G.jsx)(di,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${l?`rotate-90`:``}`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,G.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":P?`ok`:``}),e(P?`inflightLiveBadge`:`inflightMockBadge`)]}),l&&F>0?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:F})}):null]}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),l?(0,G.jsxs)(Sn,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,G.jsx)($r,{size:14,"aria-hidden":!0})]}):(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>u(!0),children:[e(`inflightExpand`),(0,G.jsx)(di,{size:14,"aria-hidden":!0})]})]}),l?(0,G.jsxs)(`div`,{id:`inflight-live-body`,ref:S,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b border-separator px-4 py-3 sm:grid-cols-4`,children:[(0,G.jsx)(w7,{label:e(`inflightWaiting`),value:x.waiting,warn:j}),(0,G.jsx)(w7,{label:e(`inflightRunning`),value:x.occupiedSlots,suffix:`/${x.workerSlots}`}),(0,G.jsx)(w7,{label:e(`inflightThroughput`),value:b.throughputPerMin,suffix:`/min`}),(0,G.jsx)(w7,{label:e(`inflightWaitP95`),value:b.waitP95Ms,kind:`ms`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 border-b border-separator px-4 py-3 lg:grid-cols-[minmax(0,0.95fr)_minmax(0,1.55fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,G.jsx)(`span`,{className:`mono text-[10px] tabular ${j?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:x.waiting})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[O.map(t=>(0,G.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 shadow-[var(--il-hair)] ${C7(t.kind)}`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_28%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,G.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-1.5 truncate text-[11px] font-medium text-foreground/92`,children:[(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-[2px] ${S7(t.kind)}`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,G.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-[10px] text-muted`,children:b7(x7(t,_))})]},t.id)),k.length?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[k.map(e=>(0,G.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${S7(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,G.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,k.length]})]}):O.length===0?(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,G.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[x.occupiedSlots,`/`,x.workerSlots]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:A.map(t=>(0,G.jsx)(Wxe,{slot:t,job:t.jobId?E.get(t.jobId):void 0,clockMs:_,idleLabel:e(`inflightSlotIdle`)},t.id))})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[4.5rem] lg:flex-col lg:gap-2.5`,children:[(0,G.jsx)(T7,{label:e(`inflightDone`),value:b.totals.done,tone:`ok`,icon:(0,G.jsx)(_i,{size:15,weight:`bold`,"aria-hidden":!0})}),(0,G.jsx)(T7,{label:e(`inflightFailed`),value:b.totals.failed,tone:`danger`,icon:(0,G.jsx)(ao,{size:15,weight:`bold`,"aria-hidden":!0})})]})]}),(0,G.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,G.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:N})]}),(0,G.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,G.jsx)(Uxe,{series:b.depthSeries,bands:[],backpressure:b.backpressure,label:N})})]})]}):null]})}function w7({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,G.jsx)(dH,{value:t,kind:r,duration:560}),n?(0,G.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function T7({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,G.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-1.5 rounded-2xl px-2.5 py-3 ${i?`bg-[var(--il-ok-bg)] shadow-[var(--il-hair-ok),0_6px_16px_color-mix(in_oklab,var(--success)_10%,transparent)]`:`bg-[var(--il-err-bg)] shadow-[var(--il-hair-err),0_6px_16px_color-mix(in_oklab,var(--danger)_10%,transparent)]`}`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-7 items-center justify-center rounded-full ${i?`bg-[color-mix(in_oklab,var(--success)_18%,transparent)] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_18%,transparent)] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,G.jsx)(`div`,{className:`mono text-[1.15rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,G.jsx)(dH,{value:t,kind:`int`,duration:560})}),(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] ${i?`text-[color-mix(in_oklab,var(--success)_72%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_72%,var(--muted))]`}`,children:e})]})}var E7=2500;Math.round(6e4/E7);function Kxe(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||zV().then(n=>{e||(t(n),r(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-24)))}).catch(()=>{})},a=()=>{n||document.hidden||(i(),n=setInterval(i,E7))},o=()=>{n&&clearInterval(n),n=null},s=()=>document.hidden?o():a();return a(),document.addEventListener(`visibilitychange`,s),()=>{e=!0,o(),document.removeEventListener(`visibilitychange`,s)}},[]),{live:e,samples:n}}var qxe=(0,v.lazy)(()=>C(()=>import(`./TrafficChart-BycQ9SfL.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1]))),D7=3e4,Jxe={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Yxe(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):AH(e,t)}function Xxe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Zxe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function O7(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var Qxe=[`ok`,`incomplete`,`error`,`canceled`],k7={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},A7={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function j7(e,t){return t>0?e/t:null}function $xe(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function eSe(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function tSe(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function nSe(){let{lang:e,t}=EI(),{overview:n,loading:r,error:i}=qI(),[a,o]=(0,v.useState)(`today`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=at(),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!0),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(!0),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(()=>Date.now()),{live:k,samples:A}=Kxe(),[j,M]=(0,v.useState)(!1),N=new Map((k?.accounts??[]).map(e=>[e.id,e])),P=!!n?.proxy?.ok,F=!!n?.worker?.ok,I=n?.worker?.ready_count??0,L=n?.worker?.hot_count??0,R=n?.worker?.cooling_count??0,z=k?.in_flight??n?.worker?.in_flight??0,B=f??Jxe,V=n?.routing?.session_affinity,H=(V?.hits??0)+(V?.misses??0),ee=j7(V?.hits??0,H),te=y.map(e=>({account:e,until:eSe(e,D)})).filter(e=>e.until!=null),ne=te.length>0;(0,v.useEffect)(()=>{if(!ne)return;let e=setInterval(()=>O(Date.now()),1e3);return()=>clearInterval(e)},[ne]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([PI(!1),VI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&b(t.value.data||[]),n.status===`fulfilled`&&w((n.value.data||[]).length))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[]);let re=s?.start?.toString()??``,ie=s?.end?.toString()??``,ae=(0,v.useRef)(0),oe=(0,v.useCallback)(e=>{let t=vH(a,s);if(!t){_(!1);return}let n=++ae.current;ZV(t).then(e=>{n===ae.current&&(p(e),h(``))}).catch(t=>{n!==ae.current||e||(p(null),h(t instanceof Error?t.message:String(t)))}).finally(()=>{n===ae.current&&_(!1)})},[a,re,ie]);(0,v.useEffect)(()=>(oe(!1),()=>{ae.current++}),[oe]),(0,v.useEffect)(()=>{if(l)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),oe(!0))},n=setInterval(t,D7),r=()=>{!document.hidden&&Date.now()-e>=D7&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[l,oe]),(0,v.useEffect)(()=>{let e=!1,t=()=>{Aoe().then(t=>{e||E(t)}).catch(()=>{})};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[]);let se=Math.floor(B.series.length/2),ce=(e,t)=>e.reduce((e,n)=>e+n[t],0),le=B.series.slice(0,se),ue=B.series.slice(se),de=((e,t)=>e>0?(t-e)/e:null)(ce(le,`requests`),ce(ue,`requests`)),fe=ce(le,`requests`)?ce(le,`ok`)/ce(le,`requests`):null,pe=ce(ue,`requests`)?ce(ue,`ok`)/ce(ue,`requests`):null,me=fe!=null&&pe!=null?pe-fe:null,he=[{label:t(`metricRequests`),value:B.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(_H[a])}),ok:B.totals.requests>0,trend:de},{label:t(`metricSuccess`),value:B.totals.success_rate,kind:`percent`,detail:`${B.totals.ok} ${t(`logsFilterOk`)} · ${B.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${B.totals.error} ${t(`logsFilterError`)}`,ok:B.totals.requests===0||B.totals.success_rate>=.9,trend:me},{label:t(`metricLatency`),value:B.latency.p95_ms??B.latency.avg_ms,kind:`ms`,detail:`p50 ${eH(B.latency.p50_ms)} · avg ${eH(B.latency.avg_ms)}`,ok:B.latency.p95_ms==null||B.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:B.tokens.total,kind:`compact`,detail:`${$V(B.tokens.prompt)} / ${$V(B.tokens.completion)}`,ok:!0,trend:null}],ge=j7(B.tokens.cache_read,B.tokens.prompt),_e=j7(B.totals.streaming,B.totals.requests),ve=[{label:t(`metricCacheHit`),value:ge,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:$V(B.tokens.cache_read),prompt:$V(B.tokens.prompt)})},{label:t(`metricStreaming`),value:_e,kind:`percent`,detail:t(`metricStreamingDetail`,{count:B.totals.streaming,total:B.totals.requests})},{label:t(`metricCanceled`),value:B.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:nH(j7(B.totals.canceled,B.totals.requests)??0)})}],ye=Qxe.map(e=>({key:e,count:B.status.find(t=>t.key===e)?.count??B.totals[e]??0})),be=e=>bH(e,B.window.from,B.window.to);return r&&!n?(0,G.jsx)(Mse,{}):(0,G.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,G.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(yH,{value:a,onChange:o,custom:s,onCustomChange:c,onBusy:()=>_(!0),t}),(0,G.jsxs)(PM,{delay:300,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(l?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":l,onPress:()=>u(e=>!e),children:l?(0,G.jsx)(xa,{size:14}):(0,G.jsx)(_a,{size:14})}),(0,G.jsx)(PM.Content,{children:t(l?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,G.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,G.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":P&&F?`ok`:`danger`}),t(P&&F?`running`:`degraded`)]})]})]})]}),i?(0,G.jsx)(QI,{title:t(`failedOverview`,{msg:i})}):null,(0,G.jsx)(Ace,{live:k,samples:A,t,onConcurrencyClick:()=>M(!0)}),(0,G.jsx)(Gxe,{t,expanded:j,onExpandedChange:M,live:j?k:null}),(0,G.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:he.map(e=>(0,G.jsxs)(HS,{className:`gap-0 p-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:g?(0,G.jsx)(Q,{className:`h-7 w-24`}):e.value==null?`—`:(0,G.jsx)(dH,{value:e.value,kind:e.kind})}),!g&&e.trend!=null?(0,G.jsx)(iSe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:ve.map(e=>(0,G.jsx)(HS,{className:`gap-0 p-3.5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]}),(0,G.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:g?(0,G.jsx)(Q,{className:`h-5 w-12`}):e.value==null?`—`:(0,G.jsx)(dH,{value:e.value,kind:e.kind})})]})},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3`,children:(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:B.totals.error?`warning`:`success`,children:nH(B.totals.success_rate)})]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4`,children:[m?(0,G.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:m})}):g?(0,G.jsx)(IV,{}):B.series.some(e=>e.requests>0)?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(IV,{}),children:(0,G.jsx)(qxe,{series:B.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:{requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)},onSelectRange:(e,t)=>d(bH({},e,t))})}):(0,G.jsx)(fH,{emptyLabel:t(`statsEmptyTraffic`)}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),eH(B.latency.p50_ms)],[t(`statsLatencyP95`),eH(B.latency.p95_ms)],[t(`statsLatencyAvg`),eH(B.latency.avg_ms)],[t(`statsTTFB`),eH(B.latency.ttfb_avg_ms)]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:g?(0,G.jsx)(Q,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,G.jsxs)(Sn,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,G.jsx)($r,{size:12})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),I,`ok`],[t(`hot`),L,L?`ok`:``],[t(`inFlight`),z,z?`ok`:``],[t(`statsAffinityHit`),ee==null?`—`:nH(ee),``,V?t(`statsAffinityHint`,{hits:V.hits??0,misses:V.misses??0,bindings:V.bindings??0}):``]].map(([e,t,n,r])=>(0,G.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,G.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,G.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),!x&&te.length?(0,G.jsxs)(`div`,{className:`border-b border-separator px-4 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`statsCoolingDetails`)}),(0,G.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:te.map(({account:e,until:n})=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-caption sm:flex-row sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pl-4 sm:contents sm:pl-0`,children:[(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?O7(e.last_error_kind,t):t(`statsUnknown`)}),(0,G.jsx)(`span`,{className:`mono shrink-0 tabular sm:w-16 sm:text-right`,children:$xe(n,D)??`—`}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted sm:w-12 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]})]},e.id))})]}):null,(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:x?(0,G.jsx)(FV,{}):y.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):y.slice(0,6).map(e=>{let n=e.quota,r=tSe(n?.percentage,n?.exceeded),i=N.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[jH(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{children:[t(`metricModels`),` `,C]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=y.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(MH,{provider:e,size:11}),t]},e):null}),(0,G.jsx)(`span`,{children:R?`${R} ${t(`statsCooling`)}`:`${y.length} ${t(`accountCount`)}`})]})]})]}),(0,G.jsx)(rSe,{resources:T,t})]}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),g?(0,G.jsx)(FV,{}):(0,G.jsx)(N7,{empty:t(`statsNoProviders`),items:(B.providers||[]).map(e=>({key:e.key,label:Yxe(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:be({provider:e.key})}))})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),g?(0,G.jsx)(FV,{rows:4}):(0,G.jsx)(N7,{empty:t(`statsNoModels`),items:B.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:be({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:eH(e.latency_avg_ms)}))})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),g?(0,G.jsx)(FV,{rows:4}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(aSe,{items:ye,t}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,G.jsx)(N7,{empty:t(`statsNoErrors`),danger:!0,items:B.errors.map(e=>({key:e.key,label:O7(e.key,t),count:e.count,href:Zxe.has(e.key)?be({error_kind:e.key}):void 0}))}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,G.jsx)(N7,{empty:t(`statsNoAccounts`),items:B.accounts.slice(0,5).map(e=>({key:e.key,label:Xxe(y,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:be({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function M7(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function rSe({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?tH(e.total_rss_bytes):`—`})]}),(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":M7(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[tH(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":M7(e.rss_bytes,e.cpu_percent)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[tH(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,G.jsx)(FV,{rows:3})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,G.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function N7({items:e,empty:t,danger:n}){let r=(0,v.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`[data-rank-fill]`);e.length&&Z.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,G.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,G.jsx)(MH,{provider:e.mark,size:14}):null,(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,G.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,G.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,G.jsx)(Sn,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function iSe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,G.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,G.jsx)(n===`down`?Ya:n===`up`?Za:hi,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function aSe({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(A7[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,G.jsx)(`div`,{className:k7[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${k7[e.key]}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(A7[e.key])}),(0,G.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,G.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:nH(e.count/n)})]},e.key))})]}):(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}function P7(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function oSe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=rH(e),s=iH(e),c=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),l=jH(c,String(e.region||e.regions?.[0]||``).trim().toLowerCase()||void 0,t),u=c===`trae`?gce(e):void 0;return(0,G.jsx)(Y.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`md`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`text-section`,children:e.display_name||e.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[l,o?` · ${o}`:``]})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:[(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`contextWindowCol`)}),(0,G.jsxs)(`div`,{className:`mt-1 text-body`,children:[P7(i),a&&a!==i?` → ${P7(a)}`:``]}),e.supports_max_mode?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(c===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,!e.supports_max_mode&&a&&a!==i?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`workbuddyContextHint`)}):null,u?u.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,P7(u.prompt_max_tokens)]}):null:e.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,P7(e.prompt_max_tokens)]}):null,u?u.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,P7(u.max_output_tokens)]}):null:e.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,P7(e.max_output_tokens)]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`reasoningHint`)}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:r.map(n=>{let r=`reasoningLevel_${n}`,i=t(r);return(0,G.jsxs)(aC,{size:`sm`,variant:`soft`,color:n===(e.reasoning_effort||e.reasoning_default)?`success`:`default`,children:[i===r?n:i,n===e.reasoning_default?` · ${t(`defaultValue`)}`:``,n===e.reasoning_effort&&n!==e.reasoning_default?` · ${t(`custom`)}`:``]},n)})})]}):(0,G.jsx)(`div`,{className:`mt-1 text-body text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function F7({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,G.jsx)(nj,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,G.jsxs)(nj.Content,{children:[(0,G.jsx)(nj.Control,{children:(0,G.jsx)(nj.Thumb,{})}),r?(0,G.jsx)(IN,{children:r}):(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})})}function I7({title:e,hint:t,action:n,icon:r,className:i}){return(0,G.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center ${i||``}`,children:(0,G.jsxs)(`div`,{className:`max-w-sm`,children:[r?(0,G.jsx)(`div`,{className:`mb-3 flex justify-center text-muted`,children:r}):null,(0,G.jsx)(Die,{className:`p-0 text-body font-medium text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t}):null,n?(0,G.jsx)(`div`,{className:`mt-5 flex justify-center`,children:n}):null]})})}var L7=`__all__`;function R7({value:e,onChange:t,ariaLabel:n,options:r,className:i}){let a=r.map(e=>({id:e.id||L7,label:e.label})),o=e||L7,s=a.find(e=>e.id===o);return(0,G.jsxs)(AF,{className:i??`w-fit min-w-36`,"aria-label":n,value:o,onChange:e=>{typeof e==`string`&&t(e===L7?``:e)},children:[(0,G.jsxs)(AF.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!s?e:(0,G.jsx)(`span`,{className:`truncate`,children:s.label})}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{className:`max-h-72 min-w-36`,children:(0,G.jsx)(oF,{children:a.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(IN,{className:`block truncate`,children:e.label}),(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})})]})}var sSe=[20,50,100],cSe=[20,50,100];function lSe(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,G.jsx)(qA,{id:String(e),children:e},e))})]}),(0,G.jsxs)(DF,{size:`sm`,className:`w-fit`,children:[(0,G.jsx)(DF.Summary,{className:`mono text-caption`,children:o}),(0,G.jsxs)(DF.Content,{children:[(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,G.jsx)(DF.PreviousIcon,{})})}),f.map((e,n)=>e===`gap`?(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Ellipsis,{})},`gap-${n}`):(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,G.jsx)(DF.NextIcon,{})})})]})]})]})}function B7({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,G.jsx)(PN,{"aria-label":r,value:e,onChange:t,className:i,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:n}),(0,G.jsx)(PN.ClearButton,{})]})})}function uSe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function V7(e){return e.settings_key||e.id}function H7(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function U7(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function W7(e){return`${H7(e)}:${U7(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function G7(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function K7(e,t){let n=`reasoningLevel_${t}`,r=e(n);return r===n?t:r}function q7({label:e,hint:t}){return(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`cursor-help text-caption text-muted`,children:e})}),(0,G.jsx)(PM.Content,{children:(0,G.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:t})})]})}function J7({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i,onReasoningChange:a}){let o=H7(e),s=r===`card`,c=s?`w-full min-w-0`:`w-full max-w-[7.5rem] min-w-0`;return(0,G.jsxs)(`div`,{className:s?`flex min-w-0 flex-col gap-3`:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[P7(e.catalog_context_length||e.context_length),e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?` → ${P7(e.catalog_context_length_max)}`:``]}),o===`workbuddy`&&e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`workbuddyContextHint`)}):null]}),(o===`trae`||o===`qoder`)&&e.supports_max_mode?(0,G.jsxs)(`div`,{className:s?`flex flex-col gap-1.5`:`flex items-center gap-2`,children:[s?(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${P7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(F7,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}),s?null:(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${P7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)})]})]}):null,(e.reasoning_options||[]).length>1?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(q7,{label:n(`reasoningLevels`),hint:n(`reasoningHint`)}),(0,G.jsx)(R7,{className:c,ariaLabel:`${e.id} ${n(`reasoningLevels`)}`,value:e.reasoning_effort||e.reasoning_default||e.reasoning_options?.[0]||``,onChange:t=>{t&&a(e,t)},options:(e.reasoning_options||[]).map(e=>({id:e,label:K7(n,e)}))})]}):(e.reasoning_options||[]).length===1?(0,G.jsx)(q7,{label:`${n(`reasoningLevels`)} ${K7(n,e.reasoning_options[0])}`,hint:n(`reasoningHint`)}):e.reasoning_type?(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:n(`reasoningFixed`,{type:e.reasoning_type})}):o===`trae`&&!e.supports_max_mode?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`catalogWindowHint`)}):null]})}function Y7({model:e,t,onDetails:n}){return(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,G.jsx)($i,{size:14}),t(`modelDetails`)]})}function dSe(){let{t:e}=EI(),{overview:t,loading:n}=qI(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(1),[d,f]=(0,v.useState)(50),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!0);(0,v.useEffect)(()=>{let e=!1;return ooe(void 0,`regional`).then(t=>{e||T(t.data||[])}).catch(()=>void 0).finally(()=>{e||D(!1)}),UI().then(t=>{e||c(uSe(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let O=(0,v.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=a.includes(`:`)?a.split(`:`,2):[a,``];return w.filter(r=>{let a=H7(r),o=U7(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=jH(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,w,a,e]),k=[r,a,d].join(`\0`),[A,j]=(0,v.useState)(k);A!==k&&(j(k),u(1));let M=Math.max(1,Math.ceil(O.length/d)),N=Math.min(A===k?Math.max(1,l):1,M);l!==N&&u(N);let P=(0,v.useMemo)(()=>{let e=(N-1)*d;return O.slice(e,e+d)},[N,O,d]),F=O.length===0?0:(N-1)*d+1,I=Math.min(O.length,N*d),L=O.length?e(`logsShownTotal`,{shown:`${F}–${I}`,total:O.length}):e(`shownTotal`,{shown:0,total:w.length});if(n&&!t||E)return(0,G.jsx)(Ise,{});function R(e,t){let n=V7(e),r=H7(e),i=w.map(e=>{if(V7(e)!==n||H7(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});T(i)}function z(e,t){let n=V7(e),r=H7(e),i=w.map(e=>V7(e)!==n||H7(e)!==r?e:{...e,reasoning_effort:t,context_custom:!!e.max_mode||!!(t&&t!==e.reasoning_default)});T(i)}async function B(){m(!0),y(``),x(!1);try{let e=await HI(void 0,`regional`);T(e.data||[])}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function V(t,n){let r=H7(t);if(r!==`trae`&&r!==`workbuddy`&&r!==`kimi`)return;let i=V7(t);g(i),y(``),x(!1);try{await coe(r,i,n),z(t,n),y(e(`reasoningSaved`,{model:t.id,level:K7(e,n)}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}async function H(t,n){if(!t.supports_max_mode){x(!0),y(e(`contextMaxUnavailable`));return}let r=V7(t),i=H7(t);g(r),y(``),x(!1);try{await soe(i,r,n,t.catalog_context_length_max),R(t,n),y(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,G.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:w.length?L:e(`noModelsYet`)})]}),(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,G.jsx)(B7,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:i,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(R7,{ariaLabel:e(`providerCol`),value:a,onChange:o,options:[{id:``,label:e(`providerFilterAll`)},...s.map(t=>({id:t.value,label:jH(t.provider,t.region,e)}))]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:p,onPress:()=>void B(),children:[(0,G.jsx)(qr,{size:14}),e(p?`refreshing`:`refresh`)]})]})]})]}),_?(0,G.jsx)(QI,{status:b?`danger`:`success`,title:_}):null,(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(ji,{size:16})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,G.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,className:`shrink-0`,children:O.length})]}),p||n?(0,G.jsx)(LV,{}):O.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(la,{size:22}),title:w.length?e(`noModelsMatch`):e(`noProviders`),hint:w.length?r||a||e(`noModelsMatch`):e(`noModelsYet`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=jH(i,U7(t)||void 0,e),o=rH(t),s=iH(t);return(0,G.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(MH,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`font-medium`,children:a})]}),(0,G.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void H(e,t),onReasoningChange:(e,t)=>void V(e,t)}),(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})]},W7(t))})}),(0,G.jsx)(X,{className:`hidden min-w-0 lg:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,G.jsx)(X.Column,{children:e(`requestIdCol`)}),(0,G.jsx)(X.Column,{children:e(`providerCol`)}),(0,G.jsx)(X.Column,{children:e(`qoderKeyCol`)}),(0,G.jsx)(X.Column,{children:e(`modelDefaultsCol`)}),(0,G.jsx)(X.Column,{children:e(`stateCol`)}),(0,G.jsx)(X.Column,{children:e(`actions`)})]}),(0,G.jsx)(X.Body,{children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=jH(i,U7(t)||void 0,e),o=rH(t),s=iH(t);return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(MH,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`text-caption font-medium`,children:a})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void H(e,t),onReasoningChange:(e,t)=>void V(e,t)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})})]},W7(t))})})]})})})]})]}),(0,G.jsx)(oSe,{model:S?w.find(e=>V7(e)===V7(S))||S:null,t:e,onClose:()=>C(null)}),(0,G.jsx)(z7,{total:O.length,page:N,pageCount:M,pageSize:d,loading:p,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:N,pages:M}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:u,onPageSize:f})]})}function X7({copied:e,size:t=14,className:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let t=e?i.current:r.current,n=e?r.current:i.current;if(!t||!n)return;let o={autoAlpha:1,scale:1,filter:`blur(0px)`},s={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(a.current||jV()){a.current=!1,Z.set(t,o),Z.set(n,s);return}Z.to(n,{...s,duration:kV.fast,ease:AV.out,overwrite:!0}),Z.fromTo(t,s,{...o,duration:kV.base,ease:AV.soft,delay:kV.instant/2,overwrite:!0})},[e]),(0,G.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,G.jsx)(`span`,{ref:r,className:`col-start-1 row-start-1 inline-flex`,children:(0,G.jsx)(Di,{size:t})}),(0,G.jsx)(`span`,{ref:i,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,G.jsx)(_i,{size:t})})]})}async function Z7(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Q7(){return`${location.protocol}//${location.host}`}function $7(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${Q7()}${e}`:`${Q7()}/${e}`:Q7()}function fSe({access:e}){let{t}=EI(),[n,r]=(0,v.useState)(``),i=$7(e?.openai_base_url||`/v1`),a=(0,v.useMemo)(()=>[{name:t(`endpointOpenAI`),url:i,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,G.jsx)(ai,{size:15})},{name:t(`endpointChat`),url:$7(e?.chat_completions||`${i}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointMessages`),url:$7(e?.messages||`${i}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointResponses`),url:$7(e?.responses||`${i}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointModels`),url:$7(e?.models||`${i}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,G.jsx)(sa,{size:15})},{name:t(`endpointHealth`),url:$7(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,G.jsx)(Zi,{size:15})}],[e,i,t]);return(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:a.length-1})})]}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,G.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,G.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:e.method})]}),(0,G.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{Z7(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,G.jsx)(X7,{copied:n===e.name})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,G.jsx)(Zr,{size:14})})]})]})]},e.name))})]})}var pSe=`https://caiaiu.com`;function e9({className:e=``}){let{t}=EI();return(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,G.jsx)(`a`,{href:pSe,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}var mSe=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),hSe=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function gSe(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function _Se(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function vSe(e){let t=gSe(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(hSe.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(mSe.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function t9({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,G.jsxs)(AF,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,G.jsxs)(AF.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,G.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,G.jsx)(AF.Indicator,{className:`size-2.5 opacity-50`})]}),(0,G.jsx)(AF.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,G.jsx)(oF,{children:a.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(IN,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,G.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})})]})}function ySe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:s,onStop:c,accountValue:l,onAccountChange:u,accountOptions:d,modelValue:f,onModelChange:p,modelOptions:m,modelsLoading:h}){let{t:g}=EI(),_=(0,v.useRef)(null);async function y(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await vSe(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&window.alert(g(`chatAttachUnsupported`,{names:i.join(`, `)})),_.current&&(_.current.value=``)}function b(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&s())}return(0,G.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,G.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Ui,{size:14})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`mono text-muted`,children:_Se(e.size)})]}),(0,G.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":g(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,G.jsx)(ao,{size:12})})]},e.id))}):null,(0,G.jsx)(JM,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:b,placeholder:g(`promptPlaceholder`),"aria-label":g(`prompt`),disabled:i||a}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,G.jsx)(`input`,{ref:_,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void y(e.target.files)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":g(`chatAttach`),isDisabled:i||a,onPress:()=>_.current?.click(),children:(0,G.jsx)(Ca,{size:15})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,G.jsx)(t9,{ariaLabel:g(`account`),value:l,onChange:u,options:d,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:g(`model`),value:f,onChange:p,placeholder:g(h?`requesting`:`model`),options:m,isDisabled:i||a||h||!m.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,G.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":g(`chatTryStop`),onPress:c,children:(0,G.jsx)(Va,{size:14,weight:`fill`})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":g(`chatTrySend`),isDisabled:!o||i||a,onPress:s,children:(0,G.jsx)(ha,{size:14,weight:`fill`})})]})]})]}),(0,G.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:g(`chatTryHelper`)})]})}function bSe({collapsed:e,onCollapsedChange:t,items:n,activeId:r,onSelect:i,onNew:a}){let{t:o}=EI(),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=s.current;!t||jV()||e||Z.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:kV.fast,ease:`power2.out`})},[e]),e?(0,G.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,G.jsx)(ka,{size:15})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryNew`),onPress:a,children:(0,G.jsx)(Ca,{size:14})})]}):(0,G.jsxs)(`aside`,{ref:s,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":o(`chatHistoryTitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:o(`chatHistoryTitle`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,G.jsx)(li,{size:14})})]}),(0,G.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:a,children:[(0,G.jsx)(Ca,{size:13}),o(`chatHistoryNew`)]})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===r;return(0,G.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>i(e.id),children:(0,G.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||o(`chatHistoryUntitled`)})},e.id)}):(0,G.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:o(`chatHistoryEmpty`)})})]})}function n9({latencyMs:e,ttfbMs:t,completionTokens:n,stream:r,labels:i,className:a=``,variant:o=`block`}){let s=dce(uce({completionTokens:n,latencyMs:e,ttfbMs:t,stream:r})),c=eH(t),l=eH(e);if(o===`inline`)return(0,G.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${a}`.trim(),children:[(0,G.jsxs)(`span`,{children:[i.ttft,` `,c]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsxs)(`span`,{children:[i.total,` `,l]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsx)(`span`,{children:s})]});let u=[[i.ttft,c],[i.total,l],[i.tps,s]];return(0,G.jsxs)(`div`,{className:a,children:[i.heading?(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:i.heading}):null,(0,G.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:u.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,G.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}function xSe({text:e,streaming:t,defaultOpen:n}){let{t:r}=EI(),[i,a]=(0,v.useState)(!!n),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(null),u=(0,v.useRef)(null);if((0,v.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,v.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,v.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,v.useEffect)(()=>{let t=l.current,n=u.current;if(!t)return;let r=jV();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}Z.to(t,{height:0,opacity:0,duration:kV.fast,ease:AV.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}Z.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:kV.base,ease:AV.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let d=jV(),f=t?o:o||c.current;return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,G.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ci,{size:12,className:`shrink-0 text-muted ${d?``:`animate-spin`}`}),(0,G.jsx)(`span`,{className:d?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,G.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(di,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{children:r(`thinkingDone`)}),f>0?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:f})}):null,!f&&e?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,G.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,G.jsx)(`pre`,{ref:u,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function SSe(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function CSe({status:e}){return e===`running`?(0,G.jsx)(Fa,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,G.jsx)(ro,{size:12,weight:`fill`,className:`text-danger`}):(0,G.jsx)(yi,{size:12,weight:`fill`,className:`text-success`})}function wSe(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function r9({call:e,forceOpen:t}){let{t:n}=EI(),[r,i]=(0,v.useState)(e.status===`error`||!!t),[a,o]=(0,v.useState)(!1),s=(0,v.useMemo)(()=>wSe(e.arguments||``),[e.arguments]);(0,v.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,v.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await Z7(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,G.jsx)(di,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,G.jsx)(CSe,{status:e.status}),SSe(e.status,n)]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,G.jsx)(ki,{size:12}),n(a?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function TSe({calls:e}){let{t}=EI(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,v.useState)(n||r||e.length===1);return(0,v.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,G.jsx)(r9,{call:e[0],forceOpen:e[0].status===`error`})}):(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,G.jsx)(di,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,G.jsx)(Fa,{size:12,className:`animate-spin`}):null]}),i?(0,G.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,G.jsx)(r9,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function ESe({message:e}){return e.attachments?.length?(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,G.jsx)(Ui,{size:12})}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function DSe({message:e}){let{t}=EI(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:$V(r??0),completion:$V(i??0)}):``;return(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:cH(n.credits)}):t(`chatTryCreditsUsed`,{amount:cH(n.credits)})})}function OSe({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,G.jsx)(`span`,{children:e},`s-${n}`):(0,G.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function kSe(){let e=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=e.current;!t||jV()||Z.from(t,{autoAlpha:0,duration:kV.fast,ease:`power2.out`})},[]),e}function ASe({message:e}){let{t}=EI(),[n,r]=(0,v.useState)(!1),i=e.role===`user`,a=kSe();if(i)return(0,G.jsx)(`div`,{ref:a,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,G.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,G.jsx)(ESe,{message:e})]})});let o=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,s=!!e.content&&e.status===`done`,c=e.status===`streaming`,l=!!(e.usage&&e.usage.credits!=null),u=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function d(){e.content&&(await Z7(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,G.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[e.reasoning||c?(0,G.jsx)(xSe,{text:e.reasoning||``,streaming:c&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,G.jsx)(TSe,{calls:e.toolCalls}):null,e.status===`error`?(0,G.jsx)(QI,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):o?(0,G.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,G.jsx)(UA,{className:`h-3 w-28 rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-full rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-[86%] rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,G.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,G.jsx)(OSe,{text:e.content,streaming:c})}):null,s||l||u?(0,G.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[s?(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex h-5 items-center gap-1 text-caption text-muted/80 opacity-70 transition-opacity hover:text-foreground hover:opacity-100`,onClick:()=>void d(),children:[(0,G.jsx)(ki,{size:12}),t(n?`copied`:`copy`)]}):null,(0,G.jsx)(DSe,{message:e})]}),u?(0,G.jsx)(n9,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function jSe({messages:e,busy:t,onLoadDemo:n}){let{t:r}=EI(),i=(0,v.useRef)(null);(0,v.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,G.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,G.jsx)(I7,{className:`min-h-56`,title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,G.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,G.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,G.jsx)(ASe,{message:e},e.id))}),(0,G.jsx)(`div`,{ref:i})]})}function MSe({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:a,requestState:o,elapsedMs:s,output:c,responseStatus:l,curl:u,copiedCurl:d,onCopyCurl:f,canSend:p,accountValue:m,onAccountChange:h,accountOptions:g,modelValue:_,onModelChange:v,modelOptions:y,modelsLoading:b,disabled:x}){let{t:S}=EI();return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:S(`rawFormatHint`)}),(0,G.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,G.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,G.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,G.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`requestBuilder`)}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`rawFormatLabel`)}),(0,G.jsx)(pH,{className:`access-format-chips`,ariaLabel:S(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:S(`rawFormatChat`)},{id:`messages`,label:S(`rawFormatMessages`)},{id:`responses`,label:S(`rawFormatResponses`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,G.jsx)(t9,{ariaLabel:S(`account`),value:m,onChange:h,options:g,isDisabled:x||o===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:S(`model`),value:_,onChange:v,placeholder:S(b?`requesting`:`model`),options:y,isDisabled:x||o===`loading`||b||!y.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`prompt`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,G.jsx)(JM,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:S(`promptPlaceholder`),"aria-label":S(`prompt`),disabled:x||o===`loading`}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:S(`promptHelper`)})]}),(0,G.jsxs)(J,{fullWidth:!0,isPending:o===`loading`,isDisabled:!p||x,onPress:a,children:[(0,G.jsx)(ha,{size:15}),S(o===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,G.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":o===`loading`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`responseInspector`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:S(`responseInspectorHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s===null?null:(0,G.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(Ti,{size:12}),s,` ms`]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:o===`success`?`success`:o===`error`?`danger`:void 0,children:l})]})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:o===`idle`?(0,G.jsx)(I7,{className:`min-h-64`,title:S(`responseEmptyTitle`),hint:S(`responseEmptyHint`)}):o===`loading`?(0,G.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,G.jsx)(UA,{className:`h-3 w-32 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-full rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[88%] rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[72%] rounded-lg`}),(0,G.jsx)(UA,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[64%] rounded-lg`})]}):o===`error`?(0,G.jsx)(`div`,{className:`space-y-3`,children:(0,G.jsx)(QI,{status:`danger`,title:S(`requestFailed`),description:c})}):(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,G.jsx)(yi,{size:14,weight:`fill`}),S(`responseReceived`)]}),(0,G.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:c})]})})]})]})}),(0,G.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:S(`curlExample`)}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:S(`curlGeneratedHint`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:f,children:[(0,G.jsx)(X7,{copied:d}),S(d?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:u})]})]})}function i9(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` + `}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`button`,{type:`button`,"data-testid":`inflight-live-toggle`,"aria-expanded":l,"aria-controls":`inflight-live-body`,onClick:()=>u(!l),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,G.jsx)(di,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${l?`rotate-90`:``}`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,G.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":P?`ok`:``}),e(P?`inflightLiveBadge`:`inflightMockBadge`)]}),l&&F>0?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:F})}):null]}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),l?(0,G.jsxs)(Sn,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,G.jsx)($r,{size:14,"aria-hidden":!0})]}):(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>u(!0),children:[e(`inflightExpand`),(0,G.jsx)(di,{size:14,"aria-hidden":!0})]})]}),l?(0,G.jsxs)(`div`,{id:`inflight-live-body`,ref:S,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b border-separator px-4 py-3 sm:grid-cols-4`,children:[(0,G.jsx)(w7,{label:e(`inflightWaiting`),value:x.waiting,warn:j}),(0,G.jsx)(w7,{label:e(`inflightRunning`),value:x.occupiedSlots,suffix:`/${x.workerSlots}`}),(0,G.jsx)(w7,{label:e(`inflightThroughput`),value:b.throughputPerMin,suffix:`/min`}),(0,G.jsx)(w7,{label:e(`inflightWaitP95`),value:b.waitP95Ms,kind:`ms`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 border-b border-separator px-4 py-3 lg:grid-cols-[minmax(0,0.95fr)_minmax(0,1.55fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,G.jsx)(`span`,{className:`mono text-[10px] tabular ${j?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:x.waiting})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[O.map(t=>(0,G.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 shadow-[var(--il-hair)] ${C7(t.kind)}`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--chart-1)_28%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,G.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-1.5 truncate text-[11px] font-medium text-foreground/92`,children:[(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-[2px] ${S7(t.kind)}`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,G.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,G.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-[10px] text-muted`,children:b7(x7(t,_))})]},t.id)),k.length?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[k.map(e=>(0,G.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${S7(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,G.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,k.length]})]}):O.length===0?(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,G.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[x.occupiedSlots,`/`,x.workerSlots]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:A.map(t=>(0,G.jsx)(Wxe,{slot:t,job:t.jobId?E.get(t.jobId):void 0,clockMs:_,idleLabel:e(`inflightSlotIdle`)},t.id))})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[4.5rem] lg:flex-col lg:gap-2.5`,children:[(0,G.jsx)(T7,{label:e(`inflightDone`),value:b.totals.done,tone:`ok`,icon:(0,G.jsx)(_i,{size:15,weight:`bold`,"aria-hidden":!0})}),(0,G.jsx)(T7,{label:e(`inflightFailed`),value:b.totals.failed,tone:`danger`,icon:(0,G.jsx)(ao,{size:15,weight:`bold`,"aria-hidden":!0})})]})]}),(0,G.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,G.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:N})]}),(0,G.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,G.jsx)(Uxe,{series:b.depthSeries,bands:[],backpressure:b.backpressure,label:N})})]})]}):null]})}function w7({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,G.jsx)(dH,{value:t,kind:r,duration:560}),n?(0,G.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function T7({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,G.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-1.5 rounded-2xl px-2.5 py-3 ${i?`bg-[var(--il-ok-bg)] shadow-[var(--il-hair-ok),0_6px_16px_color-mix(in_oklab,var(--success)_10%,transparent)]`:`bg-[var(--il-err-bg)] shadow-[var(--il-hair-err),0_6px_16px_color-mix(in_oklab,var(--danger)_10%,transparent)]`}`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-7 items-center justify-center rounded-full ${i?`bg-[color-mix(in_oklab,var(--success)_18%,transparent)] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_18%,transparent)] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,G.jsx)(`div`,{className:`mono text-[1.15rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,G.jsx)(dH,{value:t,kind:`int`,duration:560})}),(0,G.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] ${i?`text-[color-mix(in_oklab,var(--success)_72%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_72%,var(--muted))]`}`,children:e})]})}var E7=2500,Kxe=Math.round(6e4/E7);function qxe(e){let t=e?.intervalMs??2500,[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||zV().then(n=>{if(e)return;r(n);let i=Math.max(Kxe,Math.round(6e4/t));a(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-i))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:i}}var Jxe=(0,v.lazy)(()=>C(()=>import(`./TrafficChart-BzzCMmSh.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1]))),D7=3e4,Yxe={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Xxe(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):AH(e,t)}function Zxe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Qxe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function O7(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var $xe=[`ok`,`incomplete`,`error`,`canceled`],k7={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},A7={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function j7(e,t){return t>0?e/t:null}function eSe(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function tSe(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function nSe(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function rSe(){let{lang:e,t}=EI(),{overview:n,loading:r,error:i}=qI(),[a,o]=(0,v.useState)(`today`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=at(),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!0),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(!0),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(()=>Date.now()),[k,A]=(0,v.useState)(!1),{live:j,samples:M}=qxe({intervalMs:k?400:E7}),N=new Map((j?.accounts??[]).map(e=>[e.id,e])),P=!!n?.proxy?.ok,F=!!n?.worker?.ok,I=n?.worker?.ready_count??0,L=n?.worker?.hot_count??0,R=n?.worker?.cooling_count??0,z=j?.in_flight??n?.worker?.in_flight??0,B=f??Yxe,V=n?.routing?.session_affinity,H=(V?.hits??0)+(V?.misses??0),ee=j7(V?.hits??0,H),te=y.map(e=>({account:e,until:tSe(e,D)})).filter(e=>e.until!=null),ne=te.length>0;(0,v.useEffect)(()=>{if(!ne)return;let e=setInterval(()=>O(Date.now()),1e3);return()=>clearInterval(e)},[ne]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([PI(!1),VI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&b(t.value.data||[]),n.status===`fulfilled`&&w((n.value.data||[]).length))}).finally(()=>{e||S(!1)}),()=>{e=!0}},[]);let re=s?.start?.toString()??``,ie=s?.end?.toString()??``,ae=(0,v.useRef)(0),oe=(0,v.useCallback)(e=>{let t=vH(a,s);if(!t){_(!1);return}let n=++ae.current;ZV(t).then(e=>{n===ae.current&&(p(e),h(``))}).catch(t=>{n!==ae.current||e||(p(null),h(t instanceof Error?t.message:String(t)))}).finally(()=>{n===ae.current&&_(!1)})},[a,re,ie]);(0,v.useEffect)(()=>(oe(!1),()=>{ae.current++}),[oe]),(0,v.useEffect)(()=>{if(l)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),oe(!0))},n=setInterval(t,D7),r=()=>{!document.hidden&&Date.now()-e>=D7&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[l,oe]),(0,v.useEffect)(()=>{let e=!1,t=()=>{Aoe().then(t=>{e||E(t)}).catch(()=>{})};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[]);let se=Math.floor(B.series.length/2),ce=(e,t)=>e.reduce((e,n)=>e+n[t],0),le=B.series.slice(0,se),ue=B.series.slice(se),de=((e,t)=>e>0?(t-e)/e:null)(ce(le,`requests`),ce(ue,`requests`)),fe=ce(le,`requests`)?ce(le,`ok`)/ce(le,`requests`):null,pe=ce(ue,`requests`)?ce(ue,`ok`)/ce(ue,`requests`):null,me=fe!=null&&pe!=null?pe-fe:null,he=[{label:t(`metricRequests`),value:B.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(_H[a])}),ok:B.totals.requests>0,trend:de},{label:t(`metricSuccess`),value:B.totals.success_rate,kind:`percent`,detail:`${B.totals.ok} ${t(`logsFilterOk`)} · ${B.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${B.totals.error} ${t(`logsFilterError`)}`,ok:B.totals.requests===0||B.totals.success_rate>=.9,trend:me},{label:t(`metricLatency`),value:B.latency.p95_ms??B.latency.avg_ms,kind:`ms`,detail:`p50 ${eH(B.latency.p50_ms)} · avg ${eH(B.latency.avg_ms)}`,ok:B.latency.p95_ms==null||B.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:B.tokens.total,kind:`compact`,detail:`${$V(B.tokens.prompt)} / ${$V(B.tokens.completion)}`,ok:!0,trend:null}],ge=j7(B.tokens.cache_read,B.tokens.prompt),_e=j7(B.totals.streaming,B.totals.requests),ve=[{label:t(`metricCacheHit`),value:ge,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:$V(B.tokens.cache_read),prompt:$V(B.tokens.prompt)})},{label:t(`metricStreaming`),value:_e,kind:`percent`,detail:t(`metricStreamingDetail`,{count:B.totals.streaming,total:B.totals.requests})},{label:t(`metricCanceled`),value:B.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:nH(j7(B.totals.canceled,B.totals.requests)??0)})}],ye=$xe.map(e=>({key:e,count:B.status.find(t=>t.key===e)?.count??B.totals[e]??0})),be=e=>bH(e,B.window.from,B.window.to);return r&&!n?(0,G.jsx)(Mse,{}):(0,G.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,G.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(yH,{value:a,onChange:o,custom:s,onCustomChange:c,onBusy:()=>_(!0),t}),(0,G.jsxs)(PM,{delay:300,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(l?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":l,onPress:()=>u(e=>!e),children:l?(0,G.jsx)(xa,{size:14}):(0,G.jsx)(_a,{size:14})}),(0,G.jsx)(PM.Content,{children:t(l?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,G.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,G.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":P&&F?`ok`:`danger`}),t(P&&F?`running`:`degraded`)]})]})]})]}),i?(0,G.jsx)(QI,{title:t(`failedOverview`,{msg:i})}):null,(0,G.jsx)(Ace,{live:j,samples:M,t,onConcurrencyClick:()=>A(!0)}),(0,G.jsx)(Gxe,{t,expanded:k,onExpandedChange:A,live:k?j:null}),(0,G.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:he.map(e=>(0,G.jsxs)(HS,{className:`gap-0 p-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:g?(0,G.jsx)(Q,{className:`h-7 w-24`}):e.value==null?`—`:(0,G.jsx)(dH,{value:e.value,kind:e.kind})}),!g&&e.trend!=null?(0,G.jsx)(aSe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:ve.map(e=>(0,G.jsx)(HS,{className:`gap-0 p-3.5`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:g?(0,G.jsx)(Q,{className:`h-3 w-28`}):e.detail})]}),(0,G.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:g?(0,G.jsx)(Q,{className:`h-5 w-12`}):e.value==null?`—`:(0,G.jsx)(dH,{value:e.value,kind:e.kind})})]})},e.label))}),(0,G.jsx)(`section`,{className:`grid gap-3`,children:(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:B.totals.error?`warning`:`success`,children:nH(B.totals.success_rate)})]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4`,children:[m?(0,G.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:m})}):g?(0,G.jsx)(IV,{}):B.series.some(e=>e.requests>0)?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(IV,{}),children:(0,G.jsx)(Jxe,{series:B.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:{requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)},onSelectRange:(e,t)=>d(bH({},e,t))})}):(0,G.jsx)(fH,{emptyLabel:t(`statsEmptyTraffic`)}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),eH(B.latency.p50_ms)],[t(`statsLatencyP95`),eH(B.latency.p95_ms)],[t(`statsLatencyAvg`),eH(B.latency.avg_ms)],[t(`statsTTFB`),eH(B.latency.ttfb_avg_ms)]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:g?(0,G.jsx)(Q,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,G.jsxs)(Sn,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,G.jsx)($r,{size:12})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),I,`ok`],[t(`hot`),L,L?`ok`:``],[t(`inFlight`),z,z?`ok`:``],[t(`statsAffinityHit`),ee==null?`—`:nH(ee),``,V?t(`statsAffinityHint`,{hits:V.hits??0,misses:V.misses??0,bindings:V.bindings??0}):``]].map(([e,t,n,r])=>(0,G.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,G.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,G.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),!x&&te.length?(0,G.jsxs)(`div`,{className:`border-b border-separator px-4 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`statsCoolingDetails`)}),(0,G.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:te.map(({account:e,until:n})=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-caption sm:flex-row sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pl-4 sm:contents sm:pl-0`,children:[(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?O7(e.last_error_kind,t):t(`statsUnknown`)}),(0,G.jsx)(`span`,{className:`mono shrink-0 tabular sm:w-16 sm:text-right`,children:eSe(n,D)??`—`}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-muted sm:w-12 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]})]},e.id))})]}):null,(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:x?(0,G.jsx)(FV,{}):y.length===0?(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):y.slice(0,6).map(e=>{let n=e.quota,r=nSe(n?.percentage,n?.exceeded),i=N.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,G.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[jH(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,G.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,G.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,G.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,G.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{children:[t(`metricModels`),` `,C]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=y.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(MH,{provider:e,size:11}),t]},e):null}),(0,G.jsx)(`span`,{children:R?`${R} ${t(`statsCooling`)}`:`${y.length} ${t(`accountCount`)}`})]})]})]}),(0,G.jsx)(iSe,{resources:T,t})]}),(0,G.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),g?(0,G.jsx)(FV,{}):(0,G.jsx)(N7,{empty:t(`statsNoProviders`),items:(B.providers||[]).map(e=>({key:e.key,label:Xxe(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:be({provider:e.key})}))})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),g?(0,G.jsx)(FV,{rows:4}):(0,G.jsx)(N7,{empty:t(`statsNoModels`),items:B.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:be({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:eH(e.latency_avg_ms)}))})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),g?(0,G.jsx)(FV,{rows:4}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(oSe,{items:ye,t}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,G.jsx)(N7,{empty:t(`statsNoErrors`),danger:!0,items:B.errors.map(e=>({key:e.key,label:O7(e.key,t),count:e.count,href:Qxe.has(e.key)?be({error_kind:e.key}):void 0}))}),(0,G.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,G.jsx)(N7,{empty:t(`statsNoAccounts`),items:B.accounts.slice(0,5).map(e=>({key:e.key,label:Zxe(y,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:be({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function M7(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function iSe({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?tH(e.total_rss_bytes):`—`})]}),(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":M7(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[tH(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":M7(e.rss_bytes,e.cpu_percent)}),(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,G.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[tH(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,G.jsx)(FV,{rows:3})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,G.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,G.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function N7({items:e,empty:t,danger:n}){let r=(0,v.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`[data-rank-fill]`);e.length&&Z.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,G.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,G.jsx)(MH,{provider:e.mark,size:14}):null,(0,G.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,G.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,G.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,G.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,G.jsx)(Sn,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,G.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,G.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function aSe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,G.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,G.jsx)(n===`down`?Ya:n===`up`?Za:hi,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function oSe({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(A7[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,G.jsx)(`div`,{className:k7[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${k7[e.key]}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(A7[e.key])}),(0,G.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,G.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:nH(e.count/n)})]},e.key))})]}):(0,G.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}function P7(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function sSe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=rH(e),s=iH(e),c=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),l=jH(c,String(e.region||e.regions?.[0]||``).trim().toLowerCase()||void 0,t),u=c===`trae`?gce(e):void 0;return(0,G.jsx)(Y.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`md`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`text-section`,children:e.display_name||e.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[l,o?` · ${o}`:``]})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:[(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`contextWindowCol`)}),(0,G.jsxs)(`div`,{className:`mt-1 text-body`,children:[P7(i),a&&a!==i?` → ${P7(a)}`:``]}),e.supports_max_mode?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(c===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,!e.supports_max_mode&&a&&a!==i?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`workbuddyContextHint`)}):null,u?u.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,P7(u.prompt_max_tokens)]}):null:e.prompt_max_tokens?(0,G.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,P7(e.prompt_max_tokens)]}):null,u?u.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,P7(u.max_output_tokens)]}):null:e.max_output_tokens?(0,G.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,P7(e.max_output_tokens)]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`reasoningHint`)}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:r.map(n=>{let r=`reasoningLevel_${n}`,i=t(r);return(0,G.jsxs)(aC,{size:`sm`,variant:`soft`,color:n===(e.reasoning_effort||e.reasoning_default)?`success`:`default`,children:[i===r?n:i,n===e.reasoning_default?` · ${t(`defaultValue`)}`:``,n===e.reasoning_effort&&n!==e.reasoning_default?` · ${t(`custom`)}`:``]},n)})})]}):(0,G.jsx)(`div`,{className:`mt-1 text-body text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function F7({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,G.jsx)(nj,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,G.jsxs)(nj.Content,{children:[(0,G.jsx)(nj.Control,{children:(0,G.jsx)(nj.Thumb,{})}),r?(0,G.jsx)(IN,{children:r}):(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})})}function I7({title:e,hint:t,action:n,icon:r,className:i}){return(0,G.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center ${i||``}`,children:(0,G.jsxs)(`div`,{className:`max-w-sm`,children:[r?(0,G.jsx)(`div`,{className:`mb-3 flex justify-center text-muted`,children:r}):null,(0,G.jsx)(Die,{className:`p-0 text-body font-medium text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t}):null,n?(0,G.jsx)(`div`,{className:`mt-5 flex justify-center`,children:n}):null]})})}var L7=`__all__`;function R7({value:e,onChange:t,ariaLabel:n,options:r,className:i}){let a=r.map(e=>({id:e.id||L7,label:e.label})),o=e||L7,s=a.find(e=>e.id===o);return(0,G.jsxs)(AF,{className:i??`w-fit min-w-36`,"aria-label":n,value:o,onChange:e=>{typeof e==`string`&&t(e===L7?``:e)},children:[(0,G.jsxs)(AF.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!s?e:(0,G.jsx)(`span`,{className:`truncate`,children:s.label})}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{className:`max-h-72 min-w-36`,children:(0,G.jsx)(oF,{children:a.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(IN,{className:`block truncate`,children:e.label}),(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})})]})}var cSe=[20,50,100],lSe=[20,50,100];function uSe(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,G.jsx)(qA,{id:String(e),children:e},e))})]}),(0,G.jsxs)(DF,{size:`sm`,className:`w-fit`,children:[(0,G.jsx)(DF.Summary,{className:`mono text-caption`,children:o}),(0,G.jsxs)(DF.Content,{children:[(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,G.jsx)(DF.PreviousIcon,{})})}),f.map((e,n)=>e===`gap`?(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Ellipsis,{})},`gap-${n}`):(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,G.jsx)(DF.Item,{children:(0,G.jsx)(DF.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,G.jsx)(DF.NextIcon,{})})})]})]})]})}function B7({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,G.jsx)(PN,{"aria-label":r,value:e,onChange:t,className:i,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:n}),(0,G.jsx)(PN.ClearButton,{})]})})}function dSe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function V7(e){return e.settings_key||e.id}function H7(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function U7(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function W7(e){return`${H7(e)}:${U7(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function G7(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function K7(e,t){let n=`reasoningLevel_${t}`,r=e(n);return r===n?t:r}function q7({label:e,hint:t}){return(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`cursor-help text-caption text-muted`,children:e})}),(0,G.jsx)(PM.Content,{children:(0,G.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:t})})]})}function J7({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i,onReasoningChange:a}){let o=H7(e),s=r===`card`,c=s?`w-full min-w-0`:`w-full max-w-[7.5rem] min-w-0`;return(0,G.jsxs)(`div`,{className:s?`flex min-w-0 flex-col gap-3`:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[P7(e.catalog_context_length||e.context_length),e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?` → ${P7(e.catalog_context_length_max)}`:``]}),o===`workbuddy`&&e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`workbuddyContextHint`)}):null]}),(o===`trae`||o===`qoder`)&&e.supports_max_mode?(0,G.jsxs)(`div`,{className:s?`flex flex-col gap-1.5`:`flex items-center gap-2`,children:[s?(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${P7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(F7,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}),s?null:(0,G.jsx)(q7,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${P7(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)})]})]}):null,(e.reasoning_options||[]).length>1?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(q7,{label:n(`reasoningLevels`),hint:n(`reasoningHint`)}),(0,G.jsx)(R7,{className:c,ariaLabel:`${e.id} ${n(`reasoningLevels`)}`,value:e.reasoning_effort||e.reasoning_default||e.reasoning_options?.[0]||``,onChange:t=>{t&&a(e,t)},options:(e.reasoning_options||[]).map(e=>({id:e,label:K7(n,e)}))})]}):(e.reasoning_options||[]).length===1?(0,G.jsx)(q7,{label:`${n(`reasoningLevels`)} ${K7(n,e.reasoning_options[0])}`,hint:n(`reasoningHint`)}):e.reasoning_type?(0,G.jsx)(`span`,{className:`text-caption text-muted`,children:n(`reasoningFixed`,{type:e.reasoning_type})}):o===`trae`&&!e.supports_max_mode?(0,G.jsx)(q7,{label:n(`catalogWindow`),hint:n(`catalogWindowHint`)}):null]})}function Y7({model:e,t,onDetails:n}){return(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,G.jsx)($i,{size:14}),t(`modelDetails`)]})}function fSe(){let{t:e}=EI(),{overview:t,loading:n}=qI(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(1),[d,f]=(0,v.useState)(50),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)([]),[E,D]=(0,v.useState)(!0);(0,v.useEffect)(()=>{let e=!1;return ooe(void 0,`regional`).then(t=>{e||T(t.data||[])}).catch(()=>void 0).finally(()=>{e||D(!1)}),UI().then(t=>{e||c(dSe(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let O=(0,v.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=a.includes(`:`)?a.split(`:`,2):[a,``];return w.filter(r=>{let a=H7(r),o=U7(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=jH(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,w,a,e]),k=[r,a,d].join(`\0`),[A,j]=(0,v.useState)(k);A!==k&&(j(k),u(1));let M=Math.max(1,Math.ceil(O.length/d)),N=Math.min(A===k?Math.max(1,l):1,M);l!==N&&u(N);let P=(0,v.useMemo)(()=>{let e=(N-1)*d;return O.slice(e,e+d)},[N,O,d]),F=O.length===0?0:(N-1)*d+1,I=Math.min(O.length,N*d),L=O.length?e(`logsShownTotal`,{shown:`${F}–${I}`,total:O.length}):e(`shownTotal`,{shown:0,total:w.length});if(n&&!t||E)return(0,G.jsx)(Ise,{});function R(e,t){let n=V7(e),r=H7(e),i=w.map(e=>{if(V7(e)!==n||H7(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});T(i)}function z(e,t){let n=V7(e),r=H7(e),i=w.map(e=>V7(e)!==n||H7(e)!==r?e:{...e,reasoning_effort:t,context_custom:!!e.max_mode||!!(t&&t!==e.reasoning_default)});T(i)}async function B(){m(!0),y(``),x(!1);try{let e=await HI(void 0,`regional`);T(e.data||[])}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function V(t,n){let r=H7(t);if(r!==`trae`&&r!==`workbuddy`&&r!==`kimi`)return;let i=V7(t);g(i),y(``),x(!1);try{await coe(r,i,n),z(t,n),y(e(`reasoningSaved`,{model:t.id,level:K7(e,n)}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}async function H(t,n){if(!t.supports_max_mode){x(!0),y(e(`contextMaxUnavailable`));return}let r=V7(t),i=H7(t);g(r),y(``),x(!1);try{await soe(i,r,n,t.catalog_context_length_max),R(t,n),y(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){x(!0),y(e instanceof Error?e.message:String(e))}finally{g(``)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,G.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:w.length?L:e(`noModelsYet`)})]}),(0,G.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,G.jsx)(B7,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:i,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(R7,{ariaLabel:e(`providerCol`),value:a,onChange:o,options:[{id:``,label:e(`providerFilterAll`)},...s.map(t=>({id:t.value,label:jH(t.provider,t.region,e)}))]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:p,onPress:()=>void B(),children:[(0,G.jsx)(qr,{size:14}),e(p?`refreshing`:`refresh`)]})]})]})]}),_?(0,G.jsx)(QI,{status:b?`danger`:`success`,title:_}):null,(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(ji,{size:16})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,G.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,className:`shrink-0`,children:O.length})]}),p||n?(0,G.jsx)(LV,{}):O.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(la,{size:22}),title:w.length?e(`noModelsMatch`):e(`noProviders`),hint:w.length?r||a||e(`noModelsMatch`):e(`noModelsYet`)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=jH(i,U7(t)||void 0,e),o=rH(t),s=iH(t);return(0,G.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(MH,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`font-medium`,children:a})]}),(0,G.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void H(e,t),onReasoningChange:(e,t)=>void V(e,t)}),(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})]},W7(t))})}),(0,G.jsx)(X,{className:`hidden min-w-0 lg:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,G.jsx)(X.Column,{children:e(`requestIdCol`)}),(0,G.jsx)(X.Column,{children:e(`providerCol`)}),(0,G.jsx)(X.Column,{children:e(`qoderKeyCol`)}),(0,G.jsx)(X.Column,{children:e(`modelDefaultsCol`)}),(0,G.jsx)(X.Column,{children:e(`stateCol`)}),(0,G.jsx)(X.Column,{children:e(`actions`)})]}),(0,G.jsx)(X.Body,{children:P.map(t=>{let n=V7(t),r=h===n,i=H7(t),a=jH(i,U7(t)||void 0,e),o=rH(t),s=iH(t);return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),s?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,o?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:o}):null]}),G7(t)?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:G7(t)})}):null]})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(MH,{provider:i,size:14}),(0,G.jsx)(`span`,{className:`text-caption font-medium`,children:a})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(J7,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void H(e,t),onReasoningChange:(e,t)=>void V(e,t)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(Y7,{model:t,t:e,onDetails:C})})]},W7(t))})})]})})})]})]}),(0,G.jsx)(sSe,{model:S?w.find(e=>V7(e)===V7(S))||S:null,t:e,onClose:()=>C(null)}),(0,G.jsx)(z7,{total:O.length,page:N,pageCount:M,pageSize:d,loading:p,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:N,pages:M}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:u,onPageSize:f})]})}function X7({copied:e,size:t=14,className:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let t=e?i.current:r.current,n=e?r.current:i.current;if(!t||!n)return;let o={autoAlpha:1,scale:1,filter:`blur(0px)`},s={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(a.current||jV()){a.current=!1,Z.set(t,o),Z.set(n,s);return}Z.to(n,{...s,duration:kV.fast,ease:AV.out,overwrite:!0}),Z.fromTo(t,s,{...o,duration:kV.base,ease:AV.soft,delay:kV.instant/2,overwrite:!0})},[e]),(0,G.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,G.jsx)(`span`,{ref:r,className:`col-start-1 row-start-1 inline-flex`,children:(0,G.jsx)(Di,{size:t})}),(0,G.jsx)(`span`,{ref:i,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,G.jsx)(_i,{size:t})})]})}async function Z7(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Q7(){return`${location.protocol}//${location.host}`}function $7(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${Q7()}${e}`:`${Q7()}/${e}`:Q7()}function pSe({access:e}){let{t}=EI(),[n,r]=(0,v.useState)(``),i=$7(e?.openai_base_url||`/v1`),a=(0,v.useMemo)(()=>[{name:t(`endpointOpenAI`),url:i,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,G.jsx)(ai,{size:15})},{name:t(`endpointChat`),url:$7(e?.chat_completions||`${i}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointMessages`),url:$7(e?.messages||`${i}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointResponses`),url:$7(e?.responses||`${i}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,G.jsx)(ha,{size:15})},{name:t(`endpointModels`),url:$7(e?.models||`${i}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,G.jsx)(sa,{size:15})},{name:t(`endpointHealth`),url:$7(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,G.jsx)(Zi,{size:15})}],[e,i,t]);return(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:a.length-1})})]}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,G.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,G.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:e.method})]}),(0,G.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{Z7(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,G.jsx)(X7,{copied:n===e.name})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,G.jsx)(Zr,{size:14})})]})]})]},e.name))})]})}var mSe=`https://caiaiu.com`;function e9({className:e=``}){let{t}=EI();return(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,G.jsx)(`a`,{href:mSe,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}var hSe=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),gSe=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function _Se(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function vSe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function ySe(e){let t=_Se(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(gSe.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(hSe.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function t9({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,G.jsxs)(AF,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,G.jsxs)(AF.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,G.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,G.jsx)(AF.Indicator,{className:`size-2.5 opacity-50`})]}),(0,G.jsx)(AF.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,G.jsx)(oF,{children:a.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(IN,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,G.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})})]})}function bSe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:s,onStop:c,accountValue:l,onAccountChange:u,accountOptions:d,modelValue:f,onModelChange:p,modelOptions:m,modelsLoading:h}){let{t:g}=EI(),_=(0,v.useRef)(null);async function y(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await ySe(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&window.alert(g(`chatAttachUnsupported`,{names:i.join(`, `)})),_.current&&(_.current.value=``)}function b(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&s())}return(0,G.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,G.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,G.jsx)(Ui,{size:14})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`mono text-muted`,children:vSe(e.size)})]}),(0,G.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":g(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,G.jsx)(ao,{size:12})})]},e.id))}):null,(0,G.jsx)(JM,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:b,placeholder:g(`promptPlaceholder`),"aria-label":g(`prompt`),disabled:i||a}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,G.jsx)(`input`,{ref:_,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void y(e.target.files)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":g(`chatAttach`),isDisabled:i||a,onPress:()=>_.current?.click(),children:(0,G.jsx)(Ca,{size:15})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,G.jsx)(t9,{ariaLabel:g(`account`),value:l,onChange:u,options:d,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:g(`model`),value:f,onChange:p,placeholder:g(h?`requesting`:`model`),options:m,isDisabled:i||a||h||!m.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,G.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":g(`chatTryStop`),onPress:c,children:(0,G.jsx)(Va,{size:14,weight:`fill`})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":g(`chatTrySend`),isDisabled:!o||i||a,onPress:s,children:(0,G.jsx)(ha,{size:14,weight:`fill`})})]})]})]}),(0,G.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:g(`chatTryHelper`)})]})}function xSe({collapsed:e,onCollapsedChange:t,items:n,activeId:r,onSelect:i,onNew:a}){let{t:o}=EI(),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=s.current;!t||jV()||e||Z.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:kV.fast,ease:`power2.out`})},[e]),e?(0,G.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,G.jsx)(ka,{size:15})}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryNew`),onPress:a,children:(0,G.jsx)(Ca,{size:14})})]}):(0,G.jsxs)(`aside`,{ref:s,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":o(`chatHistoryTitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:o(`chatHistoryTitle`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":o(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,G.jsx)(li,{size:14})})]}),(0,G.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:a,children:[(0,G.jsx)(Ca,{size:13}),o(`chatHistoryNew`)]})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===r;return(0,G.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>i(e.id),children:(0,G.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||o(`chatHistoryUntitled`)})},e.id)}):(0,G.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:o(`chatHistoryEmpty`)})})]})}function n9({latencyMs:e,ttfbMs:t,completionTokens:n,stream:r,labels:i,className:a=``,variant:o=`block`}){let s=dce(uce({completionTokens:n,latencyMs:e,ttfbMs:t,stream:r})),c=eH(t),l=eH(e);if(o===`inline`)return(0,G.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${a}`.trim(),children:[(0,G.jsxs)(`span`,{children:[i.ttft,` `,c]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsxs)(`span`,{children:[i.total,` `,l]}),(0,G.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,G.jsx)(`span`,{children:s})]});let u=[[i.ttft,c],[i.total,l],[i.tps,s]];return(0,G.jsxs)(`div`,{className:a,children:[i.heading?(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:i.heading}):null,(0,G.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:u.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,G.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}function SSe({text:e,streaming:t,defaultOpen:n}){let{t:r}=EI(),[i,a]=(0,v.useState)(!!n),[o,s]=(0,v.useState)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(null),u=(0,v.useRef)(null);if((0,v.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,v.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,v.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,v.useEffect)(()=>{let t=l.current,n=u.current;if(!t)return;let r=jV();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}Z.to(t,{height:0,opacity:0,duration:kV.fast,ease:AV.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}Z.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:kV.base,ease:AV.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let d=jV(),f=t?o:o||c.current;return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,G.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ci,{size:12,className:`shrink-0 text-muted ${d?``:`animate-spin`}`}),(0,G.jsx)(`span`,{className:d?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,G.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(di,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{children:r(`thinkingDone`)}),f>0?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:f})}):null,!f&&e?(0,G.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,G.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,G.jsx)(`pre`,{ref:u,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function CSe(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function wSe({status:e}){return e===`running`?(0,G.jsx)(Fa,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,G.jsx)(ro,{size:12,weight:`fill`,className:`text-danger`}):(0,G.jsx)(yi,{size:12,weight:`fill`,className:`text-success`})}function TSe(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function r9({call:e,forceOpen:t}){let{t:n}=EI(),[r,i]=(0,v.useState)(e.status===`error`||!!t),[a,o]=(0,v.useState)(!1),s=(0,v.useMemo)(()=>TSe(e.arguments||``),[e.arguments]);(0,v.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,v.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await Z7(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,G.jsx)(di,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,G.jsx)(wSe,{status:e.status}),CSe(e.status,n)]})]}),r?(0,G.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,G.jsx)(ki,{size:12}),n(a?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function ESe({calls:e}){let{t}=EI(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,v.useState)(n||r||e.length===1);return(0,v.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,G.jsx)(r9,{call:e[0],forceOpen:e[0].status===`error`})}):(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,G.jsx)(di,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,G.jsx)(Fa,{size:12,className:`animate-spin`}):null]}),i?(0,G.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,G.jsx)(r9,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function DSe({message:e}){return e.attachments?.length?(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,G.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,G.jsx)(Ui,{size:12})}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function OSe({message:e}){let{t}=EI(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:$V(r??0),completion:$V(i??0)}):``;return(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:cH(n.credits)}):t(`chatTryCreditsUsed`,{amount:cH(n.credits)})})}function kSe({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,G.jsx)(`span`,{children:e},`s-${n}`):(0,G.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function ASe(){let e=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let t=e.current;!t||jV()||Z.from(t,{autoAlpha:0,duration:kV.fast,ease:`power2.out`})},[]),e}function jSe({message:e}){let{t}=EI(),[n,r]=(0,v.useState)(!1),i=e.role===`user`,a=ASe();if(i)return(0,G.jsx)(`div`,{ref:a,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,G.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,G.jsx)(DSe,{message:e})]})});let o=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,s=!!e.content&&e.status===`done`,c=e.status===`streaming`,l=!!(e.usage&&e.usage.credits!=null),u=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function d(){e.content&&(await Z7(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,G.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[e.reasoning||c?(0,G.jsx)(SSe,{text:e.reasoning||``,streaming:c&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,G.jsx)(ESe,{calls:e.toolCalls}):null,e.status===`error`?(0,G.jsx)(QI,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):o?(0,G.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,G.jsx)(UA,{className:`h-3 w-28 rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-full rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-[86%] rounded-md`}),(0,G.jsx)(UA,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,G.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,G.jsx)(kSe,{text:e.content,streaming:c})}):null,s||l||u?(0,G.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[s?(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex h-5 items-center gap-1 text-caption text-muted/80 opacity-70 transition-opacity hover:text-foreground hover:opacity-100`,onClick:()=>void d(),children:[(0,G.jsx)(ki,{size:12}),t(n?`copied`:`copy`)]}):null,(0,G.jsx)(OSe,{message:e})]}),u?(0,G.jsx)(n9,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function MSe({messages:e,busy:t,onLoadDemo:n}){let{t:r}=EI(),i=(0,v.useRef)(null);(0,v.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,G.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,G.jsx)(I7,{className:`min-h-56`,title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,G.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,G.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,G.jsx)(jSe,{message:e},e.id))}),(0,G.jsx)(`div`,{ref:i})]})}function NSe({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:a,requestState:o,elapsedMs:s,output:c,responseStatus:l,curl:u,copiedCurl:d,onCopyCurl:f,canSend:p,accountValue:m,onAccountChange:h,accountOptions:g,modelValue:_,onModelChange:v,modelOptions:y,modelsLoading:b,disabled:x}){let{t:S}=EI();return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:S(`rawFormatHint`)}),(0,G.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,G.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,G.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,G.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`requestBuilder`)}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,G.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`rawFormatLabel`)}),(0,G.jsx)(pH,{className:`access-format-chips`,ariaLabel:S(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:S(`rawFormatChat`)},{id:`messages`,label:S(`rawFormatMessages`)},{id:`responses`,label:S(`rawFormatResponses`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,G.jsx)(t9,{ariaLabel:S(`account`),value:m,onChange:h,options:g,isDisabled:x||o===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,G.jsx)(t9,{ariaLabel:S(`model`),value:_,onChange:v,placeholder:S(b?`requesting`:`model`),options:y,isDisabled:x||o===`loading`||b||!y.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,G.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:S(`prompt`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,G.jsx)(JM,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:S(`promptPlaceholder`),"aria-label":S(`prompt`),disabled:x||o===`loading`}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:S(`promptHelper`)})]}),(0,G.jsxs)(J,{fullWidth:!0,isPending:o===`loading`,isDisabled:!p||x,onPress:a,children:[(0,G.jsx)(ha,{size:15}),S(o===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,G.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":o===`loading`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-body font-semibold`,children:S(`responseInspector`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:S(`responseInspectorHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s===null?null:(0,G.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(Ti,{size:12}),s,` ms`]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:o===`success`?`success`:o===`error`?`danger`:void 0,children:l})]})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:o===`idle`?(0,G.jsx)(I7,{className:`min-h-64`,title:S(`responseEmptyTitle`),hint:S(`responseEmptyHint`)}):o===`loading`?(0,G.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,G.jsx)(UA,{className:`h-3 w-32 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-full rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[88%] rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[72%] rounded-lg`}),(0,G.jsx)(UA,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-[64%] rounded-lg`})]}):o===`error`?(0,G.jsx)(`div`,{className:`space-y-3`,children:(0,G.jsx)(QI,{status:`danger`,title:S(`requestFailed`),description:c})}):(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,G.jsx)(yi,{size:14,weight:`fill`}),S(`responseReceived`)]}),(0,G.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:c})]})})]})]})}),(0,G.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-semibold`,children:S(`curlExample`)}),(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:S(`curlGeneratedHint`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:f,children:[(0,G.jsx)(X7,{copied:d}),S(d?`copied`:`copy`)]})]}),(0,G.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:u})]})]})}function i9(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` -`:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function NSe(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:i9(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var PSe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function a9(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:PSe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes +`:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function PSe(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:i9(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var FSe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function a9(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:FSe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes placeholder`,size:128}],status:`done`},{id:`demo-assistant-1`,role:`assistant`,content:`The screenshot shows the Access playground. I looked up the chat completions route and drafted a short summary below.`,reasoning:`User attached a UI screenshot and a notes file. I should call the models/list helper, then summarize the visible chrome without inventing product claims. -Keep the reply short and ops-console toned.`,toolCalls:[{index:0,id:`call_demo_list`,name:`list_endpoints`,arguments:JSON.stringify({base:`/v1`,filter:`chat`},null,2),status:`success`},{index:1,id:`call_demo_read`,name:`read_attachment`,arguments:JSON.stringify({name:`notes.md`,max_chars:400},null,2),status:`success`}],reasoningOpen:!1,usage:{credits:.75,prompt_tokens:1840,completion_tokens:126,source:`upstream`},ttfb_ms:380,latency_ms:2140,status:`done`}]}function FSe(){return[{id:`demo-user-thinking`,role:`user`,content:`Walk through the Access playground layout.`,status:`done`},{id:`demo-assistant-thinking`,role:`assistant`,content:``,reasoning:`Scan the stage chrome, then the composer controls, then draft a short reply without inventing product claims.`,status:`streaming`}]}function o9(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function s9(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function ISe(e,t){return e.map((e,n)=>({index:typeof e.index==`number`?e.index:n,id:e.id||`tool-${n}`,name:e.function?.name||``,arguments:e.function?.arguments||``,status:t?`running`:`success`}))}function c9(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`demo`);return e===`1`||e===`full`?`full`:e===`thinking`?`thinking`:null}catch{return null}}function LSe(){let e=c9();return e===`thinking`?FSe():e===`full`?a9():[]}function l9(e){let t=e.find(e=>e.role===`user`&&e.content.trim());if(!t)return``;let n=t.content.trim().replace(/\s+/g,` `);return n.length>36?`${n.slice(0,36)}…`:n}function u9(e=[]){return{id:s9(`session`),title:l9(e),messages:e,updatedAt:Date.now()}}var d9=[{id:`hy3`,display_name:`HY3`,credits:`0.75 credits`,provider:`workbuddy`},{id:`glm-4.6`,display_name:`GLM-4.6`,credits:`0.5 credits`,provider:`workbuddy`},{id:`free-demo`,display_name:`Free Demo`,credits:`0 credits`,free:!0,provider:`workbuddy`}];function RSe(){let{t:e}=EI(),{overview:t,loading:n}=qI(),[r,i]=(0,v.useState)(`chat`),[a,o]=(0,v.useState)(`chat`),[s,c]=(0,v.useState)(!0),[l,u]=(0,v.useState)(()=>[u9(LSe())]),[d,f]=(0,v.useState)(``),p=d||l[0]?.id||``,m=(l.find(e=>e.id===p)||l[0])?.messages||[],[h,g]=(0,v.useState)([]),[_,y]=(0,v.useState)([]);(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([VI(),PI(!1)]).then(([t,n])=>{e||(t.status===`fulfilled`&&g(t.value.data||[]),n.status===`fulfilled`&&y(n.value.data||[]))}),()=>{e=!0}},[]);let b=$7(t?.access?.openai_base_url||`/v1`),x=t?.access?.chat_completions||`/v1/chat/completions`,S=t?.access?.messages||`/v1/messages`,C=t?.access?.responses||`/v1/responses`,w=a===`messages`?S:a===`responses`?C:x,T=$7(w),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(`只回复OK`),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)([]),[R,z]=(0,v.useState)(`idle`),B=(0,v.useRef)(null),[V,H]=(0,v.useState)(``),[ee,te]=(0,v.useState)(`idle`),[ne,re]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(``),oe=O||``,se=!oe||A?.accountId===oe,ce=oe?se&&A?.models||[]:h,le=!!oe&&!se,ue=se&&A?.error||``,de=c9()==null?[]:d9.map(e=>e.id),fe=ce.some(e=>e.id===E)||de.includes(E)?E:ce[0]?.id||de[0]||``;(0,v.useEffect)(()=>{if(!oe)return;let e=!1;return VI(oe).then(t=>{e||j({accountId:oe,models:t.data||[],error:``})}).catch(t=>{e||j({accountId:oe,models:[],error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[oe]),(0,v.useEffect)(()=>()=>{B.current?.abort()},[]);let pe=_.filter(e=>e.enabled!==!1&&(e.ready===!0||e.hot===!0||e.status===`ready`||e.status===`hot`)),me=(0,v.useMemo)(()=>uoe(a,fe,M),[M,a,fe]),he=(0,v.useMemo)(()=>`curl -sS ${o9(T)} \\ +Keep the reply short and ops-console toned.`,toolCalls:[{index:0,id:`call_demo_list`,name:`list_endpoints`,arguments:JSON.stringify({base:`/v1`,filter:`chat`},null,2),status:`success`},{index:1,id:`call_demo_read`,name:`read_attachment`,arguments:JSON.stringify({name:`notes.md`,max_chars:400},null,2),status:`success`}],reasoningOpen:!1,usage:{credits:.75,prompt_tokens:1840,completion_tokens:126,source:`upstream`},ttfb_ms:380,latency_ms:2140,status:`done`}]}function ISe(){return[{id:`demo-user-thinking`,role:`user`,content:`Walk through the Access playground layout.`,status:`done`},{id:`demo-assistant-thinking`,role:`assistant`,content:``,reasoning:`Scan the stage chrome, then the composer controls, then draft a short reply without inventing product claims.`,status:`streaming`}]}function o9(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function s9(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function LSe(e,t){return e.map((e,n)=>({index:typeof e.index==`number`?e.index:n,id:e.id||`tool-${n}`,name:e.function?.name||``,arguments:e.function?.arguments||``,status:t?`running`:`success`}))}function c9(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`demo`);return e===`1`||e===`full`?`full`:e===`thinking`?`thinking`:null}catch{return null}}function RSe(){let e=c9();return e===`thinking`?ISe():e===`full`?a9():[]}function l9(e){let t=e.find(e=>e.role===`user`&&e.content.trim());if(!t)return``;let n=t.content.trim().replace(/\s+/g,` `);return n.length>36?`${n.slice(0,36)}…`:n}function u9(e=[]){return{id:s9(`session`),title:l9(e),messages:e,updatedAt:Date.now()}}var d9=[{id:`hy3`,display_name:`HY3`,credits:`0.75 credits`,provider:`workbuddy`},{id:`glm-4.6`,display_name:`GLM-4.6`,credits:`0.5 credits`,provider:`workbuddy`},{id:`free-demo`,display_name:`Free Demo`,credits:`0 credits`,free:!0,provider:`workbuddy`}];function zSe(){let{t:e}=EI(),{overview:t,loading:n}=qI(),[r,i]=(0,v.useState)(`chat`),[a,o]=(0,v.useState)(`chat`),[s,c]=(0,v.useState)(!0),[l,u]=(0,v.useState)(()=>[u9(RSe())]),[d,f]=(0,v.useState)(``),p=d||l[0]?.id||``,m=(l.find(e=>e.id===p)||l[0])?.messages||[],[h,g]=(0,v.useState)([]),[_,y]=(0,v.useState)([]);(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([VI(),PI(!1)]).then(([t,n])=>{e||(t.status===`fulfilled`&&g(t.value.data||[]),n.status===`fulfilled`&&y(n.value.data||[]))}),()=>{e=!0}},[]);let b=$7(t?.access?.openai_base_url||`/v1`),x=t?.access?.chat_completions||`/v1/chat/completions`,S=t?.access?.messages||`/v1/messages`,C=t?.access?.responses||`/v1/responses`,w=a===`messages`?S:a===`responses`?C:x,T=$7(w),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(`只回复OK`),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)([]),[R,z]=(0,v.useState)(`idle`),B=(0,v.useRef)(null),[V,H]=(0,v.useState)(``),[ee,te]=(0,v.useState)(`idle`),[ne,re]=(0,v.useState)(null),[ie,ae]=(0,v.useState)(``),oe=O||``,se=!oe||A?.accountId===oe,ce=oe?se&&A?.models||[]:h,le=!!oe&&!se,ue=se&&A?.error||``,de=c9()==null?[]:d9.map(e=>e.id),fe=ce.some(e=>e.id===E)||de.includes(E)?E:ce[0]?.id||de[0]||``;(0,v.useEffect)(()=>{if(!oe)return;let e=!1;return VI(oe).then(t=>{e||j({accountId:oe,models:t.data||[],error:``})}).catch(t=>{e||j({accountId:oe,models:[],error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[oe]),(0,v.useEffect)(()=>()=>{B.current?.abort()},[]);let pe=_.filter(e=>e.enabled!==!1&&(e.ready===!0||e.hot===!0||e.status===`ready`||e.status===`hot`)),me=(0,v.useMemo)(()=>uoe(a,fe,M),[M,a,fe]),he=(0,v.useMemo)(()=>`curl -sS ${o9(T)} \\ -H "Authorization: Bearer $CLI2API_API_KEY" \\ -H ${o9(`Content-Type: application/json`)}${oe?` \\ -H ${o9(`X-Qoder-Account: ${oe}`)}`:``} \\ - -d ${o9(JSON.stringify(me))}`,[me,T,oe]);if(n&&!t)return(0,G.jsx)(Rse,{});async function ge(e,t){await Z7(e),ae(t),window.setTimeout(()=>ae(``),1100)}async function _e(){let e=performance.now();te(`loading`),re(null),H(``);try{let e=await doe(w,me,oe||void 0);H(JSON.stringify(e,null,2)),te(`success`)}catch(e){H(e instanceof Error?e.message:String(e)),te(`error`)}finally{re(Math.round(performance.now()-e))}}function ve(){B.current?.abort(),B.current=null}function ye(e){let t=p;u(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:l9(r)||n.title,updatedAt:Date.now()}}))}function be(e,t){ye(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function xe(){let e=P.trim();if(!e&&!I.length||!fe||le||R===`loading`)return;ve();let t=new AbortController;B.current=t;let n=I,r={id:s9(`user`),role:`user`,content:e,attachments:n,status:`done`},i=s9(`assistant`),a={id:i,role:`assistant`,content:``,status:`streaming`},o=m;ye([...o,r,a]),F(``),L([]),z(`loading`);let s=NSe(o,{role:`user`,content:i9(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await moe(fe,s,oe||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),be(i,{content:t})},onReasoning:(e,t)=>{e&&u(),be(i,{reasoning:t})},onToolCalls:e=>{u(),be(i,{toolCalls:ISe(e,!0)})},onUsage:e=>be(i,{usage:e})}),be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),z(`success`)}catch(e){if(t.signal.aborted){be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),z(`success`);return}be(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),z(`error`)}finally{B.current===t&&(B.current=null)}}let Se=e(ee===`success`?`requestComplete`:ee===`error`?`requestFailed`:ee===`loading`?`requesting`:`requestIdle`),Ce=c9()!=null,we=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(ti,{size:14,className:`text-muted`})},..._.map(t=>({id:t.id,textValue:`${t.name||t.id} ${jH(t.provider,t.region,e)}`,label:t.name||t.id,hint:jH(t.provider,t.region,e),icon:(0,G.jsx)(MH,{provider:t.provider,size:14})}))],Te=_.length||!Ce?we:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(ti,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ee=ce.map(t=>{let n=rH(t),r=iH(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),De=Ee.length||!Ce?Ee:d9.map(t=>{let n=rH(t),r=iH(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Oe=!!((P.trim()||I.length)&&fe&&!le&&(_.length||Ce));function ke(){ye(a9()),z(`idle`)}function Ae(){ve(),z(`idle`),F(``),L([]);let e=u9([]);u(t=>[e,...t]),f(e.id)}function je(e){e!==p&&(ve(),z(`idle`),F(``),L([]),f(e))}let Me=l.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,G.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,G.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,G.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,G.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:b}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void ge(b,`base`),children:(0,G.jsx)(X7,{copied:ie===`base`,size:13})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":pe.length?`ok`:void 0}),(0,G.jsx)(`span`,{children:e(`readyAccounts`,{ready:pe.length,total:_.length})}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:pe.length?`success`:`warning`,children:pe.length?e(`endpointReady`):e(`degraded`)})]})]}),_.length?null:(0,G.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,G.jsx)(e9,{})]}),ue?(0,G.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:ue}):null,(0,G.jsxs)(_j,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`accessTabsLabel`),children:[(0,G.jsxs)(gj,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,G.jsxs)(gj,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,G.jsx)(_j.Panel,{id:`chat`,className:`pt-4`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,G.jsx)(bSe,{collapsed:s,onCollapsedChange:c,items:Me,activeId:p,onSelect:je,onNew:Ae}),(0,G.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,G.jsx)(jSe,{messages:m,busy:R===`loading`,onLoadDemo:ke}),(0,G.jsx)(ySe,{value:P,onChange:F,attachments:I,onAttachmentsChange:L,disabled:!_.length&&c9()==null,streaming:R===`loading`,canSend:Oe,onSend:()=>void xe(),onStop:ve,accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le})]})]})}),(0,G.jsxs)(_j.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,G.jsx)(MSe,{format:a,onFormatChange:o,requestPath:w,prompt:M,onPromptChange:N,onTest:()=>void _e(),requestState:ee,elapsedMs:ne,output:V,responseStatus:Se,curl:he,copiedCurl:ie===`curl`,onCopyCurl:()=>void ge(he,`curl`),canSend:!!(M.trim()&&fe&&!le),accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le,disabled:!_.length&&c9()==null}),(0,G.jsx)(fSe,{access:t?.access})]})]})]})}function zSe(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Z.context(()=>{Z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`.meter__fill`);e.length&&Z.from(e,{scaleX:0,transformOrigin:`left center`,duration:kV.calm,ease:AV.emphasized,stagger:Ose.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function f9(e){if(!e)return``;let t=Date.parse(e)-Date.now();if(!Number.isFinite(t)||t<=0)return``;let n=Math.ceil(t/1e3);return n<60?`${n}s`:`${Math.ceil(n/60)}m`}function BSe(e){return Object.entries(e.model_cooldowns??{}).filter(([,e])=>!!f9(e)).sort(([e],[t])=>e.localeCompare(t))}function p9(e){return e.enabled?e.status===`quota_exhausted`||e.quota?.exceeded?`quota_exhausted`:e.status===`cooling`||f9(e.down_until||e.cooldown_until)?`cooling`:e.status===`dead`||e.runtime_state===`dead`?`dead`:e.status===`auth_failed`||e.runtime_state===`auth_failed`?`auth_failed`:e.status===`login_required`?`login`:(e.status===`starting`||e.runtime_state===`starting`)&&!e.hot&&!e.ready?e.quota?`starting`:`loading`:e.status===`ready`?e.hot?`hot`:`ready`:e.hot?`hot`:e.ready?`ready`:(e.status===`error`||e.status,`unavailable`):`disabled`}function VSe(e){return e===`hot`?12:e===`ready`?9:e===`cooling`?5:e===`login`?3:e===`loading`||e===`starting`?6:e===`unavailable`?2:e===`auth_failed`?3:e===`dead`?2:1}function HSe(e){return e===`hot`||e===`ready`?`ok`:e===`cooling`||e===`quota_exhausted`||e===`loading`||e===`starting`?`warn`:e===`auth_failed`||e===`unavailable`||e===`dead`||e===`login`?`danger`:`muted`}function m9(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(Math.round(e*100)/100)}function h9(e){let t=e.percentage??0;return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):0}function g9(e){let t=e.percentage??0;return e.exceeded?`danger`:t>=80?`warn`:`ok`}function USe(e){return(e.windows??[]).filter(e=>!!e.id)}var WSe={free:`Free`,go:`Go`,plus:`Plus`,pro:`Pro`,prolite:`Pro Lite`,promax:`Pro Max`,team:`Team`,business:`Business`,enterprise:`Enterprise`,edu:`Edu`,edu_plus:`Edu Plus`,edu_pro:`Edu Pro`,education:`Education`};function GSe(e){let t=e?.trim().toLowerCase()??``;return!t||t===`unknown`||t===`guest`?``:WSe[t]??t.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function KSe(e,t){return e.id===`daily`?t(`quotaDaily`):e.id===`weekly`?t(`quotaWeekly`):e.id===`monthly`?t(`quotaMonthly`):e.id===`fiveHour`?t(`quotaFiveHour`):e.id===`weeklyLimit`?t(`quotaWeeklyLimit`):e.id===`monthlyLimit`?t(`quotaMonthlyLimit`):e.label||t(`quota`)}function qSe(e,t){if(!e)return``;let n=Date.parse(e)-Date.now();if(!Number.isFinite(n)||n<=0)return t(`quotaResetsSoon`);let r=Math.max(1,Math.ceil(n/6e4));return r<60?t(`quotaResetsInMinutes`,{n:r}):t(`quotaResetsInHours`,{n:Math.round(r/60)})}function JSe(e,t){if(!e.expires_at||e.expires_at<=0||!Number.isFinite(e.expires_at))return``;let n=new Date(e.expires_at*1e3);if(Number.isNaN(n.getTime()))return``;let r=`${n.getFullYear()}/${n.getMonth()+1}/${n.getDate()}`;return t(`quotaExpiresOn`,{amount:e.expiring_remain&&e.expiring_remain>0?`${m9(e.expiring_remain)} `:``,unit:e.unit||`credits`,date:r})}function YSe(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${m9(e.add_on_used)} / ${m9(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${m9(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?JSe(e,i):``].filter(Boolean)}function XSe({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=KSe(e,t),a=t(`quotaUsedPercent`,{n:r}),o=qSe(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=h9(e),l=g9(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{className:`block w-full min-w-0`,children:(0,G.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,G.jsxs)(IF,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,G.jsxs)(IF.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,G.jsx)(IF.Track,{children:(0,G.jsx)(IF.Fill,{})})]}),o?(0,G.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{children:s}),n?.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function ZSe({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${m9(e.used)} / ${m9(e.total)}`,d=`${m9(e.remaining)}`,f=YSe(e,i,a,o,t,c),p=USe(e),m=c===`codex`?GSe(e.plan):``,h=h9(e),g=g9(e),_=g===`danger`?`danger`:g===`warn`?`warning`:`success`,y=(0,v.useRef)(null);zSe(y);let b=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,G.jsxs)(`div`,{ref:y,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,G.jsx)(`div`,{className:`w-full min-w-0`,children:(0,G.jsx)(XSe,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`div`,{ref:y,className:`w-full cursor-help`,children:(0,G.jsxs)(IF,{className:`account-meter w-full`,color:_,size:`md`,minValue:0,maxValue:100,value:Math.round(h*100),"aria-label":n,valueLabel:b,children:[(0,G.jsxs)(IF.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,G.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,G.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):null,d,(0,G.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,G.jsxs)(`span`,{className:`mono text-foreground/55`,children:[r,` `,u]})]}),(0,G.jsx)(IF.Track,{children:(0,G.jsx)(IF.Fill,{})})]})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,G.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function QSe({state:e,stateCopy:t,t:n}){let r=(0,v.useRef)(null),i=VSe(e),a=HSe(e);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=Z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{scaleY:1,autoAlpha:1}),Z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.set(e,{transformOrigin:`center bottom`}),Z.to(n,{scaleY:.32,autoAlpha:.45,duration:kV.fast,ease:AV.out,overwrite:!0}),Z.to(t,{scaleY:1,autoAlpha:1,duration:kV.base,ease:AV.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,G.jsxs)(`div`,{ref:r,className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption font-medium text-foreground/75`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":a===`muted`?void 0:a===`warn`?`warn`:a}),(0,G.jsx)(`span`,{children:n(`runtimeState`)})]}),(0,G.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,G.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(!M&&!N&&P.length===0)return;let e=window.setInterval(()=>A(e=>e+1),1e3);return()=>window.clearInterval(e)},[M,N,P.length]);let F=$Se(j,j===`dead`?N:M,o),I=j===`hot`||j===`ready`?`success`:j===`cooling`?`warning`:j===`quota_exhausted`||j===`login`||j===`unavailable`||j===`dead`||j===`auth_failed`?`danger`:void 0,L=e.last_error||e.lastError,R=e.last_error_kind||e.kind,z=jH(e.provider,e.region,o),B=e.last_checkin_status,V=B===`success`?`checkinRecordSuccess`:B===`already`?`checkinRecordAlready`:B===`skipped`?`checkinRecordSkipped`:B===`error`?`checkinRecordFailed`:`lastCheckinNone`;return(0,v.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=k.current;if(k.current=j,!t||t===j)return;let n=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[j]),(0,v.useLayoutEffect)(()=>{let e=E.current;if(!e||!n)return;let t=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,"data-state":j,className:`account-card overflow-hidden p-0`,children:[(0,G.jsxs)(HS.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,children:(0,G.jsx)(MH,{provider:e.provider,size:20})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(HS.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,children:z})]}),(0,G.jsx)(HS.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:e.remote_uid?`UID ${e.remote_uid}`:e.id})]})]}),(0,G.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,G.jsx)(`span`,{ref:T,children:P.length&&j===`cooling`?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:I,children:F})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),P.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:I,children:F})}),P.length&&j!==`cooling`?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:o(`partialCooling`)})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),P.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):null]})]}),(0,G.jsxs)(HS.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,G.jsx)(QSe,{state:j,stateCopy:F,t:o}),e.quota?(0,G.jsx)(ZSe,{quota:e.quota,t:o,label:o(`quota`),usedLabel:o(`quotaUsed`),remainingLabel:o(`quotaRemaining`),addOnLabel:o(`quotaAddOn`),resourcePackageLabel:o(`quotaResourcePackage`),exceededLabel:o(`quotaExceeded`),provider:e.provider}):(0,G.jsx)(`span`,{className:`text-caption text-foreground/65`,children:o(j===`hot`||j===`ready`||j===`loading`||j===`starting`?`quotaLoading`:`quotaUnavailable`)}),L?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,G.jsx)(ro,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[R?(0,G.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:R}):null,(0,G.jsx)(`p`,{className:`break-words line-clamp-3`,children:L})]})]})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[R?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:R}):null,L]})})]}):null]}),n&&e.enabled?(0,G.jsxs)(`section`,{ref:E,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`oauthDeviceFlow`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?o(`wizardCodexBrowserLead`):o(`qoderLoginHint`)}),(0,G.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(`cli`),children:[(0,G.jsx)(Da,{size:14}),o(`startCodexCliLogin`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>c(`chatgpt`),children:[(0,G.jsx)(Da,{size:14}),o(`startCodexChatGPTLogin`)]})]}):(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(),children:[(0,G.jsx)(Da,{size:14}),o(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`)&&f&&d?(0,G.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:o(`wizardCallbackLead`)}),(0,G.jsx)(JM,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:u||``,onChange:e=>d(e.target.value),placeholder:o(`wizardCallbackPh`),"aria-label":o(`wizardCallbackPh`)}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:f,children:o(`wizardSubmitCallback`)})]}):null]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`patFallback`)}),(0,G.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsxs)(YM,{className:`flex-1`,type:`password`,value:a,onChange:s,children:[(0,G.jsx)(IN,{className:`sr-only`,children:o(`pat`)}),(0,G.jsx)(UM,{placeholder:o(`pasteToken`),"aria-label":o(`pat`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:l,children:[(0,G.jsx)(ta,{size:14}),o(`usePat`)]})]})]}),r||i?(0,G.jsxs)(`div`,{className:`text-caption`,children:[r?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:o(`authUrl`)}),(0,G.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(Zr,{size:14}),o(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(r).then(e=>{e&&(O(!0),window.setTimeout(()=>O(!1),1100))})},children:[(0,G.jsx)(X7,{copied:D}),o(D?`copied`:`copy`)]})]})]}):null,i?(0,G.jsx)(`p`,{className:`mt-1 text-muted`,children:i}):null]}):null]}):null,b?(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-separator px-4 py-2 text-caption text-muted`,children:[(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`lastCheckin`)}),(0,G.jsx)(`span`,{className:B===`error`?`text-danger`:``,children:o(V)})]})}),(0,G.jsxs)(PM.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():o(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`autoCheckin`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||_}),(0,G.jsx)(F7,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:o(`autoCheckin`),onChange:e=>y?.(e)})]})}),(0,G.jsx)(PM.Content,{children:e.checkin_time?o(`checkinCustom`):o(`checkinInherit`)})]})]}):null,(0,G.jsxs)(HS.Footer,{className:`flex flex-wrap items-center gap-1.5 bg-surface-secondary px-4 py-2`,children:[m?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,isPending:t===`refresh`,onPress:m,"aria-label":o(`refreshAccount`),children:(0,G.jsx)(qr,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`refreshAccount`)})]}):null,(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:C,"aria-label":o(`authentication`),children:(0,G.jsx)(ta,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`authentication`)})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:w,"aria-label":o(`accountModels`),children:(0,G.jsx)(ji,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`accountModels`)})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:S,"aria-label":o(`editAccount`),children:(0,G.jsx)(ya,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`editAccount`)})]}),b?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:!e.enabled||!!t,isPending:t===`checkin`,onPress:b,"aria-label":o(`checkinNow`),children:(0,G.jsx)(si,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`checkinNow`)})]}):null,(0,G.jsxs)(uF,{children:[(0,G.jsx)(uF.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,"aria-label":o(`more`),children:(0,G.jsx)(Fi,{size:16})})}),(0,G.jsx)(uF.Popover,{placement:`bottom end`,children:(0,G.jsxs)(uF.Menu,{"aria-label":o(`more`),onAction:e=>{e===`export`&&p(),e===`checkin-records`&&x?.(),e===`delete`&&h()},children:[e.auth_type===`none`?null:(0,G.jsxs)(uF.Item,{id:`export`,textValue:o(`export`),children:[(0,G.jsx)(Di,{size:15}),o(`export`)]}),x?(0,G.jsxs)(uF.Item,{id:`checkin-records`,textValue:o(`checkinRecords`),children:[(0,G.jsx)(sa,{size:15}),o(`checkinRecords`)]}):null,(0,G.jsxs)(uF.Item,{id:`delete`,textValue:o(`delete`),className:`text-danger`,children:[(0,G.jsx)(qa,{size:15}),o(`delete`)]})]})})]}),(0,G.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center gap-3 whitespace-nowrap`,children:(0,G.jsx)(F7,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?o(`disable`):o(`enable`),label:e.enabled?o(`enabledState`):o(`disabled`),onChange:g})})]})]})}function tCe(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function nCe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function rCe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await _oe(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,v.useEffect)(()=>{l&&d()},[l]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:u}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[s?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(QI,{title:s})}):null,a?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]}):r.length?(0,G.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=tCe(e,t);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:nCe(e.created_at)})]}),(0,G.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,G.jsx)(I7,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,G.jsx)(qr,{size:14}),t(`refresh`)]})]})]})]})})})})}function iCe(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function aCe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),d=e?.id||``,f=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),p=e?jH(e.provider,e.region,t):``;async function m(e=!1){if(d){e?c(!0):(o(!0),i([])),u(``);try{let t=await(e?HI(d):VI(d));i(t.data||[])}catch(e){i([]),u(e instanceof Error?e.message:String(e))}finally{o(!1),c(!1)}}}return(0,v.useEffect)(()=>{if(!d)return;let e=!1;return VI(d).then(t=>{e||(i(t.data||[]),u(``),o(!1))}).catch(t=>{e||(i([]),u(t instanceof Error?t.message:String(t)),o(!1))}),()=>{e=!0}},[d]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:f}),(0,G.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:p}),(0,G.jsx)(`span`,{className:`text-border`,children:`·`}),(0,G.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[l?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(QI,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`})]}):r.length?(0,G.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=iCe(n),a=rH(n),o=iH(n);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,G.jsx)(MH,{provider:r,size:12}),(0,G.jsx)(`span`,{children:r})]})]},n.id)})}):(0,G.jsx)(I7,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(ji,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:r.length,total:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void m(!0),children:[(0,G.jsx)(qr,{size:14}),t(s?`refreshing`:`refresh`)]})]})]})]})})})})}var oCe=`w-28`;function _9({label:e,hint:t,labelWidthClass:n=oCe,htmlFor:r,align:i=`center`,children:a}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,G.jsx)(IN,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,G.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}function sCe({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(t),l=(0,v.useMemo)(()=>new Set(t),[t]),u=(0,v.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,v.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function h(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function g(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function _(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(PN,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:i(`modelPickerSearch`)}),(0,G.jsx)(PN.ClearButton,{})]})}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:g,children:[(0,G.jsx)(xi,{size:14}),i(`modelPickerSelectAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:_,children:[(0,G.jsx)(La,{size:14}),i(`modelPickerClear`)]})]})]}),(0,G.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>h(e,!1),children:(0,G.jsx)(ao,{size:14})})]},`offline-${e}`)),u.map(e=>(0,G.jsx)(tC,{isSelected:l.has(e),isDisabled:r,onChange:t=>h(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,G.jsxs)(tC.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,G.jsx)(tC.Control,{children:(0,G.jsx)(tC.Indicator,{})}),(0,G.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function cCe(e){let[t,n]=(0,v.useState)(e);e&&!t&&n(!0);let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(e);return(0,v.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}Z.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){Z.set(t,{overflow:`hidden`});let e=t.scrollHeight;Z.fromTo(t,{height:s===e?0:s},{height:e,duration:MV(kV.base),ease:AV.out,onComplete:()=>Z.set(t,{clearProps:`height,overflow`})}),Z.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:MV(kV.base),ease:AV.out})}else Z.set(t,{overflow:`hidden`,height:s}),Z.to(o,{autoAlpha:0,y:-4,duration:MV(kV.fast),ease:AV.inOut}),Z.to(t,{height:0,duration:MV(kV.fast+.04),ease:AV.inOut,onComplete:()=>n(!1)});return()=>{Z.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function lCe({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,v.useState)(e?.name||``),[l,u]=(0,v.useState)(e?.max_inflight??4),[d,f]=(0,v.useState)(e?.priority??50),[p,m]=(0,v.useState)(e?.proxy_url||``),[h,g]=(0,v.useState)(!!e?.drop_system_prompt),[_,y]=(0,v.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[b,x]=(0,v.useState)({alias:``,model:``}),[S,C]=(0,v.useState)(!!e?.models_restricted),[w,T]=(0,v.useState)(e?.enabled_models||[]),{mounted:E,outerRef:D,innerRef:O}=cCe(S),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!e?.checkin_time),[N,P]=(0,v.useState)(e?.checkin_time||null),[F,I]=(0,v.useState)(``);(0,v.useEffect)(()=>{if(!e?.id)return;let t=!1;return VI(e.id).then(e=>{t||A(e.data||[])}).catch(()=>{t||A([])}),()=>{t=!0}},[e?.id]);let L=i(`editAccountTitle`,{name:e?.name||e?.id||``}),R=e?jH(e.provider,e.region,i):``;async function z(n){n?.preventDefault();let r=s.trim();if(!r){I(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){I(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){I(i(`priorityInvalid`));return}if(t!==void 0&&!j&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(N??t)){I(i(`checkinTimeInvalid`));return}I(``);try{await o({name:r,max_inflight:l,priority:d,proxy_url:p.trim(),checkin_time:t===void 0?void 0:j?``:N??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?h:void 0,model_aliases:Object.fromEntries(_.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:S?w:[],set_model_routing:!0}),a()}catch(e){I(e instanceof Error?e.message:String(e))}}return(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:L}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:R})]})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2 pt-1`,children:[F?(0,G.jsxs)(tF,{status:`danger`,className:`mb-4`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:F})})]}):null,(0,G.jsxs)(QP,{className:`space-y-4`,onSubmit:e=>void z(e),children:[(0,G.jsx)(_9,{label:i(`accountName`),children:(0,G.jsx)(UM,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,G.jsx)(_9,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,G.jsx)(hF,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(hF.Group,{children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":i(`maxInflight`)}),(0,G.jsx)(hF.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`priority`),hint:i(`priorityHint`),children:(0,G.jsx)(hF,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(hF.Group,{children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":i(`priority`)}),(0,G.jsx)(hF.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,G.jsx)(UM,{value:p,onChange:e=>m(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,G.jsx)(_9,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,G.jsx)(F7,{isSelected:h,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:g})}):null,(0,G.jsx)(_9,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>y(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,G.jsx)(UM,{"aria-label":i(`modelAliasName`),value:b.alias,onChange:e=>x(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,G.jsx)(UM,{"aria-label":i(`modelAliasTarget`),value:b.model,onChange:e=>x(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isDisabled:r||!b.alias.trim()||!b.model.trim(),onPress:()=>{y(e=>[...e.filter(e=>e.alias!==b.alias.trim()),{alias:b.alias.trim(),model:b.model.trim()}]),x({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,G.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,G.jsx)(F7,{isSelected:S,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(S?`restrictModels`:`allModels`),onChange:C})]}),E?(0,G.jsx)(`div`,{ref:D,children:(0,G.jsx)(`div`,{ref:O,children:(0,G.jsx)(sCe,{catalog:k?k.map(e=>e.id):null,selected:w,onChange:T,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,G.jsx)(_9,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(F7,{isSelected:j,isDisabled:r,onChange:M,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,G.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,G.jsx)(`span`,{className:`mono`,children:n})]}),j?null:(0,G.jsx)(UM,{type:`time`,value:N??t,onChange:e=>P(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,G.jsx)(J,{isPending:r,onPress:()=>void z(),children:i(`save`)})]})]})})})})}var uCe={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function v9({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,G.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${uCe[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var y9=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),dCe=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function fCe(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function b9(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function pCe({ariaLabel:e}){return(0,G.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(UA,{className:`h-3 w-24 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-40 rounded-lg`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,G.jsx)(UA,{className:`size-10 shrink-0 rounded-lg`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsx)(UA,{className:`h-3.5 w-28 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function mCe({tile:e,disabled:t,onSelect:n}){return(0,G.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,G.jsx)(MH,{provider:e.provider,size:18})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,G.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function hCe({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,G.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,G.jsx)(mCe,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function gCe({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=EI(),[o,s]=(0,v.useState)(``),c=o.trim().toLowerCase(),l=(0,v.useMemo)(()=>{let t=fCe(e.filter(e=>y9.has(e.id)),dCe),n=e.filter(e=>!y9.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>b9(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>b9(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,G.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,G.jsx)(B7,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,G.jsx)(hCe,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}function x9(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function S9(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function _Ce(e,t){return GI(x9(e,t))}var C9={global:`Global`,cn:`CN`},vCe={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"meta-global":`accountTypeMetaGlobal`},yCe={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"meta-global":`accountTypeMetaGlobalHint`};async function bCe(){let e=(await UI().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function w9(e,t){let n=vCe[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function T9(e,t){if(!e)return``;let n=yCe[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function xCe({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,G.jsx)(yi,{size:16,className:`text-success`}):t&&n===r?(0,G.jsx)(PV,{size:16,loading:!0}):null}var SCe=90,CCe=2e3;function wCe({isOpen:e,onClose:t,onAdded:n}){let{t:r}=EI(),[i,a]=(0,v.useState)(`method`),[o,s]=(0,v.useState)(`browser`),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(4),[x,S]=(0,v.useState)(50),[C,w]=(0,v.useState)(!0),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(`payg`),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,R]=(0,v.useState)(``),[z,B]=(0,v.useState)(`idle`),[V,H]=(0,v.useState)(``),[ee,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(``),[oe,se]=(0,v.useState)(`cli`),ce=(0,v.useRef)(null),le=(0,v.useRef)(null),ue=(0,v.useRef)(null),de=(0,v.useRef)(``),fe=(0,v.useRef)(null),pe=(0,v.useRef)(null);function me(){fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)}(0,v.useEffect)(()=>()=>me(),[]),(0,v.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),d([]),l(``),bCe().then(e=>{t||(d(e),l(``),s(`browser`))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e]);let he=u.find(e=>e.id===c),ge=!f&&u.length>0,_e=he?.descriptor.capabilities?.pat_login!==!1,ve=he?.descriptor.capabilities?.import_export!==!1,ye=he?.descriptor.capabilities?.browser_login!==!1,be=he?.provider===`workbuddy`||he?.provider===`trae`,xe=he?.provider===`trae`||he?.provider===`devin`||he?.provider===`codex`,Se=z===`busy`||z===`polling`,Ce=!!de.current||Se,we=z===`done`,Te=T9(he,r);(0,v.useEffect)(()=>{o===`pat`&&!_e&&s(`browser`),o===`import`&&!ve&&s(`browser`)},[ve,_e,o]),(0,v.useEffect)(()=>{ye||(_e?s(`pat`):ve&&s(`import`))},[ye,ve,_e]);function Ee(){return!Number.isInteger(y)||y<1||y>32?4:y}function De(){return!Number.isInteger(x)||x<1||x>100?50:x}function Oe(){return{max_inflight:Ee(),priority:De(),drop_system_prompt:be?C:he?.provider!==`kimi`,proxy_url:T.trim()}}function ke(){me(),a(`method`),s(`browser`),l(``),d([]),p(!1),_(``),b(4),S(50),w(!0),E(``),O(``),A(``),M(`payg`),P(``),I(``),R(``),h(!1),B(`idle`),H(``),te(``),re(!1),ae(``),se(`cli`),de.current=``}function Ae(){Se||(ke(),t())}function je(){ke(),t()}(0,v.useLayoutEffect)(()=>{let t=ce.current;if(e||(ue.current=null),!t||!e)return;let n=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=ue.current,n=e&&e!==i?i===`login`?1:-1:0;Z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:kV.slow,ease:AV.out,overwrite:!0}),n&&le.current&&Z.fromTo(le.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:kV.base,ease:AV.out,overwrite:!0})})},t);return ue.current=i,()=>n.revert()},[e,i]);function Me(e){if(Se||!ge)return;let t=u.find(t=>t.id===e);l(e),s(t?.provider===`zhipu`?`pat`:`browser`),w(t?.provider!==`trae`&&t?.provider!==`kimi`),H(``),a(`login`)}async function Ne(){if(de.current)return de.current;if(!he)throw Error(r(`accountTypeHint`));let e=Oe(),t=await hoe(g.trim()||r(`account`),he.provider,he.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return de.current=n,n}async function Pe(){H(``),te(``);try{B(`busy`);let e=await Ne();H(r(`wizardStartingSession`)),B(`polling`);let t=await FI(e,he?.provider===`codex`?oe:void 0);t.authUrl&&te(t.authUrl),H(r(`wizardWaitingBrowser`));for(let t=0;t{fe.current=window.setTimeout(e,CCe)});let n=(await II(e)).login||{};if(n.message&&H(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(r(`wizardLoginTimeout`))}B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Fe(){let e=ie.trim();if(!e){H(r(`wizardCallbackPh`));return}try{B(`busy`);let t=await Ne();me(),await LI(t,e),B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){B(`polling`),H(e instanceof Error?e.message:String(e))}}async function Ie(){let e=N.trim();if(!e){H(r(`zhipuKeyRequired`));return}if(!he){H(r(`accountTypeHint`));return}H(``);try{B(`busy`);let t=Oe();await GI({format:`zhipu-key-v1`,api_key:e,mode:j,organization:j===`coding`?F.trim():``,project:j===`coding`?L.trim():``,name:g.trim()||r(`accountTypeZhipuCN`),enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Le(){let e=D.trim();if(!e){H(r(`pastePatFirst`));return}H(``);try{B(`busy`);let t=await Ne();H(r(`wizardStartingSession`)),await RI(e,t),B(`done`),H(r(`patDone`)),n(),window.setTimeout(je,700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Re(){H(``);let e;try{e=JSON.parse(k)}catch{H(r(`wizardBadJson`));return}if(!e||typeof e!=`object`){H(r(`wizardBadJson`));return}if(!he){H(r(`accountTypeHint`));return}if(he.provider===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){H(r(`wizardBadJson`));return}let t=Oe(),i;he.provider===`workbuddy`?i=x9(e,{region:he.region===`global`?`global`:`cn`,name:g.trim()||void 0,enabled:!0,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}):(e.format||(he.descriptor.id===`trae`?e.format=`trae-oauth-v1`:he.descriptor.id===`devin`?e.format=`devin-session-v1`:he.descriptor.id===`command`?e.format=`command-key-v1`:he.descriptor.id===`qwenwork`?e.format=`qwenwork-oauth-v1`:e.format=`qoder-native-v1`),i={...e,name:g.trim()||e.name,enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt});try{B(`busy`);let{failed:e,message:t}=S9(await GI(i),r);B(`done`),H(t),n(),window.setTimeout(je,e>0?1600:700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}function ze(){pe.current?.click()}function Be(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>A(String(n.result||``)),n.readAsText(t),e.target.value=``}let Ve=e=>Se&&o===e,He=he?.provider===`zhipu`,Ue=[he?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:r(`tabBrowser`)},_e?{value:`pat`,label:r(`tabPat`)}:null,ve?{value:`import`,label:r(`tabImport`)}:null].filter(Boolean),We=r(o===`browser`?he?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:o===`pat`?he?.provider===`command`?`wizardPatLeadCommand`:he?.region===`cn`&&he?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{e||Ae()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!Se,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,G.jsxs)(Y.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:r(`addAccountTitle`)}),(0,G.jsx)(`p`,{ref:le,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:i===`method`?r(`addAccountDesc`):Te||r(`addAccountDesc`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":r(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsx)(Y.Body,{className:i===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,G.jsx)(`div`,{ref:ce,children:i===`method`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`space-y-2.5`,children:f?(0,G.jsx)(pCe,{ariaLabel:r(`accountType`)}):ge?(0,G.jsx)(gCe,{ariaLabel:r(`accountType`),options:u.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``;return{id:e.id,provider:e.provider,label:w9(e,r),subtitle:t,hint:T9(e,r)}}),onSelect:Me,disabled:Ce}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:r(`accountTypeHint`)})}),(0,G.jsx)(`div`,{className:`mt-4 text-center`,children:(0,G.jsx)(e9,{className:`text-xs`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(MH,{provider:he?.provider,size:18})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:he?w9(he,r):r(`accountType`)}),(0,G.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Te})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>a(`method`),isDisabled:Se||!!de.current,children:[(0,G.jsx)(li,{size:12}),r(`wizardBack`)]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`accountName`)}),(0,G.jsx)(UM,{fullWidth:!0,value:g,onChange:e=>_(e.target.value),"aria-label":r(`accountName`),disabled:Ce,autoFocus:!0})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-expanded":m,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,G.jsx)(di,{size:12,className:`transition-transform duration-200 ${m?`rotate-90`:``}`}),r(`wizardAdvanced`)]}),m?(0,G.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`maxInflight`)}),(0,G.jsx)(hF,{value:y,onChange:e=>b(e??4),minValue:1,maxValue:32,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(hF.Group,{className:`w-full`,children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":r(`maxInflight`)}),(0,G.jsx)(hF.IncrementButton,{})]})}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`maxInflightHint`)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`priority`)}),(0,G.jsx)(hF,{value:x,onChange:e=>S(e??50),minValue:1,maxValue:100,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(hF.Group,{className:`w-full`,children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":r(`priority`)}),(0,G.jsx)(hF.IncrementButton,{})]})}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`priorityHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`proxyUrl`)}),(0,G.jsx)(UM,{fullWidth:!0,value:T,onChange:e=>E(e.target.value),placeholder:r(`proxyUrlPlaceholder`),"aria-label":r(`proxyUrl`),disabled:Ce}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`proxyUrlHint`)})]}),be?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`dropSystemPrompt`)}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(he?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,G.jsx)(F7,{isSelected:C,isDisabled:Ce,ariaLabel:r(`dropSystemPrompt`),onChange:w})]}):null]}):null]}),He?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-body font-medium text-muted`,children:r(`zhipuAccountMode`)}),(0,G.jsx)(v9,{ariaLabel:r(`zhipuAccountMode`),columns:2,value:j,onChange:e=>{Se||M(e)},options:[{value:`payg`,label:r(`zhipuModePayg`),hint:r(`zhipuModePaygHint`),disabled:Se},{value:`coding`,label:r(`zhipuModeCoding`),hint:r(`zhipuModeCodingHint`),disabled:Se}]})]}),(0,G.jsx)(_9,{label:r(`zhipuApiKey`),children:(0,G.jsx)(UM,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:r(`zhipuApiKeyPh`),"aria-label":r(`zhipuApiKey`),disabled:Se})}),j===`coding`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`zhipuOrganization`),children:(0,G.jsx)(UM,{value:F,onChange:e=>I(e.target.value),placeholder:r(`zhipuOrganizationPh`),"aria-label":r(`zhipuOrganization`),disabled:Se})}),(0,G.jsx)(_9,{label:r(`zhipuProject`),children:(0,G.jsx)(UM,{value:L,onChange:e=>R(e.target.value),placeholder:r(`zhipuProjectPh`),"aria-label":r(`zhipuProject`),disabled:Se})})]}):null,V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]}):null,He?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{className:`mt-3`,value:o,onChange:e=>{!Se&&e!==o&&(s(e),H(``),te(``),re(!1))},ariaLabel:r(`authentication`),options:Ue.map(e=>({id:e.value,label:e.label}))}),(0,G.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:We}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:o===`browser`?(0,G.jsxs)(G.Fragment,{children:[he?.provider===`codex`?(0,G.jsx)(v9,{ariaLabel:r(`codexLoginMethod`),columns:2,value:oe,onChange:e=>{Se||se(e)},options:[{value:`cli`,label:r(`codexLoginCli`),hint:r(`codexLoginCliHint`),disabled:Se||!!de.current},{value:`chatgpt`,label:r(`codexLoginChatGPT`),hint:r(`codexLoginChatGPTHint`),disabled:Se||!!de.current}]}):null,ee?(0,G.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(xCe,{phase:z,busy:Se,tab:o,forTab:`browser`}),(0,G.jsx)(`span`,{className:`text-muted`,children:V||r(`loginOpenMsg`)})]}),(0,G.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:ee}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(ee,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(Zr,{size:14}),r(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(ee).then(e=>{e&&(re(!0),window.setTimeout(()=>re(!1),1100))})},children:[(0,G.jsx)(X7,{copied:ne}),r(ne?`copied`:`copy`)]})]})]}):null,V&&!ee?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null,xe?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:r(`wizardCallbackLead`)}),(0,G.jsx)(JM,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:ie,onChange:e=>ae(e.target.value),placeholder:r(`wizardCallbackPh`),"aria-label":r(`wizardCallbackPh`),disabled:we}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:z===`busy`&&!!ie.trim(),onPress:()=>void Fe(),isDisabled:we,children:r(`wizardSubmitCallback`)})]}):null]}):o===`pat`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`tabPat`),children:(0,G.jsx)(UM,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:r(`wizardPatPh`),"aria-label":r(`wizardPatPh`),disabled:Se})}),V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:ze,isDisabled:Se,children:[(0,G.jsx)(Vi,{size:13}),r(`wizardChooseFile`)]}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Be})]}),(0,G.jsx)(JM,{className:`min-h-32 font-mono text-caption`,value:k,onChange:e=>A(e.target.value),placeholder:r(`wizardImportPh`),"aria-label":r(`tabImport`),disabled:Se}),V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]})})]})]})})}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:Ae,isDisabled:Se,children:r(`cancel`)}),i===`login`&&He?(0,G.jsx)(J,{isPending:z===`busy`,onPress:()=>void Ie(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{size:15}),r(`zhipuCreate`)]})}):null,i===`login`&&!He&&o===`browser`?(0,G.jsx)(J,{isPending:Ve(`browser`),onPress:()=>void Pe(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Da,{size:15}),r(`wizardStartBrowser`)]})}):null,i===`login`&&!He&&o===`pat`?(0,G.jsx)(J,{isPending:Ve(`pat`),onPress:()=>void Le(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`patDone`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{size:15}),r(`wizardCreateAndLogin`)]})}):null,i===`login`&&!He&&o===`import`?(0,G.jsx)(J,{isPending:Ve(`import`),onPress:()=>void Re(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`accountImported`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vi,{size:15}),r(`importCredential`)]})}):null]})]})})})})}function E9({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:s=`danger`,confirmVariant:c=`danger`,onClose:l,onConfirm:u}){return(0,G.jsx)(cx.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&l()},children:(0,G.jsx)(cx.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,G.jsx)(cx.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(cx.Dialog,{children:[(0,G.jsxs)(cx.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(cx.Icon,{status:s}),(0,G.jsx)(`div`,{children:(0,G.jsx)(cx.Heading,{children:t})})]}),(0,G.jsx)(cx.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,G.jsx)(cx.Body,{children:(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,G.jsxs)(cx.Footer,{children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:l,children:i}),(0,G.jsx)(J,{size:`sm`,variant:c,isPending:o,onPress:u,children:r})]})]})})})})}function TCe(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function ECe({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let[s,c]=(0,v.useState)(`cn`);(0,v.useEffect)(()=>{t&&(t.region===`cn`||t.region===`global`?c(t.region):c(`cn`))},[t]);let l=!!t?.batchImportSupported,u=t?.provider,d=t?.format||i(`batchImportFormatUnknown`),f=u?AH(u,i):i(`batchImportProviderUnknown`),p=(t?.warnings||[]).map(e=>TCe(e,i)).filter(Boolean);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,24rem)] sm:mx-0`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-2`,children:[(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[u?(0,G.jsx)(MH,{provider:u,size:18}):null,(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:f}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:d})]})]})}),l?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(`batchImportRegion`)}),(0,G.jsx)(pH,{value:s,onChange:e=>{(e===`cn`||e===`global`)&&c(e)},ariaLabel:i(`batchImportRegion`),options:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`batchImportRegionPickHint`)}):null]}):(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),p.length?(0,G.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:p.map(e=>(0,G.jsx)(`li`,{children:e},e))}):null]}),(0,G.jsxs)(Y.Footer,{className:`flex-col-reverse gap-2 px-5 pb-5 sm:flex-row sm:justify-end`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(l?`cancel`:`close`)}),l?(0,G.jsx)(J,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(s),children:i(`batchImportConfirmAction`)}):null]})]})})})})}var D9={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`},DCe=[`codebuddy.cn`,`workbuddy.cn`],OCe=[`workbuddy.ai`,`workbuddy.com`];function O9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function k9(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function kCe(e){return typeof e.format==`string`&&e.format.trim()?k9(e.format):typeof e.exportType==`string`&&e.exportType.trim()?k9(e.exportType):``}function ACe(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),O9(e.account)&&n(e.account.domain),O9(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)O9(t)&&(n(t.domain),O9(t.account)&&n(t.account.domain),O9(t.auth)&&n(t.auth.domain));return t}function jCe(e){return DCe.some(t=>e.includes(t))}function MCe(e){return OCe.some(t=>e.includes(t))}function A9(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function NCe(e){if(!O9(e))return!1;if(A9(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(O9(e.account)||O9(e.auth)){let t=O9(e.account)?e.account:null,n=O9(e.auth)?e.auth:null;if(n&&(A9(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function PCe(e){let t=ACe(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(jCe),r=t.some(MCe);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function FCe(e){return Array.isArray(e.accounts)&&e.accounts.some(NCe)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:A9(e)||O9(e.account)&&A9(e.account)||O9(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function ICe(e){if(!O9(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=kCe(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?D9[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=FCe(e);o||=r.format,s=r.provider,c=n&&!D9[n]?`low`:r.confidence,a&&!D9[n]&&t.push(`unknown_format`)}s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=PCe(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`}}function LCe(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!O9(t))throw Error(`bad_json`);return t}var j9=`__all__`,RCe=[],M9=2;function zCe(){let{t:e}=EI(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),d=s,f=d.length>0,[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)({}),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[I,L]=(0,v.useState)(null),[R,z]=(0,v.useState)(null),[B,V]=(0,v.useState)(null),[H,ee]=(0,v.useState)(null),[te,ne]=(0,v.useState)(null),[re,ie]=(0,v.useState)(``),[ae,oe]=(0,v.useState)(`all`),[se,ce]=(0,v.useState)(``),[le,ue]=(0,v.useState)(1),[de,fe]=(0,v.useState)(20),[pe,me]=(0,v.useState)({}),[he,ge]=(0,v.useState)({}),[_e,ve]=(0,v.useState)({}),[ye,be]=(0,v.useState)({}),[xe,Se]=(0,v.useState)(!1),Ce=(0,v.useCallback)(async(e=!1)=>{try{let t=(await PI(e)).data||RCe;return c(t),t}finally{u(!1)}},[]),we=(0,v.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(n.length)for(let e=0;e{try{let n=await loe(e,{quota:t});c(t=>t.map(t=>t.id===e?n:t))}catch(t){N(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))}}))}},[]);(0,v.useEffect)(()=>{Ce(!1).catch(()=>void 0)},[Ce]),(0,v.useEffect)(()=>{let e=!0;return Promise.all([UI(),$I()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&o(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]);function Te(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function Ee(e){let t=Te(e)?.timezone;return t===`Local`?r?.timezone:t}let De=(0,v.useMemo)(()=>d.map(e=>{let t=pe[e.id],n=he[e.id],r=_e[e.id],i=ye[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[pe,_e,he,ye,d]),Oe=(0,v.useMemo)(()=>{let e={all:De.length,available:0,attention:0,disabled:0};for(let t of De){let n=p9(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[De]),ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of De){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[De]),Ae=De.find(e=>e.id===I),je=De.find(e=>e.id===R)||null,Me=De.find(e=>e.id===B)||null,Ne=De.find(e=>e.id===H)||null,Pe=(0,v.useMemo)(()=>{let e=re.trim().toLowerCase();return De.filter(t=>{let n=p9(t);return!(ae===`all`||ae===`available`&&(n===`hot`||n===`ready`)||ae===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||ae===`disabled`&&n===`disabled`)||se&&String(t.provider||`qoder`).toLowerCase()!==se?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[De,ae,se,re]),Fe=[re,ae,se,de].join(`\0`),[Ie,Le]=(0,v.useState)(Fe);Ie!==Fe&&(Le(Fe),ue(1));let Re=Math.max(1,Math.ceil(Pe.length/de)),ze=Math.min(Ie===Fe?Math.max(1,le):1,Re);le!==ze&&ue(ze);let Be=(0,v.useMemo)(()=>{let e=(ze-1)*de;return Pe.slice(e,e+de)},[ze,Pe,de]);if(l&&!f)return(0,G.jsx)(Fse,{});async function Ve(e,t,n){D({id:e,kind:t}),N(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return N(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{D(null)}}async function He(t,n){ne(t),await Ve(t,`device`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await FI(t,n);r.authUrl&&F(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await II(t)).login||{};if(N(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await Ce(!1),await we([t])})}async function Ue(t){let n=(A[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Ve(t,`callback`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await LI(t,n),j(e=>({...e,[t]:``})),await Ce(!1),await we([t])})&&(ne(e=>e===t?null:e),N(e=>({...e,[t]:``})))}async function We(t){let n=(O[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Ve(t,`pat`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await RI(n,t),k(e=>({...e,[t]:``})),await Ce(!1),await we([t])})}async function Ge(t){await Ve(t,`export`,async()=>{let n=await yoe(t);await Z7(JSON.stringify(n,null,2)),N(n=>({...n,[t]:e(`credentialCopied`)}))})}async function Ke(e,t){me(n=>({...n,[e]:t})),await Ve(e,`toggle`,async()=>{await WI(e,{enabled:t}),await Ce(!1)}),me(t=>{let n={...t};return delete n[e],n})}async function qe(t){XV({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),D({id:t,kind:`refresh`}),N(e=>{let n={...e};return delete n[t],n});try{await we([t]),XV({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}catch(n){throw XV({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)}),n}finally{D(null)}}async function Je(){Se(!0),XV({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{await we(s.map(e=>e.id)),XV({id:`refresh-credits`,type:`success`,title:e(`toastCreditsRefreshed`)})}catch(t){throw XV({id:`refresh-credits`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)}),t}finally{Se(!1)}}function Ye(){h||(y(!1),x(null),C(null),T(``))}async function Xe(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let t=LCe(await n.text()),r=ICe(t);if(!r.provider){XV({type:`error`,title:e(`batchImportUnrecognized`)});return}C(t),x(r),T(n.name),y(!0)}catch(t){let n=t instanceof Error?t.message:String(t);XV({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`batchImportUnrecognized`),description:n===`bad_json`?void 0:n})}}async function Ze(t){if(!S||!b?.batchImportSupported||h)return;g(!0);let n=`batch-import-accounts`;XV({id:n,type:`loading`,title:e(`batchImportLoading`)});try{let{succeeded:r,failed:i,message:a}=S9(await _Ce(S,{region:t}),e);XV({id:n,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:a}),y(!1),x(null),C(null),T(``),r>0&&await Ce(!1)}catch(t){XV({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{g(!1)}}async function Qe(e,t){await Ve(e,`toggle`,async()=>{await WI(e,{auto_checkin:t}),await Ce(!1)})}async function $e(e){await Ve(e,`checkin`,async()=>{try{await goe(e)}finally{await Ce(!1)}})}async function et(t,n){if(!t)throw Error(e(`accountNameRequired`));ge(e=>({...e,[t]:n.name})),ve(e=>({...e,[t]:n.max_inflight})),be(e=>({...e,[t]:n.priority})),D({id:t,kind:`settings`});try{await WI(t,n),await Ce(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{D(null),ge(e=>{let n={...e};return delete n[t],n}),ve(e=>{let n={...e};return delete n[t],n}),be(e=>{let n={...e};return delete n[t],n})}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,G.jsx)(QI,{title:a}):null,(0,G.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[d.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{value:ae,onChange:e=>oe(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,G.jsxs)(G.Fragment,{children:[e(`filterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.all})]})},{id:`available`,label:(0,G.jsxs)(G.Fragment,{children:[e(`availableAccounts`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.available})]})},{id:`attention`,label:(0,G.jsxs)(G.Fragment,{children:[e(`needsAttention`),(0,G.jsx)(`span`,{className:`mono ${Oe.attention?`text-danger`:`text-muted`}`,children:Oe.attention})]})},{id:`disabled`,label:(0,G.jsxs)(G.Fragment,{children:[e(`disabled`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.disabled})]})}]}),(0,G.jsxs)(AF,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:se||j9,onChange:e=>{typeof e==`string`&&ce(e===j9?``:e)},children:[(0,G.jsxs)(AF.Trigger,{className:`items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{children:(0,G.jsxs)(oF,{children:[(0,G.jsxs)(oF.Item,{id:j9,textValue:e(`providerFilterAll`),children:[(0,G.jsxs)(IN,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:d.length})]}),(0,G.jsx)(oF.ItemIndicator,{})]}),ke.map(([t,n])=>(0,G.jsxs)(oF.Item,{id:t,textValue:AH(t,e),children:[(0,G.jsxs)(IN,{className:`flex items-center gap-2`,children:[(0,G.jsx)(MH,{provider:t,size:13}),AH(t,e),(0,G.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,G.jsx)(oF.ItemIndicator,{})]},t))]})})]}),(0,G.jsx)(B7,{className:`w-full sm:w-60`,value:re,onChange:ie,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:xe,onPress:()=>void Je(),children:[(0,G.jsx)(ti,{size:14}),e(`refreshCredits`)]}),(0,G.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${h||_?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[h?(0,G.jsx)(PV,{size:14,loading:!0}):(0,G.jsx)($a,{size:14}),e(`batchImport`)]}),(0,G.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:h||_,className:`sr-only`,onChange:e=>void Xe(e)}),(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`addAccount`)]})]})]}),(0,G.jsx)(wCe,{isOpen:p,onClose:()=>m(!1),onAdded:()=>{XV({type:`success`,title:e(`toastAccountAdded`)}),Ce(!1)}}),(0,G.jsx)(ECe,{isOpen:_,detection:b,fileName:w,isPending:h,t:e,onClose:Ye,onConfirm:e=>{Ze(e)}}),(0,G.jsx)(aCe,{account:je,t:e,onClose:()=>z(null)},R??`closed`),(0,G.jsx)(rCe,{account:Me,t:e,onClose:()=>V(null)},B??`closed`),(0,G.jsx)(lCe,{account:Ne,checkinDefaultTime:Ne&&Te(Ne)?r?.checkin_times[Ne.provider||``]:void 0,checkinTimezone:Ne?Ee(Ne):void 0,busy:!!(E&&E.id===H&&E.kind===`settings`),t:e,onClose:()=>ee(null),onSave:e=>et(H||``,e)},H??`closed`),(0,G.jsx)(E9,{isOpen:!!Ae,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:Ae?.name||Ae?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:E?.id===I&&E.kind===`delete`,onClose:()=>L(null),onConfirm:()=>{if(!Ae)return;let t=Ae.id;L(null),Ve(t,`delete`,async()=>{await voe(t),await Ce(!1)}).then(t=>{t&&XV({type:`success`,title:e(`toastAccountDeleted`)})})}}),f?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(PV,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`addAccount`)]})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(e9,{})})]}),f&&!Pe.length?(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(la,{size:22}),title:e(`noAccountsMatch`),action:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>{ie(``),oe(`all`),ce(``)},children:e(`clearFilters`)})}):null,(0,G.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:Be.map(t=>(0,G.jsx)(eCe,{account:t,busyKind:E?.id===t.id?E.kind:``,authPanelOpen:te===t.id,authUrl:P[t.id],note:M[t.id],pat:O[t.id]||``,t:e,onPatChange:e=>k(n=>({...n,[t.id]:e})),callbackUrl:A[t.id]||``,onCallbackChange:e=>j(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void Ue(t.id),onDeviceLogin:e=>void He(t.id,e),onPatLogin:()=>void We(t.id),onExport:()=>void Ge(t.id),onRefresh:()=>void qe(t.id),onDelete:()=>L(t.id),onToggle:e=>void Ke(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],onToggleAutoCheckin:Te(t)?e=>void Qe(t.id,e):void 0,onCheckin:Te(t)?()=>void $e(t.id):void 0,onViewCheckins:Te(t)?()=>V(t.id):void 0,onEdit:()=>ee(t.id),onToggleAuthPanel:()=>ne(e=>e===t.id?null:t.id),onViewModels:()=>z(t.id)},t.id))}),Pe.length?(0,G.jsx)(z7,{total:Pe.length,page:ze,pageCount:Re,pageSize:de,pageSizes:cSe,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:ze,pages:Re}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ue,onPageSize:fe}):null]})}function BCe(){let{t:e,lang:t,setLang:n}=EI(),{setApiKey:r}=kI(),{overview:i,refresh:a}=qI(),{theme:o,toggleTheme:s}=XI(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``),g=at(),_=nt().state?.from||`/`,y=(0,v.useRef)(null);if(Use(y,`login`),i)return(0,G.jsx)(At,{to:_===`/login`?`/`:_,replace:!0});async function b(t){t.preventDefault();let n=c.trim();if(!n){h(e(`loginNeedKey`));return}p(!0),h(``);try{r(n),await a(n),g(_===`/login`?`/`:_,{replace:!0})}catch(t){h(MI(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{p(!1)}}return(0,G.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,G.jsxs)(`main`,{ref:y,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(480px,45%)]`,children:[(0,G.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col border-separator px-5 py-6 sm:px-10 sm:py-8 lg:min-h-dvh lg:border-r lg:px-14 lg:py-10 xl:px-20`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(PV,{size:36}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,G.jsxs)(cM,{isAttached:!0,children:[(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,G.jsx)(Yi,{size:15})})}),(0,G.jsx)(PM.Content,{children:t===`zh`?`English`:`中文`})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:s,"aria-label":o===`dark`?`Light mode`:`Dark mode`,children:o===`dark`?(0,G.jsx)(Ua,{size:15}):(0,G.jsx)(da,{size:15})})}),(0,G.jsx)(PM.Content,{children:o===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,G.jsxs)(`div`,{className:`my-auto max-w-3xl py-16 lg:py-24`,children:[(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mb-5 mono text-caption text-muted`,children:`:3010`}),(0,G.jsx)(`h1`,{"data-gsap-reveal":!0,className:`max-w-3xl text-[clamp(2.25rem,4vw,3.6rem)] font-semibold leading-[0.98] tracking-[-0.045em] text-balance`,children:e(`loginTitle`)}),(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mt-6 max-w-xl text-section font-normal text-muted sm:text-title sm:font-normal`,children:e(`loginLead`)}),(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mt-10 max-w-xl pt-5 text-body leading-6 text-muted`,children:e(`loginHint`)})]}),(0,G.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,G.jsx)(`span`,{children:e(`loginHint`)}),(0,G.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,G.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-10 lg:px-12 xl:px-16`,children:(0,G.jsx)(HS,{"data-gsap-reveal":!0,className:`w-full p-0`,children:(0,G.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,G.jsx)(HS.Header,{className:`border-b border-separator px-6 py-6 sm:px-8`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(PV,{size:28,loading:f}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(HS.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,G.jsx)(HS.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,G.jsxs)(HS.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,G.jsxs)(YM,{name:`console-password`,className:`w-full`,isInvalid:!!m,children:[(0,G.jsx)(IN,{children:e(`loginPassword`)}),(0,G.jsxs)(KM,{children:[(0,G.jsx)(KM.Input,{id:`console-password`,type:u?`text`:`password`,value:c,onChange:e=>l(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,G.jsx)(KM.Suffix,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(u?`hidePassword`:`showPassword`),onPress:()=>d(e=>!e),children:u?(0,G.jsx)(zi,{size:16}):(0,G.jsx)(Li,{size:16})})})]})]}),m?(0,G.jsx)(QI,{title:m}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,G.jsxs)(J,{type:`submit`,fullWidth:!0,size:`lg`,isPending:f,children:[e(f?`loggingInConsole`:`loginSubmit`),f?null:(0,G.jsx)(Yr,{size:17})]})]})]})})})]})]})}function N9(){return NI(`/api/keys`)}function VCe(e){return NI(`/api/keys`,{method:`POST`,body:JSON.stringify(e)})}function P9(e,t){return NI(`/api/keys/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function HCe(e){return NI(`/api/keys/${encodeURIComponent(e)}`,{method:`DELETE`})}function UCe(){return NI(`/api/system/console-key`)}function WCe(){return NI(`/api/system/console-key`,{method:`POST`,body:JSON.stringify({rotate:!0})})}function GCe({settings:e,onSaved:t}){let{t:n}=EI(),r=at(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!0;return UI().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&d(String(t))}),()=>{e=!1}},[]);async function f(n,r){if(!(!e||r===e.checkin_times[n])){l(!0),d(``);try{t(await eL({checkin_times:{[n]:r}}))}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(e=>{let t={...e};return delete t[n],t}),l(!1)}}}return(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(HS.Header,{children:[(0,G.jsx)(HS.Title,{children:n(`checkinDefaultsTitle`)}),(0,G.jsx)(HS.Description,{children:n(`checkinDefaultsHint`)})]}),(0,G.jsxs)(HS.Content,{className:`space-y-4`,children:[u?(0,G.jsx)(QI,{title:u}):null,!e||!i?(0,G.jsx)(Q,{className:`h-24 w-full`}):i.map(t=>(0,G.jsx)(_9,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,G.jsx)(UM,{type:`time`,value:o[t.id]??e.checkin_times[t.id]??``,disabled:c,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>s(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void f(t.id,e.target.value)})},t.id))]}),(0,G.jsx)(HS.Footer,{children:(0,G.jsx)(J,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function KCe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function qCe({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:o}){let{t:s,lang:c}=EI();if(!e.length)return null;let l=n&&n!==t?n:t,u=e.some(e=>e.tag_name===l)?l:e[0]?.tag_name,d=new Set(r);return(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:s(`versionHistory`)})}),(0,G.jsx)(vh,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:u?[u]:[],children:e.map(e=>{let r=e.tag_name,l=r===t,u=!!(n&&r===n&&n!==t),f=i&&d.has(r)&&!l,p=KCe(e.published_at,c);return(0,G.jsxs)(vh.Item,{id:r,children:[(0,G.jsx)(vh.Heading,{children:(0,G.jsxs)(vh.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),l?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:s(`versionCurrentBadge`)}):null,u?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:s(`versionLatestBadge`)}):null,p?(0,G.jsx)(`span`,{className:`truncate text-caption text-muted`,children:p}):null]}),(0,G.jsx)(vh.Indicator,{})]})}),(0,G.jsx)(vh.Panel,{children:(0,G.jsxs)(vh.Body,{className:`px-3 pb-3`,children:[(0,G.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,G.jsx)(aL,{markdown:rL(e.body,c),emptyLabel:s(`updateNoNotes`)})}),f?(0,G.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>o(r),children:s(`restoreThisVersion`)})}):null]})})]},r)})})]})}function F9(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function JCe(e,t,n,r,i){return r?.length?F9(r):F9([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var YCe=[`general`,`routing`,`security`,`updates`];function XCe(){let{t:e}=EI(),[t,n]=On(),r=t.get(`tab`),i=r&&YCe.includes(r)?r:`general`,a=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:o}=kI(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(``),E=nL(),{info:D,loading:O,checking:k,submitting:A,error:j,setError:M,load:N,canRollback:P,rollbackTo:F}=E,I=(0,v.useMemo)(()=>JCe(D?.current_version||``,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions),[D?.current_version,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions]),L=(0,v.useMemo)(()=>(D?.rollback_versions||[]).map(e=>e.tag_name),[D?.rollback_versions]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>{UCe().then(c).catch(()=>void 0),$I().then(e=>{u(e),f(e.proxy_url||``)}).catch(e=>M(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[M]);async function R(e){let t=l?.cross_provider_model_pool??!0;u(t=>t&&{...t,cross_provider_model_pool:e}),m(!0),M(``);try{u(await eL({cross_provider_model_pool:e}))}catch(e){u(e=>e&&{...e,cross_provider_model_pool:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function z(e){let t=l?.checkin_disabled_accounts??!1;u(t=>t&&{...t,checkin_disabled_accounts:e}),m(!0),M(``);try{u(await eL({checkin_disabled_accounts:e}))}catch(e){u(e=>e&&{...e,checkin_disabled_accounts:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(e){let t=l?.proxy_url||``;if(e===t){f(t);return}let n=d;f(e),u(t=>t&&{...t,proxy_url:e}),m(!0),M(``);try{let t=await eL({proxy_url:e});u(t),f(t.proxy_url||``)}catch(e){f(n),u(e=>e&&{...e,proxy_url:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function V(e){let t=l?.routing_strategy||`round-robin`;u(t=>t&&{...t,routing_strategy:e}),m(!0),M(``);try{u(await eL({routing_strategy:e}))}catch(e){u(e=>e&&{...e,routing_strategy:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}return O&&!D?(0,G.jsx)(Hse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:k,onPress:()=>void N(!0),children:[(0,G.jsx)(qr,{size:15}),e(`checkUpdates`)]})]}),j?(0,G.jsx)(QI,{title:j}):null,(0,G.jsxs)(_j,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,G.jsxs)(gj,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(qi,{size:13}),e(`settingsTabGeneral`)]}),(0,G.jsxs)(gj,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(ri,{size:13}),e(`settingsTabRouting`)]}),(0,G.jsxs)(gj,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(Da,{size:13}),e(`settingsTabSecurity`)]}),(0,G.jsxs)(gj,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(Gr,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,G.jsx)(_j.Panel,{id:`general`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,G.jsx)(UM,{value:d,onChange:e=>f(e.target.value),onBlur:e=>void B(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:p||!l}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(yi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,G.jsx)(F7,{isSelected:l?.checkin_disabled_accounts??!1,isDisabled:p||!l,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void z(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,G.jsx)(GCe,{settings:l,onSaved:u})]})}),(0,G.jsx)(_j.Panel,{id:`routing`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,G.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,G.jsx)(_9,{label:e(`routingStrategy`),children:(0,G.jsxs)(AF,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:l?.routing_strategy||`round-robin`,isDisabled:p||!l,onChange:e=>{typeof e==`string`&&e&&V(e)},children:[(0,G.jsxs)(AF.Trigger,{className:`items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{children:(0,G.jsxs)(oF,{children:[(0,G.jsxs)(oF.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,G.jsx)(IN,{children:e(`routingRoundRobin`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,G.jsx)(IN,{children:e(`routingWeightedRoundRobin`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,G.jsx)(IN,{children:e(`routingFillFirst`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`fefo`,textValue:`fefo`,children:[(0,G.jsx)(IN,{children:e(`routingFEFO`)}),(0,G.jsx)(oF.ItemIndicator,{})]})]})})]})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.ttl_seconds?`${Math.round(l.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),l?.session_affinity?.last_escape_reason?(0,G.jsxs)(RN,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,l.session_affinity.last_escape_reason]}):null,l?.session_affinity?.last_miss_reason?(0,G.jsxs)(RN,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,l.session_affinity.last_miss_reason]}):null]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,G.jsx)(F7,{isSelected:l?.cross_provider_model_pool??!0,isDisabled:p||!l,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void R(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,G.jsx)(_j.Panel,{id:`security`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(ta,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,G.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:s?.prefix||`—`}),(0,G.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,G.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isPending:h,onPress:()=>y(!0),children:e(`consoleKeyRotate`)})})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ni,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,G.jsx)(Da,{size:18,className:`text-success`})]}),(0,G.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,G.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,G.jsx)(_j.Panel,{id:`updates`,className:`pt-5`,children:(0,G.jsx)(`div`,{className:`grid gap-5`,children:(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:D?.has_update?`warning`:`success`,children:D?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,G.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,G.jsx)(ZI,{update:E}),(0,G.jsx)(qCe,{releases:I,currentVersion:D?.current_version||``,nextVersion:D?.next_version,rollbackTags:L,canRollback:P,submitting:A,onRestore:T})]})]})})})]}),(0,G.jsx)(E9,{isOpen:!!w,title:e(`restoreVersionTitle`,{version:w}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:A,status:`warning`,confirmVariant:`primary`,onClose:()=>{A||T(``)},onConfirm:()=>{let e=w;T(``),F(e)}}),(0,G.jsx)(Y.Root,{isOpen:_,onOpenChange:e=>{!e&&!h&&y(!1)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!h,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:h,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:h,onPress:()=>y(!1),children:e(`cancel`)}),(0,G.jsx)(J,{variant:`danger`,isPending:h,onPress:()=>{g(!0),WCe().then(e=>{c(e),x(e.secret||``),e.secret&&o(e.secret),y(!1)}).catch(e=>{M(e instanceof Error?e.message:String(e))}).finally(()=>g(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:!!b,onOpenChange:e=>{e||x(``)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsx)(Y.Body,{className:`px-6 pb-2`,children:(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b})}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(``),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{Z7(b),C(!0),window.setTimeout(()=>C(!1),1200)},children:[(0,G.jsx)(Di,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}var I9=`__all__`;function ZCe(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function L9({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let h=e||I9,g=(0,v.useMemo)(()=>{let t=s?d:r.filter(e=>ZCe(e,l)),n=new Map;l.trim()||n.set(I9,{id:I9,label:i});for(let e of t)!e.id||e.id===I9||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),_=g.find(e=>e.id===h)||(e?{id:e,label:e}:{id:I9,label:i});return(0,G.jsxs)(NS,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:h,onChange:e=>{typeof e==`string`&&(t(e===I9?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,G.jsxs)(NS.Trigger,{className:`min-w-44 items-center`,children:[(0,G.jsx)(NS.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,G.jsx)(`span`,{className:`truncate`,children:_.label})}),e?(0,G.jsx)(NS.ClearButton,{}):null,(0,G.jsx)(NS.Indicator,{})]}),(0,G.jsx)(NS.Popover,{className:`min-w-56`,children:(0,G.jsxs)(NS.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,G.jsx)(PN,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:a}),(0,G.jsx)(PN.ClearButton,{})]})}),(0,G.jsx)(oF,{children:g.length===0?(0,G.jsx)(oF.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,G.jsx)(IN,{className:`block truncate text-muted`,children:p?a:o})}):g.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(IN,{className:`block truncate`,children:e.label}),e.id!==I9&&e.id!==e.label?(0,G.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})]})})]})}function R9(){let[e,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1;return N9().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,v.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}function z9(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function QCe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function $Ce(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function B9(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function V9(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function H9({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?U9(o):null;return i==null&&a==null&&s==null?(0,G.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,G.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,G.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function ewe(){return(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:Array.from({length:8},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-5 w-36 max-w-full`})]},t))}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-secondary px-3 py-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-24`}),(0,G.jsx)(Q,{className:`h-4 w-full`}),(0,G.jsx)(Q,{className:`h-4 w-4/5`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]})]})}function U9(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var twe=[`all`,`ok`,`incomplete`,`error`,`canceled`],nwe=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],rwe=[`all`,`1h`,`24h`,`7d`,`custom`];function W9(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=hH(e.get(`from`)),r=hH(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),twe,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),nwe,`all`),timeRange:i?`custom`:t(e.get(`range`),rwe,`1h`),customRange:i}}function iwe(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?mH(e.customRange?.start):void 0,r=e.timeRange===`custom`?mH(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function awe(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function owe(){let{t:e,lang:t}=EI(),[n,r]=On(),[i]=(0,v.useState)(()=>W9(new URLSearchParams(window.location.search))),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(`requests`),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(i.requestFilter),[b,x]=(0,v.useState)(`all`),[S,C]=(0,v.useState)(i.requestId),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(i.accountFilter),[O,k]=(0,v.useState)(i.apiKeyFilter),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(i.modelFilter),[P,F]=(0,v.useState)(i.providerFilter),[I,L]=(0,v.useState)(i.streamFilter),[R,z]=(0,v.useState)(i.errorKind),[B,V]=(0,v.useState)(i.timeRange),[H,ee]=(0,v.useState)(i.customRange),[te,ne]=(0,v.useState)(1),[re,ie]=(0,v.useState)(50),[ae,oe]=(0,v.useState)(1),[se,ce]=(0,v.useState)(50),[le,ue]=(0,v.useState)([]),[de,fe]=(0,v.useState)(0),[pe,me]=(0,v.useState)([]),[he,ge]=(0,v.useState)(0),[_e,ve]=(0,v.useState)(null),[ye,be]=(0,v.useState)(!1),[xe,Se]=(0,v.useState)(null),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),[De,Oe]=(0,v.useState)(``),ke=(0,v.useRef)(0),[Ae,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),Pe=n.toString(),Fe=iwe({requestFilter:_,requestId:S,accountFilter:E,apiKeyFilter:O,modelFilter:M,providerFilter:P,streamFilter:I,errorKind:R,timeRange:B,customRange:H}),Ie=(0,v.useRef)(Pe);(0,v.useEffect)(()=>{if(Pe===Ie.current)return;Ie.current=Pe;let e=W9(new URLSearchParams(Pe));y(e.requestFilter),C(e.requestId),D(e.accountFilter),k(e.apiKeyFilter),N(e.modelFilter),F(e.providerFilter),L(e.streamFilter),z(e.errorKind),V(e.timeRange),ee(e.customRange)},[Pe]),(0,v.useEffect)(()=>{Fe!==Ie.current&&(Ie.current=Fe,r(Fe,{replace:!0}))},[Fe,r]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([PI(!1),VI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&o(t.value.data||[]),n.status===`fulfilled`&&c(n.value.data||[]))}),()=>{e=!0}},[]);let Le=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,t.name||t.id);return e},[a]),Re=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[a]);function ze(t){let n=t.account_id?Re.get(t.account_id):void 0,r=t.provider||n?.provider;return r?jH(r,n?.region,e):`—`}function Be(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ve=(0,v.useMemo)(()=>(a||[]).map(e=>({id:e.id,label:e.name||e.id})),[a]),{nameById:He,options:Ue}=R9();function We(e){let t=e.api_key_id?.trim();return t?He.get(t)||t:`—`}let Ge=(0,v.useMemo)(()=>{let t=new Set;for(let e of a||[])e.provider&&t.add(e.provider);return P&&t.add(P),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:AH(t,e)}))]},[a,P,e]),Ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of s||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[s]),qe=(0,v.useCallback)(async e=>((await QV({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Je=!!(S||_!==`all`||E||O||M||P||I!==`all`||R!==`all`||B!==`1h`),Ye=[_,S,E,O,M,P,I,R,B,H?.start?.toString()??``,H?.end?.toString()??``,re].join(`\0`),Xe=[b,w,A,se].join(`\0`),[Ze,Qe]=(0,v.useState)(Ye),[$e,et]=(0,v.useState)(Xe);Ze!==Ye&&(Qe(Ye),ne(1)),$e!==Xe&&(et(Xe),oe(1));let tt=Math.max(1,Math.ceil(de/re)),nt=Math.min(Ze===Ye?Math.max(1,te):1,tt);te!==nt&&ne(nt);let rt=Math.max(1,Math.ceil(he/se)),it=Math.min($e===Xe?Math.max(1,ae):1,rt);ae!==it&&oe(it);let at=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=S?{from:void 0,to:void 0}:B===`custom`?{from:mH(H?.start),to:mH(H?.end,!0)}:awe(B),t=await QV({status:_===`all`?void 0:_,id:S||void 0,account:E||void 0,api_key:O||void 0,model:M||void 0,provider:P||void 0,stream:I===`all`?void 0:I===`stream`,error_kind:R===`all`?void 0:R,from:e.from,to:e.to,limit:re,offset:(nt-1)*re});ue(t.items||[]),fe(t.total||0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[_,S,E,O,M,P,I,R,B,H,nt,re]),ot=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=await cce({level:b===`all`?void 0:b,q:w.trim()||void 0,account:A||void 0,limit:se,offset:(it-1)*se});me(e.items||[]),ge(e.total??0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[b,w,A,it,se]),st=(0,v.useCallback)(async(e=!1)=>{l===`requests`?await at(e):await ot(e)},[l,at,ot]);(0,v.useEffect)(()=>{f(!0);let e=l===`runtime`&&w.trim()?280:0,t=window.setTimeout(()=>void st(!1),e);return()=>window.clearTimeout(t)},[st,l,w]),(0,v.useEffect)(()=>{if(l!==`runtime`||it!==1)return;let e=window.setInterval(()=>void ot(!0),3e3);return()=>window.clearInterval(e)},[l,it,ot]);let ct=de===0?0:(nt-1)*re+1,lt=Math.min(de,nt*re),ut=he===0?0:(it-1)*se+1,dt=Math.min(he,it*se),ft=(0,v.useMemo)(()=>l===`requests`?e(`logsShownTotal`,{shown:le.length?`${ct}–${lt}`:0,total:de}):e(`logsShownTotal`,{shown:pe.length?`${ut}–${dt}`:0,total:he}),[l,le.length,pe.length,ct,lt,de,ut,dt,he,e]);function pt(){C(``),y(`all`),D(``),k(``),N(``),F(``),L(`all`),z(`all`),V(`1h`),ee(null),ne(1)}async function mt(e){let t=++ke.current;Se(e),Oe(``),Ee(!0),we(!0);try{let n=await oce(e.id);if(ke.current!==t)return;Se(n)}catch(e){if(ke.current!==t)return;Oe(e instanceof Error?e.message:String(e))}finally{ke.current===t&&Ee(!1)}}function ht(e){ve(e),be(!0)}async function gt(){Ne(!0),XV({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await sce(),je(!1),await at(!1),XV({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){g(t instanceof Error?t.message:String(t)),XV({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{Ne(!1)}}let _t=d&&(l===`requests`?le.length===0:pe.length===0);return d&&!p?(0,G.jsx)(Bse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===`requests`?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>je(!0),isDisabled:Me||de===0,children:[(0,G.jsx)(qa,{size:14}),e(`logsClear`)]}):null,(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:d,onPress:()=>void st(!1),children:[(0,G.jsx)(qr,{size:15}),e(`refresh`)]})]})]}),h?(0,G.jsx)(QI,{title:e(`failedLogs`,{msg:h})}):null,(0,G.jsxs)(_j,{selectedKey:l,onSelectionChange:e=>u(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{children:[(0,G.jsxs)(gj,{id:`requests`,className:`gap-1.5`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(Ta,{size:13}),e(`logsRequests`)]}),(0,G.jsxs)(gj,{id:`runtime`,className:`gap-1.5`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(Ga,{size:13}),e(`logsRuntime`)]})]})}),(0,G.jsxs)(_j.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(pH,{value:_,onChange:e=>y(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null,(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:ft})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:E,onChange:D,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:O,onChange:k,options:Ue,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColModel`),value:M,onChange:N,options:Ke,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(R7,{ariaLabel:e(`logsColProvider`),value:P,onChange:F,options:Ge}),(0,G.jsx)(L9,{ariaLabel:e(`logsSearchRequestId`),value:S,onChange:C,options:S?[{id:S,label:S}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:qe,className:`min-w-56`}),(0,G.jsx)(pH,{value:I,onChange:e=>L(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,G.jsx)(R7,{ariaLabel:e(`errorKind`),value:R===`all`?``:R,onChange:e=>z(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,G.jsx)(pH,{value:B,onChange:e=>V(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),B===`custom`?(0,G.jsx)(gH,{className:`w-[min(100%,42rem)]`,value:H,onChange:ee,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,G.jsx)(HS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(RV,{}):le.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(la,{size:22}),title:e(Je?`logsNoMatch`:`logsEmptyRequests`),action:Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null}):(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":e(`logsRequests`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,G.jsx)(X.Column,{children:e(`logsColModel`)}),(0,G.jsx)(X.Column,{children:e(`logsColReasoning`)}),(0,G.jsx)(X.Column,{children:e(`logsColProvider`)}),(0,G.jsx)(X.Column,{children:e(`logsColAccount`)}),(0,G.jsx)(X.Column,{children:e(`logsColApiKey`)}),(0,G.jsx)(X.Column,{children:e(`logsColStatus`)}),(0,G.jsx)(X.Column,{children:e(`logsColStream`)}),(0,G.jsx)(X.Column,{children:e(`logsColLatency`)}),(0,G.jsx)(X.Column,{children:e(`logsColTokens`)})]}),(0,G.jsx)(X.Body,{children:le.map(n=>(0,G.jsxs)(X.Row,{className:`cursor-pointer`,onAction:()=>void mt(n),children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`mono text-xs`,children:B9(n.created_at,t)}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:V9(n)||`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:ze(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:n.account_id?Le.get(n.account_id)||n.account_id:`—`}),n.account_id&&Le.get(n.account_id)&&Le.get(n.account_id)!==n.account_id?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:We(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:z9(n.status),children:n.status}),n.error_kind?(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(n9,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(H9,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,G.jsx)(z7,{total:de,page:nt,pageCount:tt,pageSize:re,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:nt,pages:tt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ne,onPageSize:ie})]}),(0,G.jsxs)(_j.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(B7,{className:`sm:w-72`,value:w,onChange:T,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:A,onChange:j,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(pH,{value:b,onChange:e=>x(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[it===1?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,G.jsx)(`span`,{className:`mono`,children:ft})]})]}),(0,G.jsx)(HS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(zse,{}):pe.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(Ga,{size:22}),title:e(`logsEmptyRuntime`)}):(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:pe.map(e=>(0,G.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>ht(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ht(e))},children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:B9(e.time,t)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":QCe(e.level)}),(0,G.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,G.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,G.jsx)(z7,{total:he,page:it,pageCount:rt,pageSize:se,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:it,pages:rt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:oe,onPageSize:ce})]})]}),(0,G.jsx)(Y.Root,{isOpen:ye,onOpenChange:e=>{be(e),e||ve(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:_e?`#${_e.id}`:`—`})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),_e?B9(_e.time,t):`—`],[e(`logsRuntimeLevel`),_e?.level||`—`],[e(`logsRuntimeSource`),_e?.source||`—`],[e(`logsColAccount`),_e?.account_id||`—`]].map(([t,n])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&_e?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:$Ce(_e.level),children:_e.level}):n})]},String(t)))}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,G.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:_e?.message||`—`})]})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:Ce,onOpenChange:e=>{we(e),e||(ke.current+=1,Ee(!1),Oe(``),Se(null))},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:xe?.id})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsx)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:Te?(0,G.jsx)(ewe,{}):De?(0,G.jsx)(QI,{title:e(`requestFailed`),description:De}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[[e(`logsColStatus`),xe?.status||`—`],[e(`logsColModel`),xe?.requested_model||`—`],[e(`logsColReasoning`),xe&&V9(xe)||`—`],[e(`logsColProvider`),xe?ze(xe):`—`],[e(`logsColAccount`),xe?.account_id?Le.get(xe.account_id)||xe.account_id:`—`],[e(`logsColApiKey`),xe?We(xe):`—`],[e(`logsColStream`),xe?.stream?e(`logsStreamYes`):e(`logsStreamNo`)],[e(`logsRouting`),xe?Be(xe.routing):`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t})]},String(e))),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsColTokens`)}),(0,G.jsx)(`dd`,{className:`mt-1`,children:xe?(0,G.jsx)(H9,{log:xe,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})}):`—`})]}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(n9,{latencyMs:xe?.latency_ms,ttfbMs:xe?.ttfb_ms,completionTokens:xe?.completion_tokens,stream:xe?.stream,labels:{heading:e(`logsColLatency`),ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})})]}),xe&&xe.message_count?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsMessageShape`)}),(0,G.jsxs)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageCount`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5`,children:xe.message_count})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsEmptyMessageIndexes`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.empty_message_indexes?.length?xe.empty_message_indexes.join(`, `):`—`})]}),(0,G.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageRoles`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.message_roles?.join(` → `)||`—`})]})]})]}):null,xe?.error_message?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-2 text-xs leading-5 text-muted`,children:[xe.error_kind?(0,G.jsx)(`span`,{className:`mono mr-2 text-muted`,children:xe.error_kind}):null,xe.error_message]}):null,xe?.stream_diagnostic?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCancellationSource`),xe.stream_diagnostic.cancellation_source||`—`],[e(`logsUpstreamStatus`),xe.stream_diagnostic.upstream_status??`—`],[e(`logsSSEEvents`),xe.stream_diagnostic.sse_event_count],[e(`logsBytesRead`),xe.stream_diagnostic.bytes_read],[e(`logsLastEvent`),xe.stream_diagnostic.last_event||`—`],[e(`logsStreamComplete`),xe.stream_diagnostic.saw_done?`yes`:`no`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))}),xe.stream_diagnostic.context_err||xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{className:`mt-2 space-y-1 break-all text-muted`,children:[xe.stream_diagnostic.context_err?(0,G.jsxs)(`div`,{children:[`context: `,xe.stream_diagnostic.context_err]}):null,xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{children:[`relay: `,xe.stream_diagnostic.relay_error]}):null]}):null]}):null,xe?.usage_detail?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsUsageDetail`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCreditConsumed`),`${U9(xe.usage_detail.credit)} ${xe.usage_detail.unit||`credits`}`],[e(`logsColProvider`),xe.usage_detail.provider||`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))})]}):null,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsAttempts`)}),xe?.attempts?.length?(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:xe.attempts.map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 text-xs sm:grid-cols-[48px_minmax(0,1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`mono text-muted`,children:[`#`,e.attempt_index]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium`,children:e.account_id||`—`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-muted`,children:e.error_message||e.status})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:z9(e.status===`failover`?`canceled`:e.status),children:e.status})]},e.id))}):(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:e(`logsNoAttempts`)})]})]})})]})})})}),(0,G.jsx)(E9,{isOpen:Ae,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:Me,onClose:()=>je(!1),onConfirm:()=>void gt()})]})}var G9=864e5,swe=8;function K9(e){return`var(--chart-${e%swe+1})`}function q9(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function J9(e){return e<10?`0${e}`:String(e)}function Y9(e){let t=new Date(e);return`${t.getFullYear()}-${J9(t.getMonth()+1)}-${J9(t.getDate())}`}function cwe({accounts:e,t}){let[n,r]=(0,v.useState)(!1),{buckets:i,rows:a,todayStart:o,maxTotal:s}=(0,v.useMemo)(()=>{let t=q9(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,K9(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||K9(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=q9(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=Y9(q9(new Date(l)));for(let t of c)Y9(q9(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((q9(new Date(l))-t)/G9)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!a.some(e=>e.packs>0))return null;let c=n?i:i.slice(0,8);return(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,G.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:c.map(e=>{let n=e.ts===o,r=s>0?e.total/s*100:0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,G.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:m9(e.total)})]}),(0,G.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:m9(e.total)})}`,title:e.day,children:(0,G.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,G.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${m9(t.remain)}`},t.id))})}),(0,G.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:m9(e.total)})]},e.day)})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:a.filter(e=>e.remain>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,G.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,G.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,G.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:m9(e.soonestRemain)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,G.jsx)(X,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{className:`min-w-[32rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,G.jsx)(X.Body,{children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:m9(e.soonestRemain)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function lwe(){return NI(`/api/usage/pricing`)}function uwe(e={}){let t=new URLSearchParams;return e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key),NI(`/api/usage/cost${t.toString()?`?${t}`:``}`)}var X9=(0,v.lazy)(()=>C(()=>import(`./CostChart-DJ7HsYbU.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([2,1])));function dwe(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var fwe={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function pwe(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function mwe({apiKeyFilter:e=``}){let{t,lang:n}=EI(),[r,i]=(0,v.useState)(`today`),[a,o]=(0,v.useState)(`credits`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!1;return lwe().then(t=>{e||u(t)}).catch(()=>{}),()=>{e=!0}},[]);let h=(0,v.useCallback)(async()=>{f(!0);try{let t=await uwe({...r===`all`?{}:r===`today`?{from:dwe()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});c(t),m(``)}catch(e){c(null),m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[r,e]);(0,v.useEffect)(()=>{h()},[h]);let g=s??fwe,_=g.totals,y=_.requests>0&&g.models.length>0,b=g.models.filter(e=>e.priced),x=_.cost>0,S=[{label:t(`usageCredits`),value:cH(_.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:$V(_.total_tokens),detail:`${$V(_.cache_hit)} / ${$V(_.cache_miss)} / ${$V(_.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(_.requests),detail:t(`usageModelCount`,{count:g.models.length})},{label:t(`usageCacheHitRate`),value:pwe(_.cache_hit,_.cache_hit+_.cache_miss),detail:$V(_.cache_hit)}],C=a===`credits`?cH(_.credits):a===`tokens`?$V(_.total_tokens):oH(_.cost);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,G.jsx)(pH,{value:r,onChange:e=>i(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>void h(),isDisabled:d,children:[(0,G.jsx)(qr,{size:14}),t(`refresh`)]})]}),p?(0,G.jsx)(QI,{title:t(`failedStats`,{msg:p})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:S.map(e=>(0,G.jsxs)(HS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:d?(0,G.jsx)(Q,{className:`h-5 w-16`}):e.value}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:d?(0,G.jsx)(Q,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(pH,{value:a,onChange:e=>o(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:C})]})]}),(0,G.jsx)(`div`,{className:`p-5`,children:d?(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}):y?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}),children:(0,G.jsx)(X9,{series:g.series,models:g.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:a})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),d?(0,G.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,G.jsx)(Q,{className:`h-9 w-full`},e))}):y?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColRequests`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputHit`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputMiss`)}),(0,G.jsx)(X.Column,{children:t(`usageColOutput`)}),(0,G.jsx)(X.Column,{children:t(`usageColTokens`)}),(0,G.jsx)(X.Column,{children:t(`usageColCredits`)})]}),(0,G.jsxs)(X.Body,{children:[g.models.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:cH(e.credits)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:cH(_.credits)})})]})]})]})})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,G.jsx)(vh,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,G.jsxs)(vh.Item,{id:`deepseek-estimate`,children:[(0,G.jsx)(vh.Heading,{children:(0,G.jsxs)(vh.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),x?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:oH(_.cost)}):null,(0,G.jsx)(vh.Indicator,{})]})}),(0,G.jsx)(vh.Panel,{children:(0,G.jsxs)(vh.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),x?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:oH(_.cost)})]}),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(Q,{className:`h-56 w-full`}),children:(0,G.jsx)(X9,{series:g.series,models:b.length?b:g.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,b.length?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColSplit`)}),(0,G.jsx)(X.Column,{children:t(`usageColCost`)})]}),(0,G.jsxs)(X.Body,{children:[b.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[oH(e.cost_peak),` / `,oH(e.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:oH(e.cost)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[oH(_.cost_peak),` / `,oH(_.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:oH(_.cost)})})]})]})]})})}):(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,G.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,G.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(l?.models??[]).map(e=>(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[sH(e.off_peak.cache_hit),` · `,sH(e.off_peak.cache_miss),` · `,sH(e.off_peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[sH(e.peak.cache_hit),` · `,sH(e.peak.cache_miss),` · `,sH(e.peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),l?.models?.length?null:(0,G.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,G.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,G.jsx)(`p`,{children:t(`usagePeakNote`)}),g.unpriced?.length?(0,G.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:g.unpriced.join(`, `)})}):null,l?.note?(0,G.jsx)(`p`,{className:`mono text-[10px]`,children:l.note}):null]})]})]})})]})})]})}var hwe=500,gwe={model:`model`,account:`account`,provider:`provider`};function _we(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[gwe[t]]:e.key}}}function vwe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Z9(e){return e?e>=1e3?$V(e):String(Math.round(e*100)/100):`0`}function ywe(){let{t:e}=EI(),t=at(),[n,r]=On(),[i,a]=(0,v.useState)(`stats`),[o,s]=(0,v.useState)(`model`),[c,l]=(0,v.useState)(`today`),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(`count`),[C,w]=(0,v.useState)(`descending`),[T,E]=(0,v.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:D}=R9(),O=(0,v.useRef)(0),k=n.toString(),A=(0,v.useRef)(k);(0,v.useEffect)(()=>{k!==A.current&&(A.current=k,E(new URLSearchParams(k).get(`api_key`)??``))},[k]);let j=T?`api_key=${encodeURIComponent(T)}`:``;(0,v.useEffect)(()=>{j!==A.current&&(A.current=j,r(j,{replace:!0}))},[j,r]),(0,v.useEffect)(()=>{let e=!1;return PI(!1).then(t=>{e||b(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let M=u?.start?.toString()??``,N=u?.end?.toString()??``;(0,v.useEffect)(()=>{let e=vH(c,u);if(!e){h(!1);return}let t=++O.current;ZV({...e,dim:[o],limit:hwe,api_key:T||void 0}).then(e=>{t===O.current&&(p(e),_(``))}).catch(e=>{t===O.current&&(p(null),_(e instanceof Error?e.message:String(e)))}).finally(()=>{t===O.current&&h(!1)})},[o,c,M,N,T]);let P=(0,v.useMemo)(()=>{let t=new Map(y.map(e=>[e.id,e.name||e.id]));return vwe(((o===`model`?f?.models:o===`account`?f?.accounts:f?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):o===`account`?t.get(n.key)||n.key:o===`provider`?AH(n.key,e):n.key;return _we(n,o,r)}),x,C)},[f,o,y,x,C,e]),F=f?.totals,I=f?.tokens;function L(e){if(!f||!e.filter)return;let n={...e.filter,api_key:T||void 0};t(bH(n,f.window.from,f.window.to))}let R=[{id:`label`,label:e(o===`model`?`logsColModel`:o===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],z=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,G.jsx)(yH,{value:c,onChange:l,custom:u,onCustomChange:d,onBusy:()=>h(!0),t:e})}),g?(0,G.jsx)(QI,{title:e(`failedStats`,{msg:g})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),F?$V(F.requests):`—`,e(`statsWindowHint`,{window:e(_H[c])})],[e(`usageColSuccess`),F?nH(F.success_rate):`—`,F?`${F.ok} / ${F.requests}`:``],[e(`usageColTokens`),I?$V(I.total):`—`,I?`${$V(I.prompt)} / ${$V(I.completion)}`:``],[e(`usageColCacheWrite`),I?$V(I.cache_write??0):`—`,I?`${e(`chartCacheRead`)} ${$V(I.cache_read)}`:``],[e(`usageColCredits`),F?Z9(F.credits??0):`—`,``]].map(([e,t,n])=>(0,G.jsxs)(HS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:m?(0,G.jsx)(Q,{className:`h-5 w-16`}):t}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:m?(0,G.jsx)(Q,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,G.jsx)(_j,{selectedKey:o,onSelectionChange:e=>{h(!0),s(String(e))},children:(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(gj,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(ji,{size:14}),e(`usageByModel`)]}),(0,G.jsxs)(gj,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(to,{size:14}),e(`usageByAccount`)]}),(0,G.jsxs)(gj,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(za,{size:14}),e(`usageByProvider`)]})]})})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:m?``:e(`usageRowCount`,{count:P.length})})]}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(Q,{className:`h-3 w-12`}),(0,G.jsx)(Q,{className:`h-4 w-16`})]},t))})]},t))}),(0,G.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,G.jsx)(Q,{className:`h-4 w-14`},t))]},t))})]}):P.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,G.jsx)(pi,{size:16}),e(`usageEmpty`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:P.map(t=>{let n=!!(t.filter&&f),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:nH(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:eH(t.p95)},{label:e(`usageColTokens`),value:$V(t.tokens),sub:`${$V(t.prompt)} / ${$V(t.completion)}`},{label:e(`usageColCacheWrite`),value:$V(t.cache_write)},{label:e(`usageColCredits`),value:Z9(t.credits)}];return(0,G.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>L(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&t.filter?(0,G.jsx)(MH,{provider:t.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),o===`account`&&t.label!==t.key?(0,G.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,G.jsx)(X,{className:`usage-table hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:x,direction:C},onSortChange:e=>{S(String(e.column)),w(e.direction)},children:[(0,G.jsx)(X.Header,{children:R.map(e=>(0,G.jsx)(X.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,G.jsx)(X.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,G.jsx)(X.Body,{children:P.map(e=>(0,G.jsxs)(X.Row,{id:e.key,className:e.filter&&f?`cursor-pointer`:void 0,onAction:e.filter&&f?()=>L(e):void 0,children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&e.filter?(0,G.jsx)(MH,{provider:e.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),o===`account`&&e.label!==e.key?(0,G.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:e.count}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:(0,G.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:nH(e.success)})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:eH(e.p95)}),(0,G.jsxs)(X.Cell,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-body`,children:$V(e.tokens)}),(0,G.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[$V(e.prompt),` / `,$V(e.completion)]})]}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:$V(e.cache_write)}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:Z9(e.credits)})]},e.key))})]})})})]})]}),(0,G.jsx)(cwe,{accounts:y,t:e})]});return(0,G.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(i===`cost`?`usageCostLead`:`usageLead`)})]}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:T,onChange:e=>{h(!0),E(e)},options:D,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,G.jsxs)(_j,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(gj,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,G.jsxs)(gj,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,G.jsx)(_j.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:z}),(0,G.jsx)(_j.Panel,{id:`cost`,className:`pt-5`,children:(0,G.jsx)(mwe,{apiKeyFilter:T})})]})]})}var bwe=1.1;function xwe({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>{a.current?.kill()},[]),(0,G.jsxs)(PM,{delay:300,children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=Z.to(e,{scaleX:1,duration:bwe*(1-Number(Z.getProperty(e,`scaleX`))),ease:AV.linear,onComplete:()=>{a.current=null,Z.to(e,{scaleX:0,duration:jV()?0:kV.base,ease:AV.out,delay:kV.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,Z.to(e,{scaleX:0,duration:jV()?0:kV.base,ease:AV.soft}))},children:[(0,G.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,G.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,G.jsx)(PM.Content,{children:e})]})}function Swe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function Q9(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?jH(r,i,t):AH(r,t)}function Cwe(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function wwe(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Twe(e,t){return e.length?e.map(e=>Q9(e,t)).join(` · `):t(`keysAllProviders`)}function Ewe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Dwe(){let{t:e}=EI(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{UI().then(e=>{let t=Swe(e.data||[]);n(t),i(t.length>0),o(``)}).catch(e=>{o(e instanceof Error?e.message:String(e))})},[]);async function w(){u(!0);try{let e=await N9();c(e.data||[]),m(``)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[]);async function T(e){await Z7(e),C(!0),window.setTimeout(()=>C(!1),1200)}async function E(e,t){f(e.id),c(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await P9(e.id,{enabled:t});c(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){m(e instanceof Error?e.message:String(e)),await w()}finally{f(``)}}async function D(t){f(t.id);try{await HCe(t.id),c(e=>e.filter(e=>e.id!==t.id)),XV({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}return l&&!s.length?(0,G.jsx)(Lse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`keysCreate`)]})]}),p?(0,G.jsx)(QI,{title:p}):null,a?(0,G.jsx)(QI,{title:e(`keysProvidersLoadFailed`,{message:a})}):null,l?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,s.length)},(e,t)=>(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,G.jsx)(Q,{className:`h-4 w-28`}),(0,G.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,G.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,G.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))}):s.length?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:s.map(t=>(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(HS.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(HS.Title,{className:`truncate text-body`,children:t.name})}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,G.jsxs)(HS.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:(t.providers.length?t.providers:[`all`]).map(t=>(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,G.jsx)(ta,{size:12}):(0,G.jsx)(MH,{provider:Cwe(t),size:12}),(0,G.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):Q9(t,e)})]})},t))}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t.last_used_at?e(`keysLastUsed`,{time:Ewe(t.last_used_at)}):e(`keysNeverUsed`)})]}),(0,G.jsxs)(HS.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:!r,onPress:()=>y(t),children:e(`edit`)}),(0,G.jsx)(xwe,{label:e(`holdToDelete`),isPending:d===t.id,onConfirm:()=>void D(t),children:(0,G.jsx)(qa,{size:14})}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(F7,{isSelected:t.enabled,isDisabled:d===t.id,ariaLabel:e(`enable`),onChange:e=>void E(t,e)})})]})]},t.id))}):(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(PV,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`keysCreate`)]})}),(0,G.jsx)($9,{isOpen:h,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>g(!1),onSave:async e=>{let t=await VCe(e);c(e=>[t,...e.map(e=>({...e,secret:void 0}))]),g(!1),x(t)}}),(0,G.jsx)($9,{isOpen:!!_,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:_,options:t,t:e,onClose:()=>y(null),onSave:async e=>{if(!_)return;let t=await P9(_.id,e);c(e=>e.map(e=>e.id===_.id?{...e,...t,secret:void 0}:e)),y(null)}}),(0,G.jsx)(Y.Root,{isOpen:!!b?.secret,onOpenChange:e=>{e||x(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2`,children:[(0,G.jsxs)(tF,{status:`warning`,className:`mb-4`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:e(`keysSecretOnce`)})})]}),(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b?.secret})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(null),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{b?.secret&&T(b.secret)},children:[(0,G.jsx)(Di,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}function $9({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[c,l]=(0,v.useState)(r?.name||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(new Set),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;l(r?.name||``),d(wwe(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));p(t),h(!0),_(``)},[r,e,i]);function x(e){let t=i.find(t=>t.value===e);h(!1),d(n=>n.includes(e)?(t&&p(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function S(e){e?.preventDefault();let t=c.trim();if(!t){_(a(`keysNameRequired`));return}if(!i.length){_(a(`keysProvidersNotLoaded`));return}b(!0),_(``);try{await s({name:t,providers:m?r?.providers||[]:u})}catch(e){_(e instanceof Error?e.message:String(e))}finally{b(!1)}}return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!y&&o()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsx)(Y.Dialog,{className:`sm:min-w-[32rem]`,children:(0,G.jsxs)(QP,{onSubmit:S,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:t}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:y,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[g?(0,G.jsxs)(tF,{status:`danger`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:g})})]}):null,(0,G.jsx)(_9,{label:a(`keysName`),children:(0,G.jsx)(UM,{value:c,onChange:e=>l(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=u.includes(e.value),n=f.has(e.provider);return(0,G.jsx)(tC,{isSelected:t,onChange:()=>x(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,G.jsxs)(tC.Content,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(tC.Control,{children:(0,G.jsx)(tC.Indicator,{})}),(0,G.jsx)(MH,{provider:e.provider,size:16}),(0,G.jsx)(`span`,{className:`text-body font-medium`,children:jH(e.provider,e.region,a)}),n?(0,G.jsx)(`span`,{className:`rounded-md bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:Twe(u,a)})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:y,onPress:o,children:a(`cancel`)}),(0,G.jsx)(J,{type:`submit`,isPending:y,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}function Owe(){return(0,G.jsx)(Soe,{children:(0,G.jsx)(noe,{children:(0,G.jsx)(roe,{children:(0,G.jsx)(boe,{children:(0,G.jsx)(xn,{children:(0,G.jsxs)(Pt,{children:[(0,G.jsx)(Mt,{path:`/login`,element:(0,G.jsx)(BCe,{})}),(0,G.jsx)(Mt,{element:(0,G.jsx)(ace,{}),children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(ice,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(nSe,{})}),(0,G.jsx)(Mt,{path:`/auth`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/providers`,element:(0,G.jsx)(dSe,{})}),(0,G.jsx)(Mt,{path:`/access`,element:(0,G.jsx)(RSe,{})}),(0,G.jsx)(Mt,{path:`/accounts`,element:(0,G.jsx)(zCe,{})}),(0,G.jsx)(Mt,{path:`/checkins`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/usage`,element:(0,G.jsx)(ywe,{})}),(0,G.jsx)(Mt,{path:`/logs`,element:(0,G.jsx)(owe,{})}),(0,G.jsx)(Mt,{path:`/keys`,element:(0,G.jsx)(Dwe,{})}),(0,G.jsx)(Mt,{path:`/system`,element:(0,G.jsx)(XCe,{})}),(0,G.jsx)(Mt,{path:`*`,element:(0,G.jsx)(At,{to:`/`,replace:!0})})]})})]})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(v.StrictMode,{children:(0,G.jsx)(Owe,{})}));export{MJ as $,xU as $t,Mhe as A,MW as At,c4 as B,mW as Bt,w6 as C,h as Cn,FW as Ct,b3 as D,gW as Dt,fge as E,xW as Et,U4 as F,yW as Ft,uZ as G,EW as Gt,b2 as H,DW as Ht,W4 as I,hW as It,WX as J,uW as Jt,XX as K,fW as Kt,Gme as L,CW as Lt,Phe as M,AW as Mt,Nhe as N,jW as Nt,Xhe as O,wW as Ot,t3 as P,kW as Pt,cY as Q,yU as Qt,Bme as R,pW as Rt,O6 as S,xs as Sn,IW as St,y6 as T,l as Tn,SW as Tt,a2 as U,OW as Ut,s4 as V,_W as Vt,JZ as W,TW as Wt,_Y as X,Nle as Xt,MY as Y,lW as Yt,gY as Z,_U as Zt,R6 as _,$V as _n,$ as _t,a5 as a,uU as an,EJ as at,A6 as b,Z as bn,RW as bt,z8 as c,iU as cn,yq as ct,y8 as d,ZH as dn,lq as dt,hU as en,jJ as et,n8 as f,YH as fn,xq as ft,V6 as g,oH as gn,XW as gt,W6 as h,fH as hn,rq as ht,p5 as i,lU as in,DJ as it,l3 as j,NW as jt,h3 as k,vW as kt,F8 as l,rU as ln,pq as lt,J6 as m,pH as mn,sq as mt,d7 as n,dU as nn,AJ as nt,V8 as o,cU as on,Zq as ot,$6 as p,XH as pn,oq as pt,QX as q,dW as qt,v5 as r,wU as rn,kJ as rt,B8 as s,sU as sn,Gq as st,f7 as t,mU as tn,NJ as tt,D8 as u,tU as un,cq as ut,L6 as v,cH as vn,BW as vt,g6 as w,d as wn,Vle as wt,k6 as x,Mc as xn,LW as xt,M6 as y,eH as yn,HW as yt,Rme as z,bW as zt}; \ No newline at end of file + -d ${o9(JSON.stringify(me))}`,[me,T,oe]);if(n&&!t)return(0,G.jsx)(Rse,{});async function ge(e,t){await Z7(e),ae(t),window.setTimeout(()=>ae(``),1100)}async function _e(){let e=performance.now();te(`loading`),re(null),H(``);try{let e=await doe(w,me,oe||void 0);H(JSON.stringify(e,null,2)),te(`success`)}catch(e){H(e instanceof Error?e.message:String(e)),te(`error`)}finally{re(Math.round(performance.now()-e))}}function ve(){B.current?.abort(),B.current=null}function ye(e){let t=p;u(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:l9(r)||n.title,updatedAt:Date.now()}}))}function be(e,t){ye(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function xe(){let e=P.trim();if(!e&&!I.length||!fe||le||R===`loading`)return;ve();let t=new AbortController;B.current=t;let n=I,r={id:s9(`user`),role:`user`,content:e,attachments:n,status:`done`},i=s9(`assistant`),a={id:i,role:`assistant`,content:``,status:`streaming`},o=m;ye([...o,r,a]),F(``),L([]),z(`loading`);let s=PSe(o,{role:`user`,content:i9(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await moe(fe,s,oe||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),be(i,{content:t})},onReasoning:(e,t)=>{e&&u(),be(i,{reasoning:t})},onToolCalls:e=>{u(),be(i,{toolCalls:LSe(e,!0)})},onUsage:e=>be(i,{usage:e})}),be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),z(`success`)}catch(e){if(t.signal.aborted){be(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),z(`success`);return}be(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),z(`error`)}finally{B.current===t&&(B.current=null)}}let Se=e(ee===`success`?`requestComplete`:ee===`error`?`requestFailed`:ee===`loading`?`requesting`:`requestIdle`),Ce=c9()!=null,we=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(ti,{size:14,className:`text-muted`})},..._.map(t=>({id:t.id,textValue:`${t.name||t.id} ${jH(t.provider,t.region,e)}`,label:t.name||t.id,hint:jH(t.provider,t.region,e),icon:(0,G.jsx)(MH,{provider:t.provider,size:14})}))],Te=_.length||!Ce?we:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,G.jsx)(ti,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ee=ce.map(t=>{let n=rH(t),r=iH(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),De=Ee.length||!Ce?Ee:d9.map(t=>{let n=rH(t),r=iH(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Oe=!!((P.trim()||I.length)&&fe&&!le&&(_.length||Ce));function ke(){ye(a9()),z(`idle`)}function Ae(){ve(),z(`idle`),F(``),L([]);let e=u9([]);u(t=>[e,...t]),f(e.id)}function je(e){e!==p&&(ve(),z(`idle`),F(``),L([]),f(e))}let Me=l.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,G.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,G.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,G.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,G.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:b}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void ge(b,`base`),children:(0,G.jsx)(X7,{copied:ie===`base`,size:13})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":pe.length?`ok`:void 0}),(0,G.jsx)(`span`,{children:e(`readyAccounts`,{ready:pe.length,total:_.length})}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:pe.length?`success`:`warning`,children:pe.length?e(`endpointReady`):e(`degraded`)})]})]}),_.length?null:(0,G.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,G.jsx)(e9,{})]}),ue?(0,G.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:ue}):null,(0,G.jsxs)(_j,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`accessTabsLabel`),children:[(0,G.jsxs)(gj,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,G.jsxs)(gj,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,G.jsx)(_j.Panel,{id:`chat`,className:`pt-4`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,G.jsx)(xSe,{collapsed:s,onCollapsedChange:c,items:Me,activeId:p,onSelect:je,onNew:Ae}),(0,G.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,G.jsx)(MSe,{messages:m,busy:R===`loading`,onLoadDemo:ke}),(0,G.jsx)(bSe,{value:P,onChange:F,attachments:I,onAttachmentsChange:L,disabled:!_.length&&c9()==null,streaming:R===`loading`,canSend:Oe,onSend:()=>void xe(),onStop:ve,accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le})]})]})}),(0,G.jsxs)(_j.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,G.jsx)(NSe,{format:a,onFormatChange:o,requestPath:w,prompt:M,onPromptChange:N,onTest:()=>void _e(),requestState:ee,elapsedMs:ne,output:V,responseStatus:Se,curl:he,copiedCurl:ie===`curl`,onCopyCurl:()=>void ge(he,`curl`),canSend:!!(M.trim()&&fe&&!le),accountValue:oe||`auto`,onAccountChange:e=>k(e===`auto`?``:e),accountOptions:Te,modelValue:fe,onModelChange:D,modelOptions:De,modelsLoading:le,disabled:!_.length&&c9()==null}),(0,G.jsx)(pSe,{access:t?.access})]})]})]})}function BSe(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Z.context(()=>{Z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Z.utils.toArray(`.meter__fill`);e.length&&Z.from(e,{scaleX:0,transformOrigin:`left center`,duration:kV.calm,ease:AV.emphasized,stagger:Ose.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function f9(e){if(!e)return``;let t=Date.parse(e)-Date.now();if(!Number.isFinite(t)||t<=0)return``;let n=Math.ceil(t/1e3);return n<60?`${n}s`:`${Math.ceil(n/60)}m`}function VSe(e){return Object.entries(e.model_cooldowns??{}).filter(([,e])=>!!f9(e)).sort(([e],[t])=>e.localeCompare(t))}function p9(e){return e.enabled?e.status===`quota_exhausted`||e.quota?.exceeded?`quota_exhausted`:e.status===`cooling`||f9(e.down_until||e.cooldown_until)?`cooling`:e.status===`dead`||e.runtime_state===`dead`?`dead`:e.status===`auth_failed`||e.runtime_state===`auth_failed`?`auth_failed`:e.status===`login_required`?`login`:(e.status===`starting`||e.runtime_state===`starting`)&&!e.hot&&!e.ready?e.quota?`starting`:`loading`:e.status===`ready`?e.hot?`hot`:`ready`:e.hot?`hot`:e.ready?`ready`:(e.status===`error`||e.status,`unavailable`):`disabled`}function HSe(e){return e===`hot`?12:e===`ready`?9:e===`cooling`?5:e===`login`?3:e===`loading`||e===`starting`?6:e===`unavailable`?2:e===`auth_failed`?3:e===`dead`?2:1}function USe(e){return e===`hot`||e===`ready`?`ok`:e===`cooling`||e===`quota_exhausted`||e===`loading`||e===`starting`?`warn`:e===`auth_failed`||e===`unavailable`||e===`dead`||e===`login`?`danger`:`muted`}function m9(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(Math.round(e*100)/100)}function h9(e){let t=e.percentage??0;return Number.isFinite(t)?Math.min(1,Math.max(0,t/100)):0}function g9(e){let t=e.percentage??0;return e.exceeded?`danger`:t>=80?`warn`:`ok`}function WSe(e){return(e.windows??[]).filter(e=>!!e.id)}var GSe={free:`Free`,go:`Go`,plus:`Plus`,pro:`Pro`,prolite:`Pro Lite`,promax:`Pro Max`,team:`Team`,business:`Business`,enterprise:`Enterprise`,edu:`Edu`,edu_plus:`Edu Plus`,edu_pro:`Edu Pro`,education:`Education`};function KSe(e){let t=e?.trim().toLowerCase()??``;return!t||t===`unknown`||t===`guest`?``:GSe[t]??t.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function qSe(e,t){return e.id===`daily`?t(`quotaDaily`):e.id===`weekly`?t(`quotaWeekly`):e.id===`monthly`?t(`quotaMonthly`):e.id===`fiveHour`?t(`quotaFiveHour`):e.id===`weeklyLimit`?t(`quotaWeeklyLimit`):e.id===`monthlyLimit`?t(`quotaMonthlyLimit`):e.label||t(`quota`)}function JSe(e,t){if(!e)return``;let n=Date.parse(e)-Date.now();if(!Number.isFinite(n)||n<=0)return t(`quotaResetsSoon`);let r=Math.max(1,Math.ceil(n/6e4));return r<60?t(`quotaResetsInMinutes`,{n:r}):t(`quotaResetsInHours`,{n:Math.round(r/60)})}function YSe(e,t){if(!e.expires_at||e.expires_at<=0||!Number.isFinite(e.expires_at))return``;let n=new Date(e.expires_at*1e3);if(Number.isNaN(n.getTime()))return``;let r=`${n.getFullYear()}/${n.getMonth()+1}/${n.getDate()}`;return t(`quotaExpiresOn`,{amount:e.expiring_remain&&e.expiring_remain>0?`${m9(e.expiring_remain)} `:``,unit:e.unit||`credits`,date:r})}function XSe(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${m9(e.add_on_used)} / ${m9(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${m9(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?YSe(e,i):``].filter(Boolean)}function ZSe({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=qSe(e,t),a=t(`quotaUsedPercent`,{n:r}),o=JSe(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=h9(e),l=g9(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{className:`block w-full min-w-0`,children:(0,G.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,G.jsxs)(IF,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,G.jsxs)(IF.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,G.jsx)(IF.Track,{children:(0,G.jsx)(IF.Fill,{})})]}),o?(0,G.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{children:s}),n?.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function QSe({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${m9(e.used)} / ${m9(e.total)}`,d=`${m9(e.remaining)}`,f=XSe(e,i,a,o,t,c),p=WSe(e),m=c===`codex`?KSe(e.plan):``,h=h9(e),g=g9(e),_=g===`danger`?`danger`:g===`warn`?`warning`:`success`,y=(0,v.useRef)(null);BSe(y);let b=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,G.jsxs)(`div`,{ref:y,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,G.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,G.jsx)(`div`,{className:`w-full min-w-0`,children:(0,G.jsx)(ZSe,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`div`,{ref:y,className:`w-full cursor-help`,children:(0,G.jsxs)(IF,{className:`account-meter w-full`,color:_,size:`md`,minValue:0,maxValue:100,value:Math.round(h*100),"aria-label":n,valueLabel:b,children:[(0,G.jsxs)(IF.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,G.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,G.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):null,d,(0,G.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,G.jsxs)(`span`,{className:`mono text-foreground/55`,children:[r,` `,u]})]}),(0,G.jsx)(IF.Track,{children:(0,G.jsx)(IF.Fill,{})})]})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,G.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,G.jsx)(`div`,{children:e},e))]})})]})}function $Se({state:e,stateCopy:t,t:n}){let r=(0,v.useRef)(null),i=HSe(e),a=USe(e);return(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=Z.context(()=>{let e=Z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=Z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{scaleY:1,autoAlpha:1}),Z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.set(e,{transformOrigin:`center bottom`}),Z.to(n,{scaleY:.32,autoAlpha:.45,duration:kV.fast,ease:AV.out,overwrite:!0}),Z.to(t,{scaleY:1,autoAlpha:1,duration:kV.base,ease:AV.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,G.jsxs)(`div`,{ref:r,className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption font-medium text-foreground/75`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":a===`muted`?void 0:a===`warn`?`warn`:a}),(0,G.jsx)(`span`,{children:n(`runtimeState`)})]}),(0,G.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,G.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(!M&&!N&&P.length===0)return;let e=window.setInterval(()=>A(e=>e+1),1e3);return()=>window.clearInterval(e)},[M,N,P.length]);let F=eCe(j,j===`dead`?N:M,o),I=j===`hot`||j===`ready`?`success`:j===`cooling`?`warning`:j===`quota_exhausted`||j===`login`||j===`unavailable`||j===`dead`||j===`auth_failed`?`danger`:void 0,L=e.last_error||e.lastError,R=e.last_error_kind||e.kind,z=jH(e.provider,e.region,o),B=e.last_checkin_status,V=B===`success`?`checkinRecordSuccess`:B===`already`?`checkinRecordAlready`:B===`skipped`?`checkinRecordSkipped`:B===`error`?`checkinRecordFailed`:`lastCheckinNone`;return(0,v.useLayoutEffect)(()=>{let e=T.current;if(!e)return;let t=k.current;if(k.current=j,!t||t===j)return;let n=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[j]),(0,v.useLayoutEffect)(()=>{let e=E.current;if(!e||!n)return;let t=Z.context(()=>{let t=Z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,"data-state":j,className:`account-card overflow-hidden p-0`,children:[(0,G.jsxs)(HS.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,children:(0,G.jsx)(MH,{provider:e.provider,size:20})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(HS.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,children:z})]}),(0,G.jsx)(HS.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:e.remote_uid?`UID ${e.remote_uid}`:e.id})]})]}),(0,G.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,G.jsx)(`span`,{ref:T,children:P.length&&j===`cooling`?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:I,children:F})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),P.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:I,children:F})}),P.length&&j!==`cooling`?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:o(`partialCooling`)})})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:o(`partialCooling`)}),P.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,G.jsx)(`span`,{children:e}),(0,G.jsx)(`span`,{className:`mono text-foreground/65`,children:f9(t)})]},e))]})})]}):null]})]}),(0,G.jsxs)(HS.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,G.jsx)($Se,{state:j,stateCopy:F,t:o}),e.quota?(0,G.jsx)(QSe,{quota:e.quota,t:o,label:o(`quota`),usedLabel:o(`quotaUsed`),remainingLabel:o(`quotaRemaining`),addOnLabel:o(`quotaAddOn`),resourcePackageLabel:o(`quotaResourcePackage`),exceededLabel:o(`quotaExceeded`),provider:e.provider}):(0,G.jsx)(`span`,{className:`text-caption text-foreground/65`,children:o(j===`hot`||j===`ready`||j===`loading`||j===`starting`?`quotaLoading`:`quotaUnavailable`)}),L?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,G.jsx)(ro,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[R?(0,G.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:R}):null,(0,G.jsx)(`p`,{className:`break-words line-clamp-3`,children:L})]})]})}),(0,G.jsx)(PM.Content,{children:(0,G.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[R?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:R}):null,L]})})]}):null]}),n&&e.enabled?(0,G.jsxs)(`section`,{ref:E,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`oauthDeviceFlow`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?o(`wizardCodexBrowserLead`):o(`qoderLoginHint`)}),(0,G.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(`cli`),children:[(0,G.jsx)(Da,{size:14}),o(`startCodexCliLogin`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>c(`chatgpt`),children:[(0,G.jsx)(Da,{size:14}),o(`startCodexChatGPTLogin`)]})]}):(0,G.jsxs)(J,{size:`sm`,isPending:t===`device`,onPress:()=>c(),children:[(0,G.jsx)(Da,{size:14}),o(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`)&&f&&d?(0,G.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:o(`wizardCallbackLead`)}),(0,G.jsx)(JM,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:u||``,onChange:e=>d(e.target.value),placeholder:o(`wizardCallbackPh`),"aria-label":o(`wizardCallbackPh`)}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:f,children:o(`wizardSubmitCallback`)})]}):null]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:o(`patFallback`)}),(0,G.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsxs)(YM,{className:`flex-1`,type:`password`,value:a,onChange:s,children:[(0,G.jsx)(IN,{className:`sr-only`,children:o(`pat`)}),(0,G.jsx)(UM,{placeholder:o(`pasteToken`),"aria-label":o(`pat`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:l,children:[(0,G.jsx)(ta,{size:14}),o(`usePat`)]})]})]}),r||i?(0,G.jsxs)(`div`,{className:`text-caption`,children:[r?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:o(`authUrl`)}),(0,G.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(Zr,{size:14}),o(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(r).then(e=>{e&&(O(!0),window.setTimeout(()=>O(!1),1100))})},children:[(0,G.jsx)(X7,{copied:D}),o(D?`copied`:`copy`)]})]})]}):null,i?(0,G.jsx)(`p`,{className:`mt-1 text-muted`,children:i}):null]}):null]}):null,b?(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-separator px-4 py-2 text-caption text-muted`,children:[(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`lastCheckin`)}),(0,G.jsx)(`span`,{className:B===`error`?`text-danger`:``,children:o(V)})]})}),(0,G.jsxs)(PM.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():o(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(`span`,{className:`flex cursor-help items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:o(`autoCheckin`)}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||_}),(0,G.jsx)(F7,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:o(`autoCheckin`),onChange:e=>y?.(e)})]})}),(0,G.jsx)(PM.Content,{children:e.checkin_time?o(`checkinCustom`):o(`checkinInherit`)})]})]}):null,(0,G.jsxs)(HS.Footer,{className:`flex flex-wrap items-center gap-1.5 bg-surface-secondary px-4 py-2`,children:[m?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,isPending:t===`refresh`,onPress:m,"aria-label":o(`refreshAccount`),children:(0,G.jsx)(qr,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`refreshAccount`)})]}):null,(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:C,"aria-label":o(`authentication`),children:(0,G.jsx)(ta,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`authentication`)})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:w,"aria-label":o(`accountModels`),children:(0,G.jsx)(ji,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`accountModels`)})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:S,"aria-label":o(`editAccount`),children:(0,G.jsx)(ya,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`editAccount`)})]}),b?(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:!e.enabled||!!t,isPending:t===`checkin`,onPress:b,"aria-label":o(`checkinNow`),children:(0,G.jsx)(si,{size:15})})}),(0,G.jsx)(PM.Content,{children:o(`checkinNow`)})]}):null,(0,G.jsxs)(uF,{children:[(0,G.jsx)(uF.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`secondary`,"aria-label":o(`more`),children:(0,G.jsx)(Fi,{size:16})})}),(0,G.jsx)(uF.Popover,{placement:`bottom end`,children:(0,G.jsxs)(uF.Menu,{"aria-label":o(`more`),onAction:e=>{e===`export`&&p(),e===`checkin-records`&&x?.(),e===`delete`&&h()},children:[e.auth_type===`none`?null:(0,G.jsxs)(uF.Item,{id:`export`,textValue:o(`export`),children:[(0,G.jsx)(Di,{size:15}),o(`export`)]}),x?(0,G.jsxs)(uF.Item,{id:`checkin-records`,textValue:o(`checkinRecords`),children:[(0,G.jsx)(sa,{size:15}),o(`checkinRecords`)]}):null,(0,G.jsxs)(uF.Item,{id:`delete`,textValue:o(`delete`),className:`text-danger`,children:[(0,G.jsx)(qa,{size:15}),o(`delete`)]})]})})]}),(0,G.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center gap-3 whitespace-nowrap`,children:(0,G.jsx)(F7,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?o(`disable`):o(`enable`),label:e.enabled?o(`enabledState`):o(`disabled`),onChange:g})})]})]})}function nCe(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function rCe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function iCe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await _oe(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,v.useEffect)(()=>{l&&d()},[l]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:u}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[s?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(QI,{title:s})}):null,a?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]}):r.length?(0,G.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=nCe(e,t);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:rCe(e.created_at)})]}),(0,G.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,G.jsx)(I7,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,G.jsx)(qr,{size:14}),t(`refresh`)]})]})]})]})})})})}function aCe(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function oCe({account:e,t,onClose:n}){let[r,i]=(0,v.useState)([]),[a,o]=(0,v.useState)(!!e?.id),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),d=e?.id||``,f=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),p=e?jH(e.provider,e.region,t):``;async function m(e=!1){if(d){e?c(!0):(o(!0),i([])),u(``);try{let t=await(e?HI(d):VI(d));i(t.data||[])}catch(e){i([]),u(e instanceof Error?e.message:String(e))}finally{o(!1),c(!1)}}}return(0,v.useEffect)(()=>{if(!d)return;let e=!1;return VI(d).then(t=>{e||(i(t.data||[]),u(``),o(!1))}).catch(t=>{e||(i([]),u(t instanceof Error?t.message:String(t)),o(!1))}),()=>{e=!0}},[d]),(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:f}),(0,G.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:p}),(0,G.jsx)(`span`,{className:`text-border`,children:`·`}),(0,G.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`px-5 pb-2`,children:[l?(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(QI,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,G.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`}),(0,G.jsx)(Q,{className:`h-14 w-full`})]}):r.length?(0,G.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=aCe(n),a=rH(n),o=iH(n);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,G.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,G.jsx)(MH,{provider:r,size:12}),(0,G.jsx)(`span`,{children:r})]})]},n.id)})}):(0,G.jsx)(I7,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(ji,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,G.jsxs)(Y.Footer,{className:`justify-between px-5 pb-5`,children:[(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:r.length,total:r.length})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void m(!0),children:[(0,G.jsx)(qr,{size:14}),t(s?`refreshing`:`refresh`)]})]})]})]})})})})}var sCe=`w-28`;function _9({label:e,hint:t,labelWidthClass:n=sCe,htmlFor:r,align:i=`center`,children:a}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,G.jsx)(IN,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,G.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}function cCe({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(t),l=(0,v.useMemo)(()=>new Set(t),[t]),u=(0,v.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,v.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function h(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function g(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function _(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(PN,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:i(`modelPickerSearch`)}),(0,G.jsx)(PN.ClearButton,{})]})}),(0,G.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:g,children:[(0,G.jsx)(xi,{size:14}),i(`modelPickerSelectAll`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:_,children:[(0,G.jsx)(La,{size:14}),i(`modelPickerClear`)]})]})]}),(0,G.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,G.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>h(e,!1),children:(0,G.jsx)(ao,{size:14})})]},`offline-${e}`)),u.map(e=>(0,G.jsx)(tC,{isSelected:l.has(e),isDisabled:r,onChange:t=>h(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,G.jsxs)(tC.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,G.jsx)(tC.Control,{children:(0,G.jsx)(tC.Indicator,{})}),(0,G.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,G.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function lCe(e){let[t,n]=(0,v.useState)(e);e&&!t&&n(!0);let r=(0,v.useRef)(null),i=(0,v.useRef)(null),a=(0,v.useRef)(e);return(0,v.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}Z.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){Z.set(t,{overflow:`hidden`});let e=t.scrollHeight;Z.fromTo(t,{height:s===e?0:s},{height:e,duration:MV(kV.base),ease:AV.out,onComplete:()=>Z.set(t,{clearProps:`height,overflow`})}),Z.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:MV(kV.base),ease:AV.out})}else Z.set(t,{overflow:`hidden`,height:s}),Z.to(o,{autoAlpha:0,y:-4,duration:MV(kV.fast),ease:AV.inOut}),Z.to(t,{height:0,duration:MV(kV.fast+.04),ease:AV.inOut,onComplete:()=>n(!1)});return()=>{Z.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function uCe({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,v.useState)(e?.name||``),[l,u]=(0,v.useState)(e?.max_inflight??4),[d,f]=(0,v.useState)(e?.priority??50),[p,m]=(0,v.useState)(e?.proxy_url||``),[h,g]=(0,v.useState)(!!e?.drop_system_prompt),[_,y]=(0,v.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[b,x]=(0,v.useState)({alias:``,model:``}),[S,C]=(0,v.useState)(!!e?.models_restricted),[w,T]=(0,v.useState)(e?.enabled_models||[]),{mounted:E,outerRef:D,innerRef:O}=lCe(S),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!e?.checkin_time),[N,P]=(0,v.useState)(e?.checkin_time||null),[F,I]=(0,v.useState)(``);(0,v.useEffect)(()=>{if(!e?.id)return;let t=!1;return VI(e.id).then(e=>{t||A(e.data||[])}).catch(()=>{t||A([])}),()=>{t=!0}},[e?.id]);let L=i(`editAccountTitle`,{name:e?.name||e?.id||``}),R=e?jH(e.provider,e.region,i):``;async function z(n){n?.preventDefault();let r=s.trim();if(!r){I(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){I(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){I(i(`priorityInvalid`));return}if(t!==void 0&&!j&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(N??t)){I(i(`checkinTimeInvalid`));return}I(``);try{await o({name:r,max_inflight:l,priority:d,proxy_url:p.trim(),checkin_time:t===void 0?void 0:j?``:N??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?h:void 0,model_aliases:Object.fromEntries(_.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:S?w:[],set_model_routing:!0}),a()}catch(e){I(e instanceof Error?e.message:String(e))}}return(0,G.jsx)(Y.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:L}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(MH,{provider:e.provider,size:14}),(0,G.jsx)(`span`,{children:R})]})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2 pt-1`,children:[F?(0,G.jsxs)(tF,{status:`danger`,className:`mb-4`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:F})})]}):null,(0,G.jsxs)(QP,{className:`space-y-4`,onSubmit:e=>void z(e),children:[(0,G.jsx)(_9,{label:i(`accountName`),children:(0,G.jsx)(UM,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,G.jsx)(_9,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,G.jsx)(hF,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(hF.Group,{children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":i(`maxInflight`)}),(0,G.jsx)(hF.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`priority`),hint:i(`priorityHint`),children:(0,G.jsx)(hF,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,G.jsxs)(hF.Group,{children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":i(`priority`)}),(0,G.jsx)(hF.IncrementButton,{})]})})}),(0,G.jsx)(_9,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,G.jsx)(UM,{value:p,onChange:e=>m(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,G.jsx)(_9,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,G.jsx)(F7,{isSelected:h,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:g})}):null,(0,G.jsx)(_9,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>y(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,G.jsx)(UM,{"aria-label":i(`modelAliasName`),value:b.alias,onChange:e=>x(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,G.jsx)(UM,{"aria-label":i(`modelAliasTarget`),value:b.model,onChange:e=>x(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isDisabled:r||!b.alias.trim()||!b.model.trim(),onPress:()=>{y(e=>[...e.filter(e=>e.alias!==b.alias.trim()),{alias:b.alias.trim(),model:b.model.trim()}]),x({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,G.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,G.jsx)(F7,{isSelected:S,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(S?`restrictModels`:`allModels`),onChange:C})]}),E?(0,G.jsx)(`div`,{ref:D,children:(0,G.jsx)(`div`,{ref:O,children:(0,G.jsx)(cCe,{catalog:k?k.map(e=>e.id):null,selected:w,onChange:T,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,G.jsx)(_9,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(F7,{isSelected:j,isDisabled:r,onChange:M,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,G.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,G.jsx)(`span`,{className:`mono`,children:n})]}),j?null:(0,G.jsx)(UM,{type:`time`,value:N??t,onChange:e=>P(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,G.jsx)(J,{isPending:r,onPress:()=>void z(),children:i(`save`)})]})]})})})})}var dCe={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function v9({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{Z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,G.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${dCe[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,G.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var y9=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),fCe=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function pCe(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function b9(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function mCe({ariaLabel:e}){return(0,G.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(UA,{className:`h-3 w-24 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-40 rounded-lg`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,G.jsx)(UA,{className:`size-10 shrink-0 rounded-lg`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,G.jsx)(UA,{className:`h-3.5 w-28 rounded-lg`}),(0,G.jsx)(UA,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function hCe({tile:e,disabled:t,onSelect:n}){return(0,G.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,G.jsx)(MH,{provider:e.provider,size:18})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,G.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function gCe({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,G.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,G.jsx)(hCe,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function _Ce({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=EI(),[o,s]=(0,v.useState)(``),c=o.trim().toLowerCase(),l=(0,v.useMemo)(()=>{let t=pCe(e.filter(e=>y9.has(e.id)),fCe),n=e.filter(e=>!y9.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>b9(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>b9(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,G.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,G.jsx)(B7,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,G.jsx)(gCe,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}function x9(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function S9(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function vCe(e,t){return GI(x9(e,t))}var C9={global:`Global`,cn:`CN`},yCe={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"meta-global":`accountTypeMetaGlobal`},bCe={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"meta-global":`accountTypeMetaGlobalHint`};async function xCe(){let e=(await UI().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function w9(e,t){let n=yCe[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function T9(e,t){if(!e)return``;let n=bCe[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function SCe({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,G.jsx)(yi,{size:16,className:`text-success`}):t&&n===r?(0,G.jsx)(PV,{size:16,loading:!0}):null}var CCe=90,wCe=2e3;function TCe({isOpen:e,onClose:t,onAdded:n}){let{t:r}=EI(),[i,a]=(0,v.useState)(`method`),[o,s]=(0,v.useState)(`browser`),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(4),[x,S]=(0,v.useState)(50),[C,w]=(0,v.useState)(!0),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(`payg`),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``),[L,R]=(0,v.useState)(``),[z,B]=(0,v.useState)(`idle`),[V,H]=(0,v.useState)(``),[ee,te]=(0,v.useState)(``),[ne,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(``),[oe,se]=(0,v.useState)(`cli`),ce=(0,v.useRef)(null),le=(0,v.useRef)(null),ue=(0,v.useRef)(null),de=(0,v.useRef)(``),fe=(0,v.useRef)(null),pe=(0,v.useRef)(null);function me(){fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)}(0,v.useEffect)(()=>()=>me(),[]),(0,v.useEffect)(()=>{if(!e)return;let t=!1;return p(!0),d([]),l(``),xCe().then(e=>{t||(d(e),l(``),s(`browser`))}).finally(()=>{t||p(!1)}),()=>{t=!0}},[e]);let he=u.find(e=>e.id===c),ge=!f&&u.length>0,_e=he?.descriptor.capabilities?.pat_login!==!1,ve=he?.descriptor.capabilities?.import_export!==!1,ye=he?.descriptor.capabilities?.browser_login!==!1,be=he?.provider===`workbuddy`||he?.provider===`trae`,xe=he?.provider===`trae`||he?.provider===`devin`||he?.provider===`codex`,Se=z===`busy`||z===`polling`,Ce=!!de.current||Se,we=z===`done`,Te=T9(he,r);(0,v.useEffect)(()=>{o===`pat`&&!_e&&s(`browser`),o===`import`&&!ve&&s(`browser`)},[ve,_e,o]),(0,v.useEffect)(()=>{ye||(_e?s(`pat`):ve&&s(`import`))},[ye,ve,_e]);function Ee(){return!Number.isInteger(y)||y<1||y>32?4:y}function De(){return!Number.isInteger(x)||x<1||x>100?50:x}function Oe(){return{max_inflight:Ee(),priority:De(),drop_system_prompt:be?C:he?.provider!==`kimi`,proxy_url:T.trim()}}function ke(){me(),a(`method`),s(`browser`),l(``),d([]),p(!1),_(``),b(4),S(50),w(!0),E(``),O(``),A(``),M(`payg`),P(``),I(``),R(``),h(!1),B(`idle`),H(``),te(``),re(!1),ae(``),se(`cli`),de.current=``}function Ae(){Se||(ke(),t())}function je(){ke(),t()}(0,v.useLayoutEffect)(()=>{let t=ce.current;if(e||(ue.current=null),!t||!e)return;let n=Z.context(()=>{let e=Z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=ue.current,n=e&&e!==i?i===`login`?1:-1:0;Z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:kV.slow,ease:AV.out,overwrite:!0}),n&&le.current&&Z.fromTo(le.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:kV.base,ease:AV.out,overwrite:!0})})},t);return ue.current=i,()=>n.revert()},[e,i]);function Me(e){if(Se||!ge)return;let t=u.find(t=>t.id===e);l(e),s(t?.provider===`zhipu`?`pat`:`browser`),w(t?.provider!==`trae`&&t?.provider!==`kimi`),H(``),a(`login`)}async function Ne(){if(de.current)return de.current;if(!he)throw Error(r(`accountTypeHint`));let e=Oe(),t=await hoe(g.trim()||r(`account`),he.provider,he.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return de.current=n,n}async function Pe(){H(``),te(``);try{B(`busy`);let e=await Ne();H(r(`wizardStartingSession`)),B(`polling`);let t=await FI(e,he?.provider===`codex`?oe:void 0);t.authUrl&&te(t.authUrl),H(r(`wizardWaitingBrowser`));for(let t=0;t{fe.current=window.setTimeout(e,wCe)});let n=(await II(e)).login||{};if(n.message&&H(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(r(`wizardLoginTimeout`))}B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Fe(){let e=ie.trim();if(!e){H(r(`wizardCallbackPh`));return}try{B(`busy`);let t=await Ne();me(),await LI(t,e),B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,900)}catch(e){B(`polling`),H(e instanceof Error?e.message:String(e))}}async function Ie(){let e=N.trim();if(!e){H(r(`zhipuKeyRequired`));return}if(!he){H(r(`accountTypeHint`));return}H(``);try{B(`busy`);let t=Oe();await GI({format:`zhipu-key-v1`,api_key:e,mode:j,organization:j===`coding`?F.trim():``,project:j===`coding`?L.trim():``,name:g.trim()||r(`accountTypeZhipuCN`),enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),B(`done`),H(r(`wizardAccountReady`)),n(),window.setTimeout(je,700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Le(){let e=D.trim();if(!e){H(r(`pastePatFirst`));return}H(``);try{B(`busy`);let t=await Ne();H(r(`wizardStartingSession`)),await RI(e,t),B(`done`),H(r(`patDone`)),n(),window.setTimeout(je,700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}async function Re(){H(``);let e;try{e=JSON.parse(k)}catch{H(r(`wizardBadJson`));return}if(!e||typeof e!=`object`){H(r(`wizardBadJson`));return}if(!he){H(r(`accountTypeHint`));return}if(he.provider===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){H(r(`wizardBadJson`));return}let t=Oe(),i;he.provider===`workbuddy`?i=x9(e,{region:he.region===`global`?`global`:`cn`,name:g.trim()||void 0,enabled:!0,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}):(e.format||(he.descriptor.id===`trae`?e.format=`trae-oauth-v1`:he.descriptor.id===`devin`?e.format=`devin-session-v1`:he.descriptor.id===`command`?e.format=`command-key-v1`:he.descriptor.id===`qwenwork`?e.format=`qwenwork-oauth-v1`:e.format=`qoder-native-v1`),i={...e,name:g.trim()||e.name,enabled:!0,provider:he.provider,region:he.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt});try{B(`busy`);let{failed:e,message:t}=S9(await GI(i),r);B(`done`),H(t),n(),window.setTimeout(je,e>0?1600:700)}catch(e){B(`idle`),H(e instanceof Error?e.message:String(e))}}function ze(){pe.current?.click()}function Be(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>A(String(n.result||``)),n.readAsText(t),e.target.value=``}let Ve=e=>Se&&o===e,He=he?.provider===`zhipu`,Ue=[he?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:r(`tabBrowser`)},_e?{value:`pat`,label:r(`tabPat`)}:null,ve?{value:`import`,label:r(`tabImport`)}:null].filter(Boolean),We=r(o===`browser`?he?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:o===`pat`?he?.provider===`command`?`wizardPatLeadCommand`:he?.region===`cn`&&he?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{e||Ae()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!Se,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,G.jsxs)(Y.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:r(`addAccountTitle`)}),(0,G.jsx)(`p`,{ref:le,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:i===`method`?r(`addAccountDesc`):Te||r(`addAccountDesc`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":r(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsx)(Y.Body,{className:i===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,G.jsx)(`div`,{ref:ce,children:i===`method`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`space-y-2.5`,children:f?(0,G.jsx)(mCe,{ariaLabel:r(`accountType`)}):ge?(0,G.jsx)(_Ce,{ariaLabel:r(`accountType`),options:u.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||C9[e.region]||``;return{id:e.id,provider:e.provider,label:w9(e,r),subtitle:t,hint:T9(e,r)}}),onSelect:Me,disabled:Ce}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:r(`accountTypeHint`)})}),(0,G.jsx)(`div`,{className:`mt-4 text-center`,children:(0,G.jsx)(e9,{className:`text-xs`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(MH,{provider:he?.provider,size:18})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:he?w9(he,r):r(`accountType`)}),(0,G.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Te})]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>a(`method`),isDisabled:Se||!!de.current,children:[(0,G.jsx)(li,{size:12}),r(`wizardBack`)]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`accountName`)}),(0,G.jsx)(UM,{fullWidth:!0,value:g,onChange:e=>_(e.target.value),"aria-label":r(`accountName`),disabled:Ce,autoFocus:!0})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-expanded":m,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,G.jsx)(di,{size:12,className:`transition-transform duration-200 ${m?`rotate-90`:``}`}),r(`wizardAdvanced`)]}),m?(0,G.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`maxInflight`)}),(0,G.jsx)(hF,{value:y,onChange:e=>b(e??4),minValue:1,maxValue:32,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(hF.Group,{className:`w-full`,children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":r(`maxInflight`)}),(0,G.jsx)(hF.IncrementButton,{})]})}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`maxInflightHint`)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`priority`)}),(0,G.jsx)(hF,{value:x,onChange:e=>S(e??50),minValue:1,maxValue:100,isDisabled:Ce,isRequired:!0,children:(0,G.jsxs)(hF.Group,{className:`w-full`,children:[(0,G.jsx)(hF.DecrementButton,{}),(0,G.jsx)(hF.Input,{"aria-label":r(`priority`)}),(0,G.jsx)(hF.IncrementButton,{})]})}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`priorityHint`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`proxyUrl`)}),(0,G.jsx)(UM,{fullWidth:!0,value:T,onChange:e=>E(e.target.value),placeholder:r(`proxyUrlPlaceholder`),"aria-label":r(`proxyUrl`),disabled:Ce}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(`proxyUrlHint`)})]}),be?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:r(`dropSystemPrompt`)}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:r(he?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,G.jsx)(F7,{isSelected:C,isDisabled:Ce,ariaLabel:r(`dropSystemPrompt`),onChange:w})]}):null]}):null]}),He?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-body font-medium text-muted`,children:r(`zhipuAccountMode`)}),(0,G.jsx)(v9,{ariaLabel:r(`zhipuAccountMode`),columns:2,value:j,onChange:e=>{Se||M(e)},options:[{value:`payg`,label:r(`zhipuModePayg`),hint:r(`zhipuModePaygHint`),disabled:Se},{value:`coding`,label:r(`zhipuModeCoding`),hint:r(`zhipuModeCodingHint`),disabled:Se}]})]}),(0,G.jsx)(_9,{label:r(`zhipuApiKey`),children:(0,G.jsx)(UM,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:r(`zhipuApiKeyPh`),"aria-label":r(`zhipuApiKey`),disabled:Se})}),j===`coding`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`zhipuOrganization`),children:(0,G.jsx)(UM,{value:F,onChange:e=>I(e.target.value),placeholder:r(`zhipuOrganizationPh`),"aria-label":r(`zhipuOrganization`),disabled:Se})}),(0,G.jsx)(_9,{label:r(`zhipuProject`),children:(0,G.jsx)(UM,{value:L,onChange:e=>R(e.target.value),placeholder:r(`zhipuProjectPh`),"aria-label":r(`zhipuProject`),disabled:Se})})]}):null,V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]}):null,He?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{className:`mt-3`,value:o,onChange:e=>{!Se&&e!==o&&(s(e),H(``),te(``),re(!1))},ariaLabel:r(`authentication`),options:Ue.map(e=>({id:e.value,label:e.label}))}),(0,G.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:We}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:o===`browser`?(0,G.jsxs)(G.Fragment,{children:[he?.provider===`codex`?(0,G.jsx)(v9,{ariaLabel:r(`codexLoginMethod`),columns:2,value:oe,onChange:e=>{Se||se(e)},options:[{value:`cli`,label:r(`codexLoginCli`),hint:r(`codexLoginCliHint`),disabled:Se||!!de.current},{value:`chatgpt`,label:r(`codexLoginChatGPT`),hint:r(`codexLoginChatGPTHint`),disabled:Se||!!de.current}]}):null,ee?(0,G.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,G.jsx)(SCe,{phase:z,busy:Se,tab:o,forTab:`browser`}),(0,G.jsx)(`span`,{className:`text-muted`,children:V||r(`loginOpenMsg`)})]}),(0,G.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:ee}),(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>window.open(ee,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(Zr,{size:14}),r(`openAuthUrl`)]}),(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>{Z7(ee).then(e=>{e&&(re(!0),window.setTimeout(()=>re(!1),1100))})},children:[(0,G.jsx)(X7,{copied:ne}),r(ne?`copied`:`copy`)]})]})]}):null,V&&!ee?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null,xe?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:r(`wizardCallbackLead`)}),(0,G.jsx)(JM,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:ie,onChange:e=>ae(e.target.value),placeholder:r(`wizardCallbackPh`),"aria-label":r(`wizardCallbackPh`),disabled:we}),(0,G.jsx)(J,{size:`sm`,variant:`secondary`,isPending:z===`busy`&&!!ie.trim(),onPress:()=>void Fe(),isDisabled:we,children:r(`wizardSubmitCallback`)})]}):null]}):o===`pat`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_9,{label:r(`tabPat`),children:(0,G.jsx)(UM,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:r(`wizardPatPh`),"aria-label":r(`wizardPatPh`),disabled:Se})}),V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:ze,isDisabled:Se,children:[(0,G.jsx)(Vi,{size:13}),r(`wizardChooseFile`)]}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:Be})]}),(0,G.jsx)(JM,{className:`min-h-32 font-mono text-caption`,value:k,onChange:e=>A(e.target.value),placeholder:r(`wizardImportPh`),"aria-label":r(`tabImport`),disabled:Se}),V?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[we?(0,G.jsx)(yi,{size:14,className:`shrink-0 text-success`}):null,(0,G.jsx)(`span`,{className:we?`font-medium text-foreground`:`text-muted`,children:V})]}):null]})})]})]})})}),(0,G.jsxs)(Y.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:Ae,isDisabled:Se,children:r(`cancel`)}),i===`login`&&He?(0,G.jsx)(J,{isPending:z===`busy`,onPress:()=>void Ie(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{size:15}),r(`zhipuCreate`)]})}):null,i===`login`&&!He&&o===`browser`?(0,G.jsx)(J,{isPending:Ve(`browser`),onPress:()=>void Pe(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`wizardAccountReady`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Da,{size:15}),r(`wizardStartBrowser`)]})}):null,i===`login`&&!He&&o===`pat`?(0,G.jsx)(J,{isPending:Ve(`pat`),onPress:()=>void Le(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`patDone`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ta,{size:15}),r(`wizardCreateAndLogin`)]})}):null,i===`login`&&!He&&o===`import`?(0,G.jsx)(J,{isPending:Ve(`import`),onPress:()=>void Re(),isDisabled:we,children:we?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yi,{size:15}),r(`accountImported`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vi,{size:15}),r(`importCredential`)]})}):null]})]})})})})}function E9({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:s=`danger`,confirmVariant:c=`danger`,onClose:l,onConfirm:u}){return(0,G.jsx)(cx.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&l()},children:(0,G.jsx)(cx.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,G.jsx)(cx.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(cx.Dialog,{children:[(0,G.jsxs)(cx.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(cx.Icon,{status:s}),(0,G.jsx)(`div`,{children:(0,G.jsx)(cx.Heading,{children:t})})]}),(0,G.jsx)(cx.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,G.jsx)(cx.Body,{children:(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,G.jsxs)(cx.Footer,{children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:l,children:i}),(0,G.jsx)(J,{size:`sm`,variant:c,isPending:o,onPress:u,children:r})]})]})})})})}function ECe(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function DCe({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let[s,c]=(0,v.useState)(`cn`);(0,v.useEffect)(()=>{t&&(t.region===`cn`||t.region===`global`?c(t.region):c(`cn`))},[t]);let l=!!t?.batchImportSupported,u=t?.provider,d=t?.format||i(`batchImportFormatUnknown`),f=u?AH(u,i):i(`batchImportProviderUnknown`),p=(t?.warnings||[]).map(e=>ECe(e,i)).filter(Boolean);return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,24rem)] sm:mx-0`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-4 px-5 pb-2`,children:[(0,G.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[u?(0,G.jsx)(MH,{provider:u,size:18}):null,(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:f}),(0,G.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:d})]})]})}),l?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(`batchImportRegion`)}),(0,G.jsx)(pH,{value:s,onChange:e=>{(e===`cn`||e===`global`)&&c(e)},ariaLabel:i(`batchImportRegion`),options:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`batchImportRegionPickHint`)}):null]}):(0,G.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),p.length?(0,G.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:p.map(e=>(0,G.jsx)(`li`,{children:e},e))}):null]}),(0,G.jsxs)(Y.Footer,{className:`flex-col-reverse gap-2 px-5 pb-5 sm:flex-row sm:justify-end`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(l?`cancel`:`close`)}),l?(0,G.jsx)(J,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(s),children:i(`batchImportConfirmAction`)}):null]})]})})})})}var D9={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`},OCe=[`codebuddy.cn`,`workbuddy.cn`],kCe=[`workbuddy.ai`,`workbuddy.com`];function O9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function k9(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function ACe(e){return typeof e.format==`string`&&e.format.trim()?k9(e.format):typeof e.exportType==`string`&&e.exportType.trim()?k9(e.exportType):``}function jCe(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),O9(e.account)&&n(e.account.domain),O9(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)O9(t)&&(n(t.domain),O9(t.account)&&n(t.account.domain),O9(t.auth)&&n(t.auth.domain));return t}function MCe(e){return OCe.some(t=>e.includes(t))}function NCe(e){return kCe.some(t=>e.includes(t))}function A9(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function PCe(e){if(!O9(e))return!1;if(A9(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(O9(e.account)||O9(e.auth)){let t=O9(e.account)?e.account:null,n=O9(e.auth)?e.auth:null;if(n&&(A9(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function FCe(e){let t=jCe(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(MCe),r=t.some(NCe);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function ICe(e){return Array.isArray(e.accounts)&&e.accounts.some(PCe)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:A9(e)||O9(e.account)&&A9(e.account)||O9(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function LCe(e){if(!O9(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=ACe(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?D9[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=ICe(e);o||=r.format,s=r.provider,c=n&&!D9[n]?`low`:r.confidence,a&&!D9[n]&&t.push(`unknown_format`)}s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=FCe(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`}}function RCe(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!O9(t))throw Error(`bad_json`);return t}var j9=`__all__`,zCe=[],M9=2;function BCe(){let{t:e}=EI(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),d=s,f=d.length>0,[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(null),[O,k]=(0,v.useState)({}),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[I,L]=(0,v.useState)(null),[R,z]=(0,v.useState)(null),[B,V]=(0,v.useState)(null),[H,ee]=(0,v.useState)(null),[te,ne]=(0,v.useState)(null),[re,ie]=(0,v.useState)(``),[ae,oe]=(0,v.useState)(`all`),[se,ce]=(0,v.useState)(``),[le,ue]=(0,v.useState)(1),[de,fe]=(0,v.useState)(20),[pe,me]=(0,v.useState)({}),[he,ge]=(0,v.useState)({}),[_e,ve]=(0,v.useState)({}),[ye,be]=(0,v.useState)({}),[xe,Se]=(0,v.useState)(!1),Ce=(0,v.useCallback)(async(e=!1)=>{try{let t=(await PI(e)).data||zCe;return c(t),t}finally{u(!1)}},[]),we=(0,v.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(n.length)for(let e=0;e{try{let n=await loe(e,{quota:t});c(t=>t.map(t=>t.id===e?n:t))}catch(t){N(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))}}))}},[]);(0,v.useEffect)(()=>{Ce(!1).catch(()=>void 0)},[Ce]),(0,v.useEffect)(()=>{let e=!0;return Promise.all([UI(),$I()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&o(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]);function Te(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function Ee(e){let t=Te(e)?.timezone;return t===`Local`?r?.timezone:t}let De=(0,v.useMemo)(()=>d.map(e=>{let t=pe[e.id],n=he[e.id],r=_e[e.id],i=ye[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[pe,_e,he,ye,d]),Oe=(0,v.useMemo)(()=>{let e={all:De.length,available:0,attention:0,disabled:0};for(let t of De){let n=p9(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[De]),ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of De){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[De]),Ae=De.find(e=>e.id===I),je=De.find(e=>e.id===R)||null,Me=De.find(e=>e.id===B)||null,Ne=De.find(e=>e.id===H)||null,Pe=(0,v.useMemo)(()=>{let e=re.trim().toLowerCase();return De.filter(t=>{let n=p9(t);return!(ae===`all`||ae===`available`&&(n===`hot`||n===`ready`)||ae===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||ae===`disabled`&&n===`disabled`)||se&&String(t.provider||`qoder`).toLowerCase()!==se?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[De,ae,se,re]),Fe=[re,ae,se,de].join(`\0`),[Ie,Le]=(0,v.useState)(Fe);Ie!==Fe&&(Le(Fe),ue(1));let Re=Math.max(1,Math.ceil(Pe.length/de)),ze=Math.min(Ie===Fe?Math.max(1,le):1,Re);le!==ze&&ue(ze);let Be=(0,v.useMemo)(()=>{let e=(ze-1)*de;return Pe.slice(e,e+de)},[ze,Pe,de]);if(l&&!f)return(0,G.jsx)(Fse,{});async function Ve(e,t,n){D({id:e,kind:t}),N(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return N(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{D(null)}}async function He(t,n){ne(t),await Ve(t,`device`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await FI(t,n);r.authUrl&&F(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await II(t)).login||{};if(N(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await Ce(!1),await we([t])})}async function Ue(t){let n=(A[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Ve(t,`callback`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await LI(t,n),j(e=>({...e,[t]:``})),await Ce(!1),await we([t])})&&(ne(e=>e===t?null:e),N(e=>({...e,[t]:``})))}async function We(t){let n=(O[t]||``).trim();if(!n){N(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Ve(t,`pat`,async()=>{N(n=>({...n,[t]:e(`wizardStartingSession`)})),await RI(n,t),k(e=>({...e,[t]:``})),await Ce(!1),await we([t])})}async function Ge(t){await Ve(t,`export`,async()=>{let n=await yoe(t);await Z7(JSON.stringify(n,null,2)),N(n=>({...n,[t]:e(`credentialCopied`)}))})}async function Ke(e,t){me(n=>({...n,[e]:t})),await Ve(e,`toggle`,async()=>{await WI(e,{enabled:t}),await Ce(!1)}),me(t=>{let n={...t};return delete n[e],n})}async function qe(t){XV({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),D({id:t,kind:`refresh`}),N(e=>{let n={...e};return delete n[t],n});try{await we([t]),XV({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}catch(n){throw XV({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)}),n}finally{D(null)}}async function Je(){Se(!0),XV({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{await we(s.map(e=>e.id)),XV({id:`refresh-credits`,type:`success`,title:e(`toastCreditsRefreshed`)})}catch(t){throw XV({id:`refresh-credits`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)}),t}finally{Se(!1)}}function Ye(){h||(y(!1),x(null),C(null),T(``))}async function Xe(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let t=RCe(await n.text()),r=LCe(t);if(!r.provider){XV({type:`error`,title:e(`batchImportUnrecognized`)});return}C(t),x(r),T(n.name),y(!0)}catch(t){let n=t instanceof Error?t.message:String(t);XV({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`batchImportUnrecognized`),description:n===`bad_json`?void 0:n})}}async function Ze(t){if(!S||!b?.batchImportSupported||h)return;g(!0);let n=`batch-import-accounts`;XV({id:n,type:`loading`,title:e(`batchImportLoading`)});try{let{succeeded:r,failed:i,message:a}=S9(await vCe(S,{region:t}),e);XV({id:n,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:a}),y(!1),x(null),C(null),T(``),r>0&&await Ce(!1)}catch(t){XV({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{g(!1)}}async function Qe(e,t){await Ve(e,`toggle`,async()=>{await WI(e,{auto_checkin:t}),await Ce(!1)})}async function $e(e){await Ve(e,`checkin`,async()=>{try{await goe(e)}finally{await Ce(!1)}})}async function et(t,n){if(!t)throw Error(e(`accountNameRequired`));ge(e=>({...e,[t]:n.name})),ve(e=>({...e,[t]:n.max_inflight})),be(e=>({...e,[t]:n.priority})),D({id:t,kind:`settings`});try{await WI(t,n),await Ce(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{D(null),ge(e=>{let n={...e};return delete n[t],n}),ve(e=>{let n={...e};return delete n[t],n}),be(e=>{let n={...e};return delete n[t],n})}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,G.jsx)(QI,{title:a}):null,(0,G.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[d.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pH,{value:ae,onChange:e=>oe(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,G.jsxs)(G.Fragment,{children:[e(`filterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.all})]})},{id:`available`,label:(0,G.jsxs)(G.Fragment,{children:[e(`availableAccounts`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.available})]})},{id:`attention`,label:(0,G.jsxs)(G.Fragment,{children:[e(`needsAttention`),(0,G.jsx)(`span`,{className:`mono ${Oe.attention?`text-danger`:`text-muted`}`,children:Oe.attention})]})},{id:`disabled`,label:(0,G.jsxs)(G.Fragment,{children:[e(`disabled`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:Oe.disabled})]})}]}),(0,G.jsxs)(AF,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:se||j9,onChange:e=>{typeof e==`string`&&ce(e===j9?``:e)},children:[(0,G.jsxs)(AF.Trigger,{className:`items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{children:(0,G.jsxs)(oF,{children:[(0,G.jsxs)(oF.Item,{id:j9,textValue:e(`providerFilterAll`),children:[(0,G.jsxs)(IN,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,G.jsx)(`span`,{className:`mono text-muted`,children:d.length})]}),(0,G.jsx)(oF.ItemIndicator,{})]}),ke.map(([t,n])=>(0,G.jsxs)(oF.Item,{id:t,textValue:AH(t,e),children:[(0,G.jsxs)(IN,{className:`flex items-center gap-2`,children:[(0,G.jsx)(MH,{provider:t,size:13}),AH(t,e),(0,G.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,G.jsx)(oF.ItemIndicator,{})]},t))]})})]}),(0,G.jsx)(B7,{className:`w-full sm:w-60`,value:re,onChange:ie,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:xe,onPress:()=>void Je(),children:[(0,G.jsx)(ti,{size:14}),e(`refreshCredits`)]}),(0,G.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${h||_?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[h?(0,G.jsx)(PV,{size:14,loading:!0}):(0,G.jsx)($a,{size:14}),e(`batchImport`)]}),(0,G.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:h||_,className:`sr-only`,onChange:e=>void Xe(e)}),(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`addAccount`)]})]})]}),(0,G.jsx)(TCe,{isOpen:p,onClose:()=>m(!1),onAdded:()=>{XV({type:`success`,title:e(`toastAccountAdded`)}),Ce(!1)}}),(0,G.jsx)(DCe,{isOpen:_,detection:b,fileName:w,isPending:h,t:e,onClose:Ye,onConfirm:e=>{Ze(e)}}),(0,G.jsx)(oCe,{account:je,t:e,onClose:()=>z(null)},R??`closed`),(0,G.jsx)(iCe,{account:Me,t:e,onClose:()=>V(null)},B??`closed`),(0,G.jsx)(uCe,{account:Ne,checkinDefaultTime:Ne&&Te(Ne)?r?.checkin_times[Ne.provider||``]:void 0,checkinTimezone:Ne?Ee(Ne):void 0,busy:!!(E&&E.id===H&&E.kind===`settings`),t:e,onClose:()=>ee(null),onSave:e=>et(H||``,e)},H??`closed`),(0,G.jsx)(E9,{isOpen:!!Ae,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:Ae?.name||Ae?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:E?.id===I&&E.kind===`delete`,onClose:()=>L(null),onConfirm:()=>{if(!Ae)return;let t=Ae.id;L(null),Ve(t,`delete`,async()=>{await voe(t),await Ce(!1)}).then(t=>{t&&XV({type:`success`,title:e(`toastAccountDeleted`)})})}}),f?null:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(PV,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,onPress:()=>m(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`addAccount`)]})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(e9,{})})]}),f&&!Pe.length?(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(la,{size:22}),title:e(`noAccountsMatch`),action:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>{ie(``),oe(`all`),ce(``)},children:e(`clearFilters`)})}):null,(0,G.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:Be.map(t=>(0,G.jsx)(tCe,{account:t,busyKind:E?.id===t.id?E.kind:``,authPanelOpen:te===t.id,authUrl:P[t.id],note:M[t.id],pat:O[t.id]||``,t:e,onPatChange:e=>k(n=>({...n,[t.id]:e})),callbackUrl:A[t.id]||``,onCallbackChange:e=>j(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void Ue(t.id),onDeviceLogin:e=>void He(t.id,e),onPatLogin:()=>void We(t.id),onExport:()=>void Ge(t.id),onRefresh:()=>void qe(t.id),onDelete:()=>L(t.id),onToggle:e=>void Ke(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],onToggleAutoCheckin:Te(t)?e=>void Qe(t.id,e):void 0,onCheckin:Te(t)?()=>void $e(t.id):void 0,onViewCheckins:Te(t)?()=>V(t.id):void 0,onEdit:()=>ee(t.id),onToggleAuthPanel:()=>ne(e=>e===t.id?null:t.id),onViewModels:()=>z(t.id)},t.id))}),Pe.length?(0,G.jsx)(z7,{total:Pe.length,page:ze,pageCount:Re,pageSize:de,pageSizes:lSe,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:ze,pages:Re}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ue,onPageSize:fe}):null]})}function VCe(){let{t:e,lang:t,setLang:n}=EI(),{setApiKey:r}=kI(),{overview:i,refresh:a}=qI(),{theme:o,toggleTheme:s}=XI(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``),g=at(),_=nt().state?.from||`/`,y=(0,v.useRef)(null);if(Use(y,`login`),i)return(0,G.jsx)(At,{to:_===`/login`?`/`:_,replace:!0});async function b(t){t.preventDefault();let n=c.trim();if(!n){h(e(`loginNeedKey`));return}p(!0),h(``);try{r(n),await a(n),g(_===`/login`?`/`:_,{replace:!0})}catch(t){h(MI(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{p(!1)}}return(0,G.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,G.jsxs)(`main`,{ref:y,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(480px,45%)]`,children:[(0,G.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col border-separator px-5 py-6 sm:px-10 sm:py-8 lg:min-h-dvh lg:border-r lg:px-14 lg:py-10 xl:px-20`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(PV,{size:36}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,G.jsxs)(cM,{isAttached:!0,children:[(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,G.jsx)(Yi,{size:15})})}),(0,G.jsx)(PM.Content,{children:t===`zh`?`English`:`中文`})]}),(0,G.jsxs)(PM,{children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:s,"aria-label":o===`dark`?`Light mode`:`Dark mode`,children:o===`dark`?(0,G.jsx)(Ua,{size:15}):(0,G.jsx)(da,{size:15})})}),(0,G.jsx)(PM.Content,{children:o===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,G.jsxs)(`div`,{className:`my-auto max-w-3xl py-16 lg:py-24`,children:[(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mb-5 mono text-caption text-muted`,children:`:3010`}),(0,G.jsx)(`h1`,{"data-gsap-reveal":!0,className:`max-w-3xl text-[clamp(2.25rem,4vw,3.6rem)] font-semibold leading-[0.98] tracking-[-0.045em] text-balance`,children:e(`loginTitle`)}),(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mt-6 max-w-xl text-section font-normal text-muted sm:text-title sm:font-normal`,children:e(`loginLead`)}),(0,G.jsx)(`p`,{"data-gsap-reveal":!0,className:`mt-10 max-w-xl pt-5 text-body leading-6 text-muted`,children:e(`loginHint`)})]}),(0,G.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,G.jsx)(`span`,{children:e(`loginHint`)}),(0,G.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,G.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-10 lg:px-12 xl:px-16`,children:(0,G.jsx)(HS,{"data-gsap-reveal":!0,className:`w-full p-0`,children:(0,G.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,G.jsx)(HS.Header,{className:`border-b border-separator px-6 py-6 sm:px-8`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(PV,{size:28,loading:f}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(HS.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,G.jsx)(HS.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,G.jsxs)(HS.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,G.jsxs)(YM,{name:`console-password`,className:`w-full`,isInvalid:!!m,children:[(0,G.jsx)(IN,{children:e(`loginPassword`)}),(0,G.jsxs)(KM,{children:[(0,G.jsx)(KM.Input,{id:`console-password`,type:u?`text`:`password`,value:c,onChange:e=>l(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,G.jsx)(KM.Suffix,{children:(0,G.jsx)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(u?`hidePassword`:`showPassword`),onPress:()=>d(e=>!e),children:u?(0,G.jsx)(zi,{size:16}):(0,G.jsx)(Li,{size:16})})})]})]}),m?(0,G.jsx)(QI,{title:m}):(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,G.jsxs)(J,{type:`submit`,fullWidth:!0,size:`lg`,isPending:f,children:[e(f?`loggingInConsole`:`loginSubmit`),f?null:(0,G.jsx)(Yr,{size:17})]})]})]})})})]})]})}function N9(){return NI(`/api/keys`)}function HCe(e){return NI(`/api/keys`,{method:`POST`,body:JSON.stringify(e)})}function P9(e,t){return NI(`/api/keys/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function UCe(e){return NI(`/api/keys/${encodeURIComponent(e)}`,{method:`DELETE`})}function WCe(){return NI(`/api/system/console-key`)}function GCe(){return NI(`/api/system/console-key`,{method:`POST`,body:JSON.stringify({rotate:!0})})}function KCe({settings:e,onSaved:t}){let{t:n}=EI(),r=at(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!0;return UI().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&d(String(t))}),()=>{e=!1}},[]);async function f(n,r){if(!(!e||r===e.checkin_times[n])){l(!0),d(``);try{t(await eL({checkin_times:{[n]:r}}))}catch(e){d(e instanceof Error?e.message:String(e))}finally{s(e=>{let t={...e};return delete t[n],t}),l(!1)}}}return(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(HS.Header,{children:[(0,G.jsx)(HS.Title,{children:n(`checkinDefaultsTitle`)}),(0,G.jsx)(HS.Description,{children:n(`checkinDefaultsHint`)})]}),(0,G.jsxs)(HS.Content,{className:`space-y-4`,children:[u?(0,G.jsx)(QI,{title:u}):null,!e||!i?(0,G.jsx)(Q,{className:`h-24 w-full`}):i.map(t=>(0,G.jsx)(_9,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,G.jsx)(UM,{type:`time`,value:o[t.id]??e.checkin_times[t.id]??``,disabled:c,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>s(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void f(t.id,e.target.value)})},t.id))]}),(0,G.jsx)(HS.Footer,{children:(0,G.jsx)(J,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function qCe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function JCe({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:o}){let{t:s,lang:c}=EI();if(!e.length)return null;let l=n&&n!==t?n:t,u=e.some(e=>e.tag_name===l)?l:e[0]?.tag_name,d=new Set(r);return(0,G.jsxs)(`div`,{className:`mt-5`,children:[(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:s(`versionHistory`)})}),(0,G.jsx)(vh,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:u?[u]:[],children:e.map(e=>{let r=e.tag_name,l=r===t,u=!!(n&&r===n&&n!==t),f=i&&d.has(r)&&!l,p=qCe(e.published_at,c);return(0,G.jsxs)(vh.Item,{id:r,children:[(0,G.jsx)(vh.Heading,{children:(0,G.jsxs)(vh.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),l?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`success`,children:s(`versionCurrentBadge`)}):null,u?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`warning`,children:s(`versionLatestBadge`)}):null,p?(0,G.jsx)(`span`,{className:`truncate text-caption text-muted`,children:p}):null]}),(0,G.jsx)(vh.Indicator,{})]})}),(0,G.jsx)(vh.Panel,{children:(0,G.jsxs)(vh.Body,{className:`px-3 pb-3`,children:[(0,G.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,G.jsx)(aL,{markdown:rL(e.body,c),emptyLabel:s(`updateNoNotes`)})}),f?(0,G.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>o(r),children:s(`restoreThisVersion`)})}):null]})})]},r)})})]})}function F9(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function YCe(e,t,n,r,i){return r?.length?F9(r):F9([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var XCe=[`general`,`routing`,`security`,`updates`];function ZCe(){let{t:e}=EI(),[t,n]=On(),r=t.get(`tab`),i=r&&XCe.includes(r)?r:`general`,a=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:o}=kI(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(``),E=nL(),{info:D,loading:O,checking:k,submitting:A,error:j,setError:M,load:N,canRollback:P,rollbackTo:F}=E,I=(0,v.useMemo)(()=>YCe(D?.current_version||``,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions),[D?.current_version,D?.next_version,D?.release,D?.recent_releases,D?.rollback_versions]),L=(0,v.useMemo)(()=>(D?.rollback_versions||[]).map(e=>e.tag_name),[D?.rollback_versions]);(0,v.useEffect)(()=>{let e=window.setTimeout(()=>{WCe().then(c).catch(()=>void 0),$I().then(e=>{u(e),f(e.proxy_url||``)}).catch(e=>M(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[M]);async function R(e){let t=l?.cross_provider_model_pool??!0;u(t=>t&&{...t,cross_provider_model_pool:e}),m(!0),M(``);try{u(await eL({cross_provider_model_pool:e}))}catch(e){u(e=>e&&{...e,cross_provider_model_pool:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function z(e){let t=l?.checkin_disabled_accounts??!1;u(t=>t&&{...t,checkin_disabled_accounts:e}),m(!0),M(``);try{u(await eL({checkin_disabled_accounts:e}))}catch(e){u(e=>e&&{...e,checkin_disabled_accounts:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function B(e){let t=l?.proxy_url||``;if(e===t){f(t);return}let n=d;f(e),u(t=>t&&{...t,proxy_url:e}),m(!0),M(``);try{let t=await eL({proxy_url:e});u(t),f(t.proxy_url||``)}catch(e){f(n),u(e=>e&&{...e,proxy_url:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function V(e){let t=l?.routing_strategy||`round-robin`;u(t=>t&&{...t,routing_strategy:e}),m(!0),M(``);try{u(await eL({routing_strategy:e}))}catch(e){u(e=>e&&{...e,routing_strategy:t}),M(e instanceof Error?e.message:String(e))}finally{m(!1)}}return O&&!D?(0,G.jsx)(Hse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:k,onPress:()=>void N(!0),children:[(0,G.jsx)(qr,{size:15}),e(`checkUpdates`)]})]}),j?(0,G.jsx)(QI,{title:j}):null,(0,G.jsxs)(_j,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,G.jsxs)(gj,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(qi,{size:13}),e(`settingsTabGeneral`)]}),(0,G.jsxs)(gj,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(ri,{size:13}),e(`settingsTabRouting`)]}),(0,G.jsxs)(gj,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(Da,{size:13}),e(`settingsTabSecurity`)]}),(0,G.jsxs)(gj,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{}),(0,G.jsx)(Gr,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,G.jsx)(_j.Panel,{id:`general`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,G.jsx)(UM,{value:d,onChange:e=>f(e.target.value),onBlur:e=>void B(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:p||!l}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(yi,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,G.jsx)(F7,{isSelected:l?.checkin_disabled_accounts??!1,isDisabled:p||!l,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void z(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,G.jsx)(KCe,{settings:l,onSaved:u})]})}),(0,G.jsx)(_j.Panel,{id:`routing`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,G.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,G.jsx)(_9,{label:e(`routingStrategy`),children:(0,G.jsxs)(AF,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:l?.routing_strategy||`round-robin`,isDisabled:p||!l,onChange:e=>{typeof e==`string`&&e&&V(e)},children:[(0,G.jsxs)(AF.Trigger,{className:`items-center`,children:[(0,G.jsx)(AF.Value,{className:`min-w-0 truncate`}),(0,G.jsx)(AF.Indicator,{})]}),(0,G.jsx)(AF.Popover,{children:(0,G.jsxs)(oF,{children:[(0,G.jsxs)(oF.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,G.jsx)(IN,{children:e(`routingRoundRobin`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,G.jsx)(IN,{children:e(`routingWeightedRoundRobin`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,G.jsx)(IN,{children:e(`routingFillFirst`)}),(0,G.jsx)(oF.ItemIndicator,{})]}),(0,G.jsxs)(oF.Item,{id:`fefo`,textValue:`fefo`,children:[(0,G.jsx)(IN,{children:e(`routingFEFO`)}),(0,G.jsx)(oF.ItemIndicator,{})]})]})})]})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.ttl_seconds?`${Math.round(l.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:l?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),l?.session_affinity?.last_escape_reason?(0,G.jsxs)(RN,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,l.session_affinity.last_escape_reason]}):null,l?.session_affinity?.last_miss_reason?(0,G.jsxs)(RN,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,l.session_affinity.last_miss_reason]}):null]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Na,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,G.jsx)(F7,{isSelected:l?.cross_provider_model_pool??!0,isDisabled:p||!l,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void R(e)})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,G.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:l?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,G.jsx)(_j.Panel,{id:`security`,className:`pt-5`,children:(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(ta,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,G.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:s?.prefix||`—`}),(0,G.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,G.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isPending:h,onPress:()=>y(!0),children:e(`consoleKeyRotate`)})})]}),(0,G.jsxs)(HS,{"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,G.jsx)(Ni,{size:15})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,G.jsx)(Da,{size:18,className:`text-success`})]}),(0,G.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,G.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yi,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,G.jsx)(_j.Panel,{id:`updates`,className:`pt-5`,children:(0,G.jsx)(`div`,{className:`grid gap-5`,children:(0,G.jsxs)(HS,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:D?.has_update?`warning`:`success`,children:D?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,G.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,G.jsx)(ZI,{update:E}),(0,G.jsx)(JCe,{releases:I,currentVersion:D?.current_version||``,nextVersion:D?.next_version,rollbackTags:L,canRollback:P,submitting:A,onRestore:T})]})]})})})]}),(0,G.jsx)(E9,{isOpen:!!w,title:e(`restoreVersionTitle`,{version:w}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:A,status:`warning`,confirmVariant:`primary`,onClose:()=>{A||T(``)},onConfirm:()=>{let e=w;T(``),F(e)}}),(0,G.jsx)(Y.Root,{isOpen:_,onOpenChange:e=>{!e&&!h&&y(!1)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,isDismissable:!h,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`sm`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,G.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:h,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:h,onPress:()=>y(!1),children:e(`cancel`)}),(0,G.jsx)(J,{variant:`danger`,isPending:h,onPress:()=>{g(!0),GCe().then(e=>{c(e),x(e.secret||``),e.secret&&o(e.secret),y(!1)}).catch(e=>{M(e instanceof Error?e.message:String(e))}).finally(()=>g(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:!!b,onOpenChange:e=>{e||x(``)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsx)(Y.Body,{className:`px-6 pb-2`,children:(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b})}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(``),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{Z7(b),C(!0),window.setTimeout(()=>C(!1),1200)},children:[(0,G.jsx)(Di,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}var I9=`__all__`;function QCe(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function L9({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let h=e||I9,g=(0,v.useMemo)(()=>{let t=s?d:r.filter(e=>QCe(e,l)),n=new Map;l.trim()||n.set(I9,{id:I9,label:i});for(let e of t)!e.id||e.id===I9||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),_=g.find(e=>e.id===h)||(e?{id:e,label:e}:{id:I9,label:i});return(0,G.jsxs)(NS,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:h,onChange:e=>{typeof e==`string`&&(t(e===I9?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,G.jsxs)(NS.Trigger,{className:`min-w-44 items-center`,children:[(0,G.jsx)(NS.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,G.jsx)(`span`,{className:`truncate`,children:_.label})}),e?(0,G.jsx)(NS.ClearButton,{}):null,(0,G.jsx)(NS.Indicator,{})]}),(0,G.jsx)(NS.Popover,{className:`min-w-56`,children:(0,G.jsxs)(NS.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,G.jsx)(PN,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,G.jsxs)(PN.Group,{children:[(0,G.jsx)(PN.SearchIcon,{}),(0,G.jsx)(PN.Input,{placeholder:a}),(0,G.jsx)(PN.ClearButton,{})]})}),(0,G.jsx)(oF,{children:g.length===0?(0,G.jsx)(oF.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,G.jsx)(IN,{className:`block truncate text-muted`,children:p?a:o})}):g.map(e=>(0,G.jsxs)(oF.Item,{id:e.id,textValue:e.label,children:[(0,G.jsx)(IN,{className:`block truncate`,children:e.label}),e.id!==I9&&e.id!==e.label?(0,G.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,G.jsx)(oF.ItemIndicator,{})]},e.id))})]})})]})}function R9(){let[e,t]=(0,v.useState)([]);return(0,v.useEffect)(()=>{let e=!1;return N9().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,v.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,v.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}function z9(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function $Ce(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function ewe(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function B9(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function V9(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function H9({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?U9(o):null;return i==null&&a==null&&s==null?(0,G.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,G.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,G.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function twe(){return(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:Array.from({length:8},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-5 w-36 max-w-full`})]},t))}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-secondary px-3 py-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-24`}),(0,G.jsx)(Q,{className:`h-4 w-full`}),(0,G.jsx)(Q,{className:`h-4 w-4/5`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Q,{className:`h-3 w-20`}),(0,G.jsx)(Q,{className:`h-16 w-full`})]})]})}function U9(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var nwe=[`all`,`ok`,`incomplete`,`error`,`canceled`],rwe=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],iwe=[`all`,`1h`,`24h`,`7d`,`custom`];function W9(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=hH(e.get(`from`)),r=hH(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),nwe,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),rwe,`all`),timeRange:i?`custom`:t(e.get(`range`),iwe,`1h`),customRange:i}}function awe(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?mH(e.customRange?.start):void 0,r=e.timeRange===`custom`?mH(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function owe(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function swe(){let{t:e,lang:t}=EI(),[n,r]=On(),[i]=(0,v.useState)(()=>W9(new URLSearchParams(window.location.search))),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(`requests`),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(i.requestFilter),[b,x]=(0,v.useState)(`all`),[S,C]=(0,v.useState)(i.requestId),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(i.accountFilter),[O,k]=(0,v.useState)(i.apiKeyFilter),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)(i.modelFilter),[P,F]=(0,v.useState)(i.providerFilter),[I,L]=(0,v.useState)(i.streamFilter),[R,z]=(0,v.useState)(i.errorKind),[B,V]=(0,v.useState)(i.timeRange),[H,ee]=(0,v.useState)(i.customRange),[te,ne]=(0,v.useState)(1),[re,ie]=(0,v.useState)(50),[ae,oe]=(0,v.useState)(1),[se,ce]=(0,v.useState)(50),[le,ue]=(0,v.useState)([]),[de,fe]=(0,v.useState)(0),[pe,me]=(0,v.useState)([]),[he,ge]=(0,v.useState)(0),[_e,ve]=(0,v.useState)(null),[ye,be]=(0,v.useState)(!1),[xe,Se]=(0,v.useState)(null),[Ce,we]=(0,v.useState)(!1),[Te,Ee]=(0,v.useState)(!1),[De,Oe]=(0,v.useState)(``),ke=(0,v.useRef)(0),[Ae,je]=(0,v.useState)(!1),[Me,Ne]=(0,v.useState)(!1),Pe=n.toString(),Fe=awe({requestFilter:_,requestId:S,accountFilter:E,apiKeyFilter:O,modelFilter:M,providerFilter:P,streamFilter:I,errorKind:R,timeRange:B,customRange:H}),Ie=(0,v.useRef)(Pe);(0,v.useEffect)(()=>{if(Pe===Ie.current)return;Ie.current=Pe;let e=W9(new URLSearchParams(Pe));y(e.requestFilter),C(e.requestId),D(e.accountFilter),k(e.apiKeyFilter),N(e.modelFilter),F(e.providerFilter),L(e.streamFilter),z(e.errorKind),V(e.timeRange),ee(e.customRange)},[Pe]),(0,v.useEffect)(()=>{Fe!==Ie.current&&(Ie.current=Fe,r(Fe,{replace:!0}))},[Fe,r]),(0,v.useEffect)(()=>{let e=!1;return Promise.allSettled([PI(!1),VI()]).then(([t,n])=>{e||(t.status===`fulfilled`&&o(t.value.data||[]),n.status===`fulfilled`&&c(n.value.data||[]))}),()=>{e=!0}},[]);let Le=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,t.name||t.id);return e},[a]),Re=(0,v.useMemo)(()=>{let e=new Map;for(let t of a||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[a]);function ze(t){let n=t.account_id?Re.get(t.account_id):void 0,r=t.provider||n?.provider;return r?jH(r,n?.region,e):`—`}function Be(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ve=(0,v.useMemo)(()=>(a||[]).map(e=>({id:e.id,label:e.name||e.id})),[a]),{nameById:He,options:Ue}=R9();function We(e){let t=e.api_key_id?.trim();return t?He.get(t)||t:`—`}let Ge=(0,v.useMemo)(()=>{let t=new Set;for(let e of a||[])e.provider&&t.add(e.provider);return P&&t.add(P),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:AH(t,e)}))]},[a,P,e]),Ke=(0,v.useMemo)(()=>{let e=new Map;for(let t of s||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[s]),qe=(0,v.useCallback)(async e=>((await QV({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Je=!!(S||_!==`all`||E||O||M||P||I!==`all`||R!==`all`||B!==`1h`),Ye=[_,S,E,O,M,P,I,R,B,H?.start?.toString()??``,H?.end?.toString()??``,re].join(`\0`),Xe=[b,w,A,se].join(`\0`),[Ze,Qe]=(0,v.useState)(Ye),[$e,et]=(0,v.useState)(Xe);Ze!==Ye&&(Qe(Ye),ne(1)),$e!==Xe&&(et(Xe),oe(1));let tt=Math.max(1,Math.ceil(de/re)),nt=Math.min(Ze===Ye?Math.max(1,te):1,tt);te!==nt&&ne(nt);let rt=Math.max(1,Math.ceil(he/se)),it=Math.min($e===Xe?Math.max(1,ae):1,rt);ae!==it&&oe(it);let at=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=S?{from:void 0,to:void 0}:B===`custom`?{from:mH(H?.start),to:mH(H?.end,!0)}:owe(B),t=await QV({status:_===`all`?void 0:_,id:S||void 0,account:E||void 0,api_key:O||void 0,model:M||void 0,provider:P||void 0,stream:I===`all`?void 0:I===`stream`,error_kind:R===`all`?void 0:R,from:e.from,to:e.to,limit:re,offset:(nt-1)*re});ue(t.items||[]),fe(t.total||0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[_,S,E,O,M,P,I,R,B,H,nt,re]),ot=(0,v.useCallback)(async(e=!1)=>{e||f(!0);try{let e=await cce({level:b===`all`?void 0:b,q:w.trim()||void 0,account:A||void 0,limit:se,offset:(it-1)*se});me(e.items||[]),ge(e.total??0),g(``)}catch(t){e||g(t instanceof Error?t.message:String(t))}finally{e||(f(!1),m(!0))}},[b,w,A,it,se]),st=(0,v.useCallback)(async(e=!1)=>{l===`requests`?await at(e):await ot(e)},[l,at,ot]);(0,v.useEffect)(()=>{f(!0);let e=l===`runtime`&&w.trim()?280:0,t=window.setTimeout(()=>void st(!1),e);return()=>window.clearTimeout(t)},[st,l,w]),(0,v.useEffect)(()=>{if(l!==`runtime`||it!==1)return;let e=window.setInterval(()=>void ot(!0),3e3);return()=>window.clearInterval(e)},[l,it,ot]);let ct=de===0?0:(nt-1)*re+1,lt=Math.min(de,nt*re),ut=he===0?0:(it-1)*se+1,dt=Math.min(he,it*se),ft=(0,v.useMemo)(()=>l===`requests`?e(`logsShownTotal`,{shown:le.length?`${ct}–${lt}`:0,total:de}):e(`logsShownTotal`,{shown:pe.length?`${ut}–${dt}`:0,total:he}),[l,le.length,pe.length,ct,lt,de,ut,dt,he,e]);function pt(){C(``),y(`all`),D(``),k(``),N(``),F(``),L(`all`),z(`all`),V(`1h`),ee(null),ne(1)}async function mt(e){let t=++ke.current;Se(e),Oe(``),Ee(!0),we(!0);try{let n=await oce(e.id);if(ke.current!==t)return;Se(n)}catch(e){if(ke.current!==t)return;Oe(e instanceof Error?e.message:String(e))}finally{ke.current===t&&Ee(!1)}}function ht(e){ve(e),be(!0)}async function gt(){Ne(!0),XV({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await sce(),je(!1),await at(!1),XV({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){g(t instanceof Error?t.message:String(t)),XV({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{Ne(!1)}}let _t=d&&(l===`requests`?le.length===0:pe.length===0);return d&&!p?(0,G.jsx)(Bse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===`requests`?(0,G.jsxs)(J,{size:`sm`,variant:`ghost`,onPress:()=>je(!0),isDisabled:Me||de===0,children:[(0,G.jsx)(qa,{size:14}),e(`logsClear`)]}):null,(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,isPending:d,onPress:()=>void st(!1),children:[(0,G.jsx)(qr,{size:15}),e(`refresh`)]})]})]}),h?(0,G.jsx)(QI,{title:e(`failedLogs`,{msg:h})}):null,(0,G.jsxs)(_j,{selectedKey:l,onSelectionChange:e=>u(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{children:[(0,G.jsxs)(gj,{id:`requests`,className:`gap-1.5`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(Ta,{size:13}),e(`logsRequests`)]}),(0,G.jsxs)(gj,{id:`runtime`,className:`gap-1.5`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(Ga,{size:13}),e(`logsRuntime`)]})]})}),(0,G.jsxs)(_j.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(pH,{value:_,onChange:e=>y(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null,(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:ft})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:E,onChange:D,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:O,onChange:k,options:Ue,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColModel`),value:M,onChange:N,options:Ke,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(R7,{ariaLabel:e(`logsColProvider`),value:P,onChange:F,options:Ge}),(0,G.jsx)(L9,{ariaLabel:e(`logsSearchRequestId`),value:S,onChange:C,options:S?[{id:S,label:S}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:qe,className:`min-w-56`}),(0,G.jsx)(pH,{value:I,onChange:e=>L(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,G.jsx)(R7,{ariaLabel:e(`errorKind`),value:R===`all`?``:R,onChange:e=>z(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,G.jsx)(pH,{value:B,onChange:e=>V(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),B===`custom`?(0,G.jsx)(gH,{className:`w-[min(100%,42rem)]`,value:H,onChange:ee,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,G.jsx)(HS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(RV,{}):le.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(la,{size:22}),title:e(Je?`logsNoMatch`:`logsEmptyRequests`),action:Je?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:pt,children:e(`clearFilters`)}):null}):(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":e(`logsRequests`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,G.jsx)(X.Column,{children:e(`logsColModel`)}),(0,G.jsx)(X.Column,{children:e(`logsColReasoning`)}),(0,G.jsx)(X.Column,{children:e(`logsColProvider`)}),(0,G.jsx)(X.Column,{children:e(`logsColAccount`)}),(0,G.jsx)(X.Column,{children:e(`logsColApiKey`)}),(0,G.jsx)(X.Column,{children:e(`logsColStatus`)}),(0,G.jsx)(X.Column,{children:e(`logsColStream`)}),(0,G.jsx)(X.Column,{children:e(`logsColLatency`)}),(0,G.jsx)(X.Column,{children:e(`logsColTokens`)})]}),(0,G.jsx)(X.Body,{children:le.map(n=>(0,G.jsxs)(X.Row,{className:`cursor-pointer`,onAction:()=>void mt(n),children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`mono text-xs`,children:B9(n.created_at,t)}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:V9(n)||`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:ze(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`span`,{className:`text-xs`,children:n.account_id?Le.get(n.account_id)||n.account_id:`—`}),n.account_id&&Le.get(n.account_id)&&Le.get(n.account_id)!==n.account_id?(0,G.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs`,children:We(n)})}),(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:z9(n.status),children:n.status}),n.error_kind?(0,G.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(n9,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(H9,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,G.jsx)(z7,{total:de,page:nt,pageCount:tt,pageSize:re,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:nt,pages:tt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ne,onPageSize:ie})]}),(0,G.jsxs)(_j.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,G.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(B7,{className:`sm:w-72`,value:w,onChange:T,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,G.jsx)(L9,{ariaLabel:e(`logsColAccount`),value:A,onChange:j,options:Ve,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,G.jsx)(pH,{value:b,onChange:e=>x(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[it===1?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,G.jsx)(`span`,{className:`mono`,children:ft})]})]}),(0,G.jsx)(HS,{className:`overflow-hidden p-0`,"aria-busy":d,children:_t?(0,G.jsx)(zse,{}):pe.length===0?(0,G.jsx)(I7,{icon:(0,G.jsx)(Ga,{size:22}),title:e(`logsEmptyRuntime`)}):(0,G.jsx)(`div`,{className:`divide-y divide-separator`,children:pe.map(e=>(0,G.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>ht(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ht(e))},children:[(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:B9(e.time,t)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`status-dot`,"data-state":$Ce(e.level)}),(0,G.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,G.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,G.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,G.jsx)(z7,{total:he,page:it,pageCount:rt,pageSize:se,loading:d,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:it,pages:rt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:oe,onPageSize:ce})]})]}),(0,G.jsx)(Y.Root,{isOpen:ye,onOpenChange:e=>{be(e),e||ve(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:_e?`#${_e.id}`:`—`})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),_e?B9(_e.time,t):`—`],[e(`logsRuntimeLevel`),_e?.level||`—`],[e(`logsRuntimeSource`),_e?.source||`—`],[e(`logsColAccount`),_e?.account_id||`—`]].map(([t,n])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&_e?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:ewe(_e.level),children:_e.level}):n})]},String(t)))}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,G.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:_e?.message||`—`})]})]})]})})})}),(0,G.jsx)(Y.Root,{isOpen:Ce,onOpenChange:e=>{we(e),e||(ke.current+=1,Ee(!1),Oe(``),Se(null))},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{size:`lg`,scroll:`inside`,children:(0,G.jsxs)(Y.Dialog,{className:`w-full max-w-4xl`,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,G.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:xe?.id})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,G.jsx)(ao,{size:16})})]}),(0,G.jsx)(Y.Body,{className:`space-y-4 px-5 pb-5`,children:Te?(0,G.jsx)(twe,{}):De?(0,G.jsx)(QI,{title:e(`requestFailed`),description:De}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[[e(`logsColStatus`),xe?.status||`—`],[e(`logsColModel`),xe?.requested_model||`—`],[e(`logsColReasoning`),xe&&V9(xe)||`—`],[e(`logsColProvider`),xe?ze(xe):`—`],[e(`logsColAccount`),xe?.account_id?Le.get(xe.account_id)||xe.account_id:`—`],[e(`logsColApiKey`),xe?We(xe):`—`],[e(`logsColStream`),xe?.stream?e(`logsStreamYes`):e(`logsStreamNo`)],[e(`logsRouting`),xe?Be(xe.routing):`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t})]},String(e))),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsColTokens`)}),(0,G.jsx)(`dd`,{className:`mt-1`,children:xe?(0,G.jsx)(H9,{log:xe,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})}):`—`})]}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(n9,{latencyMs:xe?.latency_ms,ttfbMs:xe?.ttfb_ms,completionTokens:xe?.completion_tokens,stream:xe?.stream,labels:{heading:e(`logsColLatency`),ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})})]}),xe&&xe.message_count?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsMessageShape`)}),(0,G.jsxs)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageCount`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5`,children:xe.message_count})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsEmptyMessageIndexes`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.empty_message_indexes?.length?xe.empty_message_indexes.join(`, `):`—`})]}),(0,G.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e(`logsMessageRoles`)}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:xe.message_roles?.join(` → `)||`—`})]})]})]}):null,xe?.error_message?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-2 text-xs leading-5 text-muted`,children:[xe.error_kind?(0,G.jsx)(`span`,{className:`mono mr-2 text-muted`,children:xe.error_kind}):null,xe.error_message]}):null,xe?.stream_diagnostic?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCancellationSource`),xe.stream_diagnostic.cancellation_source||`—`],[e(`logsUpstreamStatus`),xe.stream_diagnostic.upstream_status??`—`],[e(`logsSSEEvents`),xe.stream_diagnostic.sse_event_count],[e(`logsBytesRead`),xe.stream_diagnostic.bytes_read],[e(`logsLastEvent`),xe.stream_diagnostic.last_event||`—`],[e(`logsStreamComplete`),xe.stream_diagnostic.saw_done?`yes`:`no`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))}),xe.stream_diagnostic.context_err||xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{className:`mt-2 space-y-1 break-all text-muted`,children:[xe.stream_diagnostic.context_err?(0,G.jsxs)(`div`,{children:[`context: `,xe.stream_diagnostic.context_err]}):null,xe.stream_diagnostic.relay_error?(0,G.jsxs)(`div`,{children:[`relay: `,xe.stream_diagnostic.relay_error]}):null]}):null]}):null,xe?.usage_detail?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-3 py-3 text-xs`,children:[(0,G.jsx)(`div`,{className:`font-medium text-muted`,children:e(`logsUsageDetail`)}),(0,G.jsx)(`dl`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[e(`logsCreditConsumed`),`${U9(xe.usage_detail.credit)} ${xe.usage_detail.unit||`credits`}`],[e(`logsColProvider`),xe.usage_detail.provider||`—`]].map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,G.jsx)(`dd`,{className:`mono mt-0.5 break-all`,children:t})]},String(e)))})]}):null,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsAttempts`)}),xe?.attempts?.length?(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:xe.attempts.map(e=>(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 text-xs sm:grid-cols-[48px_minmax(0,1fr)_auto]`,children:[(0,G.jsxs)(`div`,{className:`mono text-muted`,children:[`#`,e.attempt_index]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium`,children:e.account_id||`—`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-muted`,children:e.error_message||e.status})]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:z9(e.status===`failover`?`canceled`:e.status),children:e.status})]},e.id))}):(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:e(`logsNoAttempts`)})]})]})})]})})})}),(0,G.jsx)(E9,{isOpen:Ae,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:Me,onClose:()=>je(!1),onConfirm:()=>void gt()})]})}var G9=864e5,cwe=8;function K9(e){return`var(--chart-${e%cwe+1})`}function q9(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function J9(e){return e<10?`0${e}`:String(e)}function Y9(e){let t=new Date(e);return`${t.getFullYear()}-${J9(t.getMonth()+1)}-${J9(t.getDate())}`}function lwe({accounts:e,t}){let[n,r]=(0,v.useState)(!1),{buckets:i,rows:a,todayStart:o,maxTotal:s}=(0,v.useMemo)(()=>{let t=q9(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,K9(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||K9(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=q9(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=Y9(q9(new Date(l)));for(let t of c)Y9(q9(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((q9(new Date(l))-t)/G9)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!a.some(e=>e.packs>0))return null;let c=n?i:i.slice(0,8);return(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,G.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:c.map(e=>{let n=e.ts===o,r=s>0?e.total/s*100:0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,G.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,G.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:m9(e.total)})]}),(0,G.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:m9(e.total)})}`,title:e.day,children:(0,G.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,G.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${m9(t.remain)}`},t.id))})}),(0,G.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:m9(e.total)})]},e.day)})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:a.filter(e=>e.remain>0).map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,G.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,G.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,G.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,G.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:m9(e.soonestRemain)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,G.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,G.jsx)(X,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{className:`min-w-[32rem]`,children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,G.jsx)(X.Column,{children:(0,G.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,G.jsx)(X.Body,{children:a.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,G.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:m9(e.soonestRemain)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?m9(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function uwe(){return NI(`/api/usage/pricing`)}function dwe(e={}){let t=new URLSearchParams;return e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key),NI(`/api/usage/cost${t.toString()?`?${t}`:``}`)}var X9=(0,v.lazy)(()=>C(()=>import(`./CostChart-DFXT-jhI.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([2,1])));function fwe(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var pwe={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function mwe(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function hwe({apiKeyFilter:e=``}){let{t,lang:n}=EI(),[r,i]=(0,v.useState)(`today`),[a,o]=(0,v.useState)(`credits`),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(``);(0,v.useEffect)(()=>{let e=!1;return uwe().then(t=>{e||u(t)}).catch(()=>{}),()=>{e=!0}},[]);let h=(0,v.useCallback)(async()=>{f(!0);try{let t=await dwe({...r===`all`?{}:r===`today`?{from:fwe()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});c(t),m(``)}catch(e){c(null),m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[r,e]);(0,v.useEffect)(()=>{h()},[h]);let g=s??pwe,_=g.totals,y=_.requests>0&&g.models.length>0,b=g.models.filter(e=>e.priced),x=_.cost>0,S=[{label:t(`usageCredits`),value:cH(_.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:$V(_.total_tokens),detail:`${$V(_.cache_hit)} / ${$V(_.cache_miss)} / ${$V(_.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(_.requests),detail:t(`usageModelCount`,{count:g.models.length})},{label:t(`usageCacheHitRate`),value:mwe(_.cache_hit,_.cache_hit+_.cache_miss),detail:$V(_.cache_hit)}],C=a===`credits`?cH(_.credits):a===`tokens`?$V(_.total_tokens):oH(_.cost);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,G.jsx)(pH,{value:r,onChange:e=>i(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,G.jsxs)(J,{size:`sm`,variant:`secondary`,onPress:()=>void h(),isDisabled:d,children:[(0,G.jsx)(qr,{size:14}),t(`refresh`)]})]}),p?(0,G.jsx)(QI,{title:t(`failedStats`,{msg:p})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:S.map(e=>(0,G.jsxs)(HS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:d?(0,G.jsx)(Q,{className:`h-5 w-16`}):e.value}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:d?(0,G.jsx)(Q,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(pH,{value:a,onChange:e=>o(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:C})]})]}),(0,G.jsx)(`div`,{className:`p-5`,children:d?(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}):y?(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,G.jsx)(Q,{className:`h-56 w-full`})}),children:(0,G.jsx)(X9,{series:g.series,models:g.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:a})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),d?(0,G.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,G.jsx)(Q,{className:`h-9 w-full`},e))}):y?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColRequests`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputHit`)}),(0,G.jsx)(X.Column,{children:t(`usageColInputMiss`)}),(0,G.jsx)(X.Column,{children:t(`usageColOutput`)}),(0,G.jsx)(X.Column,{children:t(`usageColTokens`)}),(0,G.jsx)(X.Column,{children:t(`usageColCredits`)})]}),(0,G.jsxs)(X.Body,{children:[g.models.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs`,children:$V(e.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:cH(e.credits)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_.requests})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.cache_hit)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.cache_miss)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.output)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:$V(_.total_tokens)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-xs font-semibold`,children:cH(_.credits)})})]})]})]})})}):(0,G.jsx)(I7,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,G.jsx)(vh,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,G.jsxs)(vh.Item,{id:`deepseek-estimate`,children:[(0,G.jsx)(vh.Heading,{children:(0,G.jsxs)(vh.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),x?(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:oH(_.cost)}):null,(0,G.jsx)(vh.Indicator,{})]})}),(0,G.jsx)(vh.Panel,{children:(0,G.jsxs)(vh.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),x?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:`default`,children:oH(_.cost)})]}),(0,G.jsx)(v.Suspense,{fallback:(0,G.jsx)(Q,{className:`h-56 w-full`}),children:(0,G.jsx)(X9,{series:g.series,models:b.length?b:g.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,b.length?(0,G.jsx)(X,{children:(0,G.jsx)(X.ScrollContainer,{children:(0,G.jsxs)(X.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,G.jsxs)(X.Header,{children:[(0,G.jsx)(X.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,G.jsx)(X.Column,{children:t(`usageColSplit`)}),(0,G.jsx)(X.Column,{children:t(`usageColCost`)})]}),(0,G.jsxs)(X.Body,{children:[b.map(e=>(0,G.jsxs)(X.Row,{children:[(0,G.jsxs)(X.Cell,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[oH(e.cost_peak),` / `,oH(e.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:oH(e.cost)})})]},e.id)),(0,G.jsxs)(X.Row,{children:[(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[oH(_.cost_peak),` / `,oH(_.cost_off_peak)]})}),(0,G.jsx)(X.Cell,{children:(0,G.jsx)(`span`,{className:`mono text-sm font-semibold`,children:oH(_.cost)})})]})]})]})})}):(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,G.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,G.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,G.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(l?.models??[]).map(e=>(0,G.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,G.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[sH(e.off_peak.cache_hit),` · `,sH(e.off_peak.cache_miss),` · `,sH(e.off_peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,G.jsxs)(`div`,{className:`mono mt-0.5`,children:[sH(e.peak.cache_hit),` · `,sH(e.peak.cache_miss),` · `,sH(e.peak.output)]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),l?.models?.length?null:(0,G.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,G.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,G.jsx)(`p`,{children:t(`usagePeakNote`)}),g.unpriced?.length?(0,G.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:g.unpriced.join(`, `)})}):null,l?.note?(0,G.jsx)(`p`,{className:`mono text-[10px]`,children:l.note}):null]})]})]})})]})})]})}var gwe=500,_we={model:`model`,account:`account`,provider:`provider`};function vwe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[_we[t]]:e.key}}}function ywe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Z9(e){return e?e>=1e3?$V(e):String(Math.round(e*100)/100):`0`}function bwe(){let{t:e}=EI(),t=at(),[n,r]=On(),[i,a]=(0,v.useState)(`stats`),[o,s]=(0,v.useState)(`model`),[c,l]=(0,v.useState)(`today`),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)([]),[x,S]=(0,v.useState)(`count`),[C,w]=(0,v.useState)(`descending`),[T,E]=(0,v.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:D}=R9(),O=(0,v.useRef)(0),k=n.toString(),A=(0,v.useRef)(k);(0,v.useEffect)(()=>{k!==A.current&&(A.current=k,E(new URLSearchParams(k).get(`api_key`)??``))},[k]);let j=T?`api_key=${encodeURIComponent(T)}`:``;(0,v.useEffect)(()=>{j!==A.current&&(A.current=j,r(j,{replace:!0}))},[j,r]),(0,v.useEffect)(()=>{let e=!1;return PI(!1).then(t=>{e||b(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let M=u?.start?.toString()??``,N=u?.end?.toString()??``;(0,v.useEffect)(()=>{let e=vH(c,u);if(!e){h(!1);return}let t=++O.current;ZV({...e,dim:[o],limit:gwe,api_key:T||void 0}).then(e=>{t===O.current&&(p(e),_(``))}).catch(e=>{t===O.current&&(p(null),_(e instanceof Error?e.message:String(e)))}).finally(()=>{t===O.current&&h(!1)})},[o,c,M,N,T]);let P=(0,v.useMemo)(()=>{let t=new Map(y.map(e=>[e.id,e.name||e.id]));return ywe(((o===`model`?f?.models:o===`account`?f?.accounts:f?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):o===`account`?t.get(n.key)||n.key:o===`provider`?AH(n.key,e):n.key;return vwe(n,o,r)}),x,C)},[f,o,y,x,C,e]),F=f?.totals,I=f?.tokens;function L(e){if(!f||!e.filter)return;let n={...e.filter,api_key:T||void 0};t(bH(n,f.window.from,f.window.to))}let R=[{id:`label`,label:e(o===`model`?`logsColModel`:o===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],z=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,G.jsx)(yH,{value:c,onChange:l,custom:u,onCustomChange:d,onBusy:()=>h(!0),t:e})}),g?(0,G.jsx)(QI,{title:e(`failedStats`,{msg:g})}):null,(0,G.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),F?$V(F.requests):`—`,e(`statsWindowHint`,{window:e(_H[c])})],[e(`usageColSuccess`),F?nH(F.success_rate):`—`,F?`${F.ok} / ${F.requests}`:``],[e(`usageColTokens`),I?$V(I.total):`—`,I?`${$V(I.prompt)} / ${$V(I.completion)}`:``],[e(`usageColCacheWrite`),I?$V(I.cache_write??0):`—`,I?`${e(`chartCacheRead`)} ${$V(I.cache_read)}`:``],[e(`usageColCredits`),F?Z9(F.credits??0):`—`,``]].map(([e,t,n])=>(0,G.jsxs)(HS,{className:`gap-0 p-4`,children:[(0,G.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,G.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:m?(0,G.jsx)(Q,{className:`h-5 w-16`}):t}),(0,G.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:m?(0,G.jsx)(Q,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,G.jsx)(_j,{selectedKey:o,onSelectionChange:e=>{h(!0),s(String(e))},children:(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(gj,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(ji,{size:14}),e(`usageByModel`)]}),(0,G.jsxs)(gj,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(to,{size:14}),e(`usageByAccount`)]}),(0,G.jsxs)(gj,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),(0,G.jsx)(za,{size:14}),e(`usageByProvider`)]})]})})}),(0,G.jsx)(`span`,{className:`mono text-caption text-muted`,children:m?``:e(`usageRowCount`,{count:P.length})})]}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(Q,{className:`h-3 w-12`}),(0,G.jsx)(Q,{className:`h-4 w-16`})]},t))})]},t))}),(0,G.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,G.jsx)(Q,{className:`h-4 w-40`}),(0,G.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,G.jsx)(Q,{className:`h-4 w-14`},t))]},t))})]}):P.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,G.jsx)(pi,{size:16}),e(`usageEmpty`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:P.map(t=>{let n=!!(t.filter&&f),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:nH(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:eH(t.p95)},{label:e(`usageColTokens`),value:$V(t.tokens),sub:`${$V(t.prompt)} / ${$V(t.completion)}`},{label:e(`usageColCacheWrite`),value:$V(t.cache_write)},{label:e(`usageColCredits`),value:Z9(t.credits)}];return(0,G.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>L(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&t.filter?(0,G.jsx)(MH,{provider:t.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),o===`account`&&t.label!==t.key?(0,G.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,G.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,G.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,G.jsx)(X,{className:`usage-table hidden md:block`,children:(0,G.jsx)(X.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,G.jsxs)(X.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:x,direction:C},onSortChange:e=>{S(String(e.column)),w(e.direction)},children:[(0,G.jsx)(X.Header,{children:R.map(e=>(0,G.jsx)(X.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,G.jsx)(X.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,G.jsx)(X.Body,{children:P.map(e=>(0,G.jsxs)(X.Row,{id:e.key,className:e.filter&&f?`cursor-pointer`:void 0,onAction:e.filter&&f?()=>L(e):void 0,children:[(0,G.jsx)(X.Cell,{children:(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[o===`provider`&&e.filter?(0,G.jsx)(MH,{provider:e.key,size:14}):null,(0,G.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),o===`account`&&e.label!==e.key?(0,G.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:e.count}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:(0,G.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:nH(e.success)})}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:eH(e.p95)}),(0,G.jsxs)(X.Cell,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`mono text-body`,children:$V(e.tokens)}),(0,G.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[$V(e.prompt),` / `,$V(e.completion)]})]}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:$V(e.cache_write)}),(0,G.jsx)(X.Cell,{className:`mono text-right text-body`,children:Z9(e.credits)})]},e.key))})]})})})]})]}),(0,G.jsx)(lwe,{accounts:y,t:e})]});return(0,G.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(i===`cost`?`usageCostLead`:`usageLead`)})]}),(0,G.jsx)(L9,{ariaLabel:e(`logsColApiKey`),value:T,onChange:e=>{h(!0),E(e)},options:D,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,G.jsxs)(_j,{selectedKey:i,onSelectionChange:e=>a(String(e)),children:[(0,G.jsx)(_j.ListContainer,{className:`w-fit`,children:(0,G.jsxs)(_j.List,{"aria-label":e(`usageTitle`),children:[(0,G.jsxs)(gj,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,G.jsxs)(gj,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(_j.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,G.jsx)(_j.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:z}),(0,G.jsx)(_j.Panel,{id:`cost`,className:`pt-5`,children:(0,G.jsx)(hwe,{apiKeyFilter:T})})]})]})}var xwe=1.1;function Swe({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>{a.current?.kill()},[]),(0,G.jsxs)(PM,{delay:300,children:[(0,G.jsx)(PM.Trigger,{children:(0,G.jsxs)(J,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=Z.to(e,{scaleX:1,duration:xwe*(1-Number(Z.getProperty(e,`scaleX`))),ease:AV.linear,onComplete:()=>{a.current=null,Z.to(e,{scaleX:0,duration:jV()?0:kV.base,ease:AV.out,delay:kV.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,Z.to(e,{scaleX:0,duration:jV()?0:kV.base,ease:AV.soft}))},children:[(0,G.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,G.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,G.jsx)(PM.Content,{children:e})]})}function Cwe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function Q9(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?jH(r,i,t):AH(r,t)}function wwe(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function Twe(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Ewe(e,t){return e.length?e.map(e=>Q9(e,t)).join(` · `):t(`keysAllProviders`)}function Dwe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Owe(){let{t:e}=EI(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1);(0,v.useEffect)(()=>{UI().then(e=>{let t=Cwe(e.data||[]);n(t),i(t.length>0),o(``)}).catch(e=>{o(e instanceof Error?e.message:String(e))})},[]);async function w(){u(!0);try{let e=await N9();c(e.data||[]),m(``)}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}(0,v.useEffect)(()=>{let e=window.setTimeout(()=>void w(),0);return()=>window.clearTimeout(e)},[]);async function T(e){await Z7(e),C(!0),window.setTimeout(()=>C(!1),1200)}async function E(e,t){f(e.id),c(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await P9(e.id,{enabled:t});c(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){m(e instanceof Error?e.message:String(e)),await w()}finally{f(``)}}async function D(t){f(t.id);try{await UCe(t.id),c(e=>e.filter(e=>e.id!==t.id)),XV({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}return l&&!s.length?(0,G.jsx)(Lse,{}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`keysCreate`)]})]}),p?(0,G.jsx)(QI,{title:p}):null,a?(0,G.jsx)(QI,{title:e(`keysProvidersLoadFailed`,{message:a})}):null,l?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,s.length)},(e,t)=>(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,G.jsx)(Q,{className:`h-4 w-28`}),(0,G.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,G.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,G.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))}):s.length?(0,G.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:s.map(t=>(0,G.jsxs)(HS,{className:`overflow-hidden p-0`,children:[(0,G.jsxs)(HS.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(HS.Title,{className:`truncate text-body`,children:t.name})}),(0,G.jsx)(aC,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,G.jsxs)(HS.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,G.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:(t.providers.length?t.providers:[`all`]).map(t=>(0,G.jsx)(aC,{size:`sm`,variant:`soft`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,G.jsx)(ta,{size:12}):(0,G.jsx)(MH,{provider:wwe(t),size:12}),(0,G.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):Q9(t,e)})]})},t))}),(0,G.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t.last_used_at?e(`keysLastUsed`,{time:Dwe(t.last_used_at)}):e(`keysNeverUsed`)})]}),(0,G.jsxs)(HS.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,G.jsx)(J,{size:`sm`,variant:`ghost`,isDisabled:!r,onPress:()=>y(t),children:e(`edit`)}),(0,G.jsx)(Swe,{label:e(`holdToDelete`),isPending:d===t.id,onConfirm:()=>void D(t),children:(0,G.jsx)(qa,{size:14})}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(F7,{isSelected:t.enabled,isDisabled:d===t.id,ariaLabel:e(`enable`),onChange:e=>void E(t,e)})})]})]},t.id))}):(0,G.jsx)(I7,{className:`rounded-3xl bg-surface-secondary`,icon:(0,G.jsx)(PV,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,G.jsxs)(J,{size:`sm`,isDisabled:!r,onPress:()=>g(!0),children:[(0,G.jsx)(Ca,{size:14}),e(`keysCreate`)]})}),(0,G.jsx)($9,{isOpen:h,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>g(!1),onSave:async e=>{let t=await HCe(e);c(e=>[t,...e.map(e=>({...e,secret:void 0}))]),g(!1),x(t)}}),(0,G.jsx)($9,{isOpen:!!_,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:_,options:t,t:e,onClose:()=>y(null),onSave:async e=>{if(!_)return;let t=await P9(_.id,e);c(e=>e.map(e=>e.id===_.id?{...e,...t,secret:void 0}:e)),y(null)}}),(0,G.jsx)(Y.Root,{isOpen:!!b?.secret,onOpenChange:e=>{e||x(null)},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,children:(0,G.jsxs)(Y.Dialog,{children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,G.jsx)(Y.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`px-6 pb-2`,children:[(0,G.jsxs)(tF,{status:`warning`,className:`mb-4`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:e(`keysSecretOnce`)})})]}),(0,G.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:b?.secret})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,onPress:()=>x(null),children:e(`close`)}),(0,G.jsxs)(J,{onPress:()=>{b?.secret&&T(b.secret)},children:[(0,G.jsx)(Di,{size:14}),e(S?`copied`:`copy`)]})]})]})})})})]})}function $9({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[c,l]=(0,v.useState)(r?.name||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(new Set),[m,h]=(0,v.useState)(!0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(!e)return;l(r?.name||``),d(Twe(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));p(t),h(!0),_(``)},[r,e,i]);function x(e){let t=i.find(t=>t.value===e);h(!1),d(n=>n.includes(e)?(t&&p(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function S(e){e?.preventDefault();let t=c.trim();if(!t){_(a(`keysNameRequired`));return}if(!i.length){_(a(`keysProvidersNotLoaded`));return}b(!0),_(``);try{await s({name:t,providers:m?r?.providers||[]:u})}catch(e){_(e instanceof Error?e.message:String(e))}finally{b(!1)}}return(0,G.jsx)(Y.Root,{isOpen:e,onOpenChange:e=>{!e&&!y&&o()},children:(0,G.jsx)(Y.Backdrop,{variant:`blur`,children:(0,G.jsx)(Y.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,G.jsx)(Y.Dialog,{className:`sm:min-w-[32rem]`,children:(0,G.jsxs)(QP,{onSubmit:S,children:[(0,G.jsxs)(Y.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Y.Heading,{className:`text-section font-semibold`,children:t}),(0,G.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,G.jsx)(Y.CloseTrigger,{isDisabled:y,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,G.jsx)(ao,{size:18})})]}),(0,G.jsxs)(Y.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[g?(0,G.jsxs)(tF,{status:`danger`,children:[(0,G.jsx)(tF.Indicator,{}),(0,G.jsx)(tF.Content,{children:(0,G.jsx)(tF.Title,{children:g})})]}):null,(0,G.jsx)(_9,{label:a(`keysName`),children:(0,G.jsx)(UM,{value:c,onChange:e=>l(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(IN,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,G.jsx)(RN,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,G.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=u.includes(e.value),n=f.has(e.provider);return(0,G.jsx)(tC,{isSelected:t,onChange:()=>x(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,G.jsxs)(tC.Content,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(tC.Control,{children:(0,G.jsx)(tC.Indicator,{})}),(0,G.jsx)(MH,{provider:e.provider,size:16}),(0,G.jsx)(`span`,{className:`text-body font-medium`,children:jH(e.provider,e.region,a)}),n?(0,G.jsx)(`span`,{className:`rounded-md bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,G.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,G.jsx)(`p`,{className:`text-caption text-muted`,children:Ewe(u,a)})]})]}),(0,G.jsxs)(Y.Footer,{className:`justify-end`,children:[(0,G.jsx)(J,{variant:`ghost`,isDisabled:y,onPress:o,children:a(`cancel`)}),(0,G.jsx)(J,{type:`submit`,isPending:y,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}function kwe(){return(0,G.jsx)(Soe,{children:(0,G.jsx)(noe,{children:(0,G.jsx)(roe,{children:(0,G.jsx)(boe,{children:(0,G.jsx)(xn,{children:(0,G.jsxs)(Pt,{children:[(0,G.jsx)(Mt,{path:`/login`,element:(0,G.jsx)(VCe,{})}),(0,G.jsx)(Mt,{element:(0,G.jsx)(ace,{}),children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(ice,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(rSe,{})}),(0,G.jsx)(Mt,{path:`/auth`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/providers`,element:(0,G.jsx)(fSe,{})}),(0,G.jsx)(Mt,{path:`/access`,element:(0,G.jsx)(zSe,{})}),(0,G.jsx)(Mt,{path:`/accounts`,element:(0,G.jsx)(BCe,{})}),(0,G.jsx)(Mt,{path:`/checkins`,element:(0,G.jsx)(At,{to:`/accounts`,replace:!0})}),(0,G.jsx)(Mt,{path:`/usage`,element:(0,G.jsx)(bwe,{})}),(0,G.jsx)(Mt,{path:`/logs`,element:(0,G.jsx)(swe,{})}),(0,G.jsx)(Mt,{path:`/keys`,element:(0,G.jsx)(Owe,{})}),(0,G.jsx)(Mt,{path:`/system`,element:(0,G.jsx)(ZCe,{})}),(0,G.jsx)(Mt,{path:`*`,element:(0,G.jsx)(At,{to:`/`,replace:!0})})]})})]})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(v.StrictMode,{children:(0,G.jsx)(kwe,{})}));export{MJ as $,xU as $t,Mhe as A,MW as At,c4 as B,mW as Bt,w6 as C,h as Cn,FW as Ct,b3 as D,gW as Dt,fge as E,xW as Et,U4 as F,yW as Ft,uZ as G,EW as Gt,b2 as H,DW as Ht,W4 as I,hW as It,WX as J,uW as Jt,XX as K,fW as Kt,Gme as L,CW as Lt,Phe as M,AW as Mt,Nhe as N,jW as Nt,Xhe as O,wW as Ot,t3 as P,kW as Pt,cY as Q,yU as Qt,Bme as R,pW as Rt,O6 as S,xs as Sn,IW as St,y6 as T,l as Tn,SW as Tt,a2 as U,OW as Ut,s4 as V,_W as Vt,JZ as W,TW as Wt,_Y as X,Nle as Xt,MY as Y,lW as Yt,gY as Z,_U as Zt,R6 as _,$V as _n,$ as _t,a5 as a,uU as an,EJ as at,A6 as b,Z as bn,RW as bt,z8 as c,iU as cn,yq as ct,y8 as d,ZH as dn,lq as dt,hU as en,jJ as et,n8 as f,YH as fn,xq as ft,V6 as g,oH as gn,XW as gt,W6 as h,fH as hn,rq as ht,p5 as i,lU as in,DJ as it,l3 as j,NW as jt,h3 as k,vW as kt,F8 as l,rU as ln,pq as lt,J6 as m,pH as mn,sq as mt,d7 as n,dU as nn,AJ as nt,V8 as o,cU as on,Zq as ot,$6 as p,XH as pn,oq as pt,QX as q,dW as qt,v5 as r,wU as rn,kJ as rt,B8 as s,sU as sn,Gq as st,f7 as t,mU as tn,NJ as tt,D8 as u,tU as un,cq as ut,L6 as v,cH as vn,BW as vt,g6 as w,d as wn,Vle as wt,k6 as x,Mc as xn,LW as xt,M6 as y,eH as yn,HW as yt,Rme as z,bW as zt}; \ No newline at end of file diff --git a/internal/webui/static/index.html b/internal/webui/static/index.html index 8b873e8d..e874cea0 100644 --- a/internal/webui/static/index.html +++ b/internal/webui/static/index.html @@ -19,7 +19,7 @@ - + From ff19ed812b4dac1c392185a379db646ead87c27b Mon Sep 17 00:00:00 2001 From: caigee-cmd <210803857+caigee-cmd@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:08:23 +0800 Subject: [PATCH 2/6] fix(overview): per-slot model + elapsed, GSAP slide into cell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Queue→slot fly uses GSAP MotionPath arc into data-cell-id (滑过去槽里). /api/live occupancy from BoundRequests maps each in-flight request to a concurrency cell with RequestedModel and Bind started_at — SlotBar shows model + seconds per cell, not one account timer. --- .../unreleased/inflight-queue-visible.md | 6 +- frontend/scripts/mockInflight.test.ts | 73 ++++ frontend/src/api/live.ts | 16 +- .../components/overview/InflightLiveCard.tsx | 331 ++++++++++-------- frontend/src/lib/mockInflight.ts | 260 ++++++++++---- internal/console/live.go | 41 ++- internal/console/live_test.go | 6 + internal/logs/recent_completions_test.go | 43 +++ internal/logs/recorder.go | 46 +++ ...-CVf7FMre.js => CartesianGrid-BOtlDYoa.js} | 2 +- ...hart-DFXT-jhI.js => CostChart-Civqr14B.js} | 2 +- ...-DEWBslJX.js => LiveSparkline-B8h_bbaq.js} | 2 +- ...t-BzzCMmSh.js => TrafficChart-AulTONmo.js} | 2 +- .../webui/static/assets/index-AMFtT_NW.js | 174 +++++++++ .../webui/static/assets/index-CYQcpZwf.js | 174 --------- ...{index-CfGlqbnH.css => index-DNPGmypW.css} | 2 +- internal/webui/static/index.html | 4 +- 17 files changed, 774 insertions(+), 410 deletions(-) rename internal/webui/static/assets/{CartesianGrid-CVf7FMre.js => CartesianGrid-BOtlDYoa.js} (99%) rename internal/webui/static/assets/{CostChart-DFXT-jhI.js => CostChart-Civqr14B.js} (96%) rename internal/webui/static/assets/{LiveSparkline-DEWBslJX.js => LiveSparkline-B8h_bbaq.js} (80%) rename internal/webui/static/assets/{TrafficChart-BzzCMmSh.js => TrafficChart-AulTONmo.js} (99%) create mode 100644 internal/webui/static/assets/index-AMFtT_NW.js delete mode 100644 internal/webui/static/assets/index-CYQcpZwf.js rename internal/webui/static/assets/{index-CfGlqbnH.css => index-DNPGmypW.css} (85%) diff --git a/changelog/unreleased/inflight-queue-visible.md b/changelog/unreleased/inflight-queue-visible.md index 960439cb..a6476232 100644 --- a/changelog/unreleased/inflight-queue-visible.md +++ b/changelog/unreleased/inflight-queue-visible.md @@ -1,9 +1,11 @@ ### English - Overview InflightLiveCard selecting (选号) wait rail is visible again: expanded `/api/live` poll speeds up to 400ms, selecting display dwell is 1.6s (Acquire still immediate), and bound-within-dwell queue items keep `account_id` so pills can fly into the account slot. -- Live queue→slot fly-in no longer depends on matching mock job ids — leaving the wait rail targets the bind account (or a single newly busy slot). +- Live queue→slot fly-in no longer depends on matching mock job ids — leaving the wait rail targets the bind account (or a single newly busy slot). GSAP MotionPath gives a horizontal arc **slide into the concurrency cell** (not a teleport). +- `/api/live` adds `occupancy` from recorder BoundRequests: each in-flight request maps to a concurrency cell with its own model name and Bind `started_at`. Slot bar shows model + elapsed **per cell**, not one timer for the whole account. ### 中文 - Overview「实时进行中」选号/排队重新可见:面板展开时 `/api/live` 轮询加快到 400ms,选号展示保留约 1.6s(Acquire 仍不拖延),dwell 内已 Bind 的队列项保留 `account_id`,便于飞入账号槽位。 -- 排队→槽位飞入不再依赖 mock 同 id;离开等待轨时按 Bind 账号(或唯一新忙槽)落点。 +- 排队→槽位飞入不再依赖 mock 同 id;离开等待轨时按 Bind 账号(或唯一新忙槽)落点。GSAP MotionPath 做横向弧线 **滑入对应并发格子**(不是瞬移)。 +- `/api/live` 增加 `occupancy`(recorder BoundRequests):每个在途请求对应一个并发格,带模型名与 Bind `started_at`。槽位条按格子展示模型与秒数,**不再整账号共用一个计时**。 diff --git a/frontend/scripts/mockInflight.test.ts b/frontend/scripts/mockInflight.test.ts index 4f67ce57..4884c53b 100644 --- a/frontend/scripts/mockInflight.test.ts +++ b/frontend/scripts/mockInflight.test.ts @@ -383,3 +383,76 @@ run('liveHasSignal true when only queue present', () => { true, ) }) + +run('applyLiveProjection occupancy maps per-cell model and started_at', () => { + const t0 = new Date(Date.now() - 8_000).toISOString() + const t1 = new Date(Date.now() - 3_000).toISOString() + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 2, + rpm: 1, + workers: [ + { + id: 'acc-m', + name: 'wb-m', + provider: 'workbuddy', + busy: true, + progress: 0.5, + rate_limited: false, + max_inflight: 4, + in_flight: 2, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + occupancy: [ + { id: 'req-a', name: 'claude-sonnet', status: 'started', started_at: t0, account_id: 'acc-m' }, + { id: 'req-b', name: 'gpt-4.1', status: 'started', started_at: t1, account_id: 'acc-m' }, + ], + }) + const w = snap.workers.find((x) => x.id === 'acc-m') + assert.ok(w) + assert.equal(w.cells?.length, 2) + assert.equal(w.cells?.[0].id, 'req-a') + assert.equal(w.cells?.[0].name, 'claude-sonnet') + assert.equal(w.cells?.[1].id, 'req-b') + assert.equal(w.cells?.[1].name, 'gpt-4.1') + assert.ok((w.cells?.[0].elapsedMs ?? 0) >= 7_000) + assert.ok((w.cells?.[1].elapsedMs ?? 0) >= 2_000) + assert.ok((w.cells?.[0].elapsedMs ?? 0) > (w.cells?.[1].elapsedMs ?? 0)) + const running = snap.jobs.filter((j) => j.status === 'running') + assert.equal(running.length, 2) + assert.equal(running[0].id, 'req-a') + assert.equal(running[1].name, 'gpt-4.1') +}) + +run('applyLiveProjection occupancy dwell stays on queue not double-running', () => { + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 1, + rpm: 1, + workers: [ + { + id: 'acc-d', + name: 'wb-d', + provider: 'workbuddy', + busy: true, + progress: 0.4, + rate_limited: false, + max_inflight: 2, + in_flight: 1, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + queue: [{ id: 'req-dwell', name: 'sonnet', status: 'started', account_id: 'acc-d' }], + occupancy: [{ id: 'req-dwell', name: 'sonnet', status: 'started', account_id: 'acc-d' }], + }) + const queued = snap.jobs.filter((j) => j.status === 'queued') + const running = snap.jobs.filter((j) => j.status === 'running') + assert.equal(queued.length, 1) + assert.equal(queued[0].id, 'req-dwell') + assert.equal(running.length, 0) + const w = snap.workers.find((x) => x.id === 'acc-d') + assert.equal(w?.cells?.length, 1) + assert.equal(w?.cells?.[0].id, 'req-dwell') + assert.equal(w?.cells?.[0].name, 'sonnet') +}) diff --git a/frontend/src/api/live.ts b/frontend/src/api/live.ts index 3a30f247..7e93db75 100644 --- a/frontend/src/api/live.ts +++ b/frontend/src/api/live.ts @@ -21,23 +21,25 @@ export type LiveWorker = { /** Terminal request finish drained this /api/live poll (Done vs Failed fly-out). */ export type LiveCompletion = { + /** Open request id — per-cell Done/Failed fly-out. */ + request_id?: string account_id: string /** ok | error | incomplete | canceled */ status: string } /** - * Selecting (选号) request for the InflightLiveCard waiting rail. - * status reuses request_logs RequestStatus* (typically started) — not a new machine. + * Selecting (选号) or bound occupancy request for InflightLiveCard. + * status reuses request_logs RequestStatus* — not a new machine. */ export type LiveJob = { id: string name: string - /** RequestStatus* from recorder (started while selecting). */ + /** RequestStatus* from recorder (started while selecting / bound). */ status: string - /** RFC3339 Prepare/Start time. */ + /** RFC3339: queue = Prepare/Start; occupancy = Bind (slot entry). */ started_at?: string - /** Set during selectingMinDwell after Bind — queue→slot fly target. */ + /** Queue: dwell fly target. Occupancy: always set (cell owner). */ account_id?: string } @@ -77,8 +79,10 @@ export type LiveSnapshot = { sticky: LiveSticky /** Terminal finishes since last poll — InflightLiveCard routes fly-outs. */ recent_completions?: LiveCompletion[] - /** Prepare→Acquire 选号 (RequestStatusStarted, no pool bind). */ + /** Prepare→Acquire 选号 (RequestStatusStarted / dwell). */ queue?: LiveJob[] + /** Bound open requests — one per concurrency cell (model + per-cell started_at). */ + occupancy?: LiveJob[] } export function fetchLive() { diff --git a/frontend/src/components/overview/InflightLiveCard.tsx b/frontend/src/components/overview/InflightLiveCard.tsx index 62244e0b..48a8e7c3 100644 --- a/frontend/src/components/overview/InflightLiveCard.tsx +++ b/frontend/src/components/overview/InflightLiveCard.tsx @@ -4,6 +4,7 @@ import { Card } from '@heroui/react' import { ArrowUpRight, CaretRight, Check, X } from '@phosphor-icons/react' import type { LiveSnapshot, LiveSticky } from '@/api/live' import CustomEase from 'gsap/CustomEase' +import { MotionPathPlugin } from 'gsap/MotionPathPlugin' import { Area, AreaChart, @@ -29,10 +30,13 @@ import { CountUp } from '@/components/overview/CountUp' import { ProviderMark } from '@/components/ProviderMark' import { duration, ease, gsap, motionDuration, prefersReducedMotion } from '@/lib/motion' -gsap.registerPlugin(CustomEase) +gsap.registerPlugin(CustomEase, MotionPathPlugin) const queueEase = CustomEase.get('inflightQueue') || CustomEase.create('inflightQueue', '0.22, 1, 0.36, 1') +const slideEase = + CustomEase.get('inflightSlide') || + CustomEase.create('inflightSlide', '0.16, 1, 0.3, 1') /** AffectUI overflow: first N queue pills; rest as kind-colored dots. */ const QUEUE_PILL_MAX = 3 @@ -201,16 +205,17 @@ function DepthChart({ function SlotBar({ slot, - job, + jobById, clockMs, idleLabel, }: { slot: MockAccountSlot - job?: MockInflightJob + jobById: Map clockMs: number idleLabel: string }) { - // In-progress only: no rate-limit / cooldown amber or remaining-time annotations. + // In-progress only: no rate-limit / cooldown amber. Per-cell model + elapsed + // (not one timer for the whole account) when concurrency > 1. const concurrency = clampSlotConcurrency(slot.concurrency ?? 1) const occupiedRaw = slot.inFlight != null @@ -220,9 +225,9 @@ function SlotBar({ : 0 const occupied = Math.min(concurrency, occupiedRaw) const running = occupied > 0 - const label = job?.name ?? idleLabel - const elapsed = jobElapsedMs(job, clockMs) - const cells = Array.from({ length: concurrency }, (_, i) => i < occupied) + const occCells = (slot.cells ?? []).slice(0, occupied) + const titleBits = occCells.map((c) => `${c.name} ${formatElapsed(Math.max(0, clockMs - c.startedAtMs))}`) + const title = `${slot.name} · ${occupied}/${concurrency}${titleBits.length ? ` · ${titleBits.join(', ')}` : ''}` return (
- {/* ProviderMark blends with slot wash — no contrasting wash (same as Overview accounts / supplier tiles). */} - + {slot.name} - {/* Job pill — AffectUI worker row: kind wash + concurrency segments + elapsed */} - - {job ? ( - - ) : null} - {label} - - {/* N equal cells = account concurrency; occupied cells wash + shimmer. */} + {/* N equal cells = account concurrency; each occupied cell shows model + own seconds. */}
- {cells.map((filled, i) => ( -
- {running && filled ? ( - <> - - - - - ) : null} -
- ))} + {Array.from({ length: concurrency }, (_, i) => { + const cell = occCells[i] + const filled = Boolean(cell) + const job = cell ? jobById.get(cell.id) : undefined + const elapsed = cell + ? Math.max(0, clockMs - cell.startedAtMs) + : 0 + const model = cell?.name || idleLabel + return ( +
+ {filled ? ( + <> + + + {job ? ( + + ) : null} + + {model} + + + + {formatElapsed(elapsed)} + + + ) : ( + — + )} +
+ ) + })}
- - {job || occupied > 0 ? ( - formatElapsed(elapsed) - ) : ( - — - )} -
) } @@ -634,6 +627,11 @@ export function InflightLiveCard({ const id = el.getAttribute('data-slot-id') if (id) slotR[id] = el.getBoundingClientRect() }) + // Per-cell rects keyed by request id for queue→slot slide landings. + root.querySelectorAll('[data-cell-id]').forEach((el) => { + const id = el.getAttribute('data-cell-id') + if (id) slotR[`cell:${id}`] = el.getBoundingClientRect() + }) rectCache.current = { wait, slot: slotR, @@ -723,19 +721,25 @@ export function InflightLiveCard({ const trailShadow = `inset 0 1px 0 var(--surface-rim), 0 0 14px color-mix(in oklab, ${glowToken} 48%, transparent), 0 0 28px color-mix(in oklab, ${glowToken} 28%, transparent)` - const w = Math.max(a.width, 88) - const h = Math.max(a.height, 26) - // Beat center of the target (slot / Done / Failed). - const targetLeft = b.left + Math.max(0, (b.width - w * 0.92) / 2) - const targetTop = b.top + Math.max(0, (b.height - h) / 2) + const intoSlot = tone === 'run' + // Slot land: shrink toward the concurrency cell; outcomes keep pill size. + const w = intoSlot ? Math.max(a.width, 72) : Math.max(a.width, 88) + const h = intoSlot ? Math.max(a.height, 22) : Math.max(a.height, 26) + const endW = intoSlot ? Math.max(b.width, 40) : undefined + const endH = intoSlot ? Math.max(b.height, 22) : undefined + // Beat center of the target (cell / slot / Done / Failed). + const targetW = endW ?? w * 0.92 + const targetH = endH ?? h + const targetLeft = b.left + Math.max(0, (b.width - targetW) / 2) + const targetTop = b.top + Math.max(0, (b.height - targetH) / 2) // Outcome fly: settle slightly short of the button — don't dive into the control. const settle = tone === 'ok' || tone === 'danger' ? 0.86 : 1 const endLeft = a.left + (targetLeft - a.left) * settle const endTop = a.top + (targetTop - a.top) * settle - // Slightly longer than layout 560ms so the horizontal path reads clearly. - const flyDur = motionDuration(0.72) - const holdDur = motionDuration(0.16) - const fadeDur = motionDuration(0.14) + // Queue→slot: longer horizontal slide so it reads as 滑过去槽里. + const flyDur = motionDuration(intoSlot ? 0.88 : 0.72) + const holdDur = motionDuration(intoSlot ? 0.12 : 0.16) + const fadeDur = motionDuration(intoSlot ? 0.18 : 0.14) const makePill = (opts: { opacity: number; asTrail?: boolean }) => { const el = document.createElement('div') @@ -795,45 +799,95 @@ export function InflightLiveCard({ // Slot→slot / retry: mild shrink. Slot→Done/Failed: shrink hard toward the // outcome control so the flying pill does not stay slot-sized and ugly. const toOutcome = tone === 'ok' || tone === 'danger' - const endW = toOutcome ? w * 0.55 : w * 0.92 - const flyScale = tone === 'run' || tone === 'retry' ? 0.96 : 0.42 - const fadeScale = tone === 'run' || tone === 'retry' ? 0.9 : 0.28 + const outcomeEndW = toOutcome ? w * 0.55 : w * 0.92 + const landW = intoSlot ? (endW as number) : outcomeEndW + const flyScale = intoSlot ? 1 : tone === 'retry' ? 0.96 : 0.42 + const fadeScale = intoSlot ? 0.82 : tone === 'retry' ? 0.9 : 0.28 const ghost = makePill({ opacity: 1 }) - gsap.set(ghost, { transformOrigin: 'center center' }) + gsap.set(ghost, { transformOrigin: 'center center', x: 0, y: 0 }) + const dx = endLeft - a.left + const dy = endTop - a.top + // Soft arc above the straight line — horizontal slide into the cell. + const arc = intoSlot ? -Math.min(42, 14 + Math.abs(dx) * 0.1) : 0 + // 3 residual afterimages — stagger behind the lead pill (AffectUI trail). const trails = [0.72, 0.46, 0.26].map((op, i) => { - const t = makePill({ opacity: op, asTrail: true }) - gsap.set(t, { transformOrigin: 'center center' }) - gsap.to(t, { - left: endLeft, - top: endTop, - width: endW, - // Outcome trail shrinks with the lead; run trail keeps a motion stretch. - ...(toOutcome - ? { scale: flyScale * (0.92 - i * 0.08) } - : { scaleX: 1.28 + i * 0.1 }), - opacity: 0, - duration: flyDur, - delay: motionDuration(0.04 + i * 0.045), - ease: queueEase, - force3D: true, - onComplete: () => t.remove(), - }) - return t + const tr = makePill({ opacity: op, asTrail: true }) + gsap.set(tr, { transformOrigin: 'center center', x: 0, y: 0 }) + if (intoSlot) { + gsap.to(tr, { + motionPath: { + path: [ + { x: 0, y: 0 }, + { x: dx * 0.45, y: dy * 0.35 + arc }, + { x: dx, y: dy }, + ], + curviness: 1.35, + autoRotate: false, + }, + width: landW, + height: endH, + scaleX: 1.18 + i * 0.08, + opacity: 0, + duration: flyDur, + delay: motionDuration(0.05 + i * 0.05), + ease: slideEase, + force3D: true, + onComplete: () => tr.remove(), + }) + } else { + gsap.to(tr, { + left: endLeft, + top: endTop, + width: landW, + ...(toOutcome + ? { scale: flyScale * (0.92 - i * 0.08) } + : { scaleX: 1.28 + i * 0.1 }), + opacity: 0, + duration: flyDur, + delay: motionDuration(0.04 + i * 0.045), + ease: queueEase, + force3D: true, + onComplete: () => tr.remove(), + }) + } + return tr }) void trails + const leadVars = intoSlot + ? { + motionPath: { + path: [ + { x: 0, y: 0 }, + { x: dx * 0.45, y: dy * 0.35 + arc }, + { x: dx, y: dy }, + ], + curviness: 1.35, + autoRotate: false, + }, + width: landW, + height: endH, + scale: flyScale, + opacity: 1, + duration: flyDur, + ease: slideEase, + force3D: true, + } + : { + left: endLeft, + top: endTop, + width: landW, + scale: flyScale, + opacity: 1, + duration: flyDur, + ease: queueEase, + force3D: true, + } + gsap.to(ghost, { - left: endLeft, - top: endTop, - width: endW, - scale: flyScale, - // Keep the lead pill opaque for the whole flight — only fade after a short land hold. - opacity: 1, - duration: flyDur, - ease: queueEase, - force3D: true, + ...leadVars, onComplete: () => { // Settle: hairline flash, then playful left-right wiggle + scale // (stuffed-into the Done/Failed pill). Keep shrink fly above. @@ -907,43 +961,36 @@ export function InflightLiveCard({ flewFromQueue.add(id) const fromRect = cache.wait[id] const toEl = root.querySelector(`[data-slot-id="${CSS.escape(workerId)}"]`) - const toRect = toEl?.getBoundingClientRect() ?? cache.slot[workerId] - const wasBusy = Boolean(prev.workers.find((w) => w.id === workerId)?.busy) - const landPill = toEl?.querySelector('[data-slot-job-pill]') ?? null - const landFills = toEl - ? Array.from(toEl.querySelectorAll('[data-slot-fill]')) - : [] - // Only hide occupy chrome when the slot was idle — dwell already shows busy. - if (!wasBusy) { - if (landPill) gsap.set(landPill, { opacity: 0, scale: 0.85 }) - landFills.forEach((el) => - gsap.set(el, { opacity: 0, scaleX: 0.35, transformOrigin: 'left center' }), - ) + // Prefer the specific concurrency cell for this request — 滑过去槽里. + const cellEl = + toEl?.querySelector(`[data-cell-id="${CSS.escape(id)}"]`) ?? + toEl?.querySelector('[data-slot-fill]:last-of-type') ?? + null + const toRect = + cellEl?.getBoundingClientRect() ?? + toEl?.getBoundingClientRect() ?? + cache.slot[workerId] + const prevWorker = prev.workers.find((w) => w.id === workerId) + const prevCellIds = new Set((prevWorker?.cells ?? []).map((c) => c.id)) + const isNewCell = !prevCellIds.has(id) + const landCell = cellEl + // Hide the landing cell chrome until the ghost arrives (new cell only). + if (isNewCell && landCell) { + gsap.set(landCell, { opacity: 0, scale: 0.72, transformOrigin: 'left center' }) } flyGhost(fromRect, toRect, label, kind, 'run', null, () => { if (!toEl) return gsap.fromTo( toEl, - { filter: 'brightness(1.35)' }, - { filter: 'brightness(1)', duration: motionDuration(0.42), ease: ease.soft }, + { filter: 'brightness(1.28)' }, + { filter: 'brightness(1)', duration: motionDuration(0.48), ease: ease.soft }, ) - if (!wasBusy && landPill) { - gsap.to(landPill, { + if (isNewCell && landCell) { + gsap.to(landCell, { opacity: 1, scale: 1, - duration: motionDuration(0.42), - ease: queueEase, - }) - } - if (!wasBusy) { - landFills.forEach((el, i) => { - gsap.to(el, { - opacity: 1, - scaleX: 1, - duration: motionDuration(0.56), - ease: queueEase, - delay: motionDuration(i * 0.03), - }) + duration: motionDuration(0.48), + ease: slideEase, }) } }) @@ -1014,7 +1061,9 @@ export function InflightLiveCard({ if (before.status !== 'running') continue const still = nextJobs.get(id) const workerId = prevWorkerOf.get(id) - const fromRect = workerId ? cache.slot[workerId] : undefined + const fromRect = + cache.slot[`cell:${id}`] ?? + (workerId ? cache.slot[workerId] : undefined) // Retry: running → queued (AffectUI: retry slides back). if (still && still.status === 'queued') { @@ -1330,7 +1379,7 @@ export function InflightLiveCard({ diff --git a/frontend/src/lib/mockInflight.ts b/frontend/src/lib/mockInflight.ts index 11dfae05..feff5dec 100644 --- a/frontend/src/lib/mockInflight.ts +++ b/frontend/src/lib/mockInflight.ts @@ -41,6 +41,16 @@ export type MockInflightJob = { attempt?: number } +/** One occupied concurrency cell on an account slot bar. */ +export type MockSlotCell = { + id: string + /** Requested model / short label. */ + name: string + /** Wall-clock when this request entered the slot (Bind). */ + startedAtMs: number + elapsedMs: number +} + export type MockAccountSlot = { id: string /** Account display name. */ @@ -60,6 +70,8 @@ export type MockAccountSlot = { concurrency?: number /** Current occupied concurrency cells (in_flight). */ inFlight?: number + /** Per-cell model + elapsed (length ≤ inFlight). */ + cells?: MockSlotCell[] } export type MockRateLimitWindow = { @@ -110,18 +122,40 @@ export const MOCK_INFLIGHT: MockInflightSnapshot = { waitP95Ms: 2800, totals: { done: 186, failed: 4 }, workers: [ - { id: 'acc-wb-a1', name: 'wb-a1', provider: 'workbuddy', busy: true, progress: 0.72, jobId: 'j1', concurrency: 4, inFlight: 3 }, - { id: 'acc-wb-a2', name: 'wb-a2', provider: 'workbuddy', busy: true, progress: 0.41, jobId: 'j2', rateLimited: true, concurrency: 2, inFlight: 1 }, - { id: 'acc-qd-b1', name: 'qd-b1', provider: 'qoder', busy: true, progress: 0.88, jobId: 'j3', concurrency: 1, inFlight: 1 }, - { id: 'acc-qd-b2', name: 'qd-b2', provider: 'qoder', busy: false, progress: 0, concurrency: 4, inFlight: 0 }, - { id: 'acc-trae-c1', name: 'trae-c1', provider: 'trae', busy: true, progress: 0.23, jobId: 'j4', concurrency: 3, inFlight: 2 }, - { id: 'acc-codex-d1', name: 'codex-d1', provider: 'codex', busy: false, progress: 0, rateLimited: true, concurrency: 2, inFlight: 0 }, + { + id: 'acc-wb-a1', name: 'wb-a1', provider: 'workbuddy', busy: true, progress: 0.72, jobId: 'j1', concurrency: 4, inFlight: 3, + cells: [ + { id: 'j1', name: 'chat · sonnet', startedAtMs: 0, elapsedMs: 11_200 }, + { id: 'j1b', name: 'chat · opus', startedAtMs: 0, elapsedMs: 8400 }, + { id: 'j1c', name: 'embed · idx', startedAtMs: 0, elapsedMs: 4100 }, + ], + }, + { + id: 'acc-wb-a2', name: 'wb-a2', provider: 'workbuddy', busy: true, progress: 0.41, jobId: 'j2', rateLimited: true, concurrency: 2, inFlight: 1, + cells: [{ id: 'j2', name: 'embed · batch', startedAtMs: 0, elapsedMs: 9400 }], + }, + { + id: 'acc-qd-b1', name: 'qd-b1', provider: 'qoder', busy: true, progress: 0.88, jobId: 'j3', concurrency: 1, inFlight: 1, + cells: [{ id: 'j3', name: 'chat · gpt', startedAtMs: 0, elapsedMs: 6200 }], + }, + { id: 'acc-qd-b2', name: 'qd-b2', provider: 'qoder', busy: false, progress: 0, concurrency: 4, inFlight: 0, cells: [] }, + { + id: 'acc-trae-c1', name: 'trae-c1', provider: 'trae', busy: true, progress: 0.23, jobId: 'j4', concurrency: 3, inFlight: 2, + cells: [ + { id: 'j4', name: 'tools · patch', startedAtMs: 0, elapsedMs: 3100 }, + { id: 'j4b', name: 'chat · flash', startedAtMs: 0, elapsedMs: 1800 }, + ], + }, + { id: 'acc-codex-d1', name: 'codex-d1', provider: 'codex', busy: false, progress: 0, rateLimited: true, concurrency: 2, inFlight: 0, cells: [] }, ], jobs: [ { id: 'j1', name: 'chat · sonnet', kind: 'chat', status: 'running', accountId: 'acc-wb-a1', progress: 0.72, elapsedMs: 11_200, sticky: true }, + { id: 'j1b', name: 'chat · opus', kind: 'chat', status: 'running', accountId: 'acc-wb-a1', progress: 0.55, elapsedMs: 8400 }, + { id: 'j1c', name: 'embed · idx', kind: 'embed', status: 'running', accountId: 'acc-wb-a1', progress: 0.3, elapsedMs: 4100 }, { id: 'j2', name: 'embed · batch', kind: 'embed', status: 'running', accountId: 'acc-wb-a2', progress: 0.41, elapsedMs: 9400 }, { id: 'j3', name: 'chat · gpt', kind: 'chat', status: 'running', accountId: 'acc-qd-b1', progress: 0.88, elapsedMs: 6200 }, { id: 'j4', name: 'tools · patch', kind: 'tools', status: 'running', accountId: 'acc-trae-c1', progress: 0.23, elapsedMs: 3100 }, + { id: 'j4b', name: 'chat · flash', kind: 'chat', status: 'running', accountId: 'acc-trae-c1', progress: 0.15, elapsedMs: 1800 }, { id: 'j5', name: 'chat · wait', kind: 'chat', status: 'queued', progress: 0, elapsedMs: 7200 }, { id: 'j6', name: 'retry · cool', kind: 'chat', status: 'queued', progress: 0, elapsedMs: 5100 }, { id: 'j7', name: 'chat · sticky', kind: 'chat', status: 'queued', progress: 0, elapsedMs: 2800, sticky: true, priority: 'high' }, @@ -153,7 +187,10 @@ let seq = 100 export function cloneMockInflight(snap: MockInflightSnapshot = MOCK_INFLIGHT): MockInflightSnapshot { return { ...snap, - workers: snap.workers.map((w) => ({ ...w })), + workers: snap.workers.map((w) => ({ + ...w, + cells: w.cells?.map((c) => ({ ...c })), + })), jobs: snap.jobs.map((j) => ({ ...j })), rateLimits: snap.rateLimits.map((r) => ({ ...r })), depthSeries: [...snap.depthSeries], @@ -190,12 +227,20 @@ export function tickMockInflight(prev: MockInflightSnapshot, dtMs: number): Mock const jobById = new Map(next.jobs.map((j) => [j.id, j])) - // Progress + elapsed on busy non-frozen slots. + // Progress + elapsed on busy non-frozen slots (per-cell timers too). for (const w of next.workers) { + if (w.cells?.length) { + for (const c of w.cells) c.elapsedMs += dt + } if (!w.busy || !w.jobId) continue const job = jobById.get(w.jobId) if (!job || job.status !== 'running') continue job.elapsedMs += dt + // Keep sibling cell jobs' elapsed in sync with cells when present. + for (const c of w.cells ?? []) { + const cj = jobById.get(c.id) + if (cj && cj.status === 'running' && cj.id !== job.id) cj.elapsedMs = c.elapsedMs + } if (w.rateLimited) { // Amber freeze — no progress (AffectUI: bars stop + amber). continue @@ -223,6 +268,7 @@ export function tickMockInflight(prev: MockInflightSnapshot, dtMs: number): Mock w.progress = 0 w.jobId = undefined w.inFlight = 0 + w.cells = [] job.accountId = undefined if (f.ok) { job.status = 'done' @@ -279,7 +325,9 @@ export function tickMockInflight(prev: MockInflightSnapshot, dtMs: number): Mock w.progress = 0.04 w.jobId = job.id const cap = clampSlotConcurrency(w.concurrency ?? 1) - w.inFlight = Math.min(cap, Math.max(1, w.inFlight ?? 1)) + w.inFlight = Math.min(cap, Math.max(1, (w.inFlight ?? 0) + 1)) + const cell = { id: job.id, name: job.name, startedAtMs: Date.now(), elapsedMs: 0 } + w.cells = [...(w.cells ?? []).filter((c) => c.id !== job.id), cell].slice(0, cap) } // Soft enqueue so the waiting rail doesn’t drain dry. @@ -429,6 +477,8 @@ export type LiveProjectionInput = { recent_completions?: LiveCompletionLike[] /** Selecting requests (started, unbound) from /api/live queue. */ queue?: LiveQueueJobLike[] + /** Bound open requests — per concurrency cell (model + Bind started_at). */ + occupancy?: LiveQueueJobLike[] } /** @@ -439,9 +489,9 @@ export type LiveProjectionInput = { * polls and bump from recent_completions / inferred completions (reset when * the card starts a new viewing session). depthSeries rolls prior *live* * samples only — mock seed/tick series are discarded on first projection. - * Elapsed comes from worker `started_at` (pool InFlightSince); if missing, - * keep the prior live job's startedAtMs or stamp Date.now() on first sight. - * Progress is occupancy only — UI uses indeterminate shimmer, not %. + * Per-cell elapsed comes from occupancy `started_at` (Bind / BoundAt); falls + * back to worker InFlightSince / prior cell stamp. Progress is occupancy only — + * UI uses per-cell model + elapsed, not %. */ export function applyLiveProjection( base: MockInflightSnapshot, @@ -450,29 +500,6 @@ export function applyLiveProjection( const now = Date.now() const prevById = new Map(base.jobs.map((j) => [j.id, j])) - const workers: MockAccountSlot[] = live.workers.map((w) => { - const concurrency = clampSlotConcurrency(w.max_inflight ?? 4) - const rawIn = - w.in_flight != null && Number.isFinite(w.in_flight) - ? Math.max(0, Math.floor(w.in_flight)) - : w.busy - ? 1 - : 0 - const inFlight = Math.min(concurrency, rawIn) - return { - id: w.id, - name: w.name, - provider: w.provider, - busy: w.busy || inFlight > 0, - // Keep a soft internal value for mock-compat; busy UI ignores % fill. - progress: w.busy || inFlight > 0 ? Math.max(0.04, Math.min(1, w.progress || 0)) : 0, - rateLimited: w.rate_limited, - jobId: w.busy || inFlight > 0 ? `live-${w.id}` : undefined, - concurrency, - inFlight, - } - }) - const n = Math.max(1, MOCK_INFLIGHT.depthSeries.length) const rateLimits: MockRateLimitWindow[] = live.rate_limits.map((r, i) => { const span = 0.14 @@ -486,45 +513,7 @@ export function applyLiveProjection( } }) - const dwellNameByAccount = new Map() - for (const q of live.queue ?? []) { - const acc = (q.account_id || '').trim() - const label = (q.name || '').trim() - if (acc && label && !dwellNameByAccount.has(acc)) dwellNameByAccount.set(acc, label) - } - - const runningJobs: MockInflightJob[] = workers - .filter((w) => w.busy && w.jobId) - .map((w) => { - const id = w.jobId! - const prev = prevById.get(id) - const liveWorker = live.workers.find((lw) => lw.id === w.id) - let startedAtMs: number | undefined - const raw = liveWorker?.started_at?.trim() - if (raw) { - const parsed = Date.parse(raw) - if (!Number.isNaN(parsed)) startedAtMs = parsed - } - if (startedAtMs == null && prev?.startedAtMs != null) { - startedAtMs = prev.startedAtMs - } - if (startedAtMs == null) { - startedAtMs = now - } - return { - id, - name: dwellNameByAccount.get(w.id) ?? w.name, - kind: 'chat' as const, - status: 'running' as const, - accountId: w.id, - progress: w.progress, - startedAtMs, - elapsedMs: Math.max(0, now - startedAtMs), - } - }) - - // Selecting queue: RequestStatusStarted (etc.) → UI MockJobStatus queued. - // Do not invent parallel statuses — only map existing request_logs values. + // Selecting queue first — ids still on wait rail (incl. dwell-bound). const queuedJobs: MockInflightJob[] = (live.queue ?? []).map((q) => { const id = (q.id || '').trim() const prev = prevById.get(id) @@ -553,6 +542,128 @@ export function applyLiveProjection( elapsedMs: Math.max(0, now - startedAtMs), } }) + const queueIds = new Set(queuedJobs.map((j) => j.id)) + + const dwellNameByAccount = new Map() + for (const q of queuedJobs) { + const acc = (q.accountId || '').trim() + if (acc && q.name && !dwellNameByAccount.has(acc)) dwellNameByAccount.set(acc, q.name) + } + + // Occupancy grouped by account (FIFO from API BoundRequests). + const occByAccount = new Map() + for (const o of live.occupancy ?? []) { + const acc = (o.account_id || '').trim() + const id = (o.id || '').trim() + if (!acc || !id) continue + const list = occByAccount.get(acc) ?? [] + list.push(o) + occByAccount.set(acc, list) + } + + const prevCellsByAccount = new Map() + for (const w of base.workers) { + if (w.cells?.length) prevCellsByAccount.set(w.id, w.cells) + } + + const parseStarted = ( + raw: string | undefined, + prevMs: number | undefined, + fallback: number, + ): number => { + const t = raw?.trim() + if (t) { + const parsed = Date.parse(t) + if (!Number.isNaN(parsed)) return parsed + } + if (prevMs != null) return prevMs + return fallback + } + + const workers: MockAccountSlot[] = live.workers.map((w) => { + const concurrency = clampSlotConcurrency(w.max_inflight ?? 4) + const rawIn = + w.in_flight != null && Number.isFinite(w.in_flight) + ? Math.max(0, Math.floor(w.in_flight)) + : w.busy + ? 1 + : 0 + const inFlight = Math.min(concurrency, rawIn) + const prevCells = prevCellsByAccount.get(w.id) ?? [] + const prevByCellId = new Map(prevCells.map((c) => [c.id, c])) + const occ = occByAccount.get(w.id) ?? [] + const cells: MockSlotCell[] = [] + + for (const o of occ) { + if (cells.length >= inFlight) break + const id = (o.id || '').trim() + if (!id) continue + const prevCell = prevByCellId.get(id) + const prevJob = prevById.get(id) + const startedAtMs = parseStarted( + o.started_at, + prevCell?.startedAtMs ?? prevJob?.startedAtMs, + now, + ) + const name = (o.name || '').trim() || id + cells.push({ + id, + name, + startedAtMs, + elapsedMs: Math.max(0, now - startedAtMs), + }) + } + + // Pool says more occupied than recorder — pad anonymous cells (account started_at). + const liveWorker = live.workers.find((lw) => lw.id === w.id) + const accountStarted = parseStarted(liveWorker?.started_at, undefined, now) + while (cells.length < inFlight) { + const idx = cells.length + // First synthetic cell keeps legacy `live-${accountId}` id for fly-out routing. + const synthId = idx === 0 ? `live-${w.id}` : `live-${w.id}-${idx}` + const prevCell = prevByCellId.get(synthId) ?? prevCells[idx] + const startedAtMs = prevCell?.startedAtMs ?? accountStarted + cells.push({ + id: synthId, + name: dwellNameByAccount.get(w.id) ?? w.name, + startedAtMs, + elapsedMs: Math.max(0, now - startedAtMs), + }) + } + + const busy = w.busy || inFlight > 0 + return { + id: w.id, + name: w.name, + provider: w.provider, + busy, + progress: busy ? Math.max(0.04, Math.min(1, w.progress || 0)) : 0, + rateLimited: w.rate_limited, + jobId: cells[0]?.id, + concurrency, + inFlight, + cells, + } + }) + + // Running jobs = occupancy cells not still on the wait rail (dwell). + const runningJobs: MockInflightJob[] = [] + for (const w of workers) { + for (const c of w.cells ?? []) { + if (queueIds.has(c.id)) continue // still selecting for display + const prev = prevById.get(c.id) + runningJobs.push({ + id: c.id, + name: c.name, + kind: (prev?.kind as MockJobKind | undefined) ?? 'chat', + status: 'running', + accountId: w.id, + progress: w.progress, + startedAtMs: c.startedAtMs, + elapsedMs: c.elapsedMs, + }) + } + } const jobs: MockInflightJob[] = [...runningJobs, ...queuedJobs] @@ -644,6 +755,7 @@ export function liveHasSignal(live: LiveProjectionInput): boolean { live.rate_limits.length > 0 || live.in_flight > 0 || (live.queue?.length ?? 0) > 0 || + (live.occupancy?.length ?? 0) > 0 || (live.sticky?.bindings ?? 0) > 0 ) } diff --git a/internal/console/live.go b/internal/console/live.go index 1bdb1aed..cb76b5ab 100644 --- a/internal/console/live.go +++ b/internal/console/live.go @@ -62,20 +62,23 @@ type LiveRateLimit struct { // LiveCompletion is one terminal request finish drained from the request // recorder for this /api/live poll (busy→idle Done vs Failed routing). type LiveCompletion struct { + // RequestID identifies the finished open request so InflightLiveCard can + // fly that concurrency cell to Done/Failed independently (not whole account). + RequestID string `json:"request_id,omitempty"` AccountID string `json:"account_id"` Status string `json:"status"` } -// LiveJob is one selecting (选号) request for the InflightLiveCard waiting -// queue. Status reuses accounts.RequestStatus* (started) — not a new state -// machine. Running occupancy stays on Workers via Pool InFlight. +// LiveJob is one selecting (选号) or bound occupancy request for the +// InflightLiveCard. Status reuses accounts.RequestStatus* — not a new state +// machine. Queue uses unbound/dwell selecting; Occupancy uses BoundRequests +// (per-cell model + started_at). Workers still carry Pool InFlight counts. type LiveJob struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status"` StartedAt string `json:"started_at,omitempty"` - // AccountID set when Bind already happened but selectingMinDwell still - // projects the job on the waiting rail (queue→slot fly target). + // AccountID: dwell fly target on Queue; always set on Occupancy. AccountID string `json:"account_id,omitempty"` } @@ -89,8 +92,11 @@ type LiveSnapshot struct { RateLimits []LiveRateLimit `json:"rate_limits"` Sticky executor.SessionAffinityStats `json:"sticky"` RecentCompletions []LiveCompletion `json:"recent_completions,omitempty"` - // Queue is Prepare→Acquire 选号 (RequestStatusStarted, no pool bind). + // Queue is Prepare→Acquire 选号 (RequestStatusStarted / dwell). Queue []LiveJob `json:"queue,omitempty"` + // Occupancy is bound open requests (one per concurrency cell) with model + // name and per-request started_at (Bind time) for InflightLiveCard. + Occupancy []LiveJob `json:"occupancy,omitempty"` } // buildLiveSnapshot sums in-flight over all accounts and capacity (the @@ -105,6 +111,7 @@ func buildLiveSnapshot(views []accounts.AccountView, rpm int, sticky executor.Se Workers: make([]LiveWorker, 0, len(views)), RateLimits: make([]LiveRateLimit, 0), Queue: make([]LiveJob, 0), + Occupancy: make([]LiveJob, 0), Sticky: sticky, } for _, v := range views { @@ -217,6 +224,7 @@ func (h *Handler) HandleLive(w http.ResponseWriter, r *http.Request) { if h.Recorder != nil { for _, c := range h.Recorder.DrainRecentCompletions() { snap.RecentCompletions = append(snap.RecentCompletions, LiveCompletion{ + RequestID: c.RequestID, AccountID: c.AccountID, Status: c.Status, }) @@ -238,6 +246,27 @@ func (h *Handler) HandleLive(w http.ResponseWriter, r *http.Request) { AccountID: strings.TrimSpace(q.AccountID), }) } + for _, b := range h.Recorder.BoundRequests() { + name := strings.TrimSpace(b.RequestedModel) + if name == "" { + name = b.ID + } + status := strings.TrimSpace(b.Status) + if status == "" { + status = accounts.RequestStatusStarted + } + started := b.BoundAt + if started.IsZero() { + started = b.StartedAt + } + snap.Occupancy = append(snap.Occupancy, LiveJob{ + ID: b.ID, + Name: name, + Status: status, + StartedAt: started.UTC().Format(time.RFC3339), + AccountID: strings.TrimSpace(b.AccountID), + }) + } } writeJSON(w, http.StatusOK, snap) } diff --git a/internal/console/live_test.go b/internal/console/live_test.go index bcf18916..781d3cfa 100644 --- a/internal/console/live_test.go +++ b/internal/console/live_test.go @@ -84,6 +84,12 @@ func TestBuildLiveSnapshot(t *testing.T) { if len(got.Queue) != 0 { t.Fatalf("queue = %+v", got.Queue) } + if got.Occupancy == nil { + t.Fatalf("occupancy must be non-nil empty slice") + } + if len(got.Occupancy) != 0 { + t.Fatalf("occupancy = %+v", got.Occupancy) + } } func TestBuildLiveSnapshotEmpty(t *testing.T) { diff --git a/internal/logs/recent_completions_test.go b/internal/logs/recent_completions_test.go index b4128948..3121d033 100644 --- a/internal/logs/recent_completions_test.go +++ b/internal/logs/recent_completions_test.go @@ -118,3 +118,46 @@ func TestSelectingMinDwellDisplayOnly(t *testing.T) { t.Fatalf("fresh must keep bind target for fly handoff, got %+v", got[0]) } } + +func TestBoundRequestsPerAccountElapsed(t *testing.T) { + r := NewRequestRecorder(persistOnly{}) + defer r.Close() + + past := time.Now().UTC().Add(-(selectingMinDwell + time.Second)) + r.Start(accounts.RequestLog{ID: "a1", RequestedModel: "sonnet", Status: accounts.RequestStatusStarted, CreatedAt: past}) + r.Start(accounts.RequestLog{ID: "a2", RequestedModel: "gpt", Status: accounts.RequestStatusStarted, CreatedAt: past.Add(time.Millisecond)}) + r.Start(accounts.RequestLog{ID: "q1", RequestedModel: "wait", Status: accounts.RequestStatusStarted, CreatedAt: past.Add(2 * time.Millisecond)}) + + if got := r.BoundRequests(); len(got) != 0 { + t.Fatalf("unbound must be empty, got %+v", got) + } + + r.BindAccount("a2", "acc-x") + time.Sleep(2 * time.Millisecond) + r.BindAccount("a1", "acc-x") + got := r.BoundRequests() + if len(got) != 2 { + t.Fatalf("want 2 bound, got %+v", got) + } + // FIFO by BoundAt: a2 bound first. + if got[0].ID != "a2" || got[1].ID != "a1" { + t.Fatalf("bound order = %+v", got) + } + if got[0].AccountID != "acc-x" || got[0].RequestedModel != "gpt" { + t.Fatalf("got[0]=%+v", got[0]) + } + if got[0].BoundAt.IsZero() || got[1].BoundAt.IsZero() { + t.Fatalf("bound must stamp BoundAt: %+v", got) + } + + r.UnbindAccount("a2", "acc-x") + got = r.BoundRequests() + if len(got) != 1 || got[0].ID != "a1" { + t.Fatalf("after unbind a2 = %+v", got) + } + if !got[0].BoundAt.IsZero() { + // a1 still bound — BoundAt must remain + } else { + t.Fatalf("remaining bound a1 lost BoundAt") + } +} diff --git a/internal/logs/recorder.go b/internal/logs/recorder.go index 3c9de223..137c39eb 100644 --- a/internal/logs/recorder.go +++ b/internal/logs/recorder.go @@ -109,6 +109,7 @@ type StatsQuery struct { // DrainRecentCompletions call. /api/live drains these so Overview can route // busy→idle fly-outs to Done vs Failed without inventing a parallel stream. type RecentCompletion struct { + RequestID string AccountID string Status string At time.Time @@ -129,6 +130,9 @@ type OpenRequest struct { AccountID string Status string StartedAt time.Time + // BoundAt is when BindAccount attached the pool slot (elapsed-in-cell). + // Zero while unbound; cleared on UnbindAccount. + BoundAt time.Time } type RequestRecorder struct { @@ -249,6 +253,7 @@ func (r *RequestRecorder) noteCompletion(log accounts.RequestLog) { r.recentMu.Lock() defer r.recentMu.Unlock() r.recent = append(r.recent, RecentCompletion{ + RequestID: strings.TrimSpace(log.ID), AccountID: acc, Status: strings.TrimSpace(log.Status), At: time.Now(), @@ -328,6 +333,9 @@ func (r *RequestRecorder) BindAccount(requestID, accountID string) { defer r.openMu.Unlock() if o, ok := r.open[requestID]; ok { o.AccountID = accountID + if o.BoundAt.IsZero() { + o.BoundAt = time.Now().UTC() + } } } @@ -350,6 +358,7 @@ func (r *RequestRecorder) UnbindAccount(requestID, accountID string) { } if accountID == "" || o.AccountID == "" || o.AccountID == accountID { o.AccountID = "" + o.BoundAt = time.Time{} } } @@ -402,6 +411,43 @@ func (r *RequestRecorder) SelectingRequests() []OpenRequest { return out } +// BoundRequests returns open requests currently attached to a pool account +// (post-Acquire), FIFO by BoundAt then StartedAt. Used by /api/live occupancy +// so InflightLiveCard can show per-concurrency-cell model + elapsed — not one +// timer for the whole account. Includes dwell-bound entries (still on the +// selecting rail) so the target cell exists for queue→slot fly-in. +func (r *RequestRecorder) BoundRequests() []OpenRequest { + if r == nil { + return nil + } + r.openMu.Lock() + defer r.openMu.Unlock() + out := make([]OpenRequest, 0, len(r.open)) + for _, o := range r.open { + if o == nil || strings.TrimSpace(o.AccountID) == "" { + continue + } + out = append(out, *o) + } + sort.SliceStable(out, func(i, j int) bool { + bi, bj := out[i].BoundAt, out[j].BoundAt + if bi.IsZero() { + bi = out[i].StartedAt + } + if bj.IsZero() { + bj = out[j].StartedAt + } + if !bi.Equal(bj) { + return bi.Before(bj) + } + if !out[i].StartedAt.Equal(out[j].StartedAt) { + return out[i].StartedAt.Before(out[j].StartedAt) + } + return out[i].ID < out[j].ID + }) + return out +} + func (r *RequestRecorder) trimOpenLocked() { if len(r.open) <= openRequestCap { return diff --git a/internal/webui/static/assets/CartesianGrid-CVf7FMre.js b/internal/webui/static/assets/CartesianGrid-BOtlDYoa.js similarity index 99% rename from internal/webui/static/assets/CartesianGrid-CVf7FMre.js rename to internal/webui/static/assets/CartesianGrid-BOtlDYoa.js index 57da38a7..a875e7cd 100644 --- a/internal/webui/static/assets/CartesianGrid-CVf7FMre.js +++ b/internal/webui/static/assets/CartesianGrid-BOtlDYoa.js @@ -1,4 +1,4 @@ -import{$t as e,A as t,At as n,Bt as r,Cn as i,Ct as a,Dt as o,E as s,Et as c,F as l,Ft as u,Gt as d,H as f,Ht as p,I as m,It as h,J as g,Jt as _,K as v,Kt as y,L as b,Lt as x,M as S,Mt as C,N as w,Nt as T,O as E,Ot as D,P as O,Pt as k,R as ee,Rt as te,Sn as A,St as j,Tn as M,Tt as ne,Ut as re,Vt as ie,W as N,Wt as ae,X as oe,Xt as se,Y as P,Yt as ce,Z as le,Zt as ue,an as F,bt as de,cn as fe,ct as I,dn as pe,dt as me,en as L,et as he,fn as ge,gt as _e,ht as ve,it as ye,j as be,jt as xe,k as Se,kt as Ce,l as we,ln as Te,nn as Ee,nt as De,on as Oe,ot as ke,pn as Ae,q as R,qt as je,rt as Me,sn as Ne,st as Pe,tn as z,tt as Fe,u as Ie,ut as Le,vt as Re,wn as ze,wt as Be,xt as Ve,yt as B,z as He,zt as Ue}from"./index-CYQcpZwf.js";function We(e,t){let n=new Map;for(let r=0;rvoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;evoid 0)}function et(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r,i);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r,i):j(e,t);default:return Ve(e)&&i?typeof t!=`string`||t===``:j(e,t)}}function tt(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Je(e)&&(e=Object(e));else{let t=y(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function ot(e){return e=Qe(e),t=>at(t,e)}function st(e,t){return Xe(e,(n,i,a,s)=>{let c=t?.(n,i,a,s);if(c!==void 0)return c;if(typeof e==`object`){if(y(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return s.set(e,t),H(t,e,a,s),t}switch(Object.prototype.toString.call(e)){case h:case r:case o:{let t=new e.constructor(e?.valueOf());return H(t,e),t}case Be:{let t={};return H(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function ct(e){return st(e)}function lt(e){return typeof e==`object`&&!!e&&y(e)===`[object Arguments]`}function ut(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Te(t)&&!(t in Object(e))?Ne(t):[t],n.length===0)return!1;let r=e;for(let e=0;ee.length)&&(t=e.length);for(var n=0,r=Array(t);nW||Math.abs(e.left-t.left)>W||Math.abs(e.top-t.top)>W||Math.abs(e.width-t.width)>W}function wt(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Tt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=_t((0,U.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,U.useRef)(null),a=(0,U.useRef)(n);a.current=n;var o=(0,U.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=wt(e);if(Ct(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=wt(e);Ct(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,U.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=t.separator,r=n===void 0?K.separator:n,i=t.contentStyle,a=t.itemStyle,o=t.labelStyle,s=o===void 0?K.labelStyle:o,c=t.payload,l=t.formatter,u=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,m=t.labelFormatter,h=t.accessibilityLayer,g=h===void 0?K.accessibilityLayer:h,_=()=>{if(c&&c.length){var e={padding:0,margin:0},t=Rt(c,u).map((e,t)=>{if(!e||e.type===`none`)return null;var n=e.formatter||l||Lt,i=e.value,o=e.name,s=i,u=o;if(n){var d=n(i,o,e,t,c);if(Array.isArray(d)){var f=jt(d,2);s=f[0],u=f[1]}else if(d!=null)s=d;else return null}var p=G(G({},K.itemStyle),{},{color:e.color||K.itemStyle.color},a);return U.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,L(u)?U.createElement(`span`,{className:`recharts-tooltip-item-separator`},r):null,U.createElement(`span`,{className:`recharts-tooltip-item-value`},s),U.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return U.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},v=G(G({},K.contentStyle),i),y=G({margin:0},s),b=!e(p),x=b?p:``,S=A(`recharts-default-tooltip`,d),C=A(`recharts-tooltip-label`,f);b&&m&&c!=null&&(x=m(p,c));var w=g?{role:`status`,"aria-live":`assertive`}:{};return U.createElement(`div`,Et({className:S,style:v},w),U.createElement(`p`,{className:C,style:y},U.isValidElement(x)?x:`${x}`),_())},q=`recharts-tooltip-wrapper`,Bt={visibility:`hidden`};function Vt(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return A(q,{[`${q}-right`]:z(n)&&t&&z(t.x)&&n>=t.x,[`${q}-left`]:z(n)&&t&&z(t.x)&&n=t.y,[`${q}-top`]:z(r)&&t&&z(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function Ut(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function Wt(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=Ht({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Ht({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Ut({translateX:d,translateY:f,useTranslate3d:c})):u=Bt,{cssProperties:u,cssClasses:Vt({translateX:d,translateY:f,coordinate:n})}}function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),2),r=n[0],i=n[1];U.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(J(J({},r),{},{dismissed:!1}));var a=Wt({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=J(J({},e.hasPortalFromProps?{}:J(J({transition:tn({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return U.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var rn=U.memo(nn),an=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,hn=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=fn(e,an),h=cn({x:n,y:i,top:o,left:c,width:u,height:f},m);return!z(n)||!z(i)||!z(u)||!z(f)||!z(o)||!z(c)?null:U.createElement(`path`,on({},pe(h),{className:A(`recharts-cross`,p),d:mn(n,i,u,f,o,c)}))};function gn(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function _n(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[R(t,n,r,i),R(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var vn,yn,bn,xn,Sn,Cn,wn;function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;tEe(t-e)*Math.min(Math.abs(t-e),359.999),X=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/v,d=c?i:i+a*u,f=R(t,n,l,d),p=R(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:R(t,n,l*Math.cos(u*v),m),theta:u}},Dn=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=En(a,o),c=a+s,l=R(t,n,i,a),u=R(t,n,i,c),d=F(vn||=Y([`M `,`,`,` diff --git a/internal/webui/static/assets/CostChart-DFXT-jhI.js b/internal/webui/static/assets/CostChart-Civqr14B.js similarity index 96% rename from internal/webui/static/assets/CostChart-DFXT-jhI.js rename to internal/webui/static/assets/CostChart-Civqr14B.js index 17d5d043..98ede44f 100644 --- a/internal/webui/static/assets/CostChart-DFXT-jhI.js +++ b/internal/webui/static/assets/CostChart-Civqr14B.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-CVf7FMre.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-CYQcpZwf.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-BOtlDYoa.js";import{Tn as n,_n as r,a as i,at as a,gn as o,i as s,r as c,t as l,vn as u,wn as d,xn as f}from"./index-AMFtT_NW.js";var p=n(d(),1),m=f(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(e,t){return t===`cost`?o(e):t===`tokens`?r(e):u(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):u(e)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:n,models:r,lang:o,emptyLabel:u,totalLabel:d,metric:f=`credits`}){let v=(0,p.useMemo)(()=>r.map(e=>e.id),[r]),x=(0,p.useMemo)(()=>n.map(e=>{let t=_(e,f),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=f===`tokens`?r:Number(r.toFixed(4))}return n}),[n,v,f]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!n.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:u}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(a,{width:`100%`,height:`100%`,children:(0,m.jsxs)(l,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${f}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(s,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,o)}),(0,m.jsx)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,f)}),(0,m.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:o,models:r,totalLabel:d,metric:f})}),v.map((e,t)=>(0,m.jsx)(i,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${f}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:r.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/LiveSparkline-DEWBslJX.js b/internal/webui/static/assets/LiveSparkline-B8h_bbaq.js similarity index 80% rename from internal/webui/static/assets/LiveSparkline-DEWBslJX.js rename to internal/webui/static/assets/LiveSparkline-B8h_bbaq.js index d49942cd..71ba9f84 100644 --- a/internal/webui/static/assets/LiveSparkline-DEWBslJX.js +++ b/internal/webui/static/assets/LiveSparkline-B8h_bbaq.js @@ -1 +1 @@ -import{a as e,at as t,r as n,t as r,xn as i}from"./index-CYQcpZwf.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file +import{a as e,at as t,r as n,t as r,xn as i}from"./index-AMFtT_NW.js";var a=i();function o({samples:i,capacity:o,label:s}){let c=i.length?i:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(t,{width:`100%`,height:`100%`,children:(0,a.jsxs)(r,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(e,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrafficChart-BzzCMmSh.js b/internal/webui/static/assets/TrafficChart-AulTONmo.js similarity index 99% rename from internal/webui/static/assets/TrafficChart-BzzCMmSh.js rename to internal/webui/static/assets/TrafficChart-AulTONmo.js index 28eae298..e1e20151 100644 --- a/internal/webui/static/assets/TrafficChart-BzzCMmSh.js +++ b/internal/webui/static/assets/TrafficChart-AulTONmo.js @@ -1 +1 @@ -import{n as e,t}from"./CartesianGrid-CVf7FMre.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-CYQcpZwf.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file +import{n as e,t}from"./CartesianGrid-BOtlDYoa.js";import{$ as n,$t as r,B as i,C as a,D as o,G as s,Q as c,Qt as l,S as u,Sn as d,T as f,Tn as p,U as m,V as h,W as g,Y as _,Yt as v,_ as y,_n as b,_t as x,a as S,at as C,b as w,bn as T,c as E,ct as D,d as ee,dn as O,f as k,fn as A,ft as j,g as M,h as te,hn as ne,i as re,in as N,k as P,lt as F,m as I,mn as ie,mt as L,n as ae,o as oe,p as se,pt as R,r as ce,rn as le,s as ue,st as z,tt as de,un as fe,v as pe,w as me,wn as he,x as ge,xn as _e,y as ve,yn as B,yt as ye}from"./index-AMFtT_NW.js";var V=p(he()),be=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return U(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...Te(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function De(e,t,n){return e?Ee(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Oe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=xe(e,be),a=r??!1,o;if(t!=null){var s=i.pathRef;o=De(n,Ce(s?.current??null),t)}else n!=null&&(o=String(n));return V.createElement(_,H({},i,{connectNulls:a,strokeDasharray:o}))}function ke(e){var t=(0,V.useRef)(0),n=(0,V.useRef)(0),r=(0,V.useRef)(!1),i=(0,V.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,V.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(N(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var Ae=[`children`];function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Pe(e){var t=e.children,n=je(e,Ae);return V.createElement(Ne.Provider,{value:n},t)}var W=(e,t,n,r)=>i(e,`xAxis`,t,r),G=(e,t,n,r)=>h(e,`xAxis`,t,r),K=(e,t,n,r)=>i(e,`yAxis`,n,r),q=(e,t,n,r)=>h(e,`yAxis`,n,r),Fe=x([n,W,K,G,q],(e,t,n,r,i)=>L(e,`xAxis`)?D(t,r,!1):D(n,i,!1)),Ie=(e,t,n,r,i)=>i;function Le(e){return e.type===`line`}var Re=x([m,Ie],(e,t)=>e.filter(Le).find(e=>e.id===t)),ze=x([n,W,K,G,q,Re,Fe,s],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return at({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Be=[`id`],Ve=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],He=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=Je(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:l(i.prev.x,i.next.x,t),y:l(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:l(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:l(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:ve,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Oe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:g.line,type:`linear`},Ye=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:j(n,t),payload:e}]},Xe=V.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:le,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:j(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return V.createElement(ge,{tooltipEntrySettings:f})});function Ze(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Y(r,Be),c=A(s);return V.createElement(I,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function Qe(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,V.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return V.createElement(me,{value:t?i:void 0},n)}function $e(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,Ve),_=Z(Z({},O(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return V.createElement(V.Fragment,null,r?.length>1&&V.createElement(u,{option:m,DefaultShape:Q.shape,shapeProps:_}),V.createElement(Ze,{points:r,clipPathId:t,props:i}))}function et(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,p=n.layout,m=qe(r.current),h=pe(n.onAnimationStart,n.onAnimationEnd),g=h.isAnimating,_=h.handleAnimationStart,v=h.handleAnimationEnd,b=!g,x=ke(a),S=(0,V.useCallback)(e=>e>0&&m>0,[m]);return V.createElement(Qe,{points:a,showLabels:b},n.children,V.createElement(y,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:S,layout:p},(e,i,a)=>{var o=g||i<1,s=o?x(i,m):null;return V.createElement($e,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),V.createElement(f,{label:n.label}))}function tt(e){var t=e.clipPathId,n=e.props,r=(0,V.useRef)(null),i=(0,V.useRef)(null);return V.createElement(et,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var nt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:R(e.payload,t)}),rt=class extends V.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=d(`recharts-line`,i),_=p,v=oe(n),y=v.r,b=v.strokeWidth,x=a(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return V.createElement(P,{zIndex:h},V.createElement(fe,{className:g},m&&V.createElement(`defs`,null,V.createElement(ue,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&V.createElement(`clipPath`,{id:`clipPath-dots-${_}`},V.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:f+S}))),V.createElement(Pe,{xAxisId:o,yAxisId:s,data:r,dataPointFormatter:nt,errorBarOffset:0},V.createElement(tt,{props:this.props,clipPathId:_}))),V.createElement(k,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function it(e){var t=v(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=Y(t,He),_=E(p,m).needClip,y=se(),b=de(),x=z(),S=ye(e=>ze(e,p,m,x,h));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,D=y.y;return V.createElement(rt,J({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:D,needClip:_}))}function at(e){var t=e.layout,n=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,c=e.bandSize;return e.displayedData.map((e,l)=>{var u=R(e,s);if(t===`horizontal`)return{x:F({axis:n,ticks:a,bandSize:c,entry:e,index:l}),y:(r(u)?null:i.scale.map(u))??null,value:u,payload:e};var d=r(u)?null:n.scale.map(u),f=F({axis:i,ticks:o,bandSize:c,entry:e,index:l});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function ot(e){var t=v(e,Q),n=z();return V.createElement(M,{id:t.id,type:`line`},e=>V.createElement(V.Fragment,null,V.createElement(w,{legendPayload:Ye(t)}),V.createElement(Xe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),V.createElement(te,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V.createElement(it,J({},t,{id:e}))))}var st=V.memo(ot,c);st.displayName=`Line`;var ct=[`axis`],lt=(0,V.forwardRef)((e,t)=>V.createElement(ae,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=_e();function dt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function ft(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function pt(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function mt({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:dt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function ht({series:n,lang:r,emptyLabel:i,okLabel:a,errorLabel:o,onSelectRange:s,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,V.useState)(u),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(!1),v=(0,V.useRef)(null),y=(0,V.useMemo)(()=>n.map(pt),[n]),x=y[0],w=y[y.length-1],E=(x&&w?Date.parse(w.at)-Date.parse(x.at):0)>1728e5,D=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},O=d===`tokens`?[{key:`inputTokens`,label:D.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:D.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:D.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:D.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:D.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:a,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:o,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],k=e=>e==null?`—`:d===`latency`?B(e):b(e),A=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,j=y.flatMap(e=>O.map(t=>Number(e[t.key]??0))),M=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...j),te=ft(M),N=y.some(e=>e.requests>0),P=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e||!N||_.current)return;let t=!1,n=null,r=T.context(()=>{let r=T.matchMedia(),i=()=>{let t=T.utils.toArray(`.recharts-area-area`,e),n=T.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{T.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),T.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{T.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();T.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let F=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,I=()=>{if(p&&h&&s){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+F;s(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},L=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!n.length||!N?(0,$.jsx)(ne,{emptyLabel:i}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ie,{value:d,onChange:e=>f(e),ariaLabel:D.requests,options:[{id:`requests`,label:D.requests},{id:`tokens`,label:D.tokens},{id:`latency`,label:D.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(C,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:s?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:s?e=>{let t=L(e);t&&(m(t),g(t))}:void 0,onMouseMove:s?e=>{if(!p)return;let t=L(e);t&&g(t)}:void 0,onMouseUp:s?I:void 0,onMouseLeave:s?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:O.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(t,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(re,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,E,r)}),(0,$.jsx)(ce,{width:d===`latency`?44:36,domain:[0,te],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?B(e):b(e)}),(0,$.jsx)(e,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:E,lang:r,specs:O,format:k,totalLabel:D.total,total:A})}),O.filter(e=>e.area).map(e=>(0,$.jsx)(S,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),O.map(e=>(0,$.jsx)(st,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),p&&h?(0,$.jsx)(ee,{x1:p,x2:h,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:O.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[s&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[k(M),` peak`]})]})]})]})}export{ht as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-AMFtT_NW.js b/internal/webui/static/assets/index-AMFtT_NW.js new file mode 100644 index 00000000..2294b43f --- /dev/null +++ b/internal/webui/static/assets/index-AMFtT_NW.js @@ -0,0 +1,174 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-AulTONmo.js","assets/CartesianGrid-BOtlDYoa.js","assets/CostChart-Civqr14B.js"])))=>i.map(i=>d[i]); +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(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 u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function ee(e,t){B++,z[B]=e.current,e.current=t}var te=V(null),ne=V(null),re=V(null),ie=V(null);function ae(e,t){switch(ee(re,t),ee(ne,e),ee(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(te),ee(te,e)}function oe(){H(te),H(ne),H(re)}function se(e){e.memoizedState!==null&&ee(ie,e);var t=te.current,n=Xd(t,e.type);t!==n&&(ee(ne,e),ee(te,n))}function ce(e){ne.current===e&&(H(te),H(ne)),ie.current===e&&(H(ie),op._currentValue=R)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?de(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return e.child!==t&&t!==null?de(`Suspense Fallback`):de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return de(`Activity`);default:return``}}function he(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var ge=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,ye=t.unstable_shouldYield,be=t.unstable_requestPaint,xe=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,we=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,De=t.unstable_IdlePriority,Oe=t.log,ke=t.unstable_setDisableYieldValue,Ae=null,je=null;function Me(e){if(typeof Oe==`function`&&ke(e),je&&typeof je.setStrictMode==`function`)try{je.setStrictMode(Ae,e)}catch{}}var Ne=Math.clz32?Math.clz32:Ie,Pe=Math.log,Fe=Math.LN2;function Ie(e){return e>>>=0,e===0?32:31-(Pe(e)/Fe|0)|0}var Le=256,Re=262144,ze=4194304;function Be(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ve(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Tr=an&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Mt(r)||(r=Er,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&yr(Or,r)||(Or=r,r=Nd(Dr,`onSelect`),0>=o,i-=o,Si=1<<32-Ne(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ji&&wi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ji&&wi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ji&&wi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ji&&wi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ta(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ma(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=li(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ci(o.type,o.key,o.props,null,e.mode,c),Ma(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=fi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ta(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ja(o),c);if(o.$$typeof===C)return b(e,r,$i(e,o),c);Na(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Aa=0;var i=b(e,t,n,r);return ka=null,i}catch(t){if(t===ya||t===xa)throw t;var a=ii(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Fa=Pa(!0),Ia=Pa(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ti(e),ei(e,null,n),t}return Zr(e,r,t,n),ti(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function Ua(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Wa=!1;function Ga(){if(Wa){var e=ua;if(e!==null)throw e}}function Ka(e,t,n,r){Wa=!1;var i=e.updateQueue;La=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Hl&f)===f:(r&f)===f){f!==0&&f===la&&(Wa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:La=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Xl|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=I.T,s={};I.T=s,Ns(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,pa(c,r),vu(e)):Ms(e,t,r,vu(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},vu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;W(e,a,t,R,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},vu())}function Es(){return Qi(op)}function Ds(){return jo().memoizedState}function Os(){return jo().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vu();e=Ba(n);var r=Va(t,e,n);r!==null&&(bu(r,t,n),Ha(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=vu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=Qr(e,t,n,r),n!==null&&(bu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,vu())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Zr(e,t,i,0),Bl===null&&Xr(),!1}catch{}if(n=Qr(e,t,i,r),n!==null)return bu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=Qr(e,n,r,2),t!==null&&bu(t,e,2)}function Ps(e){var t=e.alternate;return e===uo||t!==null&&t===uo}function Fs(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Ls={readContext:Qi,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};Ls.useEffectEvent=xo;var Rs={readContext:Qi,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,hs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Me(!0);try{n(t)}finally{Me(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,uo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=js.bind(null,uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=W.bind(null,uo,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=uo,a=Ao();if(ji){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Bl.identifierPrefix;if(ji){var n=Ci,r=Si;n=(r&~(1<<32-Ne(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[nt]=t,o[rt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Hd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Ic(t),G(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=re.current,Ri(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Fi(t,!0)}else e=Jd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ri(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[nt]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(oo(t),t):(oo(t),null);if(t.flags&128)throw Error(i(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ri(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[nt]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(oo(t),t):(oo(t),null)}return oo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pc(t,t.updateQueue),Ic(t),null);case 4:return oe(),e===null&&kd(t.stateNode.containerInfo),Ic(t),null;case 10:return Ki(t.type),Ic(t),null;case 19:if(H(so),r=t.memoizedState,r===null)return Ic(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Fc(r,!1);else{if(Yl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=co(e),o!==null){for(t.flags|=128,Fc(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)si(n,e),n=n.sibling;return ee(so,so.current&1|2),ji&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&xe()>ou&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=co(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ji)return Ic(t),null}else 2*xe()-r.renderingStartTime>ou&&n!==536870912&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=xe(),e.sibling=null,n=so.current,ee(so,a?n&1|2:n&1),ji&&wi(t,r.treeForkCount),e);case 22:case 23:return oo(t),$a(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&H(ha),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ia),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ia),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(oo(t),t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(oo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(so),null;case 4:return oe(),null;case 10:return Ki(t.type),null;case 22:case 23:return oo(t),$a(),e!==null&&H(ha),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ia),null;case 25:return null;default:return null}}function zc(e,t){switch(Di(t),t.tag){case 3:Ki(ia),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&oo(t);break;case 13:oo(t);break;case 19:H(so);break;case 10:Ki(t.type);break;case 22:case 23:oo(t),$a(),e!==null&&H(ha);break;case 24:Ki(ia)}}function Bc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Xu(t,t.return,e)}}function Vc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Xu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Xu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){Xu(e,e.return,t)}}}function Uc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Xu(e,t,n)}}function Wc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Xu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Xu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Xu(e,t,n)}else n.current=null}}function Kc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Xu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[rt]=t}catch(t){Xu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&of(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Xu(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Kd=hp,e=Cr(e),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(qd={focusedElem:e,selectionRange:n},hp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Hd(o,r,n),o[nt]=e,ht(o),r=o;break a;case`link`:var s=Yf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,I.T=null,n=mu,mu=null;var o=uu,s=fu;if(lu=0,du=uu=null,fu=0,zl&6)throw Error(i(331));var c=zl;if(zl|=4,Pl(o.current),El(o,o.current,s,n),zl=c,ud(0,!1),je&&typeof je.onPostCommitFiberRoot==`function`)try{je.onPostCommitFiberRoot(Ae,o)}catch{}return!0}finally{L.p=a,I.T=r,Ku(e,t)}}function Yu(e,t,n){t=mi(n,t),t=Zs(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Ke(e,2),ld(e))}function Xu(e,t,n){if(e.tag===3)Yu(e,e,n);else for(;t!==null;){if(t.tag===3){Yu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cu===null||!cu.has(r))){e=mi(n,e),n=Qs(2),r=Va(t,n,2),r!==null&&($s(n,r,t,e),Ke(r,2),ld(r));break}}t=t.return}}function Zu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ql=!0,i.add(n),e=Qu.bind(null,e,t,n),t.then(e,e))}function Qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(Hl&n)===n&&(Yl===4||Yl===3&&(Hl&62914560)===Hl&&300>xe()-iu?!(zl&2)&&Du(e,0):Ql|=n,eu===Hl&&(eu=0)),ld(e)}function $u(e,t){t===0&&(t=We()),e=$r(e,t),e!==null&&(Ke(e,t),ld(e))}function ed(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$u(e,n)}function td(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),$u(e,n)}function nd(e,t){return _e(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ne(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,hd(r,a))}else a=Hl,a=Ve(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,hd(r,a))}r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&$d()&&(e=cd);for(var t=xe(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}lu!==0&&lu!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Wd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=mt(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);ht(c),Hd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=mt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),ht(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=mt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),ht(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=re.current)?wf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Rf(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Rf(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Sf.set(e,n),o||Vf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Hf(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Rf(e){return`href="`+Pt(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Hd(t,`link`,n),ht(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Pt(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,ht(a),a):(r=n,(a=Sf.get(o))&&(r=m({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Gf(r,n.precedence,e));return t.instance}function Gf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Zf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=`modulepreload`,x=function(e){return`/`+e},S={},C=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=x(t,n),t=s(t),t in S)return;S[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:b,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},w=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,T=/^[\\/]{2}/;function E(e,t){return t+e.replace(/\\/g,`/`)}var D=`popstate`;function O(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function k(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return P(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:F(t)}return L(t,n,null,e)}function A(e,t){if(e===!1||e==null)throw Error(t)}function j(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function M(){return Math.random().toString(36).substring(2,10)}function N(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function P(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?I(t):t,state:n,key:t&&t.key||r||M(),mask:i}}function F({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function I(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function L(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=O(e)?e:P(h.location,e,t);n&&n(r,e),l=u()+1;let d=N(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=O(e)?e:P(h.location,e,t);n&&n(r,e),l=u();let i=N(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return R(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(D,d),c=e,()=>{i.removeEventListener(D,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function R(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),A(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:F(t);return i=i.replace(/ $/,`%20`),!n&&T.test(i)&&(i=r+i),new URL(i,r)}function z(e,t,n=`/`){return B(e,t,n,!1)}function B(e,t,n,r,i){let a=ge((typeof t==`string`?I(t):t).pathname||`/`,n);if(a==null)return null;let o=i??V(e),s=null,c=he(a);for(let e=0;s==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;A(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=we([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(A(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),H(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=me(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ee(e.path))a(e,t,!0,n)}),t}function ee(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ee(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function te(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ne=/^:[\w-]+$/,re=3,ie=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=ie),n.filter(e=>!ce(e)).reduce((e,t)=>e+(ne.test(t)?re:t===``?ae:oe),r)}function ue(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){j(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return j(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ge(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?I(e):e,a;return n?(n=Ce(n),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:De(r),hash:Oe(i)}}function ve(e,t){let n=Te(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=I(e):(i={...e},A(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),A(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),A(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ce=e=>e.replace(/[\\/]{2,}/g,`/`),we=e=>Ce(e.join(`/`)),Te=e=>e.replace(/\/+$/,``),Ee=e=>Te(e).replace(/^\/*/,`/`),De=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Oe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ke=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ae(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function je(e){return we(e.map(e=>e.route.path).filter(Boolean))||`/`}var Me=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ne(e,t){let n=e;if(typeof n!=`string`||!w.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Me)try{let e=new URL(window.location.href),r=T.test(n)?new URL(E(n,e.protocol)):new URL(n),a=ge(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{j(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Pe=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Pe);var Fe=[`GET`,...Pe];new Set(Fe);var Ie=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Le(e){try{return Ie.includes(new URL(e).protocol)}catch{return!1}}var Re=v.createContext(null);Re.displayName=`DataRouter`;var ze=v.createContext(null);ze.displayName=`DataRouterState`;var Be=v.createContext(!1);function Ve(){return v.useContext(Be)}var He=v.createContext({isTransitioning:!1});He.displayName=`ViewTransition`;var Ue=v.createContext(new Map);Ue.displayName=`Fetchers`;var We=v.createContext(null);We.displayName=`Await`;var Ge=v.createContext(null);Ge.displayName=`Navigation`;var Ke=v.createContext(null);Ke.displayName=`Location`;var qe=v.createContext({outlet:null,matches:[],isDataRoute:!1});qe.displayName=`Route`;var Je=v.createContext(null);Je.displayName=`RouteError`;var Ye=`REACT_ROUTER_ERROR`,Xe=`REDIRECT`,Ze=`ROUTE_ERROR_RESPONSE`;function Qe(e){if(e.startsWith(`${Ye}:${Xe}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function $e(e){if(e.startsWith(`${Ye}:${Ze}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ke(t.status,t.statusText,t.data)}catch{}}function et(e,{relative:t}={}){A(tt(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=v.useContext(Ge),{hash:i,pathname:a,search:o}=lt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:we([n,a])),r.createHref({pathname:s,search:o,hash:i})}function tt(){return v.useContext(Ke)!=null}function nt(){return A(tt(),`useLocation() may be used only in the context of a component.`),v.useContext(Ke).location}var rt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function it(e){v.useContext(Ge).static||v.useLayoutEffect(e)}function at(){let{isDataRoute:e}=v.useContext(qe);return e?Et():ot()}function ot(){A(tt(),`useNavigate() may be used only in the context of a component.`);let e=v.useContext(Re),{basename:t,navigator:n}=v.useContext(Ge),{matches:r}=v.useContext(qe),{pathname:i}=nt(),a=JSON.stringify(xe(r)),o=v.useRef(!1);return it(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(j(o.current,rt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:we([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var st=v.createContext(null);function ct(e){let t=v.useContext(qe).outlet;return v.useMemo(()=>t&&v.createElement(st.Provider,{value:e},t),[t,e])}function lt(e,{relative:t}={}){let{matches:n}=v.useContext(qe),{pathname:r}=nt(),i=JSON.stringify(xe(n));return v.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ut(e,t){return dt(e,t)}function dt(e,t,n){A(tt(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=v.useContext(Ge),{matches:i}=v.useContext(qe),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ot(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let u=nt(),d;if(t){let e=typeof t==`string`?I(t):t;A(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):z(e,{pathname:p});j(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),j(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=vt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:we([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:we([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(Ke.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function ft(){let e=Tt(),t=Ae(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var pt=v.createElement(ft,null),mt=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=$e(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(qe.Provider,{value:this.props.routeContext},v.createElement(Je.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(gt,{error:e},t):t}};mt.contextType=Be;var ht=new WeakMap;function gt({children:e,error:t}){let{basename:n}=v.useContext(Ge);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Qe(t.digest);if(e){let r=ht.get(t);if(r)throw r;let i=Ne(e.location,n),a=i.absoluteURL||i.to;if(Le(a))throw Error(`Invalid redirect location`);if(Me&&!ht.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw ht.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function _t({routeContext:e,match:t,children:n}){let r=v.useContext(Re);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(qe.Provider,{value:e},n)}function vt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);A(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:je(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||pt,o&&(s<0&&c===0?(Ot(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(_t,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(mt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function yt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bt(e){let t=v.useContext(Re);return A(t,yt(e)),t}function xt(e){let t=v.useContext(ze);return A(t,yt(e)),t}function St(e){let t=v.useContext(qe);return A(t,yt(e)),t}function Ct(e){let t=St(e),n=t.matches[t.matches.length-1];return A(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function wt(){return Ct(`useRouteId`)}function Tt(){let e=v.useContext(Je),t=xt(`useRouteError`),n=Ct(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Et(){let{router:e}=bt(`useNavigate`),t=Ct(`useNavigate`),n=v.useRef(!1);return it(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{j(n.current,rt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Dt={};function Ot(e,t,n){!t&&!Dt[e]&&(Dt[e]=!0,j(!1,n))}v.memo(kt);function kt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return dt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function At({to:e,replace:t,state:n,relative:r}){A(tt(),` may be used only in the context of a component.`);let{static:i}=v.useContext(Ge);j(!i,` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(qe),{pathname:o}=nt(),s=at(),c=Se(e,xe(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function jt(e){return ct(e.context)}function Mt(e){A(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Nt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){A(!tt(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=I(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=ge(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return j(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:v.createElement(Ge.Provider,{value:c},v.createElement(Ke.Provider,{children:t,value:h}))}function Pt({children:e,location:t}){return ut(Ft(e),t)}v.Component;function Ft(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,Ft(e.props.children,i));return}A(e.type===Mt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),A(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Ft(e.props.children,i)),n.push(a)}),n}var It=`get`,Lt=`application/x-www-form-urlencoded`;function Rt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function zt(e){return Rt(e)&&e.tagName.toLowerCase()===`button`}function Bt(e){return Rt(e)&&e.tagName.toLowerCase()===`form`}function Vt(e){return Rt(e)&&e.tagName.toLowerCase()===`input`}function Ht(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ut(e,t){return e.button===0&&(!t||t===`_self`)&&!Ht(e)}function Wt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Gt(e,t){let n=Wt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Kt=null;function qt(){if(Kt===null)try{new FormData(document.createElement(`form`),0),Kt=!1}catch{Kt=!0}return Kt}var Jt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Yt(e){return e!=null&&!Jt.has(e)?(j(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Lt}"`),null):e}function Xt(e,t){let n,r,i,a,o;if(Bt(e)){let o=e.getAttribute(`action`);r=o?ge(o,t):null,n=e.getAttribute(`method`)||It,i=Yt(e.getAttribute(`enctype`))||Lt,a=new FormData(e)}else if(zt(e)||Vt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a