diff --git a/changelog/unreleased/overview-inflight-copy-icons.md b/changelog/unreleased/overview-inflight-copy-icons.md new file mode 100644 index 00000000..387e4277 --- /dev/null +++ b/changelog/unreleased/overview-inflight-copy-icons.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard: account slots show ProviderMark next to the name (same marks as Accounts / supplier tiles, blended with solid-glass — no contrasting wash); idle slots fade icon+name. Shortened captions (Waiting / Slots / P95 / Empty; hint to Slots · in-flight · cooldown). Done/Failed are icon-first with aria-label/title. Elapsed + shimmer unchanged. + +### 中文 + +- Overview「实时进行中」:账号槽位名旁复用 ProviderMark(与账号页/供应商卡片同款,贴合 solid-glass 底、无对比色洗底);空闲槽图标+名称淡化。文案收紧(等待/槽位/P95/暂无;副标题改为「槽位 · 进行中 · 冷却」)。完成/失败改为图标优先(aria-label/title 保留可读)。耗时与流光未改。 diff --git a/changelog/unreleased/overview-inflight-elapsed-shimmer.md b/changelog/unreleased/overview-inflight-elapsed-shimmer.md new file mode 100644 index 00000000..203dea0e --- /dev/null +++ b/changelog/unreleased/overview-inflight-elapsed-shimmer.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard busy slots show **real elapsed** seconds from pool `InFlightSince` → `/api/live` `workers[].started_at` (client ticks ~150ms; falls back to first-seen busy time if the field is absent). Progress bar is an **indeterminate** solid-glass shimmer — no fake % toward completion. Idle stays 空闲; rate-limit amber unchanged; GSAP fly in/out kept. + +### 中文 + +- Overview「实时进行中」忙碌槽位显示真实已耗时(Pool `InFlightSince` → `/api/live` `started_at`,前端约 150ms 滴答;无字段时用首次见到忙碌的时刻)。进度条改为不确定流光,不再用假百分比。空闲仍为「空闲」;限流琥珀不变;GSAP 飞入/飞出保留。 diff --git a/changelog/unreleased/overview-inflight-glow-enrich.md b/changelog/unreleased/overview-inflight-glow-enrich.md new file mode 100644 index 00000000..039cd30a --- /dev/null +++ b/changelog/unreleased/overview-inflight-glow-enrich.md @@ -0,0 +1,9 @@ +### English + +- Overview InflightLiveCard: richer busy-slot shimmer (brighter surface highlight + stronger chart-1 bands), opaque queue→slot fly with kind-tinted trail glow (~3 afterimages), fuller kind pastels / busy edge / soft chart-1 slot glow. Still project tokens only; no orange panel wash. Provider icons + short copy kept. +- Overview InflightLiveCard: busy→idle fly-outs route by per-job outcome — `/api/live` drains `recent_completions` from the request recorder (plus `last_error_kind` fallback). HTTP/API/upstream failures land on Failed (X), not Done (Check). Mock tick emits the same `completions` list so same-tick mixed finishes stay correct. + +### 中文 + +- Overview「实时进行中」:忙碌槽流光提亮(更亮高光 + 更浓 chart-1 色带);队列飞入槽位保持不透明胶囊 + kind 色拖尾光晕(约 3 道残影);kind 粉彩与忙碌描边略加饱和,忙碌槽轻柔 chart-1 外辉。仍仅用项目 token,无大面积橙色洗底。ProviderMark 与精简文案保留。 +- Overview「实时进行中」:busy→idle 飞出按单次请求结果路由——`/api/live` 从请求 recorder 抽干 `recent_completions`(并以 `last_error_kind` 兜底)。HTTP/API/上游失败落入 Failed(X),不再误进 Done(勾)。Mock 同 tick 也产出 `completions`,混合完成不再全进成功槽。 diff --git a/changelog/unreleased/overview-inflight-hairline.md b/changelog/unreleased/overview-inflight-hairline.md new file mode 100644 index 00000000..9dc0e468 --- /dev/null +++ b/changelog/unreleased/overview-inflight-hairline.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard: drop nested solid-glass / stacked inset rings on queue pills, account slots, job pills, Done·Failed chips, and depth chrome. Distinguish by wash + color (busy tint, kind pastels, success/danger); at most one soft hairline per small item. Keep shimmer glow, fail→Failed routing, ProviderMark, shortened copy. No large orange wash. + +### 中文 + +- Overview「实时进行中」:去掉队列胶囊、账号槽、任务 pill、Done/Failed、深度图上的嵌套 solid-glass / 叠描边。靠洗底 + 颜色区分(忙碌冷色、kind 粉彩、成功/失败色);小项最多一根极细描边。保留流光、失败飞 Failed、ProviderMark、精简文案。无大面积橙色洗底。 diff --git a/changelog/unreleased/overview-inflight-mock-card.md b/changelog/unreleased/overview-inflight-mock-card.md new file mode 100644 index 00000000..f2a38d7b --- /dev/null +++ b/changelog/unreleased/overview-inflight-mock-card.md @@ -0,0 +1,22 @@ +### English + +- Overview adds a read-only「Live now」summary card (Phase 1 mock): Waiting → account-slot bars → Done/Failed, depth chart with amber rate-limit bands, GSAP/CSS motion aligned to **public** AffectUI Agent Queue demo timings; queue pills and account slots reuse project **solid-glass** (top-edge rim + light contact shadow, not frosted/gray wells); amber only for rate-limit/cooldown; no pause/cancel/concurrency; `/live` not built yet. +- `/api/live` extends with a read-only projection: `workers` from AccountView/Pool in-flight, `rate_limits` from DownUntil/ModelCooldowns, `sticky` from SessionAffinity.Stats — no new cooldown state machine, no `/api/inflight*`, no SQLite. Shape matches Stage-3 mock swap. + +### 中文 + +- Overview 增加只读「实时进行中」摘要卡(阶段 1 示意):等待 → 账号槽位进度条 → 完成/失败、带琥珀限流色带的深度图;等待队列项与账号槽位复用项目 **solid-glass**(顶边高光 + 轻阴影,非磨砂/灰底);琥珀仅用于限流/冷却;无暂停/取消/并发调节;尚未做 `/live`。 +- `/api/live` 扩展只读投影:`workers` 来自 AccountView/Pool 进行中、`rate_limits` 来自 DownUntil/ModelCooldowns、`sticky` 来自 SessionAffinity.Stats — 不新建冷却状态机、不新增 `/api/inflight*`、不碰 SQLite;字段形状对齐阶段 3 与 mock 互换。 + +- Stage-1 mock live loop: waiting pills get a subtle 流光; running bars keep stronger sheen+glow; jobs FLIP/fly queue→worker and worker→Done/Failed (AffectUI public Motion prose; GSAP + solid-glass ghosts). Depth series scrolls; rate-limit bars stay amber-frozen. Entrance timings unchanged (520/420/560ms, ease 0.22,1,0.36,1). +- 阶段 1 mock 活环:等待队列轻流光、进行中条更强扫光/前沿光晕;任务从队列飞入账号槽、完成后飞入 Done/Failed;深度图滚动;限流槽琥珀冻结。入场时长与公开 demo 一致。 + + +- Motion gaps filled (GSAP only): queue vacancy FLIP after fly-out 560ms; worker receive/occupy on land; priority glide-past (mock `priority`); CountUp on metrics/Done·Failed; depth chart continuous glide + eased Y peak; retry slides back to queue when mock emits. AffectUI overflow: first 3 queue pills + kind-colored overflow dots (slide up on shrink); workers rail shows ≤4 busy/rate-limited slots. solid-glass kept; no chart-3 orange wash. +- 动效缺口补齐(仅 GSAP):飞出后队列合缝 FLIP;落槽占用;高优插队滑过;指标 CountUp;深度图连续滑移;失败可重试滑回队列。溢出:队列仅前 3 条 pill + 色点堆;槽位最多 4 条 busy/限流。solid-glass 不变,无橙色洗底。 + +- Stage-3 wire: Overview「实时进行中」**默认收起**,不消费 live 投影;点 LiveStrip「当前并发」或卡片 toggle 才展开。展开后把 `/api/live` 的 `workers` / `rate_limits` / `sticky` 映射到槽位与限流色带;mock 活环仅在 live 不可用时作空演示兜底。jobs 级明细仍示意,待请求级 API。 +- Stage-3: InflightLiveCard **collapsed by default** (no live consume until expand from concurrency strip or toggle). Open → project `/api/live` workers/rate_limits/sticky; mock tick only if live missing. Request-level jobs still demo until a real inflight API. + +- Fix: real `/api/live` projection no longer spreads mock totals/throughput/p95/depth — idle live shows zeros; depthSeries from live samples only; mock tick only when live is null. +- 修复:真实 `/api/live` 投影不再带入 mock 的完成/失败/吞吐/P95/深度;空闲 live 显示 0;深度仅用真实采样;仅 live 为 null 时跑 mock 活环。 diff --git a/changelog/unreleased/overview-inflight-outcome-fly-pulse.md b/changelog/unreleased/overview-inflight-outcome-fly-pulse.md new file mode 100644 index 00000000..95303f33 --- /dev/null +++ b/changelog/unreleased/overview-inflight-outcome-fly-pulse.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard: Done/Failed fly-outs settle slightly short of the outcome control (no dive into the button). On fly `onComplete`, the matching Done/Failed hairline gets 1–2 soft GSAP border pulses (success/danger tokens only — no orange wash). Concurrency slots, glow, fail routing, ProviderMark, and short copy kept. + +### 中文 + +- Overview「实时进行中」:飞向完成/失败时略提前落点(不到按钮中心)。飞行 `onComplete` 时对应控件细描边用 GSAP 轻脉冲 1–2 下(仅 success/danger token,无橙色洗底)。并发格、流光、失败路由、ProviderMark 与精简文案保留。 diff --git a/changelog/unreleased/overview-inflight-slot-concurrency.md b/changelog/unreleased/overview-inflight-slot-concurrency.md new file mode 100644 index 00000000..dc3078f4 --- /dev/null +++ b/changelog/unreleased/overview-inflight-slot-concurrency.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard: each account slot bar is divided into N equal cells from that account’s max concurrency (`max_inflight`); occupied cells follow live `in_flight` (wash + elapsed shimmer). One concurrency → one full-width cell. Idle cells stay faint; hairline wash only — keep glow, fail→Failed, ProviderMark, short copy. + +### 中文 + +- Overview「实时进行中」:账号槽进度条按该账号最大并发(`max_inflight`)均分成 N 格;占用格跟 live `in_flight`(洗底 + 耗时流光)。并发为 1 时一整条。空闲格淡色;仅洗底/细描边——保留流光、失败飞 Failed、ProviderMark、精简文案。 diff --git a/changelog/unreleased/overview-inflight-slot-polish.md b/changelog/unreleased/overview-inflight-slot-polish.md new file mode 100644 index 00000000..ba5e8173 --- /dev/null +++ b/changelog/unreleased/overview-inflight-slot-polish.md @@ -0,0 +1,7 @@ +### English + +- Overview InflightLiveCard: account slots slightly roomier (py-2, h-2.5 track, 11px labels, gap-2); softer pastel kind pills (chart-1/5/6); richer mint/coral Done·Failed; lighter rate-limit amber wash; busy slots get a cool chart-1 fill + edge so idle solid-glass stays clearer. Still ≤4 slots; no orange panel wash. + +### 中文 + +- Overview「实时进行中」账号槽位略加大呼吸感(py-2、进度条 h-2.5、文案 11px、槽间距 gap-2);kind 色点/胶囊用更柔的 chart 粉彩;完成/失败略加深薄荷/珊瑚;限流琥珀洗底变轻;忙碌槽用冷色 chart-1 填充与描边,空闲仍 solid-glass。仍最多 4 槽;无大面积橙色洗底。 diff --git a/docs/assets/overview-inflight-mock/affectui-public-motion-notes.md b/docs/assets/overview-inflight-mock/affectui-public-motion-notes.md new file mode 100644 index 00000000..fa27a17d --- /dev/null +++ b/docs/assets/overview-inflight-mock/affectui-public-motion-notes.md @@ -0,0 +1,89 @@ +# Agent Queue — publicly readable Motion / structure notes + +Extracted 2026-10-29 from the **public docs page** and its marketing/demo chunks. +**Do not copy Pro component source into cli2api.** Apply equivalent GSAP/CSS with project tokens. + +## Locked (Pro) + +| Asset | Status | +|-------|--------| +| `https://www.affectui.com/r/agent-queue.json` | HTTP 401 — Bearer access key required | +| `assets/component-DkFrPebu.js` / `component.clean-*.js` | Serves `var e="";export{e as default}` (empty stub) | +| Registry install via shadcn | Pro gate | + +## Publicly readable + +| Asset | What it gives | +|-------|----------------| +| Page HTML + `assets/index-*.js/css` | Catalog entry, lazy chunk names, marketing copy | +| `assets/docs-OUFUpYq4.js` | Full public docs object: props, a11y, responsive, **Motion prose** | +| `assets/demo-CRKNaMKk.js` (and `.clean`) | Live preview: **CSS keyframes, `--ui-agq-ease`, timing constants, class structure** | +| Reference PNGs (light / pinned / rate-limited) | Layout feel | +| handoff-spec.md | Stage plan + earlier Motion paraphrase | + +### Docs Motion prose (public) + +- New jobs drop in at the back; high-priority lands then glides past +- Front job → free worker → growing bar with **sheen + glowing front edge** +- Done: green beat, flies into Done; Failed: **shakes red** (or retry slides back) +- Rate limit: bars **stop + amber**, countdown; depth climbs then drains +- Numbers ease; chart scale glides; sleeps off-screen / idle +- `prefers-reduced-motion`: appear in place +- Wide: Queue | Workers | Done/Failed; `<600px` stacks + +### Demo timing constants (public) + +``` +s = 560 // layout / bar grow glide (ms) +c = 1100 // front-edge glow period +l = 1500 // sheen / sweep period +u = 520 // drop-in +d = 200 // short fades +f = 520 // flash/drop companion +``` + +### Public easing + +``` +--ui-agq-ease: cubic-bezier(0.22, 1, 0.36, 1); +``` + +(Note: earlier handoff paraphrase cited `cubic-bezier(0.32, 0.72, 0.24, 1)` — **demo CSS uses 0.22, 1, 0.36, 1**. Prefer the public demo value.) + +### Public keyframes (names + from-state only — reimplement, don’t paste Pro file) + +| Name | From | Duration / use | +|------|------|----------------| +| `ui-agq-drop` | opacity 0; translateY(-10px) scale(0.6) | **520ms** ease, backwards | +| `ui-agq-slot` | opacity 0; translateX(-8px) | **420ms** ease | +| `ui-agq-grow` | clip-path: inset(0 100% 0 0 round 8px) | **560ms** ease, backwards | +| `ui-agq-sweep` | background-position → | **1500ms** linear infinite (sheen) | +| `ui-agq-glow` | filter opacity ~0.45 | **1100ms** ease-in-out **alternate** | +| `ui-agq-shake` | translateX(-3px) @20% | **420ms** ease (with drop on fail flash) | +| `ui-agq-calm` | opacity 0 | 300ms | +| `ui-agq-pulse` | opacity mid 0.35 | 1400ms ease-in-out infinite | +| `ui-agq-pop` | scale 0.9 | — | +| `ui-agq-open` | translateY(-4px) scale(0.97) | 200ms | +| `ui-agq-hit` | — | 700ms ease-out + 380ms delay | +| `ui-agq-ping` | — | 1600ms ease-out infinite | + +### Progress bar (public CSS idea) + +``` +clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0 round 8px); +transition: clip-path 260ms linear, …; +``` + +Sheen via `::before` sweep; glow via `::after` at the front edge. + +### Class / token structure (names only) + +Root `.ui-agq` with CSS variables `--ui-agq-*` (kind tints llm/tool/agent/human, warn/ok/error, depth, ease). +Jobs `.ui-agq__job` with `data-shape` (bar / square / …), `data-flash`, workers rail, bins Done/Failed, chart bands. + +### cli2api mapping (read-only Stage 1) + +- Reimplement timings/easing above with **GSAP + small CSS keyframes** +- Colors: **cold project tokens** only (`foreground` / `surface` / `warning` / `success` / `danger`; chart hues only for kind chips if needed) +- No Pause / Cancel / concurrency stepper / promote +- No Pro source file, no `.ui-agq` wholesale CSS copy diff --git a/docs/assets/overview-inflight-mock/card-dark-rate-limit.png b/docs/assets/overview-inflight-mock/card-dark-rate-limit.png new file mode 100644 index 00000000..dc990842 Binary files /dev/null and b/docs/assets/overview-inflight-mock/card-dark-rate-limit.png differ diff --git a/docs/assets/overview-inflight-mock/card-light.png b/docs/assets/overview-inflight-mock/card-light.png new file mode 100644 index 00000000..fa304e2b Binary files /dev/null and b/docs/assets/overview-inflight-mock/card-light.png differ diff --git a/docs/assets/overview-inflight-mock/motion-gap-work-notes.md b/docs/assets/overview-inflight-mock/motion-gap-work-notes.md new file mode 100644 index 00000000..b0754d29 --- /dev/null +++ b/docs/assets/overview-inflight-mock/motion-gap-work-notes.md @@ -0,0 +1,38 @@ +# InflightLiveCard motion gaps — work notes +时间:2026-10-29 15:43 Asia/Shanghai · tip 7701907 · PR #435 + +## 改动量:**中** + +不引入 Motion / framer-motion(项目无该 dep;已有 gsap ^3.15)。 + +## Reuse(已有) + +| 已有 | 用途 | +|------|------| +| `flyGhost` + `rectCache` + `queueEase` 560ms | 队列→槽 / 槽→Done·Failed 飞牌 | +| GSAP + CustomEase `inflightQueue` (0.22,1,0.36,1) | 全部 layout / grow | +| SlotBar `data-slot-fill` clip-path grow | 落槽进度条入场(已有,补 land 时序) | +| `CountUp` (`overview/CountUp.tsx`,RAF ease) | 指标/Done·Failed 数字缓动 | +| `tickMockInflight` + solid-glass tokens | mock 环 + 表面规范(无 orange wash) | + +## 缺口 → 做法 + +1. **Queue vacancy FLIP** — fly-out 后对剩余 `data-wait-id` 用 rectCache First→Last,GSAP x/y 560ms queueEase 合缝 +2. **Worker receive/occupy on land** — fly 完成再淡入槽位 pill + 延迟 clip grow;落点轻微 brightness pulse +3. **priority glide-past** — mock 加 `priority?: 'high'|'normal'`;高优 enqueue 后插到队前,FLIP 滑过 +4. **CountUp wire** — Metric / Outcome 接 CountUp(int / ms);后缀 `/min`、`/slots` 静态 +5. **chart continuous glide** — DepthChart 稳定 x 索引 + 更长线性 scroll 感;peak domain 缓变 +6. **retry → queue** — mock 失败约一半同 id 回 queued(不 +failed);flyGhost worker→queue + drop-in + +## 不做 + +- 不加 Motion dep +- 不改 solid-glass / 不引入 chart-3 orange wash +- 不 merge / 不 release + +## + AffectUI overflow UX(steering) + +7. **QUEUE overflow** — 仅前 N=3 条 pill;其余按 kind 色小方点堆叠;队缩时点上滑晋升为 pill(FLIP + drop),可顶到最上 pill 位。去掉灰色 pad 虚点。 +8. **WORKERS overflow** — 只展示前 ~4 个 busy/rateLimited 优先槽,不铺满全部账号;计数仍用 summary.busyWorkers/workerSlots。 + +改动量仍为 **中**(同 reuse 表;overflow 为渲染裁剪 + 点位 FLIP)。 diff --git a/docs/assets/overview-inflight-mock/overview-dark.png b/docs/assets/overview-inflight-mock/overview-dark.png new file mode 100644 index 00000000..acd922a2 Binary files /dev/null and b/docs/assets/overview-inflight-mock/overview-dark.png differ diff --git a/docs/assets/overview-inflight-mock/overview-light.png b/docs/assets/overview-inflight-mock/overview-light.png new file mode 100644 index 00000000..e568a69d Binary files /dev/null and b/docs/assets/overview-inflight-mock/overview-light.png differ diff --git a/frontend/scripts/mockInflight.test.ts b/frontend/scripts/mockInflight.test.ts new file mode 100644 index 00000000..dd169c6a --- /dev/null +++ b/frontend/scripts/mockInflight.test.ts @@ -0,0 +1,283 @@ +import assert from 'node:assert/strict' +import { + applyLiveProjection, + cloneMockInflight, + getMockInflightSnapshot, + MOCK_INFLIGHT, +} from '../src/lib/mockInflight.ts' + +function run(name: string, fn: () => void) { + try { + fn() + console.log(`ok ${name}`) + } catch (error) { + console.error(`FAIL ${name}`) + throw error + } +} + +run('applyLiveProjection uses started_at for elapsed', () => { + const started = new Date(Date.now() - 12_400).toISOString() + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 1, + rpm: 3, + workers: [ + { + id: 'acc-1', + name: 'wb-a1', + provider: 'workbuddy', + busy: true, + progress: 0.5, + rate_limited: false, + started_at: started, + }, + { + id: 'acc-2', + name: 'idle', + provider: 'qoder', + busy: false, + progress: 0, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + assert.equal(snap.jobs.length, 1) + assert.equal(snap.totals.done, 0) + assert.equal(snap.waitP95Ms, 0) + const job = snap.jobs[0] + assert.ok(job.startedAtMs != null) + assert.ok(job.elapsedMs >= 12_000 && job.elapsedMs < 20_000, `elapsed=${job.elapsedMs}`) + const idle = snap.workers.find((w) => w.id === 'acc-2') + assert.equal(idle?.busy, false) + assert.equal(idle?.progress, 0) + assert.equal(idle?.jobId, undefined) +}) + +run('applyLiveProjection keeps startedAtMs across polls without started_at', () => { + const first = applyLiveProjection(cloneMockInflight(MOCK_INFLIGHT), { + in_flight: 1, + rpm: 0, + workers: [ + { + id: 'acc-1', + name: 'wb-a1', + provider: 'workbuddy', + busy: true, + progress: 0.2, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + const stamped = first.jobs[0].startedAtMs + assert.ok(stamped != null) + const second = applyLiveProjection(first, { + in_flight: 1, + rpm: 0, + workers: [ + { + id: 'acc-1', + name: 'wb-a1', + provider: 'workbuddy', + busy: true, + progress: 0.2, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + assert.equal(second.jobs[0].startedAtMs, stamped) +}) + +run('idle live does not bleed mock totals', () => { + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 0, + rpm: 0, + workers: [], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + assert.equal(snap.totals.done, 0) + assert.equal(snap.totals.failed, 0) + assert.equal(snap.throughputPerMin, 0) + assert.equal(snap.waitP95Ms, 0) +}) + + +run('applyLiveProjection routes fail via recent_completions', () => { + const busy = applyLiveProjection(cloneMockInflight(MOCK_INFLIGHT), { + in_flight: 1, + rpm: 0, + workers: [ + { + id: 'acc-1', + name: 'wb-a1', + provider: 'workbuddy', + busy: true, + progress: 0.5, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + assert.equal(busy.jobs.length, 1) + const idleFail = applyLiveProjection(busy, { + in_flight: 0, + rpm: 1, + workers: [ + { + id: 'acc-1', + name: 'wb-a1', + provider: 'workbuddy', + busy: false, + progress: 0, + rate_limited: false, + last_error_kind: 'unavailable', + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + recent_completions: [{ account_id: 'acc-1', status: 'error' }], + }) + assert.equal(idleFail.jobs.length, 0) + assert.equal(idleFail.totals.done, 0) + assert.equal(idleFail.totals.failed, 0) + assert.ok(idleFail.completions && idleFail.completions.length === 1) + assert.equal(idleFail.completions[0].ok, false) + assert.equal(idleFail.completions[0].id, 'live-acc-1') +}) + +run('applyLiveProjection last_error_kind fallback without completions', () => { + const busy = applyLiveProjection(cloneMockInflight(MOCK_INFLIGHT), { + in_flight: 1, + rpm: 0, + workers: [ + { + id: 'acc-9', + name: 'x', + provider: 'qoder', + busy: true, + progress: 0.2, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + const idle = applyLiveProjection(busy, { + in_flight: 0, + rpm: 0, + workers: [ + { + id: 'acc-9', + name: 'x', + provider: 'qoder', + busy: false, + progress: 0, + rate_limited: false, + last_error_kind: 'auth', + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + assert.ok(idle.completions && idle.completions.length === 1) + assert.equal(idle.completions[0].ok, false) +}) + +run('applyLiveProjection success completion flies ok', () => { + const busy = applyLiveProjection(cloneMockInflight(MOCK_INFLIGHT), { + in_flight: 1, + rpm: 0, + workers: [ + { + id: 'acc-ok', + name: 'ok', + provider: 'qoder', + busy: true, + progress: 0.9, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + const idle = applyLiveProjection(busy, { + in_flight: 0, + rpm: 2, + workers: [ + { + id: 'acc-ok', + name: 'ok', + provider: 'qoder', + busy: false, + progress: 0, + rate_limited: false, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + recent_completions: [{ account_id: 'acc-ok', status: 'ok' }], + }) + assert.ok(idle.completions && idle.completions[0].ok === true) +}) + + +run('applyLiveProjection maps max_inflight / in_flight to slot cells', () => { + const snap = applyLiveProjection(getMockInflightSnapshot(), { + in_flight: 3, + rpm: 1, + workers: [ + { + id: 'acc-4', + name: 'wb-x', + provider: 'workbuddy', + busy: true, + progress: 0.5, + rate_limited: false, + max_inflight: 4, + in_flight: 3, + }, + { + id: 'acc-1', + name: 'solo', + provider: 'qoder', + busy: true, + progress: 0.2, + rate_limited: false, + max_inflight: 1, + in_flight: 1, + }, + { + id: 'acc-idle', + name: 'idle', + provider: 'trae', + busy: false, + progress: 0, + rate_limited: false, + max_inflight: 4, + in_flight: 0, + }, + ], + rate_limits: [], + sticky: { bindings: 0, hits: 0, misses: 0, capacity: 64, ttl_seconds: 600 }, + }) + const multi = snap.workers.find((w) => w.id === 'acc-4') + assert.equal(multi?.concurrency, 4) + assert.equal(multi?.inFlight, 3) + assert.equal(multi?.busy, true) + const solo = snap.workers.find((w) => w.id === 'acc-1') + assert.equal(solo?.concurrency, 1) + assert.equal(solo?.inFlight, 1) + const idle = snap.workers.find((w) => w.id === 'acc-idle') + assert.equal(idle?.concurrency, 4) + assert.equal(idle?.inFlight, 0) + assert.equal(idle?.busy, false) +}) + +console.log('all mockInflight tests passed') diff --git a/frontend/src/api/live.ts b/frontend/src/api/live.ts index 8be1d717..ac163ba4 100644 --- a/frontend/src/api/live.ts +++ b/frontend/src/api/live.ts @@ -2,12 +2,66 @@ import { api } from './client' export type LiveAccount = { id: string; in_flight: number; max_inflight: number; enabled: boolean } +/** Account-pool slot projection — Stage-3 InflightLiveCard swaps mock workers onto this. */ +export type LiveWorker = { + id: string + name: string + provider: string + busy: boolean + in_flight: number + max_inflight: number + enabled: boolean + rate_limited: boolean + progress: number + /** RFC3339 when the pool slot went busy (InFlight 0→1); omitted when idle. */ + started_at?: string + /** Account last_error_kind — fallback for busy→idle fail routing. */ + last_error_kind?: string +} + +/** Terminal request finish drained this /api/live poll (Done vs Failed fly-out). */ +export type LiveCompletion = { + account_id: string + /** ok | error | incomplete | canceled */ + status: string +} + +/** Active cooldown window from AccountView.DownUntil / model_cooldowns. */ +export type LiveRateLimit = { + id: string + label: string + account_id: string + model?: string + until: string + remaining_ms: number +} + +export type LiveSticky = { + ttl_seconds: number + capacity: number + bindings: number + hits: number + misses: number + escapes: number + rebindings: number + last_escape_at?: string + last_escape_reason?: string + last_miss_reason?: string +} + export type LiveSnapshot = { time: string in_flight: number capacity: number rpm: number accounts: LiveAccount[] + /** Stage-3: map onto MockAccountSlot (busy / rate_limited / progress). */ + workers: LiveWorker[] + /** Stage-3: map onto MockRateLimitWindow (remaining_ms; depth bands stay client-side). */ + rate_limits: LiveRateLimit[] + sticky: LiveSticky + /** Terminal finishes since last poll — InflightLiveCard routes fly-outs. */ + recent_completions?: LiveCompletion[] } export function fetchLive() { diff --git a/frontend/src/components/overview/InflightLiveCard.tsx b/frontend/src/components/overview/InflightLiveCard.tsx new file mode 100644 index 00000000..f1fd5528 --- /dev/null +++ b/frontend/src/components/overview/InflightLiveCard.tsx @@ -0,0 +1,1423 @@ +import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react' +import { Link } from 'react-router-dom' +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 { + Area, + AreaChart, + ReferenceArea, + ReferenceLine, + ResponsiveContainer, + XAxis, + YAxis, +} from 'recharts' +import { + applyLiveProjection, + clampSlotConcurrency, + cloneMockInflight, + getMockInflightSnapshot, + summarizeMockInflight, + tickMockInflight, + type MockAccountSlot, + type MockInflightJob, + type MockInflightSnapshot, + type MockJobKind, +} from '@/lib/mockInflight' +import { CountUp } from '@/components/overview/CountUp' +import { ProviderMark } from '@/components/ProviderMark' +import { duration, ease, gsap, motionDuration, prefersReducedMotion } from '@/lib/motion' + +gsap.registerPlugin(CustomEase) +const queueEase = + CustomEase.get('inflightQueue') || + CustomEase.create('inflightQueue', '0.22, 1, 0.36, 1') + +/** AffectUI overflow: first N queue pills; rest as kind-colored dots. */ +const QUEUE_PILL_MAX = 3 +/** AffectUI: show a short worker rail (busy/rate-limited first), not every account. */ +const WORKER_VISIBLE_MAX = 4 + +type T = (key: string, vars?: Record) => string + +function formatRemain(ms: number) { + const sec = Math.max(0, Math.round(ms / 1000)) + const m = Math.floor(sec / 60) + const s = sec % 60 + if (m) return `${m}m ${String(s).padStart(2, '0')}s` + return `${s}s` +} + +function formatElapsed(ms: number) { + const sec = Math.max(0, ms / 1000) + if (sec >= 60) { + const m = Math.floor(sec / 60) + const s = Math.floor(sec % 60) + return `${m}m ${String(s).padStart(2, '0')}s` + } + if (sec >= 10) return `${sec.toFixed(0)}s` + return `${sec.toFixed(1)}s` +} + +/** Busy-slot elapsed: prefer wall-clock startedAtMs + live clock; else mock elapsedMs. */ +function jobElapsedMs(job: MockInflightJob | undefined, clockMs: number): number { + if (!job) return 0 + if (job.startedAtMs != null) return Math.max(0, clockMs - job.startedAtMs) + return Math.max(0, job.elapsedMs) +} + +/** + * Kind identity from public AffectUI demo hierarchy (llm/tool/agent washes), + * remapped to project chart / foreground tokens — never a second brand palette. + */ +function kindDot(kind: MockJobKind): string { + switch (kind) { + 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 kindPill(kind: MockJobKind): string { + switch (kind) { + 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 DepthChart({ + series, + bands, + backpressure, + label, +}: { + series: number[] + bands: Array<{ from: number; until: number }> + backpressure: number + label: string +}) { + // Continuous glide: keep a stable x domain (0..n-1) while values scroll; + // ease Y peak so scale changes don’t jump. Tick cadence ~260ms → linear ~560ms morph. + const rawPeak = Math.max(backpressure, ...series, 1) + const peakRef = useRef(rawPeak) + const [peak, setPeak] = useState(rawPeak) + useEffect(() => { + if (prefersReducedMotion()) { + peakRef.current = rawPeak + setPeak(rawPeak) + return + } + const from = peakRef.current + const to = rawPeak + if (Math.abs(to - from) < 0.01) return + let raf = 0 + const t0 = performance.now() + const dur = motionDuration(0.56) * 1000 + const tick = (now: number) => { + const t = Math.min(1, (now - t0) / dur) + // queue ease approx: 1 - (1-t)^3 + const e = 1 - Math.pow(1 - t, 3) + const v = from + (to - from) * e + peakRef.current = v + setPeak(v) + if (t < 1) raf = requestAnimationFrame(tick) + } + raf = requestAnimationFrame(tick) + return () => cancelAnimationFrame(raf) + }, [rawPeak]) + + const data = useMemo( + () => series.map((v, i) => ({ i, v, bp: backpressure })), + [series, backpressure], + ) + const bandRows = useMemo( + () => + bands.map((band, idx) => { + const n = Math.max(1, series.length - 1) + return { + key: idx, + x1: band.from * n, + x2: Math.max(band.from * n + 0.35, band.until * n), + } + }), + [bands, series.length], + ) + const yMax = Math.max(peak, backpressure, 1) + + return ( +
+ + + + + {bandRows.map((b) => ( + + ))} + + + + + + + + + + +
+ ) +} + +function SlotBar({ + slot, + job, + clockMs, + idleLabel, + pausedLabel, +}: { + slot: MockAccountSlot + job?: MockInflightJob + clockMs: number + idleLabel: string + pausedLabel: string +}) { + const frozen = Boolean(slot.rateLimited) + const concurrency = clampSlotConcurrency(slot.concurrency ?? 1) + const occupiedRaw = + slot.inFlight != null + ? Math.max(0, Math.floor(slot.inFlight)) + : slot.busy + ? 1 + : 0 + const occupied = Math.min(concurrency, occupiedRaw) + const running = Boolean(occupied > 0 && !frozen) + const label = job?.name ?? (frozen ? pausedLabel : idleLabel) + const elapsed = jobElapsedMs(job, clockMs) + const cells = Array.from({ length: concurrency }, (_, i) => i < occupied) + return ( +
+ {frozen ? ( + + ) : null} + + {/* 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. */} +
+ {cells.map((filled, i) => ( +
+ {running && filled ? ( + <> + + + + + ) : null} +
+ ))} +
+ + {frozen ? ( + {pausedLabel} + ) : job || occupied > 0 ? ( + formatElapsed(elapsed) + ) : ( + — + )} + +
+ ) +} + +/** + * Overview summary: Agent Queue feel over cli2api pool/inflight/cooldown concepts. + * Default collapsed — no /api/live consume and no mock loop until expanded + * (toggle or LiveStrip「当前并发」). When open, project live workers / + * rate_limits / sticky; mock tick only as empty-demo fallback. + * Motion timings from public AffectUI Agent Queue demo (mapped to project + * tokens). Link targets `/live` later — no Pause/Cancel/stepper. + */ +export function InflightLiveCard({ + t, + snapshot, + live = null, + expanded: expandedProp, + onExpandedChange, + defaultExpanded = false, +}: { + t: T + snapshot?: MockInflightSnapshot + /** Parent /api/live snapshot — only passed while expanded so the card does not drive fetches. */ + live?: LiveSnapshot | null + expanded?: boolean + onExpandedChange?: (open: boolean) => void + defaultExpanded?: boolean +}) { + const controlled = snapshot !== undefined + const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultExpanded) + const expanded = expandedProp ?? uncontrolledOpen + const setExpanded = (open: boolean) => { + onExpandedChange?.(open) + if (expandedProp === undefined) setUncontrolledOpen(open) + } + + const [liveSnap, setLiveSnap] = useState(() => + cloneMockInflight(snapshot ?? getMockInflightSnapshot()), + ) + const [useMockFallback, setUseMockFallback] = useState(false) + const [sticky, setSticky] = useState(null) + /** Wall clock for live startedAtMs elapsed (mock uses tickMockInflight elapsedMs). */ + const [clockMs, setClockMs] = useState(() => Date.now()) + const snap = controlled ? snapshot! : liveSnap + const summary = useMemo(() => summarizeMockInflight(snap), [snap]) + const rootRef = useRef(null) + const enteredRef = useRef(false) + const prevRef = useRef(snap) + /** Last painted rects — handoff flies read these after the source unmounts. */ + const rectCache = useRef<{ + wait: Record + slot: Record + outcome: { ok?: DOMRect; danger?: DOMRect } + }>({ wait: {}, slot: {}, outcome: {} }) + const jobById = useMemo(() => new Map(snap.jobs.map((j) => [j.id, j])), [snap.jobs]) + const waiting = snap.jobs.filter((j) => j.status === 'queued') + const queuePills = waiting.slice(0, QUEUE_PILL_MAX) + const queueOverflow = waiting.slice(QUEUE_PILL_MAX) + // AffectUI: short worker rail — busy / rate-limited first, cap at N (not every account). + const visibleWorkers = useMemo(() => { + const preferred = snap.workers.filter((w) => w.busy || w.rateLimited) + const rest = snap.workers.filter((w) => !w.busy && !w.rateLimited) + const out: typeof snap.workers = [] + const seen = new Set() + for (const w of [...preferred, ...rest]) { + if (seen.has(w.id)) continue + seen.add(w.id) + out.push(w) + if (out.length >= WORKER_VISIBLE_MAX) break + } + return out + }, [snap.workers]) + const rateActive = snap.rateLimits[0] + const waitAmber = summary.waiting >= snap.backpressure + + // External snapshot (tests) wins. Otherwise: when expanded, project /api/live + // (even idle — no mock totals/throughput/p95/depth bleed). Mock tick only if + // live is null. useLayoutEffect so the first expanded paint is already clean. + useLayoutEffect(() => { + if (controlled) { + setLiveSnap(cloneMockInflight(snapshot!)) + setUseMockFallback(false) + setSticky(null) + return + } + if (!expanded) { + setUseMockFallback(false) + return + } + if (live !== null) { + setUseMockFallback(false) + setSticky(live.sticky) + setClockMs(Date.now()) + setLiveSnap((prev) => applyLiveProjection(prev, live)) + return + } + // live === null → Stage-1 mock loop only (offline / no parent poll). + setSticky(null) + setUseMockFallback(true) + }, [controlled, snapshot, expanded, live]) + + // Mock raf loop — gated on useMockFallback (live === null only). + useEffect(() => { + if (controlled || !expanded || !useMockFallback || live !== null) return + if (prefersReducedMotion()) return + let raf = 0 + let last = performance.now() + let alive = true + const step = (now: number) => { + if (!alive) return + const dt = now - last + if (!document.hidden && dt >= 260) { + last = now + setLiveSnap((prev) => tickMockInflight(prev, dt)) + } + raf = requestAnimationFrame(step) + } + raf = requestAnimationFrame(step) + return () => { + alive = false + cancelAnimationFrame(raf) + } + }, [controlled, expanded, useMockFallback, live]) + + // Elapsed tick (~150ms): wall-clock since started_at so busy slots don't stick at 0.0s between /api/live polls. + useEffect(() => { + if (!expanded) return + if (prefersReducedMotion()) { + setClockMs(Date.now()) + return + } + let raf = 0 + let last = 0 + let alive = true + const step = (now: number) => { + if (!alive) return + if (!document.hidden && now - last >= 150) { + last = now + setClockMs(Date.now()) + } + raf = requestAnimationFrame(step) + } + setClockMs(Date.now()) + raf = requestAnimationFrame(step) + return () => { + alive = false + cancelAnimationFrame(raf) + } + }, [expanded]) + + useEffect(() => { + if (!expanded) enteredRef.current = false + }, [expanded]) + + /** Entrance once — public ui-agq-drop / slot / grow timings. */ + useLayoutEffect(() => { + const root = rootRef.current + if (!root || prefersReducedMotion() || enteredRef.current) return + enteredRef.current = true + const ctx = gsap.context(() => { + const pills = root.querySelectorAll('[data-wait-pill]') + const tokens = root.querySelectorAll('[data-wait-token]') + const slots = root.querySelectorAll('[data-slot]') + const fills = root.querySelectorAll('[data-slot-fill]') + const depth = root.querySelectorAll('[data-depth]') + + if (pills.length) { + gsap.fromTo( + pills, + { opacity: 0, y: -10, scale: 0.6 }, + { + opacity: 1, + y: 0, + scale: 1, + duration: motionDuration(0.52), + ease: queueEase, + stagger: 0.045, + force3D: true, + }, + ) + } + if (tokens.length) { + gsap.fromTo( + tokens, + { opacity: 0, scale: 0.6 }, + { + opacity: 1, + scale: 1, + duration: motionDuration(0.42), + ease: ease.soft, + stagger: 0.02, + delay: motionDuration(0.18), + }, + ) + } + if (slots.length) { + gsap.fromTo( + slots, + { opacity: 0, x: -8 }, + { + opacity: 1, + x: 0, + duration: motionDuration(0.42), + ease: queueEase, + stagger: 0.05, + delay: motionDuration(0.06), + force3D: true, + }, + ) + } + if (fills.length) { + fills.forEach((el, i) => { + gsap.fromTo( + el, + { opacity: 0, scaleX: 0.35 }, + { + opacity: 1, + scaleX: 1, + duration: motionDuration(0.56), + ease: queueEase, + delay: motionDuration(0.18 + i * 0.03), + transformOrigin: 'left center', + }, + ) + }) + } + const doneEl = root.querySelector('[data-outcome="ok"]') + const failEl = root.querySelector('[data-outcome="danger"]') + if (doneEl) { + gsap.fromTo( + doneEl, + { opacity: 0, y: 8, scale: 0.92, filter: 'brightness(1.6)' }, + { + opacity: 1, + y: 0, + scale: 1, + filter: 'brightness(1)', + duration: motionDuration(0.48), + ease: ease.soft, + delay: motionDuration(0.42), + }, + ) + } + if (failEl) { + gsap.fromTo( + failEl, + { opacity: 0, x: 0 }, + { + opacity: 1, + duration: motionDuration(0.28), + delay: motionDuration(0.5), + onComplete: () => { + if (prefersReducedMotion()) return + gsap.fromTo( + failEl, + { x: -3 }, + { + x: 3, + duration: motionDuration(0.07), + yoyo: true, + repeat: 5, + ease: 'power1.inOut', + onComplete: () => { + gsap.set(failEl, { x: 0 }) + }, + }, + ) + }, + }, + ) + } + if (depth.length) { + gsap.fromTo( + depth, + { opacity: 0, y: 6 }, + { + opacity: 1, + y: 0, + duration: motionDuration(duration.base), + ease: queueEase, + delay: motionDuration(0.35), + force3D: true, + }, + ) + } + }, root) + return () => ctx.revert() + // Re-run when body mounts (default collapsed). + }, [expanded]) + + /** Live handoffs: queue→worker fly, worker→DONE/FAILED fly (AffectUI prose). */ + useLayoutEffect(() => { + const root = rootRef.current + const prev = prevRef.current + prevRef.current = snap + const refreshCache = () => { + if (!root) return + const wait: Record = {} + root.querySelectorAll('[data-wait-id]').forEach((el) => { + const id = el.getAttribute('data-wait-id') + if (id) wait[id] = el.getBoundingClientRect() + }) + const slotR: Record = {} + root.querySelectorAll('[data-slot-id]').forEach((el) => { + const id = el.getAttribute('data-slot-id') + if (id) slotR[id] = el.getBoundingClientRect() + }) + rectCache.current = { + wait, + slot: slotR, + outcome: { + ok: root.querySelector('[data-outcome="ok"]')?.getBoundingClientRect(), + danger: root.querySelector('[data-outcome="danger"]')?.getBoundingClientRect(), + }, + } + } + if (!root || prefersReducedMotion() || !enteredRef.current) { + refreshCache() + return + } + if (prev === snap) { + refreshCache() + return + } + + const prevJobs = new Map(prev.jobs.map((j) => [j.id, j])) + const nextJobs = new Map(snap.jobs.map((j) => [j.id, j])) + const prevWorkerOf = new Map( + prev.workers.filter((w) => w.jobId).map((w) => [w.jobId!, w.id]), + ) + const nextWorkerOf = new Map( + snap.workers.filter((w) => w.jobId).map((w) => [w.jobId!, w.id]), + ) + + const flyGhost = ( + from: DOMRect | HTMLElement | null | undefined, + to: DOMRect | HTMLElement | null | undefined, + label: string, + kind: MockJobKind, + tone: 'run' | 'ok' | 'danger' | 'retry', + beatEl?: HTMLElement | null, + onLand?: () => void, + ) => { + const a = from instanceof HTMLElement ? from.getBoundingClientRect() : from + const b = to instanceof HTMLElement ? to.getBoundingClientRect() : to + if (!a || !b || a.width < 2 || b.width < 2) return + + // Opaque solid-glass pill clone (AffectUI: full job pill flies into slot, + // not a faint label). Stay readable mid-flight; trail is separate afterimages. + const kindToken = + kind === 'chat' + ? 'var(--chart-1)' + : kind === 'embed' + ? 'var(--chart-6)' + : kind === 'tools' + ? 'var(--chart-5)' + : 'var(--foreground)' + const kindWash = + kind === 'chat' + ? 'color-mix(in oklab, var(--chart-1) 32%, var(--surface))' + : kind === 'embed' + ? 'color-mix(in oklab, var(--chart-6) 32%, var(--surface))' + : kind === 'tools' + ? 'color-mix(in oklab, var(--chart-5) 26%, var(--surface))' + : 'var(--surface)' + const bg = + tone === 'ok' + ? 'color-mix(in oklab, var(--success) 24%, var(--surface))' + : tone === 'danger' + ? 'color-mix(in oklab, var(--danger) 22%, var(--surface))' + : tone === 'retry' + ? 'color-mix(in oklab, var(--warning) 16%, var(--surface))' + : kindWash + const fg = + tone === 'ok' + ? 'var(--success)' + : tone === 'danger' + ? 'var(--danger)' + : tone === 'retry' + ? 'var(--warning)' + : 'var(--foreground)' + const glowToken = + tone === 'ok' + ? 'var(--success)' + : tone === 'danger' + ? 'var(--danger)' + : tone === 'retry' + ? 'var(--warning)' + : kindToken + const dotColor = kindToken + // Opaque lead + kind-tinted outer glow so the trail reads as light, not faint ghosts. + const glassShadow = + `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, ${glowToken} 28%, transparent), 0 6px 18px color-mix(in oklab, ${glowToken} 36%, transparent), 0 12px 32px color-mix(in oklab, var(--foreground) 16%, transparent)` + 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) + // 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) + + const makePill = (opts: { opacity: number; asTrail?: boolean }) => { + const el = document.createElement('div') + el.setAttribute('aria-hidden', 'true') + Object.assign(el.style, { + position: 'fixed', + left: `${a.left}px`, + top: `${a.top}px`, + width: `${w}px`, + height: `${h}px`, + zIndex: opts.asTrail ? '78' : '80', + pointerEvents: 'none', + display: 'flex', + alignItems: 'center', + gap: '6px', + padding: '0 8px', + borderRadius: '8px', + fontSize: '11px', + fontWeight: '500', + lineHeight: '1', + color: fg, + background: bg, + boxShadow: opts.asTrail ? trailShadow : glassShadow, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + opacity: String(opts.opacity), + willChange: 'transform, left, top, opacity, filter', + // Stretch residual slightly so the trail reads as motion, not a second pill. + transform: opts.asTrail ? 'scaleX(1.12)' : 'none', + filter: opts.asTrail + ? 'blur(0.9px) brightness(1.18) saturate(1.25)' + : 'none', + } as CSSStyleDeclaration) + const dot = document.createElement('span') + Object.assign(dot.style, { + width: '6px', + height: '6px', + borderRadius: '2px', + flexShrink: '0', + background: dotColor, + }) + const text = document.createElement('span') + text.textContent = label + Object.assign(text.style, { + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + minWidth: '0', + flex: '1', + }) + el.append(dot, text) + document.body.appendChild(el) + return el + } + + const ghost = makePill({ opacity: 1 }) + // 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.to(t, { + left: endLeft, + top: endTop, + width: w * 0.92, + 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 + }) + void trails + + gsap.to(ghost, { + left: endLeft, + top: endTop, + width: w * 0.92, + scale: tone === 'run' || tone === 'retry' ? 0.96 : 0.88, + // Keep the lead pill opaque for the whole flight — only fade after a short land hold. + opacity: 1, + duration: flyDur, + ease: queueEase, + force3D: true, + onComplete: () => { + // Immediate on fly settle: light Done/Failed hairline pulse (no delay). + const beat = beatEl + if (beat && (tone === 'ok' || tone === 'danger')) { + const base = + tone === '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)' + const lit = + tone === 'ok' + ? 'inset 0 0 0 1.5px color-mix(in oklab, var(--success) 52%, transparent), 0 0 8px color-mix(in oklab, var(--success) 16%, transparent)' + : 'inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 52%, transparent), 0 0 8px color-mix(in oklab, var(--danger) 16%, transparent)' + gsap.fromTo( + beat, + { boxShadow: base }, + { + boxShadow: lit, + duration: motionDuration(0.22), + ease: 'power1.inOut', + yoyo: true, + repeat: 3, // ~2 soft pulses + onComplete: () => { + gsap.set(beat, { clearProps: 'boxShadow' }) + }, + }, + ) + } + // Slot/queue land chrome, then fade the opaque ghost after a short hold. + onLand?.() + gsap.to(ghost, { + opacity: 0, + scale: tone === 'run' || tone === 'retry' ? 0.9 : 0.82, + duration: fadeDur, + delay: holdDur, + ease: 'power1.out', + onComplete: () => ghost.remove(), + }) + }, + }) + } + + const cache = rectCache.current + + // Queue → worker: was queued, now running on a slot. + 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 + 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 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, () => { + if (!toEl) return + gsap.fromTo( + toEl, + { filter: 'brightness(1.35)' }, + { filter: 'brightness(1)', duration: motionDuration(0.42), ease: ease.soft }, + ) + if (landPill) { + gsap.to(landPill, { + opacity: 1, + scale: 1, + duration: motionDuration(0.42), + ease: queueEase, + }) + } + landFills.forEach((el, i) => { + gsap.to(el, { + opacity: 1, + scaleX: 1, + duration: motionDuration(0.56), + ease: queueEase, + delay: motionDuration(i * 0.03), + }) + }) + }) + } + + // 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]') + waitEls.forEach((el) => { + const id = el.dataset.waitId + if (!id || flewFromQueue.has(id)) return + const first = cache.wait[id] + if (!first) return + const last = el.getBoundingClientRect() + const dx = first.left - last.left + const dy = first.top - last.top + if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5) return + gsap.fromTo( + el, + { x: dx, y: dy }, + { x: 0, y: 0, duration: motionDuration(0.56), ease: queueEase, force3D: true }, + ) + }) + // Overflow dots that promote into pill slots also FLIP from token rects. + const tokens = root.querySelectorAll('[data-wait-token][data-wait-id]') + tokens.forEach((el) => { + const id = el.dataset.waitId + if (!id) return + const first = cache.wait[id] + if (!first) return + const last = el.getBoundingClientRect() + const dx = first.left - last.left + const dy = first.top - last.top + if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5) return + gsap.fromTo( + el, + { x: dx, y: dy, scale: 1.15 }, + { x: 0, y: 0, scale: 1, duration: motionDuration(0.56), ease: queueEase }, + ) + }) + } + + // Worker → retry queue (same id back to queued) OR DONE/FAILED. + for (const [id, before] of prevJobs) { + if (before.status !== 'running') continue + const still = nextJobs.get(id) + const workerId = prevWorkerOf.get(id) + const fromRect = workerId ? cache.slot[workerId] : undefined + + // Retry: running → queued (AffectUI: retry slides back). + if (still && still.status === 'queued') { + const toEl = + root.querySelector(`[data-wait-id="${CSS.escape(id)}"]`) ?? + root.querySelector('[data-queue-col]') + const toRect = toEl?.getBoundingClientRect() + flyGhost(fromRect, toRect, before.name, before.kind, 'retry', null, () => { + const pill = root.querySelector(`[data-wait-id="${CSS.escape(id)}"]`) + if (!pill) return + gsap.fromTo( + pill, + { opacity: 0.4, scale: 0.85 }, + { opacity: 1, scale: 1, duration: motionDuration(0.42), ease: queueEase }, + ) + }) + continue + } + + if (still && still.status === 'running') continue + // Prefer per-job completion (mock tick + live recent_completions / + // last_error_kind). Totals bump is a last-resort fallback only — live + // keeps totals at 0, so without completions every busy→idle looked Done. + const comp = snap.completions?.find((c) => c.id === id) + let tone: 'ok' | 'danger' + if (comp) { + tone = comp.ok ? 'ok' : 'danger' + } else if (still?.status === 'failed') { + tone = 'danger' + } else if (still?.status === 'done') { + tone = 'ok' + } else { + const okBump = snap.totals.done > prev.totals.done + const failBump = snap.totals.failed > prev.totals.failed + // fail-only bump → Failed; otherwise Done (ambiguous same-tick needs completions). + tone = failBump && !okBump ? 'danger' : 'ok' + } + const beat = root.querySelector( + tone === 'ok' ? '[data-outcome="ok"]' : '[data-outcome="danger"]', + ) + const toRect = beat?.getBoundingClientRect() ?? cache.outcome[tone] + flyGhost(fromRect, toRect, before.name, before.kind, tone, beat) + } + + // New wait pills drop in (AffectUI: new jobs drop at the back). + // High-priority later glides past via queue-order FLIP below. + for (const [id, job] of nextJobs) { + if (job.status !== 'queued') continue + if (prevJobs.has(id)) continue + const el = root.querySelector(`[data-wait-id="${CSS.escape(id)}"]`) + if (!el) continue + gsap.fromTo( + el, + { opacity: 0, y: -10, scale: 0.6 }, + { + opacity: 1, + y: 0, + scale: 1, + duration: motionDuration(0.52), + ease: queueEase, + }, + ) + } + + // Priority glide-past + general queue reorder FLIP (high moved toward front). + { + const prevQueued = prev.jobs.filter((j) => j.status === 'queued').map((j) => j.id) + const nextQueued = snap.jobs.filter((j) => j.status === 'queued').map((j) => j.id) + const orderChanged = + prevQueued.length === nextQueued.length && + prevQueued.some((id, i) => id !== nextQueued[i]) + if (orderChanged) { + for (const id of nextQueued) { + const el = root.querySelector(`[data-wait-id="${CSS.escape(id)}"]`) + if (!el) continue + const first = cache.wait[id] + if (!first) continue + const last = el.getBoundingClientRect() + const dx = first.left - last.left + const dy = first.top - last.top + if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5) continue + gsap.fromTo( + el, + { x: dx, y: dy }, + { x: 0, y: 0, duration: motionDuration(0.56), ease: queueEase, force3D: true }, + ) + } + } + } + + // Dot → pill promotion when overflow slides up into the visible N. + { + const prevQueued = prev.jobs.filter((j) => j.status === 'queued').map((j) => j.id) + const nextQueued = snap.jobs.filter((j) => j.status === 'queued').map((j) => j.id) + for (let i = 0; i < Math.min(QUEUE_PILL_MAX, nextQueued.length); i++) { + const id = nextQueued[i] + const prevIdx = prevQueued.indexOf(id) + if (prevIdx < QUEUE_PILL_MAX) continue // already was a pill (or new) + if (prevIdx < 0) continue + const el = root.querySelector(`[data-wait-id="${CSS.escape(id)}"]`) + if (!el || el.dataset.waitToken) continue + // Was a dot, now a pill — slide-up expand. + gsap.fromTo( + el, + { opacity: 0.5, y: 12, scale: 0.7 }, + { opacity: 1, y: 0, scale: 1, duration: motionDuration(0.52), ease: queueEase }, + ) + } + } + + refreshCache() + }, [snap, expanded]) + + const depthLabel = t('inflightDepthHint', { n: summary.depthNow }) + const liveBadge = !useMockFallback && Boolean(live) + const stickyBindings = sticky?.bindings ?? 0 + + return ( + + + +
+ + {expanded ? ( + e.stopPropagation()} + > + {t('inflightOpen')} + + + ) : ( + + )} +
+ + {expanded ? ( +
+
+ + + + +
+ + {/* Waiting → account-slot bars → Done/Failed (AffectUI Agent Queue flow) */} +
+
+
+ {t('inflightQueue')} + + {summary.waiting} + +
+
+ {queuePills.map((job) => ( +
+ + + + + {job.name} + {job.priority === 'high' ? ( + ↑ + ) : null} + {job.sticky ? ( + {t('inflightSticky')} + ) : null} + + + + {formatElapsed(jobElapsedMs(job, clockMs))} + +
+ ))} + {queueOverflow.length ? ( +
+ {queueOverflow.map((job) => ( + + ))} + +{queueOverflow.length} +
+ ) : queuePills.length === 0 ? ( +
{t('inflightQueueEmpty')}
+ ) : null} +
+
+ +
+
+ {t('inflightSlots')} + + {summary.occupiedSlots}/{summary.workerSlots} + +
+ {/* Vertical worker rail — growing bars, AffectUI layout */} +
+ {visibleWorkers.map((slot) => ( + + ))} +
+
+ +
+ } + /> + } + /> +
+
+ +
+
+ {t('inflightDepth')} + {depthLabel} +
+
+ ({ from: r.from, until: r.until }))} + backpressure={snap.backpressure} + label={depthLabel} + /> +
+ {rateActive ? ( +
+ {t('inflightRateBand', { + label: rateActive.label, + remain: formatRemain(rateActive.remainingMs), + })} +
+ ) : null} +
+ +
+ ) : null} +
+ ) +} + +function Metric({ + label, + value, + suffix, + kind = 'int', + warn, +}: { + label: string + value: number + suffix?: string + kind?: 'int' | 'ms' + warn?: boolean +}) { + return ( +
+
{label}
+
+ + {suffix ? {suffix} : null} +
+
+ ) +} + +function Outcome({ + label, + value, + tone, + icon, +}: { + label: string + value: number + tone: 'ok' | 'danger' + icon: ReactNode +}) { + const ok = tone === 'ok' + return ( +
+ + {icon} + +
+ +
+ {label} +
+ ) +} diff --git a/frontend/src/components/overview/LiveStrip.tsx b/frontend/src/components/overview/LiveStrip.tsx index 22a6a32b..bdf4d598 100644 --- a/frontend/src/components/overview/LiveStrip.tsx +++ b/frontend/src/components/overview/LiveStrip.tsx @@ -7,11 +7,35 @@ const LiveSparkline = lazy(() => import('@/components/overview/LiveSparkline').t type T = (key: string, vars?: Record) => string /** Slim one-row live readout: concurrency/capacity, requests in last 60s, 60s trace. */ -export function LiveStrip({ live, samples, t }: { live: LiveSnapshot | null; samples: LiveSample[]; t: T }) { +export function LiveStrip({ + live, + samples, + t, + onConcurrencyClick, +}: { + live: LiveSnapshot | null + samples: LiveSample[] + t: T + /** Expand Overview InflightLiveCard from「当前并发」without a second fetch. */ + onConcurrencyClick?: () => void +}) { const inFlight = live?.in_flight ?? null const capacity = live?.capacity ?? 0 const load = inFlight != null && capacity > 0 ? inFlight / capacity : 0 const saturated = capacity > 0 && inFlight != null && inFlight >= capacity + const concurrencyInner = ( + <> + {t('liveConcurrency')} + + + {inFlight ?? '—'}/{live ? capacity : '—'} + + + + + + + ) return (
0 ? 'ok' : ''} /> - - {t('liveConcurrency')} - - - {inFlight ?? '—'}/{live ? capacity : '—'} - - - - + {onConcurrencyClick ? ( + + ) : ( + + {concurrencyInner} - + )} {t('liveRpm')} {live?.rpm ?? '—'} diff --git a/frontend/src/i18n/messages.ts b/frontend/src/i18n/messages.ts index 7be6e0d3..ed70a824 100644 --- a/frontend/src/i18n/messages.ts +++ b/frontend/src/i18n/messages.ts @@ -659,6 +659,31 @@ export const messages: Record = { liveTrace: 'Trend', livePeak: 'peak {n}', liveSaturated: 'Saturated', + inflightTitle: 'Live now', + inflightMockBadge: 'mock', + inflightLiveBadge: 'live', + inflightHint: 'Slots · in-flight · cooldown', + inflightCardAria: 'Open live detail', + inflightOpen: 'View all', + inflightExpand: 'Expand', + inflightExpandFromConcurrency: 'Expand live in-flight details', + inflightStickyBindings: 'sticky · {n}', + inflightWaiting: 'Waiting', + inflightRunning: 'Running', + inflightThroughput: 'Throughput', + inflightWaitP95: 'P95', + inflightQueue: 'Waiting', + inflightQueueEmpty: 'Empty', + inflightSlots: 'Slots', + inflightSticky: 'sticky', + inflightDone: 'Done', + inflightFailed: 'Failed', + inflightDepth: 'Depth', + inflightDepthHint: '{n}', + inflightRatePill: 'rate limit · {remain}', + inflightRateBand: '{label} · {remain}', + inflightSlotIdle: 'idle', + inflightSlotPaused: 'cooling', restarts: 'Restarts', dropSystemPrompt: 'Drop system prompt', dropSystemPromptHint: 'Strip caller system prompts before sending; WorkBuddy still gets an empty leading system slot so Global does not reject the request', @@ -1581,6 +1606,31 @@ export const messages: Record = { liveTrace: '走势', livePeak: '峰值 {n}', liveSaturated: '已满载', + inflightTitle: '实时进行中', + inflightMockBadge: '示意', + inflightLiveBadge: '实时', + inflightHint: '槽位 · 进行中 · 冷却', + inflightCardAria: '打开实时详情', + inflightOpen: '查看全部', + inflightExpand: '展开', + inflightExpandFromConcurrency: '展开实时进行中详情', + inflightStickyBindings: '粘性 · {n}', + inflightWaiting: '等待', + inflightRunning: '进行中', + inflightThroughput: '吞吐', + inflightWaitP95: 'P95', + inflightQueue: '等待', + inflightQueueEmpty: '暂无', + inflightSlots: '槽位', + inflightSticky: '粘性', + inflightDone: '完成', + inflightFailed: '失败', + inflightDepth: '深度', + inflightDepthHint: '{n}', + inflightRatePill: '限流 · {remain}', + inflightRateBand: '{label} · {remain}', + inflightSlotIdle: '空闲', + inflightSlotPaused: '冷却', restarts: '重启次数', dropSystemPrompt: '丢弃系统提示词', dropSystemPromptHint: '发送前剥离调用方的系统提示词;仍会补一条空的 system,避免国际版要求第一条必须是系统提示词', diff --git a/frontend/src/lib/mockInflight.ts b/frontend/src/lib/mockInflight.ts new file mode 100644 index 00000000..77b579eb --- /dev/null +++ b/frontend/src/lib/mockInflight.ts @@ -0,0 +1,570 @@ +/** + * Phase-1 fake snapshot for Overview「实时进行中」. + * Shaped like cli2api runtime concepts (not a parallel control plane): + * jobs ≈ in-flight / waiting proxy requests + * workers ≈ account slots currently (or recently) hitting upstream + * rateLimits≈ cooldown / provider rate-limit windows + * depth ≈ recent waiting + concurrency approx + * totals ≈ recent request_logs Done/Failed (mock until Phase 2) + * Stage-3 swaps workers/rateLimits/sticky onto /api/live (LiveWorker, + * LiveRateLimit, LiveSticky); keep jobs/depth mock-only until request-level + * inflight lands. Do not invent a parallel /api/inflight*. + * + * Live loop (`tickMockInflight`) mirrors public AffectUI Motion prose: + * progress fill, queue→worker handoff, DONE/FAILED stack, depth scroll — + * Stage-1 only; real /api/live projection stays read-only. + */ + +export type MockJobKind = 'chat' | 'embed' | 'tools' | 'other' +export type MockJobStatus = 'queued' | 'running' | 'done' | 'failed' + +export type MockJobPriority = 'high' | 'normal' | 'low' + +export type MockInflightJob = { + id: string + /** Short label — model / route style. */ + name: string + kind: MockJobKind + status: MockJobStatus + /** Account id holding the request when running. */ + accountId?: string + progress: number + /** Elapsed wait or run, ms. */ + elapsedMs: number + /** Wall-clock start (epoch ms) for live/mock elapsed ticking. */ + startedAtMs?: number + /** Sticky session hint (affinity hit). */ + sticky?: boolean + /** AffectUI priority — high lands at back then glides past. */ + priority?: MockJobPriority + /** Retry attempt count when failed job slides back to queue. */ + attempt?: number +} + +export type MockAccountSlot = { + id: string + /** Account display name. */ + name: string + provider: string + /** Busy with an upstream call. */ + busy: boolean + /** Internal mock completion driver (0–1). Busy UI uses indeterminate shimmer, not this %. */ + progress: number + jobId?: string + /** Slot paused by an active cooldown / rate-limit. */ + rateLimited?: boolean + /** + * Account max concurrency (max_inflight). Slot bar divides into this many + * equal cells. Clamp in UI (min 1). + */ + concurrency?: number + /** Current occupied concurrency cells (in_flight). */ + inFlight?: number +} + +export type MockRateLimitWindow = { + id: string + label: string + /** Remaining cooldown / rate-limit window in ms. */ + remainingMs: number + /** Depth-chart band: fraction along [0,1] series. */ + from: number + until: number +} + +/** One job that just landed on Done or Failed this tick (GSAP fly-out routing). */ +export type MockCompletion = { + id: string + name: string + kind: MockJobKind + ok: boolean +} + +export type MockInflightSnapshot = { + jobs: MockInflightJob[] + workers: MockAccountSlot[] + rateLimits: MockRateLimitWindow[] + /** Recent waiting+concurrency depth (oldest → newest). */ + depthSeries: number[] + /** Soft backpressure guide on the depth chart. */ + backpressure: number + totals: { done: number; failed: number } + /** Throughput mock: completed / min. */ + throughputPerMin: number + waitP95Ms: number + generatedAt: number + /** + * Ephemeral per-tick terminal outcomes for GSAP Done/Failed routing. + * Not cloned across ticks unless the producer sets them again; live totals + * stay zero so priorIsLive keeps working. + */ + completions?: MockCompletion[] +} + +/** Stable demo seed — deterministic for first paint / screenshots. */ +export const MOCK_INFLIGHT: MockInflightSnapshot = { + generatedAt: 0, + backpressure: 6, + throughputPerMin: 42, + 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 }, + ], + jobs: [ + { id: 'j1', name: 'chat · sonnet', kind: 'chat', status: 'running', accountId: 'acc-wb-a1', progress: 0.72, elapsedMs: 11_200, sticky: true }, + { 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: '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' }, + { 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: 97_000, from: 0.55, until: 0.72 }, + { id: 'rl2', label: 'codex-d1 冷却', remainingMs: 41_000, from: 0.82, until: 1 }, + ], + // Soft hump under rate-limit, then partial drain. + 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], +} + +const SEED_NAMES: Array<{ name: string; kind: MockJobKind; sticky?: boolean }> = [ + { name: 'chat · opus', kind: 'chat' }, + { name: 'embed · idx', kind: 'embed' }, + { name: 'tools · apply', kind: 'tools' }, + { name: 'chat · flash', kind: 'chat', sticky: true }, + { name: 'chat · wait', kind: 'chat' }, + { name: 'embed · docs', kind: 'embed' }, +] + +let seq = 100 + +export function cloneMockInflight(snap: MockInflightSnapshot = MOCK_INFLIGHT): MockInflightSnapshot { + return { + ...snap, + workers: snap.workers.map((w) => ({ ...w })), + jobs: snap.jobs.map((j) => ({ ...j })), + rateLimits: snap.rateLimits.map((r) => ({ ...r })), + depthSeries: [...snap.depthSeries], + totals: { ...snap.totals }, + // Completions are ephemeral — never inherit a prior tick's fly-out list. + completions: undefined, + } +} + +export function getMockInflightSnapshot(): MockInflightSnapshot { + return cloneMockInflight() +} + +/** + * Advance the Stage-1 mock one frame. Mirrors public AffectUI loop: + * progress fills (frozen under rate-limit), completed jobs → Done/Failed, + * free slots pull the front of the waiting queue, depth series scrolls, + * rate-limit remaining counts down. Deterministic-ish for a given dt. + */ +export function tickMockInflight(prev: MockInflightSnapshot, dtMs: number): MockInflightSnapshot { + const dt = Math.max(16, Math.min(500, dtMs)) + const next = cloneMockInflight(prev) + next.generatedAt = (prev.generatedAt || 0) + dt + + // Countdown rate-limit windows; clear expired → unfreeze matching slots. + next.rateLimits = next.rateLimits + .map((r) => ({ ...r, remainingMs: Math.max(0, r.remainingMs - dt) })) + .filter((r) => r.remainingMs > 0) + // Keep rateLimited flag in sync with remaining windows (seed label → slot). + for (const w of next.workers) { + if (w.id === 'acc-wb-a2') w.rateLimited = next.rateLimits.some((r) => r.label.includes('wb-a2')) + else if (w.id === 'acc-codex-d1') w.rateLimited = next.rateLimits.some((r) => r.label.includes('codex-d1')) + } + + const jobById = new Map(next.jobs.map((j) => [j.id, j])) + + // Progress + elapsed on busy non-frozen slots. + for (const w of next.workers) { + if (!w.busy || !w.jobId) continue + const job = jobById.get(w.jobId) + if (!job || job.status !== 'running') continue + job.elapsedMs += dt + if (w.rateLimited) { + // Amber freeze — no progress (AffectUI: bars stop + amber). + continue + } + // ~8–14s to complete from current progress, paced by dt. + const speed = 0.045 + (w.id.charCodeAt(w.id.length - 1) % 5) * 0.008 + w.progress = Math.min(1, w.progress + speed * (dt / 1000)) + job.progress = w.progress + } + + // Complete / fail when progress hits 1. + const finished: Array<{ jobId: string; workerId: string; ok: boolean }> = [] + for (const w of next.workers) { + if (!w.busy || !w.jobId || w.rateLimited) continue + if (w.progress < 0.995) continue + // ~12% fail flash (AffectUI shake path); rest → Done. + const ok = (w.jobId.charCodeAt(1) + Math.floor(next.generatedAt / 1000)) % 9 !== 0 + finished.push({ jobId: w.jobId, workerId: w.id, ok }) + } + for (const f of finished) { + const job = jobById.get(f.jobId) + const w = next.workers.find((x) => x.id === f.workerId) + if (!job || !w) continue + w.busy = false + w.progress = 0 + w.jobId = undefined + w.inFlight = 0 + job.accountId = undefined + if (f.ok) { + job.status = 'done' + job.progress = 1 + next.totals.done += 1 + continue + } + // AffectUI: failed shakes — or retry slides back to queue (same id). + const attempt = (job.attempt ?? 1) + 1 + const canRetry = attempt <= 3 && (f.jobId.charCodeAt(0) + Math.floor(next.generatedAt / 900)) % 2 === 0 + if (canRetry) { + job.status = 'queued' + job.progress = 0 + job.elapsedMs = 80 + job.attempt = attempt + job.priority = 'high' + continue + } + job.status = 'failed' + job.progress = 1 + next.totals.failed += 1 + } + + // Per-job outcomes for GSAP (retry back to queue is not a sink landing). + const completions: MockCompletion[] = [] + for (const f of finished) { + const job = jobById.get(f.jobId) + if (!job) continue + if (job.status === 'done' || job.status === 'failed') { + completions.push({ id: job.id, name: job.name, kind: job.kind, ok: job.status === 'done' }) + } + } + next.completions = completions.length > 0 ? completions : undefined + + // Drop terminal jobs from the active list (keep queue + running only). + next.jobs = next.jobs.filter((j) => j.status === 'queued' || j.status === 'running') + + // Waiting elapsed ticks up. + for (const j of next.jobs) { + if (j.status === 'queued') j.elapsedMs += dt + } + + // Free slots pull front of queue (queue → worker handoff). + const queue = next.jobs.filter((j) => j.status === 'queued') + for (const w of next.workers) { + if (w.busy || w.rateLimited) continue + const job = queue.shift() + if (!job) break + job.status = 'running' + job.accountId = w.id + job.progress = 0.04 + job.elapsedMs = 0 + w.busy = true + 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)) + } + + // Soft enqueue so the waiting rail doesn’t drain dry. + const waiting = next.jobs.filter((j) => j.status === 'queued').length + if (waiting < 6 && next.generatedAt % 2800 < dt) { + const pick = SEED_NAMES[seq % SEED_NAMES.length] + seq += 1 + // Every ~4th job is high priority (lands at back, then glides past). + const priority = seq % 4 === 0 ? 'high' as const : 'normal' as const + next.jobs.push({ + id: `j${seq}`, + name: pick.name, + kind: pick.kind, + status: 'queued', + progress: 0, + elapsedMs: 200 + (seq % 7) * 400, + sticky: pick.sticky, + priority, + }) + } + + // High-priority: after a brief back-of-queue land (~400ms), glide past to front. + { + const running = next.jobs.filter((j) => j.status === 'running') + const queued = next.jobs.filter((j) => j.status === 'queued') + const promote = queued.filter((j) => j.priority === 'high' && j.elapsedMs >= 400) + const rest = queued.filter((j) => !(j.priority === 'high' && j.elapsedMs >= 400)) + // Stable: already-promoted highs keep relative order at front; new promotes append after them. + const highs = promote + next.jobs = [...running, ...highs, ...rest] + } + + // Depth chart scrolls: shift left, append current waiting+busy approx. + const busy = next.workers.filter((w) => w.busy).length + const waitNow = next.jobs.filter((j) => j.status === 'queued').length + const depthNow = Math.max(1, waitNow + Math.max(0, busy - 2)) + const series = next.depthSeries.slice(1) + series.push(depthNow) + next.depthSeries = series + + // Throughput / p95 drift gently. + next.throughputPerMin = Math.max(28, Math.min(58, next.throughputPerMin + ((seq % 3) - 1))) + next.waitP95Ms = Math.max(900, Math.min(5200, next.waitP95Ms + (waitNow > 4 ? 40 : -20))) + + return next +} + +/** Clamp account concurrency for slot-bar cells (UI + summary). */ +export function clampSlotConcurrency(n: number | undefined): number { + if (n == null || !Number.isFinite(n)) return 1 + return Math.max(1, Math.min(16, Math.floor(n))) +} + +export function summarizeMockInflight(snap: MockInflightSnapshot) { + const running = snap.jobs.filter((j) => j.status === 'running').length + const waiting = snap.jobs.filter((j) => j.status === 'queued').length + const busyWorkers = snap.workers.filter((w) => w.busy).length + // Capacity / occupancy from per-account concurrency (max_inflight / in_flight). + let workerSlots = 0 + let occupiedSlots = 0 + for (const w of snap.workers) { + const cap = clampSlotConcurrency(w.concurrency ?? 1) + workerSlots += cap + const occ = + w.inFlight != null + ? Math.max(0, Math.min(cap, Math.floor(w.inFlight))) + : w.busy + ? 1 + : 0 + occupiedSlots += occ + } + const depthNow = snap.depthSeries[snap.depthSeries.length - 1] ?? waiting + return { + running, + waiting, + busyWorkers, + occupiedSlots, + workerSlots, + rateLimitActive: snap.rateLimits.length, + depthNow, + } +} + +/** Optional sticky projection from /api/live (Stage-3 wire). */ +export type MockStickyStats = { + bindings: number + hits: number + misses: number + capacity: number + ttlSeconds: number + escapes?: number +} + +export type LiveWorkerLike = { + id: string + name: string + provider: string + busy: boolean + progress: number + rate_limited: boolean + /** Account max concurrency — drives slot-bar cell count. */ + max_inflight?: number + /** Occupied concurrency cells on this account. */ + in_flight?: number + /** RFC3339 from pool InFlightSince when available. */ + started_at?: string + /** Fallback fail signal when recent_completions missed the finish. */ + last_error_kind?: string +} + +export type LiveCompletionLike = { + account_id: string + status: string +} + +export type LiveRateLimitLike = { + id: string + label: string + remaining_ms: number +} + +export type LiveStickyLike = { + bindings: number + hits: number + misses: number + capacity: number + ttl_seconds: number + escapes?: number +} + +export type LiveProjectionInput = { + in_flight: number + rpm: number + workers: LiveWorkerLike[] + rate_limits: LiveRateLimitLike[] + sticky: LiveStickyLike + recent_completions?: LiveCompletionLike[] +} + +/** + * Merge /api/live workers + rate_limits (+ sticky meta) onto a snapshot. + * Busy workers → synthetic running jobs. When `live` is provided, never inherit + * mock totals / throughput / p95 / depth: zeros unless the API supplies a value + * (`rpm` → throughput; no done/failed/p95 fields yet). 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 %. + */ +export function applyLiveProjection( + base: MockInflightSnapshot, + live: LiveProjectionInput, +): MockInflightSnapshot { + 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 + const from = Math.min(0.86, ((i * 0.22) % 0.86)) + return { + id: r.id, + label: r.label, + remainingMs: Math.max(0, r.remaining_ms), + from, + until: Math.min(1, from + span), + } + }) + + const jobs: 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: w.name, + kind: 'chat' as const, + status: 'running' as const, + accountId: w.id, + progress: w.progress, + startedAtMs, + elapsedMs: Math.max(0, now - startedAtMs), + } + }) + + // Continue rolling depth only after a prior live projection (cleared p95 + + // zero totals). Mock seed/tick always leaves waitP95Ms > 0 — start zeros. + const priorIsLive = base.waitP95Ms === 0 && base.totals.done === 0 && base.totals.failed === 0 + const series = priorIsLive + ? base.depthSeries.slice(1) + : Array.from({ length: Math.max(0, n - 1) }, () => 0) + series.push(Math.max(0, live.in_flight)) + while (series.length < n) series.unshift(0) + + // Match busy→idle jobs to drained request finishes (or last_error_kind). + const pendingByAccount = new Map() + for (const c of live.recent_completions ?? []) { + const acc = (c.account_id || '').trim() + if (!acc) continue + const ok = (c.status || '').trim() === 'ok' + const list = pendingByAccount.get(acc) ?? [] + list.push(ok) + pendingByAccount.set(acc, list) + } + const stillIds = new Set(jobs.map((j) => j.id)) + const completions: MockCompletion[] = [] + for (const prev of base.jobs) { + if (prev.status !== 'running') continue + if (stillIds.has(prev.id)) continue + const acc = (prev.accountId || prev.id.replace(/^live-/, '')).trim() + const queue = pendingByAccount.get(acc) + let ok = true + if (queue && queue.length > 0) { + ok = queue.shift()! + } else { + const lw = live.workers.find((w) => w.id === acc) + if (lw?.last_error_kind && lw.last_error_kind.trim() !== '') { + ok = false + } + } + completions.push({ + id: prev.id, + name: prev.name, + kind: prev.kind, + ok, + }) + } + + return { + generatedAt: now, + backpressure: base.backpressure, + // API: rpm only. No done/failed/p95 yet → zeros (do not spread mock base). + throughputPerMin: Math.max(0, live.rpm), + waitP95Ms: 0, + totals: { done: 0, failed: 0 }, + workers, + rateLimits, + jobs, + depthSeries: series.slice(-n), + completions: completions.length > 0 ? completions : undefined, + } +} + +/** True when live has something to show (slots or cooldowns or concurrency). */ +export function liveHasSignal(live: LiveProjectionInput): boolean { + return ( + live.workers.length > 0 || + live.rate_limits.length > 0 || + live.in_flight > 0 || + (live.sticky?.bindings ?? 0) > 0 + ) +} diff --git a/frontend/src/pages/OverviewPage.tsx b/frontend/src/pages/OverviewPage.tsx index 6448719a..f779913e 100644 --- a/frontend/src/pages/OverviewPage.tsx +++ b/frontend/src/pages/OverviewPage.tsx @@ -30,6 +30,7 @@ import { formatBytes, formatCompact, formatLatency, formatPercent } from '@/lib/ 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' type AccountRow = NonNullable[number] @@ -139,6 +140,7 @@ export function OverviewPage() { const [resources, setResources] = useState(null) const [now, setNow] = useState(() => Date.now()) const { live, samples: liveSamples } = useLive() + const [inflightOpen, setInflightOpen] = useState(false) const liveById = new Map((live?.accounts ?? []).map((item) => [item.id, item])) const proxyOk = Boolean(overview?.proxy?.ok) @@ -321,7 +323,9 @@ export function OverviewPage() { {error ? : null} - + setInflightOpen(true)} /> + +
{metrics.map((metric) => ( diff --git a/internal/accounts/types.go b/internal/accounts/types.go index 6e9794e1..c2b69581 100644 --- a/internal/accounts/types.go +++ b/internal/accounts/types.go @@ -120,6 +120,8 @@ type AccountView struct { Ready bool `json:"ready"` Hot bool `json:"hot"` InFlight int `json:"in_flight"` + // InFlightSince is RFC3339 when the pool slot went busy (0→1); empty when idle. + InFlightSince string `json:"in_flight_since,omitempty"` Restarts int `json:"restarts"` RuntimeState string `json:"runtime_state,omitempty"` NextRestartAt string `json:"next_restart_at,omitempty"` diff --git a/internal/console/live.go b/internal/console/live.go index f2e0cdf7..bcfbf78f 100644 --- a/internal/console/live.go +++ b/internal/console/live.go @@ -1,13 +1,18 @@ package console import ( + "fmt" "net/http" + "sort" + "strings" "time" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/executor" ) -// LiveAccount is the per-account slice of the live concurrency snapshot. +// LiveAccount is the per-account slice of the live concurrency snapshot +// (LiveStrip / sidebar). Kept for backward compatibility. type LiveAccount struct { ID string `json:"id"` InFlight int `json:"in_flight"` @@ -15,36 +20,191 @@ type LiveAccount struct { Enabled bool `json:"enabled"` } +// LiveWorker is one account-pool slot projected for the Overview「实时进行中」 +// card. Stage-1 UI still mocks jobs/depth; Stage-3 swaps workers/rate_limits/ +// sticky onto this shape without a parallel /api/inflight*. +type LiveWorker struct { + ID string `json:"id"` + Name string `json:"name"` + Provider string `json:"provider"` + Busy bool `json:"busy"` + InFlight int `json:"in_flight"` + MaxInFlight int `json:"max_inflight"` + Enabled bool `json:"enabled"` + RateLimited bool `json:"rate_limited"` + // Progress is a legacy occupancy ratio (in_flight/max_inflight). The + // Overview card no longer treats it as % toward completion — busy slots + // use an indeterminate shimmer; keep the field for API compat. + Progress float64 `json:"progress"` + // StartedAt is RFC3339 wall-clock when the pool slot went busy + // (InFlight 0→1). Empty when idle. UI shows real elapsed from this. + StartedAt string `json:"started_at,omitempty"` + // LastErrorKind is AccountView.LastErrorKind — fallback when a busy→idle + // transition has no matching recent_completions entry yet. + LastErrorKind string `json:"last_error_kind,omitempty"` +} + +// LiveRateLimit is one active account-wide or model-scoped cooldown window, +// read from AccountView.DownUntil / ModelCooldowns (already projected from +// Pool DownUntil / ModelDownUntil). Console never invents a second cooldown +// state machine here. +type LiveRateLimit struct { + ID string `json:"id"` + Label string `json:"label"` + AccountID string `json:"account_id"` + Model string `json:"model,omitempty"` + Until string `json:"until"` + RemainingMs int64 `json:"remaining_ms"` +} + // LiveSnapshot is the cheap payload behind /api/live, polled every few -// seconds by the overview live strip. +// seconds by the overview live strip and (Stage-3) the inflight card. +// 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 { + AccountID string `json:"account_id"` + Status string `json:"status"` +} + type LiveSnapshot struct { - Time string `json:"time"` - InFlight int `json:"in_flight"` - Capacity int `json:"capacity"` - RPM int `json:"rpm"` - Accounts []LiveAccount `json:"accounts"` + Time string `json:"time"` + InFlight int `json:"in_flight"` + Capacity int `json:"capacity"` + RPM int `json:"rpm"` + Accounts []LiveAccount `json:"accounts"` + Workers []LiveWorker `json:"workers"` + RateLimits []LiveRateLimit `json:"rate_limits"` + Sticky executor.SessionAffinityStats `json:"sticky"` + RecentCompletions []LiveCompletion `json:"recent_completions,omitempty"` } // buildLiveSnapshot sums in-flight over all accounts and capacity (the -// effective max_inflight, default 4) over enabled accounts only. -func buildLiveSnapshot(views []accounts.AccountView, rpm int, now time.Time) LiveSnapshot { - out := LiveSnapshot{Time: now.Format(time.RFC3339), RPM: rpm, Accounts: make([]LiveAccount, 0, len(views))} +// effective max_inflight, default 4) over enabled accounts only, then +// projects workers / rate_limits / sticky for the Overview card. It is a +// read-only console projection: Classify→Pool write path is untouched. +func buildLiveSnapshot(views []accounts.AccountView, rpm int, sticky executor.SessionAffinityStats, now time.Time) LiveSnapshot { + out := LiveSnapshot{ + Time: now.Format(time.RFC3339), + RPM: rpm, + Accounts: make([]LiveAccount, 0, len(views)), + Workers: make([]LiveWorker, 0, len(views)), + RateLimits: make([]LiveRateLimit, 0), + Sticky: sticky, + } for _, v := range views { maxInFlight := accounts.DefaultMaxInFlightValue(v.MaxInFlight) out.InFlight += v.InFlight if v.Enabled { out.Capacity += maxInFlight } - out.Accounts = append(out.Accounts, LiveAccount{ID: v.ID, InFlight: v.InFlight, MaxInFlight: maxInFlight, Enabled: v.Enabled}) + out.Accounts = append(out.Accounts, LiveAccount{ + ID: v.ID, InFlight: v.InFlight, MaxInFlight: maxInFlight, Enabled: v.Enabled, + }) + + name := strings.TrimSpace(v.Name) + if name == "" { + name = v.ID + } + accountLimited := cooldownActive(v.DownUntil, now) + modelLimited := false + for model, until := range v.ModelCooldowns { + if !cooldownActive(until, now) { + continue + } + modelLimited = true + remaining := remainingMs(until, now) + label := name + if model != "" { + label = fmt.Sprintf("%s · %s", name, model) + } + out.RateLimits = append(out.RateLimits, LiveRateLimit{ + ID: fmt.Sprintf("%s:%s", v.ID, model), + Label: label, + AccountID: v.ID, + Model: model, + Until: until, + RemainingMs: remaining, + }) + } + if accountLimited { + out.RateLimits = append(out.RateLimits, LiveRateLimit{ + ID: v.ID, + Label: name, + AccountID: v.ID, + Until: v.DownUntil, + RemainingMs: remainingMs(v.DownUntil, now), + }) + } + + progress := 0.0 + if maxInFlight > 0 && v.InFlight > 0 { + progress = float64(v.InFlight) / float64(maxInFlight) + if progress > 1 { + progress = 1 + } + } + out.Workers = append(out.Workers, LiveWorker{ + ID: v.ID, Name: name, Provider: v.Provider, + Busy: v.InFlight > 0, InFlight: v.InFlight, MaxInFlight: maxInFlight, + Enabled: v.Enabled, RateLimited: accountLimited || modelLimited, + Progress: progress, StartedAt: strings.TrimSpace(v.InFlightSince), + LastErrorKind: strings.TrimSpace(v.LastErrorKind), + }) } + sort.SliceStable(out.RateLimits, func(i, j int) bool { + if out.RateLimits[i].RemainingMs != out.RateLimits[j].RemainingMs { + return out.RateLimits[i].RemainingMs > out.RateLimits[j].RemainingMs + } + return out.RateLimits[i].ID < out.RateLimits[j].ID + }) return out } +func cooldownActive(until string, now time.Time) bool { + until = strings.TrimSpace(until) + if until == "" { + return false + } + t, err := time.Parse(time.RFC3339, until) + if err != nil { + return false + } + return now.Before(t) +} + +func remainingMs(until string, now time.Time) int64 { + t, err := time.Parse(time.RFC3339, strings.TrimSpace(until)) + if err != nil || !now.Before(t) { + return 0 + } + return t.Sub(now).Milliseconds() +} + +func (h *Handler) stickyStats() executor.SessionAffinityStats { + if h == nil || h.Executor == nil || h.Executor.SessionAffinity == nil { + return executor.SessionAffinityStats{} + } + return h.Executor.SessionAffinity.Stats() +} + func (h *Handler) HandleLive(w http.ResponseWriter, r *http.Request) { views, err := h.Control.Accounts.List(r.Context(), false) if err != nil { writeErr(w, http.StatusInternalServerError, "account_list_failed", err.Error()) return } - writeJSON(w, http.StatusOK, buildLiveSnapshot(views, h.Recorder.RecentRequests(), time.Now())) + rpm := 0 + if h.Recorder != nil { + rpm = h.Recorder.RecentRequests() + } + snap := buildLiveSnapshot(views, rpm, h.stickyStats(), time.Now()) + if h.Recorder != nil { + for _, c := range h.Recorder.DrainRecentCompletions() { + snap.RecentCompletions = append(snap.RecentCompletions, LiveCompletion{ + AccountID: c.AccountID, + Status: c.Status, + }) + } + } + writeJSON(w, http.StatusOK, snap) } diff --git a/internal/console/live_test.go b/internal/console/live_test.go index eba5a1bf..2394bc16 100644 --- a/internal/console/live_test.go +++ b/internal/console/live_test.go @@ -5,21 +5,114 @@ import ( "time" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/executor" ) func TestBuildLiveSnapshot(t *testing.T) { // AccountView.InFlight is the pool's current counter (Acquire/Release), // not a probe snapshot; /api/live just sums those live values. + now := time.Unix(1_700_000_000, 0).UTC() + coolingUntil := now.Add(90 * time.Second).Format(time.RFC3339) + modelUntil := now.Add(45 * time.Second).Format(time.RFC3339) + expiredUntil := now.Add(-time.Minute).Format(time.RFC3339) + views := []accounts.AccountView{ - {Account: accounts.Account{ID: "a", Enabled: true, MaxInFlight: 4}, InFlight: 4}, - {Account: accounts.Account{ID: "b", Enabled: true}, InFlight: 1}, // default 4 + { + Account: accounts.Account{ID: "a", Name: "wb-a1", Provider: "workbuddy", Enabled: true, MaxInFlight: 4}, + InFlight: 4, + InFlightSince: now.Add(-12 * time.Second).Format(time.RFC3339), + }, + { + Account: accounts.Account{ID: "b", Name: "wb-a2", Provider: "workbuddy", Enabled: true}, + InFlight: 1, // default max 4 + DownUntil: coolingUntil, + ModelCooldowns: map[string]string{"glm-5": modelUntil, "stale": expiredUntil}, + }, {Account: accounts.Account{ID: "c", Enabled: false, MaxInFlight: 8}}, } - got := buildLiveSnapshot(views, 17, time.Unix(0, 0)) + sticky := executor.SessionAffinityStats{Bindings: 3, Hits: 12, Misses: 2, Capacity: 64, TTLSeconds: 600} + + got := buildLiveSnapshot(views, 17, sticky, now) if got.InFlight != 5 || got.Capacity != 8 || got.RPM != 17 { t.Fatalf("snapshot = %+v", got) } if len(got.Accounts) != 3 || got.Accounts[1].MaxInFlight != accounts.DefaultMaxInFlight || got.Accounts[2].Enabled { t.Fatalf("accounts = %+v", got.Accounts) } + if got.Sticky.Bindings != 3 || got.Sticky.Hits != 12 { + t.Fatalf("sticky = %+v", got.Sticky) + } + if len(got.Workers) != 3 { + t.Fatalf("workers len = %d", len(got.Workers)) + } + w0 := got.Workers[0] + if !w0.Busy || w0.RateLimited || w0.Progress != 1 || w0.Name != "wb-a1" || w0.Provider != "workbuddy" { + t.Fatalf("worker[0] = %+v", w0) + } + if w0.StartedAt == "" || w0.StartedAt != now.Add(-12*time.Second).Format(time.RFC3339) { + t.Fatalf("worker[0].StartedAt = %q", w0.StartedAt) + } + if got.Workers[2].StartedAt != "" { + t.Fatalf("idle worker must omit started_at, got %q", got.Workers[2].StartedAt) + } + w1 := got.Workers[1] + if !w1.Busy || !w1.RateLimited || w1.Progress != 0.25 { + t.Fatalf("worker[1] = %+v", w1) + } + w2 := got.Workers[2] + if w2.Busy || w2.RateLimited || w2.Name != "c" { + t.Fatalf("worker[2] = %+v", w2) + } + + // Active: account-wide b + model glm-5. Expired stale model is dropped. + if len(got.RateLimits) != 2 { + t.Fatalf("rate_limits = %+v", got.RateLimits) + } + // Sorted by remaining_ms desc: account 90s, then model 45s. + if got.RateLimits[0].AccountID != "b" || got.RateLimits[0].Model != "" || got.RateLimits[0].RemainingMs != 90_000 { + t.Fatalf("rate_limits[0] = %+v", got.RateLimits[0]) + } + if got.RateLimits[1].Model != "glm-5" || got.RateLimits[1].RemainingMs != 45_000 { + t.Fatalf("rate_limits[1] = %+v", got.RateLimits[1]) + } + if got.RateLimits[0].Label != "wb-a2" || got.RateLimits[1].Label != "wb-a2 · glm-5" { + t.Fatalf("labels = %q / %q", got.RateLimits[0].Label, got.RateLimits[1].Label) + } +} + +func TestBuildLiveSnapshotEmpty(t *testing.T) { + got := buildLiveSnapshot(nil, 0, executor.SessionAffinityStats{}, time.Unix(0, 0).UTC()) + if got.InFlight != 0 || got.Capacity != 0 || got.Workers == nil || got.RateLimits == nil || got.Accounts == nil { + t.Fatalf("empty snapshot should use non-nil slices: %+v", got) + } + if len(got.Workers) != 0 || len(got.RateLimits) != 0 || len(got.Accounts) != 0 { + t.Fatalf("empty lengths: %+v", got) + } +} + +func TestBuildLiveSnapshotLastErrorKind(t *testing.T) { + now := time.Unix(1_700_000_000, 0).UTC() + views := []accounts.AccountView{ + { + Account: accounts.Account{ + ID: "err1", Name: "fail-slot", Provider: "qoder", Enabled: true, + LastErrorKind: accounts.KindUnavailable, + }, + InFlight: 0, + }, + { + Account: accounts.Account{ + ID: "ok1", Name: "ok-slot", Provider: "qoder", Enabled: true, + }, + InFlight: 1, + InFlightSince: now.Add(-2 * time.Second).Format(time.RFC3339), + }, + } + got := buildLiveSnapshot(views, 0, executor.SessionAffinityStats{}, now) + if got.Workers[0].LastErrorKind != accounts.KindUnavailable { + t.Fatalf("worker[0].LastErrorKind = %q", got.Workers[0].LastErrorKind) + } + if got.Workers[1].LastErrorKind != "" { + t.Fatalf("busy-ok worker must omit last_error_kind, got %q", got.Workers[1].LastErrorKind) + } } diff --git a/internal/executor/pool.go b/internal/executor/pool.go index 56d13b60..88681b9e 100644 --- a/internal/executor/pool.go +++ b/internal/executor/pool.go @@ -24,6 +24,10 @@ type Item struct { Ready *bool Hot *bool InFlight int + // InFlightSince is when the slot last went from idle to busy + // (InFlight 0→1). Cleared when InFlight returns to 0. Read-only + // console projection for /api/live elapsed; no new SM. + InFlightSince time.Time // MaxInFlight caps concurrent requests routed to this account. Zero // means unknown and does not block routing. MaxInFlight int @@ -1232,6 +1236,9 @@ func (p *Pool) Acquire(id string) bool { if p.items[i].MaxInFlight > 0 && p.items[i].InFlight >= p.items[i].MaxInFlight { return false } + if p.items[i].InFlight == 0 { + p.items[i].InFlightSince = time.Now() + } p.items[i].InFlight++ return true } @@ -1252,6 +1259,9 @@ func (p *Pool) Release(id string) { } if p.items[i].InFlight > 0 { p.items[i].InFlight-- + if p.items[i].InFlight == 0 { + p.items[i].InFlightSince = time.Time{} + } } return } @@ -1460,6 +1470,7 @@ func (p *Pool) Snapshot() []map[string]any { "ready": ready, "hot": hot, "in_flight": item.InFlight, + "in_flight_since": pastTime(item.InFlightSince), "restarts": item.Restarts, "runtime_state": item.RuntimeState, "next_restart_at": nullableTime(item.NextRestartAt, now), @@ -1522,6 +1533,15 @@ func nullableTime(t time.Time, now time.Time) any { return t.UTC().Format(time.RFC3339) } +// pastTime formats a historical timestamp (e.g. InFlightSince). Unlike +// nullableTime it does not require the instant to be in the future. +func pastTime(t time.Time) any { + if t.IsZero() { + return nil + } + return t.UTC().Format(time.RFC3339) +} + func itoa(n int) string { if n == 0 { return "0" diff --git a/internal/executor/pool_test.go b/internal/executor/pool_test.go index 7ab395d5..4805878f 100644 --- a/internal/executor/pool_test.go +++ b/internal/executor/pool_test.go @@ -628,17 +628,27 @@ func TestAcquireReleaseCapsAndFloors(t *testing.T) { if item.InFlight != 2 { t.Fatalf("in_flight=%d want 2", item.InFlight) } + if item.InFlightSince.IsZero() { + t.Fatal("InFlightSince must be set while busy") + } + since := item.InFlightSince p.Release("a") item, _ = p.ByID("a") if item.InFlight != 1 { t.Fatalf("after release in_flight=%d want 1", item.InFlight) } + if !item.InFlightSince.Equal(since) { + t.Fatal("InFlightSince must stay on the first 0→1 while still busy") + } p.Release("a") p.Release("a") // floor at zero item, _ = p.ByID("a") if item.InFlight != 0 { t.Fatalf("over-release in_flight=%d want 0", item.InFlight) } + if !item.InFlightSince.IsZero() { + t.Fatal("InFlightSince must clear when idle") + } if p.Acquire("missing") { t.Fatal("unknown id must not acquire") } diff --git a/internal/logs/recent_completions_test.go b/internal/logs/recent_completions_test.go new file mode 100644 index 00000000..0ae3fb29 --- /dev/null +++ b/internal/logs/recent_completions_test.go @@ -0,0 +1,31 @@ +package logs + +import ( + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func TestDrainRecentCompletions(t *testing.T) { + r := NewRequestRecorder(persistOnly{}) + defer r.Close() + + r.Finish(accounts.RequestLog{AccountID: "a1", Status: accounts.RequestStatusOK}) + r.Finish(accounts.RequestLog{AccountID: "a2", Status: accounts.RequestStatusError}) + r.Finish(accounts.RequestLog{AccountID: "a3", Status: accounts.RequestStatusStreaming}) // ignored + r.Finish(accounts.RequestLog{AccountID: "", Status: accounts.RequestStatusError}) // ignored + + got := r.DrainRecentCompletions() + if len(got) != 2 { + t.Fatalf("want 2 completions, got %+v", got) + } + if got[0].AccountID != "a1" || got[0].Status != accounts.RequestStatusOK { + t.Fatalf("got[0]=%+v", got[0]) + } + if got[1].AccountID != "a2" || got[1].Status != accounts.RequestStatusError { + t.Fatalf("got[1]=%+v", got[1]) + } + if again := r.DrainRecentCompletions(); len(again) != 0 { + t.Fatalf("second drain must be empty, got %+v", again) + } +} diff --git a/internal/logs/recorder.go b/internal/logs/recorder.go index f6f0f5d2..c4370c32 100644 --- a/internal/logs/recorder.go +++ b/internal/logs/recorder.go @@ -104,6 +104,15 @@ type StatsQuery struct { APIKeyID string } +// RecentCompletion is a terminal request finish noticed since the last +// 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 { + AccountID string + Status string + At time.Time +} + type RequestRecorder struct { store RequestPersister queue chan func() @@ -116,6 +125,8 @@ type RequestRecorder struct { usageCache map[string]usageCacheEntry rateOnce sync.Once rate *RateCounter + recentMu sync.Mutex + recent []RecentCompletion } func NewRequestRecorder(store RequestPersister) *RequestRecorder { @@ -185,6 +196,7 @@ func (r *RequestRecorder) rateCounter() *RateCounter { func (r *RequestRecorder) RecentRequests() int { return r.rateCounter().Count() } func (r *RequestRecorder) Finish(log accounts.RequestLog) { + r.noteCompletion(log) r.enqueue(func() { if err := r.store.UpdateRequestLog(context.Background(), log); err != nil { logf("update request log: %v", err) @@ -192,6 +204,49 @@ func (r *RequestRecorder) Finish(log accounts.RequestLog) { }) } +func terminalRequestStatus(status string) bool { + switch strings.TrimSpace(status) { + case accounts.RequestStatusOK, accounts.RequestStatusError, + accounts.RequestStatusIncomplete, accounts.RequestStatusCanceled: + return true + default: + return false + } +} + +func (r *RequestRecorder) noteCompletion(log accounts.RequestLog) { + if r == nil || !terminalRequestStatus(log.Status) { + return + } + acc := strings.TrimSpace(log.AccountID) + if acc == "" { + return + } + r.recentMu.Lock() + defer r.recentMu.Unlock() + r.recent = append(r.recent, RecentCompletion{ + AccountID: acc, + Status: strings.TrimSpace(log.Status), + At: time.Now(), + }) + const capN = 64 + if len(r.recent) > capN { + r.recent = append([]RecentCompletion(nil), r.recent[len(r.recent)-capN:]...) + } +} + +// DrainRecentCompletions returns and clears finishes recorded since the last drain. +func (r *RequestRecorder) DrainRecentCompletions() []RecentCompletion { + if r == nil { + return nil + } + r.recentMu.Lock() + defer r.recentMu.Unlock() + out := r.recent + r.recent = nil + return out +} + func (r *RequestRecorder) Attempt(attempt accounts.RequestAttempt) { r.enqueue(func() { if err := r.store.InsertRequestAttempt(context.Background(), attempt); err != nil { diff --git a/internal/runtime/manager_accounts.go b/internal/runtime/manager_accounts.go index 98ac977a..47b867f0 100644 --- a/internal/runtime/manager_accounts.go +++ b/internal/runtime/manager_accounts.go @@ -174,6 +174,9 @@ func (m *Manager) AccountView(ctx context.Context, id string) (AccountView, erro view.Ready = item.Ready == nil || *item.Ready view.Hot = item.Hot != nil && *item.Hot view.InFlight = item.InFlight + if !item.InFlightSince.IsZero() { + view.InFlightSince = item.InFlightSince.UTC().Format(time.RFC3339) + } view.Restarts = item.Restarts view.RuntimeState = item.RuntimeState view.RestartBackoffLevel = item.RestartBackoffLevel @@ -209,6 +212,9 @@ func (m *Manager) Accounts(ctx context.Context) ([]AccountView, error) { view.Ready = item.Ready == nil || *item.Ready view.Hot = item.Hot != nil && *item.Hot view.InFlight = item.InFlight + if !item.InFlightSince.IsZero() { + view.InFlightSince = item.InFlightSince.UTC().Format(time.RFC3339) + } view.Restarts = item.Restarts view.RuntimeState = item.RuntimeState view.RestartBackoffLevel = item.RestartBackoffLevel diff --git a/internal/webui/static/assets/AreaChart-CEDgNyR2.js b/internal/webui/static/assets/AreaChart-CEDgNyR2.js deleted file mode 100644 index f070f91e..00000000 --- a/internal/webui/static/assets/AreaChart-CEDgNyR2.js +++ /dev/null @@ -1 +0,0 @@ -import{f as e,h as t}from"./index-Bk7mZAyg.js";import{L as n,t as r}from"./CartesianChart-CsA30U9Q.js";var i=t(e()),a=[`axis`],o=(0,i.forwardRef)((e,t)=>i.createElement(r,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:a,tooltipPayloadSearcher:n,categoricalChartProps:e,ref:t}));export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CartesianChart-CsA30U9Q.js b/internal/webui/static/assets/CartesianChart-CsA30U9Q.js deleted file mode 100644 index 45bb7129..00000000 --- a/internal/webui/static/assets/CartesianChart-CsA30U9Q.js +++ /dev/null @@ -1,21 +0,0 @@ -import{c as e,d as t,f as n,h as r,m as i,p as a,u as o}from"./index-Bk7mZAyg.js";var s=r(n()),c=`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 l(e){return typeof e==`string`&&c.includes(e)}var u=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 d(e){return typeof e==`string`&&u.has(e)}function f(e){return typeof e==`string`&&e.startsWith(`data-`)}function p(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(d(n)||f(n))&&(t[n]=e[n]);return t}function m(e){if(e==null)return null;if((0,s.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return p(t)}return typeof e==`object`&&!Array.isArray(e)?p(e):null}function h(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(d(n)||f(n)||l(n))&&(t[n]=e[n]);return t}function g(e){return e==null?null:(0,s.isValidElement)(e)?h(e.props):typeof e==`object`&&!Array.isArray(e)?h(e):null}var _=r(t()),v=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function y(){return y=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,c=e.className,l=e.style,u=e.title,d=e.desc,f=b(e,v),p=a||{width:r,height:i,x:0,y:0},m=o(`recharts-surface`,c);return s.createElement(`svg`,y({},h(f),{className:m,width:r,height:i,style:l,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),s.createElement(`title`,null,u),s.createElement(`desc`,null,d),n)}),C=[`children`,`className`];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=T(e,C),a=o(`recharts-layer`,r);return s.createElement(`g`,w({className:a},h(i),{ref:t}),n)});function O(e){return e===`__proto__`}var k=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function A(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:k.test(e);default:return!1}}function j(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function M(e){return typeof e==`symbol`||e instanceof Symbol}function N(e){return e==null?``:ee(e)}function ee(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(ee).join(`,`);if(M(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function te(e){if(Array.isArray(e))return e.map(j);if(typeof e==`symbol`)return[e];e=N(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]:ie),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function oe(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+ae(i)+n},``)}var se=e=>e===0?0:e>0?1:-1,ce=e=>typeof e==`number`&&e!=+e,le=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!ce(e),ue=e=>P(e)||typeof e==`string`,de=0,fe=e=>{var t=++de;return`${e||``}${t}`},pe=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(!P(e)&&typeof e!=`string`)return n;var i;if(le(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return ce(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},me=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):ne(e,t))===n)}var _e=e=>e==null,ve=e=>_e(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ye(e){return e!=null}function be(){}function xe(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 Se(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 Ce(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=xe(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`?Ce({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Ce({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Ce({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Ce({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Ce({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Ce({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Ce({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Ce({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(P(n.x)||le(n.x))&&(P(n.y)||le(n.y))?Ce({x:c+pe(n.x,g),y:l+pe(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Ce({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Oe=[`top`,`left`,`right`,`bottom`];function ke(e){return e==null?!1:typeof e==`object`||Oe.includes(e)}var Ae=(0,s.createContext)(null);function F(e){return function(){return e}}var je=Math.PI,Me=2*je,Ne=1e-6,Pe=Me-Ne;function Fe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Fe;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tNe){if(!(Math.abs(u*s-c*l)>Ne)||!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((je-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ne&&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)>Ne||Math.abs(this._y1-l)>Ne)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Me+Me),d>Pe?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>Ne&&this._append`A${n},${n},0,${+(d>=je)},${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._}};Le.prototype;function Re(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 Le(t)}Array.prototype.slice;function ze(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Be(e){this._context=e}Be.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 Ve(e){return new Be(e)}function He(e){return e[0]}function Ue(e){return e[1]}function We(e,t){var n=F(!0),r=null,i=Ve,a=null,o=Re(s);e=typeof e==`function`?e:e===void 0?He:F(e),t=typeof t==`function`?t:t===void 0?Ue:F(t);function s(s){var c,l=(s=ze(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 We().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:F(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:F(+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:F(!!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 Ke=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 qe(e){return new Ke(e,!0)}function Je(e){return new Ke(e,!1)}function Ye(){}function Xe(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 Ze(e){this._context=e}Ze.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:Xe(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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qe(e){return new Ze(e)}function $e(e){this._context=e}$e.prototype={areaStart:Ye,areaEnd:Ye,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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function et(e){return new $e(e)}function tt(e){this._context=e}tt.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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nt(e){return new tt(e)}function rt(e){this._context=e}rt.prototype={areaStart:Ye,areaEnd:Ye,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 it(e){return new rt(e)}function at(e){return e<0?-1:1}function ot(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(at(a)+at(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function st(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ct(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 lt(e){this._context=e}lt.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:ct(this,this._t0,st(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,ct(this,st(this,n=ot(this,e,t)),n);break;default:ct(this,this._t0,n=ot(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ut(e){this._context=new dt(e)}(ut.prototype=Object.create(lt.prototype)).point=function(e,t){lt.prototype.point.call(this,t,e)};function dt(e){this._context=e}dt.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 ft(e){return new lt(e)}function pt(e){return new ut(e)}function mt(e){this._context=e}mt.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=ht(e),i=ht(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 vt(e){return new _t(e,.5)}function yt(e){return new _t(e,0)}function bt(e){return new _t(e,1)}function xt(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 Ct(e,t){return e[t]}function wt(e){let t=[];return t.key=e,t}function Tt(){var e=F([]),t=St,n=xt,r=Ct;function i(i){var a=Array.from(e.apply(this,arguments),wt),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,At=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,s.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{l(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},jt=(e,t,n)=>r=>(e(t,n,r),null),Mt=(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];l(i)&&typeof a==`function`&&(r||={},r[i]=jt(a,t,n))}),r};function Nt(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 Pt(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function zt(e){return Number.isSafeInteger(e)&&e>=0}function Bt(e){return e!=null&&typeof e!=`function`&&zt(e.length)}function Vt(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ht(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ut=`[object RegExp]`,Wt=`[object String]`,Gt=`[object Number]`,Kt=`[object Boolean]`,qt=`[object Arguments]`,Jt=`[object Symbol]`,Yt=`[object Date]`,Xt=`[object Map]`,Zt=`[object Set]`,Qt=`[object Array]`,$t=`[object Function]`,en=`[object ArrayBuffer]`,tn=`[object Object]`,nn=`[object Error]`,rn=`[object DataView]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`,ln=`[object BigUint64Array]`,un=`[object Int8Array]`,dn=`[object Int16Array]`,fn=`[object Int32Array]`,pn=`[object BigInt64Array]`,mn=`[object Float32Array]`,hn=`[object Float64Array]`,gn=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function _n(e){return gn.Buffer!==void 0&&gn.Buffer.isBuffer(e)}function vn(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function yn(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var bn=/^(?:0|[1-9]\d*)$/;function xn(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var r=n(),i=e();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=r.useRef,l=r.useEffect,u=r.useMemo,d=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),Cn=a(((e,t)=>{t.exports=Sn()}))(),wn=(0,s.createContext)(null),Tn=e=>e,I=()=>{var e=(0,s.useContext)(wn);return e?e.store.dispatch:Tn},En=()=>{},Dn=()=>En,On=(e,t)=>e===t;function L(e){var t=(0,s.useContext)(wn),n=(0,s.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:En,[t,e]);return(0,Cn.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Dn,t?t.store.getState:En,t?t.store.getState:En,n,On)}function kn(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function An(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 jn=e=>Array.isArray(e)?e:[e];function Mn(e){let t=Array.isArray(e[0])?e[0]:e;return An(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Nn(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Pn:WeakRef,In=0,Ln=1;function Rn(){return{s:In,v:void 0,o:null,p:null}}function zn(e){return e instanceof Fn?e.deref():e}function Bn(e,t={}){let n=Rn(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=Rn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Vn(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()),kn(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Bn,argsMemoizeOptions:u=[]}={...n,...a},d=jn(c),f=jn(u),p=Mn(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Nn(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 R=Vn(Bn);function Hn(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Wn(e),i=Wn(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qn=/^\w*$/;function Jn(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||M(e)?!0:typeof e==`string`&&(qn.test(e)||!Kn.test(e))||t!=null&&Object.hasOwn(t,e)}function Yn(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Bt(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)||Jn(e)?e:{key:e,path:te(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 Xn(e,...t){let n=t.length;return n>1&&Un(e,t[0],t[1])?t=[]:n>2&&Un(t[0],t[1],t[2])&&(t=[t[0]]),Yn(e,Hn(t),[`asc`])}var Zn=e=>e.legend.settings,Qn=e=>e.legend.size;R([e=>e.legend.payload,Zn],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Xn(r,n):r});function z(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 $n=typeof Symbol==`function`&&Symbol.observable||`@@observable`,er=()=>Math.random().toString(36).substring(7).split(``).join(`.`),tr={INIT:`@@redux/INIT${er()}`,REPLACE:`@@redux/REPLACE${er()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${er()}`};function nr(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 rr(e,t,n){if(typeof e!=`function`)throw Error(z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(z(1));return n(rr)(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(z(3));return i}function d(e){if(typeof e!=`function`)throw Error(z(4));if(c)throw Error(z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!nr(e))throw Error(z(7));if(e.type===void 0)throw Error(z(8));if(typeof e.type!=`string`)throw Error(z(17));if(c)throw Error(z(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(z(10));r=e,f({type:tr.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[$n](){return this}}}return f({type:tr.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[$n]:m}}function ir(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:tr.INIT})===void 0)throw Error(z(12));if(n(void 0,{type:tr.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(z(13))})}function ar(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 sr(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(z(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=or(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function cr(e){return nr(e)&&`type`in e&&typeof e.type==`string`}var lr=Symbol.for(`immer-nothing`),ur=Symbol.for(`immer-draftable`),dr=Symbol.for(`immer-state`);function fr(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pr=Object,mr=pr.getPrototypeOf,hr=`constructor`,gr=`prototype`,_r=`configurable`,vr=`enumerable`,yr=`writable`,br=`value`,xr=e=>!!e&&!!e[dr];function Sr(e){return e?Tr(e)||Mr(e)||!!e[ur]||!!e[hr]?.[ur]||Nr(e)||Pr(e):!1}var Cr=pr[gr][hr].toString(),wr=new WeakMap;function Tr(e){if(!e||!Fr(e))return!1;let t=mr(e);if(t===null||t===pr[gr])return!0;let n=pr.hasOwnProperty.call(t,hr)&&t[hr];if(n===Object)return!0;if(!Ir(n))return!1;let r=wr.get(n);return r===void 0&&(r=Function.toString.call(n),wr.set(n,r)),r===Cr}function Er(e,t,n=!0){Dr(e)===0?(n?Reflect.ownKeys(e):pr.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Dr(e){let t=e[dr];return t?t.type_:Mr(e)?1:Nr(e)?2:Pr(e)?3:0}var Or=(e,t,n=Dr(e))=>n===2?e.has(t):pr[gr].hasOwnProperty.call(e,t),kr=(e,t,n=Dr(e))=>n===2?e.get(t):e[t],Ar=(e,t,n,r=Dr(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function jr(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Mr=Array.isArray,Nr=e=>e instanceof Map,Pr=e=>e instanceof Set,Fr=e=>typeof e==`object`,Ir=e=>typeof e==`function`,Lr=e=>typeof e==`boolean`;function Rr(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var zr=e=>e.copy_||e.base_,Br=e=>e.modified_?e.copy_:e.base_;function Vr(e,t){if(Nr(e))return new Map(e);if(Pr(e))return new Set(e);if(Mr(e))return Array[gr].slice.call(e);let n=Tr(e);if(t===!0||t===`class_only`&&!n){let t=pr.getOwnPropertyDescriptors(e);delete t[dr];let n=Reflect.ownKeys(t);for(let r=0;r1&&pr.defineProperties(e,{set:Wr,add:Wr,clear:Wr,delete:Wr}),pr.freeze(e),t&&Er(e,(e,t)=>{Hr(t,!0)},!1),e)}function Ur(){fr(2)}var Wr={[br]:Ur};function Gr(e){return e===null||!Fr(e)||pr.isFrozen(e)}var Kr=`MapSet`,qr=`Patches`,Jr=`ArrayMethods`,Yr={};function Xr(e){let t=Yr[e];return t||fr(0,e),t}var Zr=e=>!!Yr[e],Qr,$r=()=>Qr,ei=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Zr(Kr)?Xr(Kr):void 0,arrayMethodsPlugin_:Zr(Jr)?Xr(Jr):void 0});function ti(e,t){t&&(e.patchPlugin_=Xr(qr),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ni(e){ri(e),e.drafts_.forEach(ai),e.drafts_=null}function ri(e){e===Qr&&(Qr=e.parent_)}var ii=e=>Qr=ei(Qr,e);function ai(e){let t=e[dr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function oi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[dr].modified_&&(ni(t),fr(4)),Sr(e)&&(e=si(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[dr].base_,e,t)}else e=si(t,n);return ci(t,e,!0),ni(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===lr?void 0:e}function si(e,t){if(Gr(t))return t;let n=t[dr];if(!n)return gi(t,e.handledSet_,e);if(!ui(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);mi(n,e)}return n.copy_}function ci(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hr(t,n)}function li(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ui=(e,t)=>e.scope_===t,di=[];function fi(e,t,n,r){let i=zr(e),a=e.type_;if(r!==void 0&&kr(i,r,a)===t){Ar(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Er(i,(e,n)=>{if(xr(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??di;for(let e of o)Ar(i,e,n,a)}function pi(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!ui(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Br(i);fi(e,i.draft_??i,a,n),mi(i,r)})}function mi(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)}li(e)}}function hi(e,t,n){let{scope_:r}=e;if(xr(n)){let i=n[dr];ui(i,r)&&i.callbacks_.push(function(){Ti(e),fi(e,n,Br(i),t)})}else Sr(n)&&e.callbacks_.push(function(){let i=zr(e);e.type_===3?i.has(n)&&gi(n,r.handledSet_,r):kr(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&gi(kr(e.copy_,t,e.type_),r.handledSet_,r)})}function gi(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xr(e)||t.has(e)||!Sr(e)||Gr(e)?e:(t.add(e),Er(e,(r,i)=>{if(xr(i)){let t=i[dr];ui(t,n)&&(Ar(e,r,Br(t),e.type_),li(t))}else Sr(i)&&gi(i,t,n)}),e)}function _i(e,t){let n=Mr(e),r={type_:+!!n,scope_:t?t.scope_:$r(),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=vi;n&&(i=[r],a=yi);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var vi={get(e,t){if(t===dr)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=zr(e);if(!Or(i,t,e.type_))return Si(e,i,t);let a=i[t];if(e.finalized_||!Sr(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Rr(t))return a;if(a===bi(e.base_,t)||xi(e,t,a)){Ti(e);let n=e.type_===1?+t:t,r=Di(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in zr(e)},ownKeys(e){return Reflect.ownKeys(zr(e))},set(e,t,n){let r=Ci(zr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=bi(zr(e),t),i=r?.[dr];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(jr(n,r)&&(n!==void 0||Or(e.base_,t,e.type_)))return!0;Ti(e),wi(e)}return e.copy_[t]===n&&(n!==void 0||Or(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),hi(e,t,n),!0)},deleteProperty(e,t){return Ti(e),bi(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),wi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=zr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[yr]:!0,[_r]:e.type_!==1||t!==`length`,[vr]:r[vr],[br]:n[t]}},defineProperty(){fr(11)},getPrototypeOf(e){return mr(e.base_)},setPrototypeOf(){fr(12)}},yi={};for(let e in vi){let t=vi[e];yi[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)},yi.set=function(e,t,n){return vi.set.call(this,e[0],t,n,e[0])};function bi(e,t){let n=e[dr];return(n?zr(n):e)[t]}function xi(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Sr(n)||n[dr]?!1:e.baseRefs_.has(n)}function Si(e,t,n){let r=Ci(t,n);return r?br in r?r[br]:r.get?.call(e.draft_):void 0}function Ci(e,t){if(!(t in e))return;let n=mr(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=mr(n)}}function wi(e){e.modified_||(e.modified_=!0,e.parent_&&wi(e.parent_))}function Ti(e){e.copy_||=(e.assigned_=new Map,Vr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ei=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ir(e)&&!Ir(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ir(t)||fr(6),n!==void 0&&!Ir(n)&&fr(7);let r;if(Sr(e)){let i=ii(this),a=Di(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?ni(i):ri(i)}return ti(i,n),oi(r,i)}if(!e||!Fr(e)){if(r=t(e),r===void 0&&(r=e),r===lr&&(r=void 0),this.autoFreeze_&&Hr(r,!0),n){let t=[],i=[];Xr(qr).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}fr(1,e)},this.produceWithPatches=(e,t)=>{if(Ir(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]},Lr(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Lr(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Lr(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Sr(e)||fr(8),xr(e)&&(e=Oi(e));let t=ii(this),n=Di(t,e,void 0);return n[dr].isManual_=!0,ri(t),n}finishDraft(e,t){let n=e&&e[dr];(!n||!n.isManual_)&&fr(9);let{scope_:r}=n;return ti(r,t),oi(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=Xr(qr).applyPatches_;return xr(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Di(e,t,n,r){let[i,a]=Nr(t)?Xr(Kr).proxyMap_(t,n):Pr(t)?Xr(Kr).proxySet_(t,n):_i(t,n);return(n?.scope_??$r()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?pi(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 Oi(e){return xr(e)||fr(10,e),ki(e)}function ki(e){if(!Sr(e)||Gr(e))return e;let t=e[dr],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vr(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vr(e,!0);return Er(n,(e,t)=>{Ar(n,e,ki(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var Ai=new Ei().produce,B=e=>e;function ji(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Mi=ji(),Ni=ji,Pi=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?or:or.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function Fi(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(Ua(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=>cr(t)&&t.type===e,n}var Ii=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 Li(e){return Sr(e)?Ai(e,()=>{}):e}function Ri(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function zi(e){return typeof e==`boolean`}var Bi=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new Ii;return t&&(zi(t)?a.push(Mi):a.push(Ni(t.extraArgument))),a},Vi=`RTK_autoBatch`,V=()=>e=>({payload:e,meta:{[Vi]:!0}}),Hi=e=>t=>{setTimeout(t,e)},Ui=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},Wi=(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?Ui(window.requestAnimationFrame,100):Hi(10):e.type===`callback`?e.queueNotification:Hi(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?.[Vi],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Gi=e=>function(t){let{autoBatch:n=!0}=t??{},r=new Ii(e);return n&&r.push(Wi(typeof n==`object`?n:void 0)),r};function Ki(e){let t=Bi(),{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(nr(n))c=ar(n);else throw Error(Ua(1));let l;l=typeof r==`function`?r(t):t();let u=or;i&&(u=Pi({trace:!1,...typeof i==`object`&&i}));let d=Gi(sr(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return rr(c,o,p)}function qi(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(Ua(28));if(r in t)throw Error(Ua(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 Ji(e){return typeof e==`function`}function Yi(e,t){let[n,r,i]=qi(t),a;if(Ji(e))a=()=>Li(e());else{let t=Li(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(xr(e)){let r=n(e,t);return r===void 0?e:r}if(Sr(e))return Ai(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 Xi=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Zi=(e=21)=>{let t=``,n=e;for(;n--;)t+=Xi[Math.random()*64|0];return t},Qi=Symbol.for(`rtk-slice-createasyncthunk`);function $i(e,t){return`${e}/${t}`}function ea({creators:e}={}){let t=e?.asyncThunk?.[Qi];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(Ua(11));let i=(typeof e.reducers==`function`?e.reducers(ra()):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(Ua(12));if(n in o.sliceCaseReducersByType)throw Error(Ua(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:$i(n,r),createNotation:typeof e.reducers==`function`};aa(a)?sa(o,a,s,t):ia(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?qi(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Yi(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=Ri(d,r,m)),i}function i(t=l){return Ri(Ri(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=ta(a,t,()=>Ri(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 ta(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 na=ea();function ra(){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 ia({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!oa(r))throw Error(Ua(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Fi(e,o):Fi(e))}function aa(e){return e._reducerDefinitionType===`asyncThunk`}function oa(e){return e._reducerDefinitionType===`reducerWithPrepare`}function sa({type:e,reducerName:t},n,r,i){if(!i)throw Error(Ua(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||ca,pending:s||ca,rejected:c||ca,settled:l||ca})}function ca(){}var la=`task`,ua=`listener`,da=`completed`,fa=`cancelled`,pa=`task-${fa}`,ma=`task-${da}`,ha=`${ua}-${fa}`,ga=`${ua}-${da}`,_a=class{constructor(e){this.code=e,this.message=`${la} ${fa} (reason: ${e})`}code;name=`TaskAbortError`;message},va=(e,t)=>{if(typeof e!=`function`)throw TypeError(Ua(32))},ya=()=>{},ba=(e,t=ya)=>(e.catch(t),e),xa=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Sa=e=>{if(e.aborted)throw new _a(e.reason)};function Ca(e,t){let n=ya;return new Promise((r,i)=>{let a=()=>i(new _a(e.reason));if(e.aborted){a();return}n=xa(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=ya})}var wa=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof _a?`cancelled`:`rejected`,error:e}}finally{t?.()}},Ta=e=>t=>ba(Ca(e,t).then(t=>(Sa(e),t))),Ea=e=>{let t=Ta(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:Da}=Object,Oa={},ka=`listenerMiddleware`,Aa=(e,t)=>{let n=t=>xa(e,()=>t.abort(e.reason));return(r,i)=>{va(r,`taskExecutor`);let a=new AbortController;n(a);let o=wa(async()=>{Sa(e),Sa(a.signal);let t=await r({pause:Ta(a.signal),delay:Ea(a.signal),signal:a.signal});return Sa(a.signal),t},()=>a.abort(ma));return i?.autoJoin&&t.push(o.catch(ya)),{result:Ta(e)(o),cancel(){a.abort(pa)}}}},ja=(e,t)=>{let n=async(n,r)=>{Sa(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 Ca(t,Promise.race(a));return Sa(t),e}finally{i()}};return((e,t)=>ba(n(e,t)))},Ma=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Fi(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(Ua(21));return va(a,`options.listener`),{predicate:i,type:t,effect:a}},Na=Da(e=>{let{type:t,predicate:n,effect:r}=Ma(e);return{id:Zi(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(Ua(22))}}},{withTypes:()=>Na}),Pa=(e,t)=>{let{type:n,effect:r,predicate:i}=Ma(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},Fa=e=>{e.pending.forEach(e=>{e.abort(ha)})},Ia=(e,t)=>()=>{for(let e of t.keys())Fa(e);e.clear()},La=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},Ra=Da(Fi(`${ka}/add`),{withTypes:()=>Ra}),za=Fi(`${ka}/removeAll`),Ba=Da(Fi(`${ka}/remove`),{withTypes:()=>Ba}),Va=(...e)=>{console.error(`${ka}/error`,...e)},Ha=(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=Va}=e;va(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Fa(e)}),c=(e=>{let n=Pa(t,e)??Na(e);return s(n)});Da(c,{withTypes:()=>c});let l=e=>{let n=Pa(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Fa(n)),!!n};Da(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=ja(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,Da({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Ea(u.signal),pause:Ta(u.signal),extra:a,signal:u.signal,fork:Aa(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(ha),n.delete(e))})},cancel:()=>{u.abort(ha),e.pending.delete(u)},throwIfCancelled:()=>{Sa(u.signal)}})))}catch(e){e instanceof _a||La(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(ga),i(e),e.pending.delete(u)}},d=Ia(t,n);return{middleware:e=>n=>r=>{if(!cr(r))return n(r);if(Ra.match(r))return c(r.payload);if(za.match(r)){d();return}if(Ba.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===Oa)throw Error(Ua(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,La(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=Oa}return s},startListening:c,stopListening:l,clearListeners:d}};function Ua(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 Wa=na({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}}}),Ga=Wa.actions,Ka=Ga.setMargin,qa=Ga.setLayout,Ja=Ga.setChartSize,Ya=Ga.setScale,Xa=Wa.reducer;function Za(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function H(e){return Number.isFinite(e)}function Qa(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function $a(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 eo(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(ke(c)){if(c===`top`&&P(e.top))return eo(eo({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&P(e.bottom))return eo(eo({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&P(e.left))return eo(eo({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&P(e.right))return eo(eo({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return eo(eo({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return eo(eo({},e),{},{[o]:e[o]+(i||0)})}return e},ao=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,oo=(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},so=(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?se(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 H(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(ye):c&&l?l.map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.domain().map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(ye)},co={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:Et,none:xt,silhouette:Dt,wiggle:Ot,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)}}}}},lo=(e,t,n)=>{var r=co[n]??xt,i=Tt().keys(t).value((e,t)=>Number(U(e,t,0))).order(St).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=U(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function uo(e){return e==null?void 0:String(e)}function fo(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&&!_e(i[t.dataKey])){var s=ge(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=U(i,_e(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var po=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},mo=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],ho=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return mo(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=po(Za(r,t,n));return!H(i[0])||!H(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]))},go=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_o=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vo=(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=Xn(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 yo(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return eo(eo({},t),{},{dataKey:n,payload:r,value:i,name:a})}function bo(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var xo=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},So=(e,t)=>t===`centric`?e.angle:e.radius,Co=e=>e.layout.width,wo=e=>e.layout.height,To=e=>e.layout.scale,Eo=e=>e.layout.margin,Do=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Oo=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),ko=`data-recharts-item-index`;function Ao(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 jo(e){for(var t=1;te.brush.height;function Io(e){return Oo(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Lo(e){return Oo(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Ro(e){return Do(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function zo(e){return Do(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Bo=R([Co,wo,Eo,Fo,Io,Lo,Ro,zo,Zn,Qn],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=jo(jo({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=io(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return jo(jo({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Vo=R(Bo,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ho=R(Co,wo,(e,t)=>({x:0,y:0,width:e,height:t})),Uo=(0,s.createContext)(null),Wo=()=>(0,s.useContext)(Uo)!=null,Go=e=>e.brush,Ko=R([Go,Bo,Eo],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width}));function qo(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 Jo(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=qo(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 Yo(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Jo(e,t,{leading:r,maxWait:t,trailing:i})}var Xo=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++]))}}},Zo={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Qo=(e,t,n)=>{var r=n.width,i=r===void 0?Zo.width:r,a=n.height,o=a===void 0?Zo.height:a,s=n.aspect,c=n.maxHeight,l=le(i)?e:Number(i),u=le(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}},$o={width:0,height:0,overflow:`visible`},es={width:0,overflowX:`visible`},ts={height:0,overflowY:`visible`},ns={},rs=e=>{var t=e.width,n=e.height,r=le(t),i=le(n);return r&&i?$o:r?es:i?ts:ns};function is(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=Zo.width,a=Zo.height):i===void 0?i=r&&r>0?void 0:Zo.width:a===void 0&&(a=r&&r>0?void 0:Zo.height),{width:i,height:a}}var as=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function os(){return os=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 xs(i)?s.createElement(bs.Provider,{value:i},t):null}var Cs=()=>(0,s.useContext)(bs),ws=(0,s.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?Zo.initialDimension:r,a=e.width,c=e.height,l=e.minWidth,u=l===void 0?Zo.minWidth:l,d=e.minHeight,f=e.maxHeight,p=e.children,m=e.debounce,h=m===void 0?Zo.debounce:m,g=e.id,_=e.className,v=e.onResize,y=e.style,b=y===void 0?{}:y,x=vs(e,as),S=(0,s.useRef)(null),C=(0,s.useRef)();C.current=v,(0,s.useImperativeHandle)(t,()=>S.current);var w=fs((0,s.useState)({containerWidth:i.width,containerHeight:i.height}),2),T=w[0],E=w[1],D=(0,s.useCallback)((e,t)=>{E(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,s.useEffect)(()=>{if(S.current==null||typeof ResizeObserver>`u`)return be;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;D(i,a),(t=C.current)==null||t.call(C,i,a)}};h>0&&(e=Yo(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),()=>{t.disconnect()}},[D,h]);var O=T.containerWidth,k=T.containerHeight;Xo(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var A=Qo(O,k,{width:a,height:c,aspect:n,maxHeight:f}),j=A.calculatedWidth,M=A.calculatedHeight;return Xo(O<0||k<0||j!=null&&j>0||M!=null&&M>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 - height and width.`,j,M,a,c,u,d,n),s.createElement(`div`,os({id:g?`${g}`:void 0,className:o(`recharts-responsive-container`,_),style:cs(cs({},b),{},{width:a,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},x),s.createElement(`div`,{style:rs({width:a,height:c})},s.createElement(Ss,{width:j,height:M},p)))}),Ts=(0,s.forwardRef)((e,t)=>{var n=Cs();if(Qa(n.width)&&Qa(n.height))return e.children;var r=is({width:e.width,height:e.height,aspect:e.aspect}),i=r.width,a=r.height,o=Qo(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight}),c=o.calculatedWidth,l=o.calculatedHeight;return P(c)&&P(l)?s.createElement(Ss,{width:c,height:l},e.children):s.createElement(ws,os({},e,{width:i,height:a,ref:t}))}),Es=()=>{var e=Wo(),t=L(Vo),n=L(Ko),r=L(Go)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},Ds={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Os=()=>L(Bo)??Ds,ks=()=>L(Co),As=()=>L(wo),W=e=>e.layout.layoutType,js=()=>L(W),Ms=()=>{var e=js();if(e===`horizontal`||e===`vertical`)return e},Ns=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},Ps=()=>js()!==void 0,Fs=e=>{var t=I(),n=Wo(),r=e.width,i=e.height,a=Cs(),o=r,c=i;return a&&(o=a.width>0?a.width:r,c=a.height>0?a.height:i),(0,s.useEffect)(()=>{!n&&Qa(o)&&Qa(c)&&t(Ja({width:o,height:c}))},[t,n,o,c]),null},Is=na({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`bottom`,itemSorter:`value`,position:void 0,offset:0},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(B(t.payload))},prepare:V()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).payload.indexOf(B(r));a>-1&&(e.payload[a]=B(i))},prepare:V()},removeLegendPayload:{reducer(e,t){var n=Oi(e).payload.indexOf(B(t.payload));n>-1&&e.payload.splice(n,1)},prepare:V()}}}),Ls=Is.actions;Ls.setLegendSize,Ls.setLegendSettings;var Rs=Ls.addLegendPayload,zs=Ls.replaceLegendPayload,Bs=Ls.removeLegendPayload,Vs=Is.reducer,Hs=a((e=>{var t=n();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));a(((e,t)=>{t.exports=Hs()}))();function Us(e){e()}function Ws(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Us(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Gs={notify(){},get:()=>[]};function Ks(e,t){let n,r=Gs,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=Ws())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Gs)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var qs=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Js=typeof navigator<`u`&&navigator.product===`ReactNative`,Ys=qs||Js?s.useLayoutEffect:s.useEffect;function Xs(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function Zs(e,t){if(Xs(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=Ks(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=s.useMemo(()=>i.getState(),[i]);Ys(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let c=n||tc;return s.createElement(c.Provider,{value:a},t)}var rc=nc,ic=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function ac(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function oc(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(ic.has(n)){if(e[n]==null&&t[n]==null)continue;if(!Zs(e[n],t[n]))return!1}else if(!ac(e[n],t[n]))return!1;return!0}var sc={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function cc(e,t){return pc(e)||fc(e,t)||uc(e,t)||lc()}function lc(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uc(e,t){if(e){if(typeof e==`string`)return dc(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)?dc(e,t):void 0}}function dc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nsc.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),2),t=e[0],n=e[1];return(0,s.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}},[]),t}var hc=()=>L(e=>e.rootProps.accessibilityLayer)??!0;function gc(){return gc=Object.assign?Object.assign.bind():function(e){for(var t=1;tH(e.x)&&H(e.y),wc=e=>e.base!=null&&Cc(e.base)&&Cc(e),Tc=e=>e.x,Ec=e=>e.y,Dc=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${ve(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=Sc[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return Sc[n]||Ve},Oc={connectNulls:!1,type:`linear`},kc=e=>{var t=e.type,n=t===void 0?Oc.type:t,r=e.points,i=r===void 0?[]:r,a=e.baseLine,o=e.layout,s=e.connectNulls,c=s===void 0?Oc.connectNulls:s,l=Dc(n,o),u=c?i.filter(Cc):i;if(Array.isArray(a)){var d,f=i.map((e,t)=>vc(vc({},e),{},{base:a[t]}));return d=o===`vertical`?Ge().y(Ec).x1(Tc).x0(e=>e.base.x):Ge().x(Tc).y1(Ec).y0(e=>e.base.y),d.defined(wc).curve(l)(c?f.filter(wc):f)}return(o===`vertical`&&P(a)?Ge().y(Ec).x1(Tc).x0(a):P(a)?Ge().x(Tc).y1(Ec).y0(a):We().x(Tc).y(Ec)).defined(Cc).curve(l)(u)},Ac=e=>{var t=e.className,n=e.points,r=e.path,i=e.pathRef,a=js();if((!n||!n.length)&&!r)return null;var c={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?kc(c):r;return s.createElement(`path`,gc({},p(e),At(e),{className:o(`recharts-curve`,t),d:l===null?void 0:l,ref:i}))},jc=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Mc=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),Nc=(e,t)=>n=>Mc(jc(e,t),n),Pc=(e,t)=>n=>Mc([...jc(e,t).map((e,t)=>e*t).slice(1),0],n),Fc=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},Ic=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=Fc(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},Lc=(e,t,n,r)=>{var i=Nc(e,n),a=Nc(t,r),o=Pc(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},Rc=function(){return Lc(...Ic(...arguments))},zc=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?16.67:a,s=1,c=[0],l=0,u=0,d=1e4,f=0;f{if(e<=0)return 0;if(e>=1)return s;var t=e*h,n=Math.floor(t),r=t-n;return(c[n]??0)+((c[n+1]??0)-(c[n]??0))*r}},Bc=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return Rc(e);case`spring`:return zc();default:if(e.split(`(`)[0]===`cubic-bezier`)return Rc(e)}return typeof e==`function`?e:null},Vc=(0,s.createContext)((e,t,n)=>{var r,i=a=>{var o=t.tick(a);if(t.getState()===`active`){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(i,o);return}r=e.setTimeout(i,o)};return r=e.setTimeout(i,0),()=>r?.()});Vc.Provider;function Hc(e){var t=(0,s.useContext)(Vc);return(0,s.useMemo)(()=>e??t,[e,t])}function Uc(e,t,n){return(t=Wc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wc(e){var t=Gc(e,`string`);return typeof t==`symbol`?t:t+``}function Gc(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Kc=`init`,qc=`pending`,Jc=`active`,Yc=`completed`;function Xc(e){return Math.max(0,e)}var Zc=class{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var t;Uc(this,`state`,Kc),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=Xc(e.animationDuration),this.animationBegin=Xc(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(t=e.onAnimationStart)==null||t.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Kc)return this.state=qc,this.beginStartedTime=e,this.animationBegin;if(this.getState()===qc){if(this.beginStartedTime==null)throw Error();var t=e-this.beginStartedTime;return t>=this.animationBegin?(this.state=Jc,this.animationStartedTime=e,this.nextAnimationUpdate(0)):Xc(this.animationBegin-t)}if(this.getState()===Jc){if(this.animationStartedTime==null)throw Error();var n=e-this.animationStartedTime;return this.setProgress(n/this.animationDuration),this.nextAnimationUpdate(n)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state===`active`){var e;(e=this.onAnimationEnd)==null||e.call(this)}this.state=Yc}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}},Qc=class extends Zc{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(he(this.getFrom(),this.getTo(),this.getProgress()))}},$c=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):r=requestAnimationFrame(i)};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function el(e,t){return al(e)||il(e,t)||nl(e,t)||tl()}function tl(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nl(e,t){if(e){if(typeof e==`string`)return rl(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)?rl(e,t):void 0}}function rl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},sl=0,cl=1;function ll(e){var t=Rt(e,ol),n=t.animationId,r=t.isActive,i=t.canBegin,a=t.duration,o=t.easing,c=t.begin,l=t.onAnimationEnd,u=t.onAnimationStart,d=t.children,f=mc(),p=r===`auto`?!sc.isSsr&&!f:r,m=Hc(t.animationController),h=el((0,s.useState)(p?sl:cl),2),g=h[0],_=h[1];return(0,s.useEffect)(()=>{p||_(cl)},[p]),(0,s.useEffect)(()=>{var e=Bc(o);return!p||!i||e==null?be:m(new $c,new Qc({animationId:n,easing:e,animationDuration:a,animationBegin:c,onAnimationStart:u,onAnimationEnd:l,from:sl,to:cl}),_)},[m,n,p,i,a,o,c,u,l]),d(Number(g))}function ul(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,s.useRef)(fe(t)),r=(0,s.useRef)(e);return r.current!==e&&(n.current=fe(t),r.current=e),n.current}function dl(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 fl(e){for(var t=1;te*180/Math.PI,vl=(e,t,n,r)=>({x:e+Math.cos(-gl*r)*n,y:t+Math.sin(-gl*r)*n}),yl=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},bl=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return Math.sqrt((n-i)**2+(r-a)**2)},xl=(e,t)=>{var n=e.x,r=e.y,i=t.cx,a=t.cy,o=bl({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:_l(c),angleInRadian:c}},Sl=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},Cl=(e,t)=>{var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},wl=(e,t)=>{var n=e.relativeX,r=e.relativeY,i=xl({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac||a===0)return null;var l=Sl(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?fl(fl({},t),{},{radius:a,angle:Cl(f,t)}):null};function Tl(e){return M(e)?NaN:Number(e)}function El(e){return e?(e=Tl(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Dl(e,t,n){n&&typeof n!=`number`&&Un(e,t,n)&&(t=n=void 0),e=El(e),t===void 0?(t=e,e=0):t=El(t),n=n===void 0?ee.chartData,kl=R([Ol],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Al=(e,t,n,r)=>r?kl(e):Ol(e),jl=(e,t,n)=>n?kl(e):Ol(e),Ml=R([Al],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});R([kl],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});var Nl=R([Ol],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});function Pl(e,t){return zl(e)||Rl(e,t)||Il(e,t)||Fl()}function Fl(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Il(e,t){if(e){if(typeof e==`string`)return Ll(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)?Ll(e,t):void 0}}function Ll(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function Wl(e){return e===0?1:Math.floor(new G.default(e).abs().log(10).toNumber())+1}function Gl(e,t,n){for(var r=new G.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}function Kl(e,t){return Zl(e)||Xl(e,t)||Jl(e,t)||ql()}function ql(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jl(e,t){if(e){if(typeof e==`string`)return Yl(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)?Yl(e,t):void 0}}function Yl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=Kl(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]},$l=(e,t,n)=>{if(e.lte(0))return new G.default(0);var r=Wl(e.toNumber()),i=new G.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new G.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new G.default(s.toNumber()):new G.default(Math.ceil(s.toNumber()))},eu=(e,t,n)=>{if(e.lte(0))return new G.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new G.default(i).abs().log(10).toNumber()),o=new G.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new G.default(10).pow(l))}var u=r[c]??1,d=new G.default(u).mul(o);return t?d:new G.default(Math.ceil(d.toNumber()))},tu=(e,t,n)=>{var r=new G.default(1),i=new G.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new G.default(10).pow(Wl(e)-1),i=new G.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new G.default(Math.floor(e)))}else e===0?i=new G.default(Math.floor((t-1)/2)):n||(i=new G.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:$l;if(!Number.isFinite((t-e)/(n-1)))return{step:new G.default(0),tickMin:new G.default(0),tickMax:new G.default(0)};var o=a(new G.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new G.default(0):(s=new G.default(e).add(t).div(2),s=s.sub(new G.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new G.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?nu(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new G.default(c).mul(o)),tickMax:s.add(new G.default(l).mul(o))})},ru=function(e){var t=Kl(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Math.max(i,2),c=Kl(Ql([n,r]),2),l=c[0],u=c[1];if(l===-1/0||u===1/0){var d=u===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),u];return n>r?d.reverse():d}if(l===u)return tu(l,i,a);var f=nu(l,u,s,a,0,o===`snap125`?eu:$l),p=f.step,m=f.tickMin,h=f.tickMax,g=Gl(m,h.add(new G.default(.1).mul(p)),p);return n>r?g.reverse():g},iu=function(e,t){var n=Kl(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Kl(Ql([r,i]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0)return[r,i];if(c===l)return[c];var u=o===`snap125`?eu:$l,d=Math.max(t,2),f=u(new G.default(l).sub(c).div(d-1),a,0),p=[...Gl(new G.default(c),new G.default(l),f),l];if(a===!1){p=p.map(e=>Math.round(e));var m=p.length-1;m>0&&p[m]===p[m-1]&&(p=p.slice(0,m))}return r>i?p.reverse():p},au=e=>e.rootProps.barCategoryGap,ou=e=>e.rootProps.stackOffset,su=e=>e.rootProps.reverseStackOrder,cu=e=>e.options.chartName,lu=e=>e.rootProps.syncId,uu=e=>e.rootProps.syncMethod,du=e=>e.options.eventEmitter,fu=e=>e.rootProps.baseValue,pu={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},mu={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:pu.axis},hu={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:pu.axis},gu=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function _u(e,t,n){if(n!==`auto`)return n;if(e!=null)return ao(e,t)?`category`:`number`}function vu(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 yu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},Ns],(e,t)=>{if(e!=null)return e;var n=_u(t,`angleAxis`,Cu.type)??`category`;return yu(yu({},Cu),{},{type:n})}),Eu=R([(e,t)=>e.polarAxis.radiusAxis[t],Ns],(e,t)=>{if(e!=null)return e;var n=_u(t,`radiusAxis`,wu.type)??`category`;return yu(yu({},wu),{},{type:n})}),Du=e=>e.polarOptions,Ou=R([Co,wo,Bo],yl),ku=R([Du,Ou],(e,t)=>{if(e!=null)return pe(e.innerRadius,t,0)}),Au=R([Du,Ou],(e,t)=>{if(e!=null)return pe(e.outerRadius,t,t*.8)}),ju=R([Du],e=>e==null?[0,0]:[e.startAngle,e.endAngle]);R([Tu,ju],gu);var Mu=R([Ou,ku,Au],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});R([Eu,Mu],gu);var Nu=R([W,Du,ku,Au,Co,wo],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var o=t.cx,s=t.cy,c=t.startAngle,l=t.endAngle;return{cx:pe(o,i,i/2),cy:pe(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),K=(e,t)=>t,Pu=(e,t,n)=>n;function Fu(e){return e?.id}function Iu(e,t,n){var r=t.chartData,i=r===void 0?[]:r,a=n.allowDuplicatedCategory,o=n.dataKey,s=new Map;return e.forEach(e=>{var t=e.data??i;if(t!=null&&t.length!==0){var n=Fu(e);t.forEach((t,r)=>{var i=o==null||a?r:String(U(t,o,null)),c=U(t,e.dataKey,0),l=s.has(i)?s.get(i):{};Object.assign(l,{[n]:c}),s.set(i,l)})}}),Array.from(s.values())}function Lu(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var Ru=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function zu(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Bu(e,t){if(e.length===t.length){for(var n=0;n{var t=W(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Vu=e=>e.tooltip.settings.axisId;function Hu(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var Uu=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!Bl(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Wu(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Gu(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ku(e){let t,n,r;e.length===2?(t=e===Wu||e===Gu?e:qu,n=e,r=e):(t=Wu,n=(t,n)=>Wu(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function qu(){return 0}function Ju(e){return e===null?NaN:+e}function*Yu(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Xu=Ku(Wu),Zu=Xu.right;Xu.left,Ku(Ju).center;var Qu=class extends Map{constructor(e,t=nd){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get($u(this,e))}has(e){return super.has($u(this,e))}set(e,t){return super.set(ed(this,e),t)}delete(e){return super.delete(td(this,e))}};function $u({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function ed({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function td({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function nd(e){return typeof e==`object`&&e?e.valueOf():e}function rd(e=Wu){if(e===Wu)return id;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function id(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var ad=Math.sqrt(50),od=Math.sqrt(10),sd=Math.sqrt(2);function cd(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=ad?10:a>=od?5:a>=sd?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function pd(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function md(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?id:rd(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));md(e,t,u,d,i)}let a=e[t],o=n,s=r;for(hd(e,n,t),i(e[r],a)>0&&hd(e,n,r);o0;)--s}i(e[n],a)===0?hd(e,n,s):(++s,hd(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function hd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function gd(e,t,n){if(e=Float64Array.from(Yu(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return pd(e);if(t>=1)return fd(e);var r,i=(r-1)*t,a=Math.floor(i),o=fd(md(e,a).subarray(0,a+1));return o+(pd(e.subarray(a+1))-o)*(i-a)}}function _d(e,t,n=Ju){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function vd(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jd(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Fd.exec(e))?new Zd(t[1],t[2],t[3],1):(t=Id.exec(e))?new Zd(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ld.exec(e))?Jd(t[1],t[2],t[3],t[4]):(t=Rd.exec(e))?Jd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zd.exec(e))?af(t[1],t[2]/100,t[3]/100,1):(t=Bd.exec(e))?af(t[1],t[2]/100,t[3]/100,t[4]):Vd.hasOwnProperty(e)?qd(Vd[e]):e===`transparent`?new Zd(NaN,NaN,NaN,0):null}function qd(e){return new Zd(e>>16&255,e>>8&255,e&255,1)}function Jd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Zd(e,t,n,r)}function Yd(e){return e instanceof Od||(e=Kd(e)),e?(e=e.rgb(),new Zd(e.r,e.g,e.b,e.opacity)):new Zd}function Xd(e,t,n,r){return arguments.length===1?Yd(e):new Zd(e,t,n,r??1)}function Zd(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ed(Zd,Xd,Dd(Od,{brighter(e){return e=e==null?Ad:Ad**+e,new Zd(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kd:kd**+e,new Zd(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zd(nf(this.r),nf(this.g),nf(this.b),tf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qd,formatHex:Qd,formatHex8:$d,formatRgb:ef,toString:ef}));function Qd(){return`#${rf(this.r)}${rf(this.g)}${rf(this.b)}`}function $d(){return`#${rf(this.r)}${rf(this.g)}${rf(this.b)}${rf((isNaN(this.opacity)?1:this.opacity)*255)}`}function ef(){let e=tf(this.opacity);return`${e===1?`rgb(`:`rgba(`}${nf(this.r)}, ${nf(this.g)}, ${nf(this.b)}${e===1?`)`:`, ${e})`}`}function tf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rf(e){return e=nf(e),(e<16?`0`:``)+e.toString(16)}function af(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cf(e,t,n,r)}function of(e){if(e instanceof cf)return new cf(e.h,e.s,e.l,e.opacity);if(e instanceof Od||(e=Kd(e)),!e)return new cf;if(e instanceof cf)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new cf(o,s,c,e.opacity)}function sf(e,t,n,r){return arguments.length===1?of(e):new cf(e,t,n,r??1)}function cf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ed(cf,sf,Dd(Od,{brighter(e){return e=e==null?Ad:Ad**+e,new cf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kd:kd**+e,new cf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Zd(df(e>=240?e-240:e+120,i,r),df(e,i,r),df(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cf(lf(this.h),uf(this.s),uf(this.l),tf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=tf(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lf(this.h)}, ${uf(this.s)*100}%, ${uf(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function lf(e){return e=(e||0)%360,e<0?e+360:e}function uf(e){return Math.max(0,Math.min(1,e||0))}function df(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ff=e=>()=>e;function pf(e,t){return function(n){return e+n*t}}function mf(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function hf(e){return(e=+e)==1?gf:function(t,n){return n-t?mf(t,n,e):ff(isNaN(t)?n:t)}}function gf(e,t){var n=t-e;return n?pf(e,n):ff(isNaN(e)?t:e)}var _f=(function e(t){var n=hf(t);function r(e,t){var r=n((e=Xd(e)).r,(t=Xd(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=gf(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function vf(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Sf(r,i)})),n=Tf.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Rf(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?zf:Rf,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Sf))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Nf),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Af,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Ff,u()):o!==Ff},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Hf(){return Vf()(Ff,Ff)}function Uf(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Wf(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Gf(e){return e=Wf(Math.abs(e)),e?e[1]:NaN}function Kf(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function qf(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Jf=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Yf(e){if(!(t=Jf.exec(e)))throw Error(`invalid format: `+e);var t;return new Xf({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Yf.prototype=Xf.prototype;function Xf(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Xf.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Zf(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var Qf;function $f(e,t){var n=Wf(e,t);if(!n)return Qf=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Qf=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Wf(e,Math.max(0,t+a-1))[0]}function ep(e,t){var n=Wf(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var tp={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Uf,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ep(e*100,t),r:ep,s:$f,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function np(e){return e}var rp=Array.prototype.map,ip=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function ap(e){var t=e.grouping===void 0||e.thousands===void 0?np:Kf(rp.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?np:qf(rp.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Yf(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):tp[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=tp[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Zf(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Qf!==void 0?ip[8+Qf/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Gf(t)/3)))*3,r=10**-n,i=l((e=Yf(e),e.type=`f`,e),{suffix:ip[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var op,sp,cp;lp({thousands:`,`,grouping:[3],currency:[`$`,``]});function lp(e){return op=ap(e),sp=op.format,cp=op.formatPrefix,op}function up(e){return Math.max(0,-Gf(Math.abs(e)))}function dp(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Gf(t)/3)))*3-Gf(Math.abs(e)))}function fp(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Gf(t)-Gf(e))+1}function pp(e,t,n,r){var i=dd(e,t,n),a;switch(r=Yf(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=dp(i,o))&&(r.precision=a),cp(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=fp(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=up(i))&&(r.precision=a-(r.type===`%`)*2)}return sp(r)}function mp(e){var t=e.domain;return e.ticks=function(e){var n=t();return ld(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return pp(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=ud(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function hp(){var e=Hf();return e.copy=function(){return Bf(e,hp())},yd.apply(e,arguments),mp(e)}function gp(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,Nf),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return gp(e).unknown(t)},e=arguments.length?Array.from(e,Nf):[0,1],mp(n)}function _p(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function wp(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Tp(e){return(t,n)=>-e(-t,n)}function Ep(e){let t=e(vp,yp),n=t.domain,r=10,i,a;function o(){return i=wp(r),a=Cp(r),n()[0]<0?(i=Tp(i),a=Tp(a),e(bp,xp)):e(vp,yp),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Yf(n)).precision==null&&(n.trim=!0),n=sp(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(_p(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Dp(){let e=Ep(Vf()).domain([1,10]);return e.copy=()=>Bf(e,Dp()).base(e.base()),yd.apply(e,arguments),e}function Op(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function kp(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ap(e){var t=1,n=e(Op(t),kp(t));return n.constant=function(n){return arguments.length?e(Op(t=+n),kp(t)):t},mp(n)}function jp(){var e=Ap(Vf());return e.copy=function(){return Bf(e,jp()).constant(e.constant())},yd.apply(e,arguments)}function Mp(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Np(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Pp(e){return e<0?-e*e:e*e}function Fp(e){var t=e(Ff,Ff),n=1;function r(){return n===1?e(Ff,Ff):n===.5?e(Np,Pp):e(Mp(n),Mp(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},mp(t)}function Ip(){var e=Fp(Vf());return e.copy=function(){return Bf(e,Ip()).exponent(e.exponent())},yd.apply(e,arguments),e}function Lp(){return Ip.apply(null,arguments).exponent(.5)}function Rp(e){return Math.sign(e)*e*e}function zp(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Bp(){var e=Hf(),t=[0,1],n=!1,r;function i(t){var i=zp(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(Rp(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,Nf)).map(Rp)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Bp(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},yd.apply(i,arguments),mp(i)}function Vp(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Hp().domain([e,t]).range(i).unknown(a)},yd.apply(mp(o),arguments)}function Up(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Zu(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Up().domain(e).range(t).unknown(n)},yd.apply(i,arguments)}var Wp=new Date,Gp=new Date;function J(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(Wp.setTime(+t),Gp.setTime(+r),e(Wp),e(Gp),Math.floor(n(Wp,Gp))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var Kp=J(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Kp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?J(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Kp),Kp.range;var qp=1e3,Jp=qp*60,Yp=Jp*60,Xp=Yp*24,Zp=Xp*7,Qp=Xp*30,$p=Xp*365,em=J(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*qp)},(e,t)=>(t-e)/qp,e=>e.getUTCSeconds());em.range;var tm=J(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qp)},(e,t)=>{e.setTime(+e+t*Jp)},(e,t)=>(t-e)/Jp,e=>e.getMinutes());tm.range;var nm=J(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Jp)},(e,t)=>(t-e)/Jp,e=>e.getUTCMinutes());nm.range;var rm=J(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qp-e.getMinutes()*Jp)},(e,t)=>{e.setTime(+e+t*Yp)},(e,t)=>(t-e)/Yp,e=>e.getHours());rm.range;var im=J(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Yp)},(e,t)=>(t-e)/Yp,e=>e.getUTCHours());im.range;var am=J(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jp)/Xp,e=>e.getDate()-1);am.range;var om=J(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xp,e=>e.getUTCDate()-1);om.range;var sm=J(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xp,e=>Math.floor(e/Xp));sm.range;function cm(e){return J(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jp)/Zp)}var lm=cm(0),um=cm(1),dm=cm(2),fm=cm(3),pm=cm(4),mm=cm(5),hm=cm(6);lm.range,um.range,dm.range,fm.range,pm.range,mm.range,hm.range;function gm(e){return J(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/Zp)}var _m=gm(0),vm=gm(1),ym=gm(2),bm=gm(3),xm=gm(4),Sm=gm(5),Cm=gm(6);_m.range,vm.range,ym.range,bm.range,xm.range,Sm.range,Cm.range;var wm=J(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());wm.range;var Tm=J(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Tm.range;var Em=J(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Em.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:J(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),Em.range;var Dm=J(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Dm.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:J(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),Dm.range;function Om(e,t,n,r,i,a){let o=[[em,1,qp],[em,5,5*qp],[em,15,15*qp],[em,30,30*qp],[a,1,Jp],[a,5,5*Jp],[a,15,15*Jp],[a,30,30*Jp],[i,1,Yp],[i,3,3*Yp],[i,6,6*Yp],[i,12,12*Yp],[r,1,Xp],[r,2,2*Xp],[n,1,Zp],[t,1,Qp],[t,3,3*Qp],[e,1,$p]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(dd(t/$p,n/$p,r));if(a===0)return Kp.every(Math.max(dd(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=Pm(Fm(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?vm.ceil(a):vm(a),a=om.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=Nm(Fm(r.y,0,1)),o=a.getDay(),a=o>4||o===0?um.ceil(a):um(a),a=am.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?Pm(Fm(r.y,0,1)).getUTCDay():Nm(Fm(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,Pm(r)):Nm(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in Lm?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function ee(e){return a[e.getDay()]}function te(e){return c[e.getMonth()]}function ne(e){return s[e.getMonth()]}function re(e){return i[+(e.getHours()>=12)]}function ie(e){return 1+~~(e.getMonth()/3)}function ae(e){return o[e.getUTCDay()]}function oe(e){return a[e.getUTCDay()]}function se(e){return c[e.getUTCMonth()]}function ce(e){return s[e.getUTCMonth()]}function le(e){return i[+(e.getUTCHours()>=12)]}function P(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var Lm={"-":``,_:` `,0:`0`},Y=/^\s*\d+/,Rm=/^%/,zm=/[\\^$*+?|[\]().{}]/g;function X(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function Um(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Wm(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Gm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Km(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Jm(e,t,n){var r=Y.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ym(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Xm(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function Zm(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Qm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $m(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function eh(e,t,n){var r=Y.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function th(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nh(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rh(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ih(e,t,n){var r=Y.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ah(e,t,n){var r=Y.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oh(e,t,n){var r=Rm.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function sh(e,t,n){var r=Y.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ch(e,t,n){var r=Y.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function lh(e,t){return X(e.getDate(),t,2)}function uh(e,t){return X(e.getHours(),t,2)}function dh(e,t){return X(e.getHours()%12||12,t,2)}function fh(e,t){return X(1+am.count(Em(e),e),t,3)}function ph(e,t){return X(e.getMilliseconds(),t,3)}function mh(e,t){return ph(e,t)+`000`}function hh(e,t){return X(e.getMonth()+1,t,2)}function gh(e,t){return X(e.getMinutes(),t,2)}function _h(e,t){return X(e.getSeconds(),t,2)}function vh(e){var t=e.getDay();return t===0?7:t}function yh(e,t){return X(lm.count(Em(e)-1,e),t,2)}function bh(e){var t=e.getDay();return t>=4||t===0?pm(e):pm.ceil(e)}function xh(e,t){return e=bh(e),X(pm.count(Em(e),e)+(Em(e).getDay()===4),t,2)}function Sh(e){return e.getDay()}function Ch(e,t){return X(um.count(Em(e)-1,e),t,2)}function wh(e,t){return X(e.getFullYear()%100,t,2)}function Th(e,t){return e=bh(e),X(e.getFullYear()%100,t,2)}function Eh(e,t){return X(e.getFullYear()%1e4,t,4)}function Dh(e,t){var n=e.getDay();return e=n>=4||n===0?pm(e):pm.ceil(e),X(e.getFullYear()%1e4,t,4)}function Oh(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+X(t/60|0,`0`,2)+X(t%60,`0`,2)}function kh(e,t){return X(e.getUTCDate(),t,2)}function Ah(e,t){return X(e.getUTCHours(),t,2)}function jh(e,t){return X(e.getUTCHours()%12||12,t,2)}function Mh(e,t){return X(1+om.count(Dm(e),e),t,3)}function Nh(e,t){return X(e.getUTCMilliseconds(),t,3)}function Ph(e,t){return Nh(e,t)+`000`}function Fh(e,t){return X(e.getUTCMonth()+1,t,2)}function Ih(e,t){return X(e.getUTCMinutes(),t,2)}function Lh(e,t){return X(e.getUTCSeconds(),t,2)}function Rh(e){var t=e.getUTCDay();return t===0?7:t}function zh(e,t){return X(_m.count(Dm(e)-1,e),t,2)}function Bh(e){var t=e.getUTCDay();return t>=4||t===0?xm(e):xm.ceil(e)}function Vh(e,t){return e=Bh(e),X(xm.count(Dm(e),e)+(Dm(e).getUTCDay()===4),t,2)}function Hh(e){return e.getUTCDay()}function Uh(e,t){return X(vm.count(Dm(e)-1,e),t,2)}function Wh(e,t){return X(e.getUTCFullYear()%100,t,2)}function Gh(e,t){return e=Bh(e),X(e.getUTCFullYear()%100,t,2)}function Kh(e,t){return X(e.getUTCFullYear()%1e4,t,4)}function qh(e,t){var n=e.getUTCDay();return e=n>=4||n===0?xm(e):xm.ceil(e),X(e.getUTCFullYear()%1e4,t,4)}function Jh(){return`+0000`}function Yh(){return`%`}function Xh(e){return+e}function Zh(e){return Math.floor(e/1e3)}var Qh,$h,eg;tg({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function tg(e){return Qh=Im(e),$h=Qh.format,Qh.parse,eg=Qh.utcFormat,Qh.utcParse,Qh}function ng(e){return new Date(e)}function rg(e){return e instanceof Date?+e:+new Date(+e)}function ig(e,t,n,r,i,a,o,s,c,l){var u=Hf(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>gd(e,r/t))},n.copy=function(){return mg(t).domain(e)},bd.apply(n,arguments)}function hg(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=Ff,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eCd,scaleDiverging:()=>gg,scaleDivergingLog:()=>_g,scaleDivergingPow:()=>yg,scaleDivergingSqrt:()=>bg,scaleDivergingSymlog:()=>vg,scaleIdentity:()=>gp,scaleImplicit:()=>xd,scaleLinear:()=>hp,scaleLog:()=>Dp,scaleOrdinal:()=>Sd,scalePoint:()=>Td,scalePow:()=>Ip,scaleQuantile:()=>Vp,scaleQuantize:()=>Hp,scaleRadial:()=>Bp,scaleSequential:()=>lg,scaleSequentialLog:()=>ug,scaleSequentialPow:()=>fg,scaleSequentialQuantile:()=>mg,scaleSequentialSqrt:()=>pg,scaleSequentialSymlog:()=>dg,scaleSqrt:()=>Lp,scaleSymlog:()=>jp,scaleThreshold:()=>Up,scaleTime:()=>ag,scaleUtc:()=>og,tickFormat:()=>pp});function Sg(e){var t=xg;if(e in t&&typeof t[e]==`function`)return t[e]();var n=`scale${ve(e)}`;if(n in t&&typeof t[n]==`function`)return t[n]()}function Cg(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=Sg(e);if(r!=null)return r.domain(t).range(n),r}}function wg(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?Cg(e.scale,n,r):Cg(t,n,r)}function Tg(e){return`scale${ve(e)}`}function Eg(e){return Tg(e)in xg}var Dg=(e,t,n)=>{if(e!=null){var r=e.scale,i=e.type;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return Eg(r)?r:`point`}};function Og(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function kg(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=Og(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function Ag(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):kg(e,void 0)}function jg(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 Mg(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ne.cartesianAxis.xAxis[t],Gg=(e,t)=>Wg(e,t)??Ug,Z={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Hg,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},Kg=(e,t)=>e.cartesianAxis.yAxis[t],qg=(e,t)=>Kg(e,t)??Z,Jg={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},Yg=(e,t)=>e.cartesianAxis.zAxis[t]??Jg,Xg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);case`zAxis`:return Yg(e,n);case`angleAxis`:return Tu(e,n);case`radiusAxis`:return Eu(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Zg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Qg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);case`angleAxis`:return Tu(e,n);case`radiusAxis`:return Eu(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},$g=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function e_(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var t_=e=>e.graphicalItems.cartesianItems,n_=R([K,Pu],e_),r_=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),i_=R([t_,Xg,n_],r_,{memoizeOptions:{resultEqualityCheck:zu}}),a_=R([i_],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Lu)),o_=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),s_=R([i_],o_),c_=e=>e.map(e=>e.data).filter(Boolean).flat(1),l_=R([i_],e=>e.some(e=>!e.data)),u_=R([i_],c_,{memoizeOptions:{resultEqualityCheck:zu}}),d_=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,i=t.dataStartIndex,a=t.dataEndIndex;return e.length>0?e:r.slice(i,a+1)},f_=R([u_,Al],d_),p_=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:U(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:U(e,t.dataKey)})),m_=(e,t,n,r,i,a)=>{var o=r.chartData,s=o===void 0?[]:o,c=r.dataStartIndex,l=r.dataEndIndex,u=p_(e,t,n);return i&&t?.dataKey!=null&&a.length>0?[...s.slice(c,l+1).map(e=>({value:U(e,t.dataKey)})).filter(e=>e.value!=null),...u]:u},h_=R([f_,Xg,i_,Al,l_,u_],m_);function g_(e){if(ue(e)||e instanceof Date){var t=Number(e);if(H(t))return t}}function __(e){if(Array.isArray(e)){var t=[g_(e[0]),g_(e[1])];return Bl(t)?t:void 0}var n=g_(e);if(n!=null)return[n,n]}function v_(e){return e.map(g_).filter(ye)}function y_(e,t){var n=g_(e),r=g_(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var b_=R([h_],e=>e?.map(e=>e.value).sort(y_));function x_(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function S_(e,t,n){if(!n||!n.length)return[];var r;if(typeof t==`number`&&!ce(t))r=t;else if(Array.isArray(t)){var i=v_(t);i.length>0&&(r=Math.max(...i))}return r==null?[]:v_(n.flatMap(t=>{var n=U(e,t.dataKey),i,a;if(Array.isArray(n)){var o=Ig(n,2);i=o[0],a=o[1]}else i=a=n;if(!(!H(i)||!H(a)))return[r-i,r+a]}))}var Q=e=>Qg(e,q(e),Vu(e)),C_=R([Q],e=>e?.dataKey),w_=R([a_,Al,Q],Iu),T_=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var i=Ig(t,2),a=i[0],o=i[1],s=r?[...o].reverse():o;return[a,{stackedData:lo(e,s.map(Fu),n),graphicalItems:s}]}))},E_=R([w_,a_,ou,su],T_),D_=(e,t,n,r)=>{var i=t.dataStartIndex,a=t.dataEndIndex;if(r==null&&n!==`zAxis`)return ho(e,i,a)},O_=R([Xg],e=>e.allowDataOverflow),k_=e=>{if(e==null||!(`domain`in e))return Hg;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=v_(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??Hg},A_=R([Xg],k_),j_=R([A_,O_],Hl),M_=R([E_,Ol,K,j_],D_,{memoizeOptions:{resultEqualityCheck:Ru}}),N_=e=>e.errorBars,P_=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>x_(n,e)),F_=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},I_=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],o,s;if(n.length>0&&n.forEach(e=>{var n=e.data==null?a:[...e.data],c=r[e.id]?.filter(e=>x_(i,e));n.forEach(n=>{var r=U(n,t.dataKey??e.dataKey),i=S_(n,r,c);if(i.length>=2){var a=Math.min(...i),l=Math.max(...i);(o==null||as)&&(s=l)}var u=__(r);u!=null&&(o=o==null?u[0]:Math.min(o,u[0]),s=s==null?u[1]:Math.max(s,u[1]))})}),t?.dataKey!=null&&n.length===0&&e.forEach(e=>{var n=__(U(e,t.dataKey));n!=null&&(o=o==null?n[0]:Math.min(o,n[0]),s=s==null?n[1]:Math.max(s,n[1]))}),H(o)&&H(s))return[o,s]},L_=R([f_,Xg,s_,N_,K,Ml],I_,{memoizeOptions:{resultEqualityCheck:Ru}});function R_(e){var t=e.value;if(ue(t)||t instanceof Date)return t}var z_=(e,t,n)=>{var r=e.map(R_).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&me(r))?Dl(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},B_=e=>e.referenceElements.dots,V_=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),H_=R([B_,K,Pu],V_),U_=e=>e.referenceElements.areas,W_=R([U_,K,Pu],V_),G_=e=>e.referenceElements.lines,K_=R([G_,K,Pu],V_),q_=(e,t)=>{if(e!=null){var n=v_(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},J_=R(H_,K,q_),Y_=(e,t)=>{if(e!=null){var n=v_(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},X_=R([W_,K],Y_);function Z_(e){if(e.x!=null)return v_([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:v_(t)}function Q_(e){if(e.y!=null)return v_([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:v_(t)}var $_=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?Z_(e):Q_(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},ev=R(J_,R([K_,K],$_),X_,(e,t,n)=>F_(e,n,t)),tv=(e,t,n,r,i,a,o,s,c)=>{if(n!=null)return n;var l=o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?F_(r,a,i):F_(a,i),u=Ul(t,l,e.allowDataOverflow);return u==null&&e.allowDataOverflow&&l==null&&c!=null?c:u},nv=R([Xg,A_,j_,M_,L_,ev,W,K,R([Xg],e=>{if(!(e==null||e.type!==`number`||!(`ticks`in e)||e.ticks==null)){var t=v_(e.ticks);if(t.length!==0)return[Math.min(...t),Math.max(...t)]}},{memoizeOptions:{resultEqualityCheck:Ru}})],tv,{memoizeOptions:{resultEqualityCheck:Ru}}),rv=[0,1],iv=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var s=e.dataKey,c=e.type,l=ao(t,a);return l&&s==null?Dl(0,n?.length??0):c===`category`?z_(r,e,l):i===`expand`&&!l?rv:o}},av=R([Xg,W,f_,h_,ou,K,nv],iv),ov=R([Xg,$g,cu],Dg),sv=(e,t,n)=>{var r=t.niceTicks;if(r!==`none`){var i=k_(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&Bl(e)){if(a)return ru(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return iu(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&Bl(e))return ru(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&Bl(e))return iu(e,t.tickCount,t.allowDecimals,`adaptive`)}}},cv=R([av,Qg,ov],sv),lv=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&Bl(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},uv=R([Xg,av,cv,K],lv),dv=R(R(h_,Xg,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(v_(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!H(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=pe(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),fv=(e,t,n)=>{var r=Gg(e,t);return r==null||typeof r.padding!=`string`?0:dv(e,`xAxis`,t,n,r.padding)},pv=(e,t,n)=>{var r=qg(e,t);return r==null||typeof r.padding!=`string`?0:dv(e,`yAxis`,t,n,r.padding)},mv=R(Gg,fv,(e,t)=>{if(e==null)return{left:0,right:0};var n=e.padding;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),hv=R(qg,pv,(e,t)=>{if(e==null)return{top:0,bottom:0};var n=e.padding;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),gv=R([Bo,mv,Ko,Go,(e,t,n)=>n],(e,t,n,r,i)=>{var a=r.padding;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),_v=R([Bo,W,hv,Ko,Go,(e,t,n)=>n],(e,t,n,r,i,a)=>{var o=i.padding;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),vv=(e,t,n,r)=>{switch(t){case`xAxis`:return gv(e,n,r);case`yAxis`:return _v(e,n,r);case`zAxis`:return Yg(e,n)?.range;case`angleAxis`:return ju(e);case`radiusAxis`:return Mu(e,n);default:return}},yv=R([Xg,vv],gu),bv=R([Xg,ov,R([ov,uv],Uu),yv],wg),xv=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var i=n.type,a=n.scale;if(ao(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Sv=R([W,h_,Qg,K],xv),Cv=R([bv],Hu);R([bv],Ag),R([bv,b_],kg),R([i_,N_,K],P_);function wv(e,t){return e.idt.id)}var Tv=(e,t)=>t,Ev=(e,t,n)=>n,Dv=R(Do,Tv,Ev,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(wv)),Ov=R(Oo,Tv,Ev,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(wv)),kv=(e,t)=>{var n=typeof t.height==`number`?t.height:30;return{width:e.width,height:n}},Av=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),jv=R(Bo,Gg,kv),Mv=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},Nv=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},Pv=R(wo,Bo,Dv,Tv,Ev,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=kv(t,n);o??=Mv(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),Fv=R(Co,Bo,Ov,Tv,Ev,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=Av(t,n);o??=Nv(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),Iv=R([Bo,Gg,(e,t)=>{var n=Gg(e,t);if(n!=null)return Pv(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Lv=R([Bo,qg,(e,t)=>{var n=qg(e,t);if(n!=null)return Fv(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),Rv=R(Bo,qg,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),zv=(e,t,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,a=n.type,o=n.dataKey,s=ao(e,r),c=t.map(e=>e.value),l=c.filter(e=>e!=null);if(o&&s&&a===`category`&&i&&me(l))return c}},Bv=R([W,h_,Xg,K],zv),Vv=R([W,Zg,ov,Cv,Bv,Sv,vv,cv,K],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=ao(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),Hv=R([W,Qg,ov,Cv,cv,vv,Bv,Sv,K],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=ao(e,c),u=t.type,d=t.ticks,f=t.tickCount,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?se(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return H(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(ye):l&&s?s.map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(ye):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(ye):r.domain().map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(ye)}}),Uv=R([W,Qg,Cv,vv,Bv,Sv,K],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=ao(e,o),c=t.tickCount,l=0;return l=o===`angleAxis`&&r?.length>=2?se(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(ye):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(ye):n.domain().map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(ye)}}),Wv=R(Xg,Cv,(e,t)=>{if(e!=null&&t!=null)return Mg(Mg({},e),{},{scale:t})});R((e,t,n)=>Yg(e,n),R([R([Xg,ov,av,yv],wg)],Hu),(e,t)=>{if(e!=null&&t!=null)return Mg(Mg({},e),{},{scale:t})});var Gv=R([W,Do,Oo],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});R([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,qv=e=>e.options.validateTooltipEventTypes;function Jv(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Yv(e,t){return Jv(t,Kv(e),qv(e))}function Xv(e){return L(t=>Yv(t,e))}var Zv=(e,t)=>{var n,r=Number(t);if(!(ce(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Qv=e=>e.tooltip.settings,$v={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},ey=na({name:`tooltip`,initialState:{itemInteraction:{click:$v,hover:$v},axisInteraction:{click:$v,hover:$v},keyboardInteraction:$v,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(B(t.payload))},prepare:V()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).tooltipItemPayloads.indexOf(B(r));a>-1&&(e.tooltipItemPayloads[a]=B(i))},prepare:V()},removeTooltipEntrySettings:{reducer(e,t){var n=Oi(e).tooltipItemPayloads.indexOf(B(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:V()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),ty=ey.actions,ny=ty.addTooltipEntrySettings,ry=ty.replaceTooltipEntrySettings,iy=ty.removeTooltipEntrySettings,ay=ty.setTooltipSettingsState,oy=ty.setActiveMouseOverItemIndex;ty.mouseLeaveItem;var sy=ty.mouseLeaveChart;ty.setActiveClickItemIndex;var cy=ty.setMouseOverAxisIndex,ly=ty.setMouseClickAxisIndex,uy=ty.setSyncInteraction,dy=ty.setKeyboardInteraction,fy=ey.reducer;function py(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 my(e){for(var t=1;t{if(t==null)return $v;var i=vy(e,t,n);if(i==null)return $v;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(yy(i)){if(a)return my(my({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return my(my({},$v),{},{coordinate:i.coordinate})};function xy(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function Sy(e,t){var n=xy(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function Cy(e,t,n){if(n==null||t==null)return!0;var r=U(e,t);return r==null||!Bl(n)||Sy(r,n)}var wy=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!H(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||Cy(l,n,r)?String(c):null},Ty=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},Ey=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(r!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},Dy=e=>e.options.tooltipPayloadSearcher,Oy=e=>e.tooltip;function ky(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 Ay(e){for(var t=1;te(t)}function Ly(e){if(typeof e==`string`)return e}function Ry(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?Py(e.name):void 0,unit:`unit`in e?Fy(e.unit):void 0,dataKey:`dataKey`in e?Iy(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?Ly(e.color):void 0,fill:`fill`in e?Ly(e.fill):void 0}}function zy(e,t){return e??t}var By=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var s=n.chartData,c=n.computedData,l=n.dataStartIndex,u=n.dataEndIndex;return e.reduce((e,n)=>{var d=n.dataDefinedOnItem,f=n.settings,p=zy(d,s),m=Array.isArray(p)?Za(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_;return r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?(_=ge(m,r,i),_??=a(m,t,c,g)):_=a(m,t,c,g),Array.isArray(_)?_.forEach(t=>{var n=Ry(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=Ay(Ay({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(yo({tooltipEntrySettings:o,dataKey:i,payload:a,value:U(a,i),name:r==null?void 0:String(r)}))}):e.push(yo({tooltipEntrySettings:f,dataKey:h,payload:_,value:U(_,h),name:U(_,g)??f?.name})),e},[])}},Vy=R([Q,$g,cu],Dg),Hy=R([R([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Q,R([q,Vu],e_)],r_,{memoizeOptions:{resultEqualityCheck:zu}}),Uy=R([Hy],e=>e.filter(Lu)),Wy=R([Hy],c_,{memoizeOptions:{resultEqualityCheck:zu}}),Gy=R([Hy],e=>e.some(e=>!e.data)),Ky=R([Wy,Ol],d_),qy=R([Uy,Ol,Q],Iu),Jy=R([Ky,Q,Hy,Ol,Gy,Wy],m_),Yy=R([Q],k_),Xy=R([Yy,R([Q],e=>e.allowDataOverflow)],Hl),Zy=R([R([qy,R([Hy],e=>e.filter(Lu)),ou,su],T_),Ol,q,Xy],D_),Qy=R([Ky,Q,R([Hy],o_),N_,q,Nl],I_,{memoizeOptions:{resultEqualityCheck:Ru}}),$y=R([R([B_,q,Vu],V_),q],q_),eb=R([R([U_,q,Vu],V_),q],Y_),tb=R([Q,W,Ky,Jy,ou,q,R([Q,Yy,Xy,Zy,Qy,R([$y,R([R([G_,q,Vu],V_),q],$_),eb],F_),W,q],tv)],iv),nb=R([Q,tb,R([tb,Q,Vy],sv),q],lv),rb=e=>vv(e,q(e),Vu(e),!1),ib=R([Q,rb],gu),ab=R([R([Q,Vy,nb,ib],wg)],Hu),ob=R([W,Q,Vy,ab,rb,R([W,Jy,Q,q],zv),R([W,Jy,Q,q],xv),q],(e,t,n,r,i,a,o,s)=>{if(t){var c=t.type,l=ao(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?se(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(ye):r.domain().map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(ye)}}}),sb=R([Kv,qv,Qv],(e,t,n)=>Jv(n.shared,e,t)),cb=e=>e.tooltip.settings.trigger,lb=e=>e.tooltip.settings.defaultIndex,ub=R([Oy,sb,cb,lb],by),db=R([ub,Ky,C_,tb],wy),fb=R([ob,db],Zv),pb=R([ub],e=>{if(e)return e.dataKey}),mb=R([ub],e=>{if(e)return e.graphicalItemId}),hb=R([Oy,sb,cb,lb],Ey),gb=R([ub,R([Co,wo,W,Bo,ob,lb,hb],Ty)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),_b=R([ub],e=>e?.active??!1),vb=R([R([hb,db,Ol,C_,fb,Dy,sb],By)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function yb(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 bb(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},Tb=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,o=r.radius;return bb(bb(bb({},r),vl(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return bb(bb(bb({},r),vl(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Eb(e,t){var n=e.relativeX,r=e.relativeY;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var Db=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=i[1]-i[0],s=(t,n,r)=>[e,e+o,e-o].some(e=>(r?e>=t:e>t)&&e<=n),c=0;c0?n[c-1]?.coordinate:n[a-1]?.coordinate,u=n[c]?.coordinate,d=c>=a-1?n[0]?.coordinate:n[c+1]?.coordinate,f=void 0;if(l!=null&&u!=null&&d!=null){if(se(u-l)!==se(d-u)){var p=[];if(se(d-u)===se(i[1]-i[0])){f=d;var m=u+i[1]-i[0];p[0]=Math.min(m,(m+l)/2),p[1]=Math.max(m,(m+l)/2)}else{f=l;var h=d+i[1]-i[0];p[0]=Math.min(u,(h+u)/2),p[1]=Math.max(u,(h+u)/2)}var g=[Math.min(u,(f+u)/2),Math.max(u,(f+u)/2)];if(s(g[0],g[1],!1)||s(p[0],p[1],!0))return n[c]?.index}else{var _=Math.min(l,d),v=Math.max(l,d);if(s((_+u)/2,(v+u)/2,!1))return n[c]?.index}}}else if(t)for(var y=0;y(b.coordinate+S.coordinate)/2||y>0&&y(b.coordinate+S.coordinate)/2&&e<=(b.coordinate+x.coordinate)/2)return b.index}}return-1},Ob=()=>L(cu),kb=(e,t)=>t,Ab=(e,t,n)=>n,jb=(e,t,n,r)=>r,Mb=R(ob,e=>Xn(e,e=>e.coordinate)),Nb=R([Oy,kb,Ab,jb],by),Pb=R([Nb,Ky,C_,tb],wy),Fb=(e,t,n)=>{if(t!=null){var r=Oy(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Ib=R([Oy,kb,Ab,jb],Ey),Lb=R([Co,wo,W,Bo,ob,jb,Ib],Ty),Rb=R([Nb,Lb],(e,t)=>e.coordinate??t),zb=R([ob,Pb],Zv),Bb=R([Ib,Pb,Ol,C_,zb,Dy,kb],By),Vb=R([Nb,Pb],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),Hb=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&Eb(e,o)){var s=Db(xo(e,t),a,i,n,r),c=wb(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},Ub=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=wl(e,n);if(s){var c=Db(So(s,t),o,a,r,i),l=Tb(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},Wb=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?Hb(e,t,r,i,a,o,s):Ub(e,t,n,r,i,a,o)},Gb=R(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),Kb=R(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(pu));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:Bu}});function qb(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 Jb(e){for(var t=1;tJb(Jb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},$b=new Set(Object.values(pu));function ex(e){return $b.has(e)}var tx=na({name:`zIndex`,initialState:Qb,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:V()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!ex(n)&&delete e.zIndexMap[n])},prepare:V()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,r=n.zIndex,i=n.element,a=n.isPanorama;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=B(i):e.zIndexMap[r].element=B(i):e.zIndexMap[r]={consumers:0,element:a?void 0:B(i),panoramaElement:a?B(i):void 0}},prepare:V()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:V()}}}),nx=tx.actions,rx=nx.registerZIndexPortal,ix=nx.unregisterZIndexPortal,ax=nx.registerZIndexPortalElement,ox=nx.unregisterZIndexPortalElement,sx=tx.reducer;function cx(e){var t=e.zIndex,n=e.children,r=Ps()&&t!==void 0&&t!==0,i=Wo(),a=(0,s.useRef)(void 0),o=(0,s.useRef)(new Set),c=I(),l=L(e=>Gb(e,t,i));if((0,s.useLayoutEffect)(()=>{if(!r){var e=o.current;e.forEach(e=>{c(ix({zIndex:e}))}),e.clear(),a.current=void 0;return}if(o.current.has(t)||(c(rx({zIndex:t})),o.current.add(t)),l){a.current=l;var n=o.current;n.forEach(e=>{e!==t&&(c(ix({zIndex:e})),n.delete(e))})}},[c,t,r,l]),(0,s.useLayoutEffect)(()=>{var e=o.current;return()=>{e.forEach(e=>{c(ix({zIndex:e}))}),e.clear()}},[c]),!r)return n;var u=l??a.current;return u?(0,_.createPortal)(n,u):null}var lx=(0,s.createContext)(null),ux=()=>(0,s.useContext)(lx),dx=r(a(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!ce(n))return e[n]}},gx=na({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),_x=gx.reducer,vx=gx.actions.createEventEmitter;function yx(e){return e.tooltip.syncInteraction}var bx=na({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=B(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var n=t.payload,r=n.startIndex,i=n.endIndex;r!=null&&(e.dataStartIndex=r),i!=null&&(e.dataEndIndex=i)}}}),xx=bx.actions,Sx=xx.setChartData,Cx=xx.setDataStartEndIndexes;xx.setComputedData;var wx=bx.reducer,Tx=[`x`,`y`];function Ex(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 Dx(e){for(var t=1;te.rootProps.className);(0,s.useEffect)(()=>{if(e==null)return be;var s=(s,c,l)=>{if(t!==l&&e===s){if(c.payload.active===!1){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,f=d.x,p=d.y,m=jx(d,Tx),h=c.payload.sourceViewBox,g=h.x,_=h.y,v=h.width,y=h.height,b=Dx(Dx({},m),{},{x:o.x+(v?(f-g)/v:0)*o.width,y:o.y+(y?(p-_)/y:0)*o.height});n(Dx(Dx({},c),{},{payload:Dx(Dx({},c.payload),{},{coordinate:b})}))}else n(c);return}if(i!=null){var x;typeof r==`function`?x=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(x=i.find(e=>String(e.value)===c.payload.label));var S=c.payload.coordinate;if(S==null||o==null){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(x==null){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:void 0}));return}var C=S.x,w=S.y,T=Math.min(C,o.x+o.width),E=Math.min(w,o.y+o.height),D={x:a===`horizontal`?x.coordinate:T,y:a===`horizontal`?E:x.coordinate};n(uy({active:c.payload.active,coordinate:D,dataKey:c.payload.dataKey,index:String(x.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return fx.on(px,s),()=>{fx.off(px,s)}},[c,n,t,e,r,i,a,o])}function Px(){var e=L(lu),t=L(du),n=I();(0,s.useEffect)(()=>{if(e==null)return be;var r=(r,i,a)=>{t!==a&&e===r&&n(Cx(i))};return fx.on(mx,r),()=>{fx.off(mx,r)}},[n,t,e])}function Fx(){var e=I();(0,s.useEffect)(()=>{e(vx())},[e]),Nx(),Px()}function Ix(e,t,n,r,i,a){var o=L(n=>Fb(n,e,t)),c=L(mb),l=L(du),u=L(lu),d=L(uu),f=L(yx)?.sourceViewBox!=null,p=Es();(0,s.useEffect)(()=>{if(!f&&u!=null&&l!=null){var e=uy({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:p,graphicalItemId:c});fx.emit(px,u,e,l)}},[f,n,o,c,i,r,l,u,d,a,p])}function Lx(e,t,n){return(t=Rx(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rx(e){var t=zx(e,`string`);return typeof t==`symbol`?t:t+``}function zx(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Bx=class{constructor(e){Lx(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function Vx(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 Hx(e){for(var t=1;t{try{var n=document.getElementById(Yx);n||(n=document.createElement(`span`),n.setAttribute(`id`,Yx),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,Jx,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Qx=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||sc.isSsr)return{width:0,height:0};if(!Kx.enableCache)return Zx(e,t);var n=Xx(e,t),r=qx.get(n);if(r)return r;var i=Zx(e,t);return qx.set(n,i),i},$x;function eS(e,t){return aS(e)||iS(e,t)||nS(e,t)||tS()}function tS(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nS(e,t){if(e){if(typeof e==`string`)return rS(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)?rS(e,t):void 0}}function rS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=e.breakAll,r=e.style;try{var i=[];return _e(t)||(i=n?t.toString().split(``):t.toString().split(IS)),{wordsWithComputedWidth:i.map(e=>({word:e,width:Qx(e,r).width})),spaceWidth:n?0:Qx(`\xA0`,r).width}}catch{return null}};function RS(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function zS(e){return _e(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var BS=(e,t,n,r)=>e.reduce((e,i)=>{var a=i.word,o=i.width,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),HS=`…`,US=(e,t,n,r,i,a,o,s)=>{var c=LS({breakAll:n,style:r,children:e.slice(0,t)+HS});if(!c)return[!1,[]];var l=BS(c.wordsWithComputedWidth,a,o,s);return[l.length>i||VS(l).width>Number(a),l]},WS=(e,t,n,r,i)=>{var a=e.maxLines,o=e.children,s=e.style,c=e.breakAll,l=P(a),u=String(o),d=BS(t,r,n,i);if(!l||i||!(d.length>a||VS(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),_=AS(US(u,g-1,c,s,a,r,n,i),2),v=_[0],y=_[1],b=AS(US(u,g,c,s,a,r,n,i),1)[0];if(!v&&!b&&(f=g+1),v&&b&&(p=g-1),!v&&b){h=y;break}m++}return h||d},GS=e=>[{words:_e(e)?[]:e.toString().split(IS),width:void 0}],KS=e=>{var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!sc.isSsr){var s,c,l=LS({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return GS(r);return WS({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return GS(r)},qS=`#808080`,JS={angle:0,breakAll:!1,capHeight:`0.71em`,fill:qS,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},YS=(0,s.forwardRef)((e,t)=>{var n=Rt(e,JS),r=n.x,i=n.y,a=n.lineHeight,c=n.capHeight,l=n.fill,u=n.scaleToFit,d=n.textAnchor,f=n.verticalAnchor,p=OS(n,TS),m=(0,s.useMemo)(()=>KS({breakAll:p.breakAll,children:p.children,maxLines:p.maxLines,scaleToFit:u,style:p.style,width:p.width}),[p.breakAll,p.children,p.maxLines,u,p.style,p.width]),g=p.dx,_=p.dy,v=p.angle,y=p.className,b=p.breakAll,x=OS(p,ES);if(!ue(r)||!ue(i)||m.length===0)return null;var S=Number(r)+(P(g)?g:0),C=Number(i)+(P(_)?_:0);if(!H(S)||!H(C))return null;var w;switch(f){case`start`:w=wS(`calc(${c})`);break;case`middle`:w=wS(`calc(${(m.length-1)/2} * -${a} + (${c} / 2))`);break;default:w=wS(`calc(${m.length-1} * -${a})`)}var T=[],E=m[0];if(u&&E!=null){var D=E.width,O=p.width;T.push(`scale(${P(O)&&P(D)?O/D:1})`)}return v&&T.push(`rotate(${v}, ${S}, ${C})`),T.length&&(x.transform=T.join(` `)),s.createElement(`text`,DS({},h(x),{ref:t,x:S,y:C,className:o(`recharts-text`,y),textAnchor:d,fill:l.includes(`url`)?qS:l}),m.map((e,t)=>{var n=e.words.join(b?``:` `);return s.createElement(`tspan`,{x:S,dy:t===0?w:a,key:`${n}-${t}`},n)}))});YS.displayName=`Text`;var XS=[`labelRef`],ZS=[`content`];function QS(e,t){if(e==null)return{};var n,r,i=$S(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var t=e.x,n=e.y,r=e.upperWidth,i=e.lowerWidth,a=e.width,o=e.height,c=e.children,l=(0,s.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return s.createElement(oC.Provider,{value:l},c)},cC=()=>{var e=(0,s.useContext)(oC),t=Es();return e||(t?xe(t):void 0)},lC=(0,s.createContext)(null),uC=()=>{var e=(0,s.useContext)(lC),t=L(Nu);return e||t},dC=e=>{var t=e.value,n=e.formatter,r=_e(e.children)?t:e.children;return typeof n==`function`?n(r):r},fC=e=>e!=null&&typeof e==`function`,pC=(e,t)=>se(t-e)*Math.min(Math.abs(t-e),360),mC=(e,t,n,r,i)=>{var a=e.offset,c=e.className,l=i.cx,u=i.cy,d=i.innerRadius,f=i.outerRadius,p=i.startAngle,m=i.endAngle,h=i.clockWise,g=(d+f)/2,_=pC(p,m),v=_>=0?1:-1,y,b;switch(t){case`insideStart`:y=p+v*a,b=h;break;case`insideEnd`:y=m-v*a,b=!h;break;case`end`:y=m+v*a,b=h;break;default:throw Error(`Unsupported position ${t}`)}b=_<=0?b:!b;var x=vl(l,u,g,y),S=vl(l,u,g,y+(b?1:-1)*359),C=`M${x.x},${x.y} - A${g},${g},0,1,${+!b}, - ${S.x},${S.y}`,w=_e(e.id)?fe(`recharts-radial-line-`):e.id;return s.createElement(`text`,aC({},r,{dominantBaseline:`central`,className:o(`recharts-radial-bar-label`,c)}),s.createElement(`defs`,null,s.createElement(`path`,{id:w,d:C})),s.createElement(`textPath`,{xlinkHref:`#${w}`},n))},hC=(e,t,n)=>{var r=e.cx,i=e.cy,a=e.innerRadius,o=e.outerRadius,s=(e.startAngle+e.endAngle)/2;if(n===`outside`){var c=vl(r,i,o+t,s),l=c.x;return{x:l,y:c.y,textAnchor:l>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var u=vl(r,i,(a+o)/2,s);return{x:u.x,y:u.y,textAnchor:`middle`,verticalAnchor:`middle`}},gC=e=>e!=null&&`cx`in e&&P(e.cx),_C={angle:0,offset:5,zIndex:pu.label,position:`middle`,textBreakAll:!1};function vC(e){if(!gC(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function yC(e){var t=Rt(e,_C),n=t.viewBox,r=t.parentViewBox,i=t.position,a=t.value,c=t.children,l=t.content,u=t.className,d=u===void 0?``:u,f=t.textBreakAll,p=t.labelRef,m=uC(),g=cC(),_=n==null?i===`center`?g:m??g:gC(n)?n:xe(n),v,y,b=vC(_);if(!_||_e(a)&&_e(c)&&!(0,s.isValidElement)(l)&&typeof l!=`function`)return null;var x=gC(_)&&(i===`insideStart`||i===`insideEnd`||i===`end`);if(gC(_))x||(y=hC(_,t.offset,t.position));else if(b){var S=De({viewBox:b,position:i,offset:t.offset,parentViewBox:gC(r)?void 0:r,clamp:!0});y=tC(tC({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width===void 0?{}:{width:S.width}),S.height===void 0?{}:{height:S.height})}var C=tC(tC(tC(tC({},y?.x===void 0?{}:{x:y.x}),y?.y===void 0?{}:{y:y.y}),t),{},{viewBox:_});if((0,s.isValidElement)(l)){C.labelRef;var w=QS(C,XS);return(0,s.cloneElement)(l,w)}if(typeof l==`function`){C.content;var T=QS(C,ZS);if(v=(0,s.createElement)(l,T),(0,s.isValidElement)(v))return v}else v=dC(t);var E=h(t);return x&&gC(_)?mC(t,i,v,E,_):y==null?null:s.createElement(cx,{zIndex:t.zIndex},s.createElement(YS,aC({ref:p,className:o(`recharts-label`,d)},E,y,{textAnchor:RS(E.textAnchor)?E.textAnchor:y.textAnchor,breakAll:f}),v))}yC.displayName=`Label`;var bC=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?s.createElement(yC,aC({key:`label-implicit`},r)):ue(e)?s.createElement(yC,aC({key:`label-implicit`,value:e},r)):(0,s.isValidElement)(e)?e.type===yC?(0,s.cloneElement)(e,tC({key:`label-implicit`},r)):s.createElement(yC,aC({key:`label-implicit`,content:e},r)):fC(e)?s.createElement(yC,aC({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?s.createElement(yC,aC({},e,{key:`label-implicit`},r)):null};function xC(e){var t=e.label,n=e.labelRef;return bC(t,cC(),n)||null}var SC=[`valueAccessor`],CC=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function wC(){return wC=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(zS(t))return t},OC=(0,s.createContext)(void 0),kC=OC.Provider,AC=(0,s.createContext)(void 0);AC.Provider;function jC(){return(0,s.useContext)(OC)}function MC(){return(0,s.useContext)(AC)}function NC(e){var t=e.valueAccessor,n=t===void 0?DC:t,r=TC(e,SC),i=r.dataKey;r.clockWise;var a=r.id,o=r.textBreakAll,c=r.zIndex,l=TC(r,CC),u=jC(),d=MC(),f=u||d;return!f||!f.length?null:s.createElement(cx,{zIndex:c??pu.label},s.createElement(D,{className:`recharts-label-list`},f.map((e,t)=>{var c=_e(i)?n(e,t):U(e.payload,i),u=_e(a)?{}:{id:`${a}-${t}`};return s.createElement(yC,wC({key:`label-${t}`},h(e),l,u,{fill:r.fill??e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:t,zIndex:0}))})))}NC.displayName=`LabelList`;function PC(e){var t=e.label;return t?t===!0?s.createElement(NC,{key:`labelList-implicit`}):s.isValidElement(t)||fC(t)?s.createElement(NC,{key:`labelList-implicit`,content:t}):typeof t==`object`?s.createElement(NC,wC({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}function FC(){return FC=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=e.cx,n=e.cy,r=e.r,i=e.className,a=o(`recharts-dot`,i);return P(t)&&P(n)&&P(r)?s.createElement(`circle`,FC({},p(e),At(e),{className:a,cx:t,cy:n,r})):null},LC=na({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=B(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=B(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),RC=LC.actions;RC.addRadiusAxis,RC.removeRadiusAxis,RC.addAngleAxis,RC.removeAngleAxis;var zC=LC.reducer;function BC(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var VC=a((e=>{typeof Symbol==`function`&&Symbol.for}));a(((e,t)=>{t.exports=VC()}))();var HC=e=>e&&typeof e==`object`&&`clipDot`in e?!!e.clipDot:!0;function UC(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 WC(e){for(var t=1;t{r||(i.current===null?n(ny(t)):i.current!==t&&n(ry({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,s.useLayoutEffect)(()=>()=>{i.current&&=(n(iy(i.current)),null)},[n]),null}function tw(e){var t=e.legendPayload,n=I(),r=Wo(),i=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{r||(i.current===null?n(Rs(t)):i.current!==t&&n(zs({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,s.useLayoutEffect)(()=>()=>{i.current&&=(n(Bs(i.current)),null)},[n]),null}function nw(e,t){return sw(e)||ow(e,t)||iw(e,t)||rw()}function rw(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iw(e,t){if(e){if(typeof e==`string`)return aw(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)?aw(e,t):void 0}}function aw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:`removed`,prev:i});for(var a=0;ae[Math.floor(r*n)]),t)}function dw(e,t){return lw(t.map((t,n)=>e[n]),t)}function fw(e,t){for(var n=new Map,r=0;r{var a=n(e,t);if(a!=null){var o=r.get(a);if(o!==void 0)return i.add(a),o}}),o=[];for(var s of r){var c=nw(s,2),l=c[0],u=c[1];i.has(l)||o.push(u)}return lw(a,t,o)}function mw(e,t,n){return t==null?null:e==null?t.map(e=>({status:`added`,next:e})):n===`index`?uw(e,t):n===`append`?dw(e,t):pw(e,t,n)}function hw(e,t){var n=(0,s.useRef)(e),r=(0,s.useRef)(t.current),i=(0,s.useRef)(!0);n.current!==e&&(n.current=e,r.current=t.current,i.current=!1);var a=(0,s.useCallback)(function(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(n===0){i.current=!0;return}n===1&&(r.current=e),n>0&&i.current&&a&&(t.current=e)},[t]);return{startValue:r.current,syncStepValue:a}}function gw(e,t){return xw(e)||bw(e,t)||vw(e,t)||_w()}function _w(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vw(e,t){if(e){if(typeof e==`string`)return yw(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)?yw(e,t):void 0}}function yw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{typeof e==`function`&&e(),i(!0)},[e]),handleAnimationEnd:(0,s.useCallback)(()=>{typeof t==`function`&&t(),i(!1)},[t])}}function Cw(e){var t=e.animationInput,n=e.animationIdPrefix,r=e.items,i=e.previousItemsRef,a=e.isAnimationActive,o=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.onAnimationStart,d=e.onAnimationEnd,f=e.animationInterpolateFn,p=e.animationMatchBy,m=e.shouldUpdatePreviousRef,h=e.children,g=e.layout,_=ul(t,n),v=hw(_,i),y=v.startValue??null,b=mw(y,r,p??cw);return s.createElement(ll,{animationId:_,begin:o,duration:c,isActive:a,easing:l,onAnimationEnd:d,onAnimationStart:u,key:_},e=>{var t=y==null,n=r==null?r:f(b,e,g),i=m?m(e):e>0;return v.syncStepValue(n,e,i),n==null?null:h(n,e,t)})}function ww(e,t){return kw(e)||Ow(e,t)||Ew(e,t)||Tw()}function Tw(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ew(e,t){if(e){if(typeof e==`string`)return Dw(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)?Dw(e,t):void 0}}function Dw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nww(s.useState(()=>fe(`uid-`)),1)[0]);function jw(e,t){var n=Aw();return t||(e?`${e}-${n}`:n)}var Mw=(0,s.createContext)(void 0),Nw=e=>{var t=e.id,n=e.type,r=e.children,i=jw(`recharts-${n}`,t);return s.createElement(Mw.Provider,{value:i},r(i))},Pw=na({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(B(t.payload))},prepare:V()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).cartesianItems.indexOf(B(r));a>-1&&(e.cartesianItems[a]=B(i))},prepare:V()},removeCartesianGraphicalItem:{reducer(e,t){var n=Oi(e).cartesianItems.indexOf(B(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:V()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(B(t.payload))},prepare:V()},removePolarGraphicalItem:{reducer(e,t){var n=Oi(e).polarItems.indexOf(B(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:V()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).polarItems.indexOf(B(r));a>-1&&(e.polarItems[a]=B(i))},prepare:V()}}}),Fw=Pw.actions,Iw=Fw.addCartesianGraphicalItem,Lw=Fw.replaceCartesianGraphicalItem,Rw=Fw.removeCartesianGraphicalItem;Fw.addPolarGraphicalItem,Fw.removePolarGraphicalItem,Fw.replacePolarGraphicalItem;var zw=Pw.reducer,Bw=(0,s.memo)(e=>{var t=I(),n=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{n.current===null?t(Iw(e)):n.current!==e&&t(Lw({prev:n.current,next:e})),n.current=e},[t,e]),(0,s.useLayoutEffect)(()=>()=>{n.current&&=(t(Rw(n.current)),null)},[t]),null}),Vw=[`points`];function Hw(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 Uw(e){for(var t=1;t{var c=Uw(Uw(Uw({r:3},o),p),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return s.createElement(Xw,{key:`dot-${r}`,option:n,dotProps:c,className:i})}),h={};return c&&l!=null&&(h.clipPath=`url(#clipPath-${f?``:`dots-`}${l})`),s.createElement(cx,{zIndex:d},s.createElement(D,qw({className:r},h),m))}function $w(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 eT(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Co,wo],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),gT=()=>L(hT),_T=()=>L(vb);function vT(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 yT(e){for(var t=1;t{var t=e.point,n=e.childIndex,r=e.mainColor,i=e.activeDot,a=e.dataKey,o=e.clipPath;if(i===!1||t.x==null||t.y==null)return null;var c=yT(yT(yT({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),m(i)),At(i)),l=(0,s.isValidElement)(i)?(0,s.cloneElement)(i,c):typeof i==`function`?i(c):s.createElement(IC,c);return s.createElement(D,{className:`recharts-active-dot`,clipPath:o},l)};function wT(e){var t=e.points,n=e.mainColor,r=e.activeDot,i=e.itemDataKey,a=e.clipPath,o=e.zIndex,c=o===void 0?pu.activeDot:o,l=L(db),u=_T();if(t==null||u==null)return null;var d=t.find(e=>u.includes(e.payload));return _e(d)?null:s.createElement(cx,{zIndex:c},s.createElement(CT,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var TT=e=>{var t=e.chartData,n=I(),r=Wo();return(0,s.useEffect)(()=>r?()=>{}:(n(Sx(t)),()=>{n(Sx(void 0))}),[t,n,r]),null},ET={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},DT=na({name:`brush`,initialState:ET,reducers:{setBrushSettings(e,t){return t.payload==null?ET:t.payload}}});DT.actions.setBrushSettings;var OT=DT.reducer,kT=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}};function AT(e){return(e%180+180)%180}var jT=function(e){var t=e.width,n=e.height,r=AT(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Oi(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Oi(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(B(t.payload))},removeLine:(e,t)=>{var n=Oi(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),NT=MT.actions;NT.addDot,NT.removeDot;var PT=NT.addArea,FT=NT.removeArea;NT.addLine,NT.removeLine;var IT=MT.reducer;function LT(e,t){return HT(e)||VT(e,t)||zT(e,t)||RT()}function RT(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zT(e,t){if(e){if(typeof e==`string`)return BT(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)?BT(e,t):void 0}}function BT(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=LT((0,s.useState)(`${fe(`recharts`)}-clip`),1)[0],r=gT();if(r==null)return null;var i=r.x,a=r.y,o=r.width,c=r.height;return s.createElement(UT.Provider,{value:n},s.createElement(`defs`,null,s.createElement(`clipPath`,{id:n},s.createElement(`rect`,{x:i,y:a,height:c,width:o}))),t)},GT=()=>(0,s.useContext)(UT);function KT(){}function qT(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 JT(e,t,n){return YT(e,t,void 0,void 0,void 0,void 0,n)}function YT(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 XT(e,t,a,o)}return XT(e,t,a,o)}function XT(e,t,n,r){if(Object.is(e,t))return!0;let i=Ht(e),a=Ht(t);if(i===`[object Arguments]`&&(i=tn),a===`[object Arguments]`&&(a=tn),i!==a)return!1;switch(i){case Wt:return e.toString()===t.toString();case Gt:return vn(e.valueOf(),t.valueOf());case Kt:case Yt:case Jt:return Object.is(e.valueOf(),t.valueOf());case Ut:return e.source===t.source&&e.flags===t.flags;case $t: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 Xt:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!YT(a,t.get(i),i,e,t,n,r))return!1;return!0;case Zt:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;oYT(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case Qt:case an:case on:case sn:case cn:case ln:case un:case dn:case fn:case pn:case mn:case hn:if(_n(e)!==_n(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 nE(e,t){return QT(e,t+1)}function rE(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:QT(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||tE(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 iE(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||tE(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=oE(oE({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=oE(oE({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&tE(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=oE(oE({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function dE(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=oE(oE({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&tE(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=oE(oE({},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=oE(oE({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=oE(oE({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&tE(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=oE(oE({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?$T(Qx(i,{fontSize:t,letterSpacing:n}),m,d):Qx(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?se(_.coordinate-g.coordinate):1,y=eE(a,v,p);return c===`equidistantPreserveStart`?rE(v,y,h,i,o):c===`equidistantPreserveEnd`?iE(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?dE(v,y,h,i,o,c===`preserveStartEnd`):uE(v,y,h,i,o),f.filter(e=>e.isShow))}var pE=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},mE=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},hE=na({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]=B(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),gE=hE.actions,_E=gE.setRenderedTicks,vE=gE.removeRenderedTicks,yE=hE.reducer,bE=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function xE(e,t){return EE(e)||TE(e,t)||CE(e,t)||SE()}function SE(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CE(e,t){if(e){if(typeof e==`string`)return wE(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)?wE(e,t):void 0}}function wE(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&&ZT(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(_E({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,s.useEffect)(()=>r==null||n==null?be:()=>{i(vE({axisId:r,axisType:n}))},[i,r,n]),null}var VE=(0,s.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,c=e.stroke,l=e.tickFormatter,u=e.unit,d=e.padding,f=e.tickTextProps,h=e.orientation,g=e.mirror,_=e.x,v=e.y,y=e.width,b=e.height,x=e.tickSize,S=e.tickMargin,C=e.fontSize,w=e.letterSpacing,T=e.getTicksConfig,E=e.events,O=e.axisType,k=e.axisId,A=fE($($({},T),{},{ticks:r}),C,w),j=p(T),M=m(i),N=RS(j.textAnchor)?j.textAnchor:LE(h,g),ee=RE(h,g),te={};typeof a==`object`&&(te=a);var re=$($({},j),{},{fill:`none`},te),ie=A.map(e=>$({entry:e},IE(e,_,v,y,b,h,x,g,S))),ae=ie.map(e=>{var t=e.entry,n=e.line;return s.createElement(D,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&s.createElement(`line`,kE({},re,n,{className:o(`recharts-cartesian-axis-tick-line`,ne(a,`className`))})))}),oe=ie.map((e,t)=>{var n=e.entry,r=e.tick,a=$($({},$($($($({verticalAnchor:ee},j),{},{textAnchor:N,stroke:`none`,fill:c},r),{},{index:t,payload:n,visibleTicksCount:A.length,tickFormatter:l,padding:d},f),{},{angle:f?.angle??j.angle??0})),M);return s.createElement(D,kE({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Mt(E,n,t)),i&&s.createElement(zE,{option:i,tickProps:a,value:`${typeof l==`function`?l(n.value,t):n.value}${u||``}`}))});return s.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${O}-ticks`},s.createElement(BE,{ticks:A,axisId:k,axisType:O}),oe.length>0&&s.createElement(cx,{zIndex:pu.label},s.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${O}-tick-labels`,ref:t},oe)),ae.length>0&&s.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${O}-tick-lines`},ae))}),HE=(0,s.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,c=e.hide,l=e.ticks,u=e.axisType,d=e.axisId,f=DE(e,bE),m=xE((0,s.useState)(``),2),h=m[0],g=m[1],_=xE((0,s.useState)(``),2),v=_[0],y=_[1],b=(0,s.useRef)(null);(0,s.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>pE({ticks:b.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>mE({ticks:b.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var x=(0,s.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);b.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==h||a!==v)&&(g(i),y(a))}}},[h,v]);return c||r!=null&&r<=0||i!=null&&i<=0?null:s.createElement(cx,{zIndex:e.zIndex},s.createElement(D,{className:o(`recharts-cartesian-axis`,a)},s.createElement(FE,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:p(e)}),s.createElement(VE,{ref:x,axisType:u,events:f,fontSize:h,getTicksConfig:e,height:e.height,letterSpacing:v,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:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:d}),s.createElement(sC,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},s.createElement(xC,{label:e.label,labelRef:e.labelRef}),e.children)))}),UE=s.forwardRef((e,t)=>{var n=Rt(e,PE);return s.createElement(HE,kE({},n,{ref:t}))});UE.displayName=`CartesianAxis`;var WE=na({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))}}}),GE=WE.actions;GE.addErrorBar,GE.replaceErrorBar,GE.removeErrorBar;var KE=WE.reducer;function qE(e,t){var n=L(t=>Gg(t,e)),r=L(e=>qg(e,t)),i=n?.allowDataOverflow??Ug.allowDataOverflow,a=r?.allowDataOverflow??Z.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function JE(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=gT(),a=qE(t,n),o=a.needClipX,c=a.needClipY,l=a.needClip,u=L(e=>gv(e,t,!1)),d=L(e=>_v(e,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,m=i.width,h=i.height,g=o&&u?Math.min(u[0],u[1]):f-m/2,_=c&&d?Math.min(d[0],d[1]):p-h/2,v=o&&u?Math.abs(u[1]-u[0]):m*2,y=c&&d?Math.abs(d[1]-d[0]):h*2;return s.createElement(`clipPath`,{id:`clipPath-${r}`},s.createElement(`rect`,{x:g,y:_,width:v,height:y}))}function YE(e){var t=m(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 XE(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function ZE(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var QE=(e,t,n)=>Wv(e,`xAxis`,XE(e,t),n),$E=(e,t,n)=>Uv(e,`xAxis`,XE(e,t),n),eD=(e,t,n)=>Wv(e,`yAxis`,ZE(e,t),n),tD=(e,t,n)=>Uv(e,`yAxis`,ZE(e,t),n),nD=R([W,QE,eD,$E,tD],(e,t,n,r,i)=>ao(e,`xAxis`)?vo(t,r,!1):vo(n,i,!1)),rD=R([t_,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),iD=e=>ao(W(e),`xAxis`)?`yAxis`:`xAxis`,aD=(e,t)=>iD(e)===`yAxis`?ZE(e,t):XE(e,t),oD=(e,t,n)=>E_(e,iD(e),aD(e,t),n),sD=R([W,QE,eD,$E,tD,R([rD,oD],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=Fu(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]])}}}),jl,nD,rD,fu,R([rD,oD],(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(ye)}})],(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 BD({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),cD=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],lD=[`id`,`baseLine`];function uD(){return uD=Object.assign?Object.assign.bind():function(e){for(var t=1;te.y||0));return P(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.y||0),l)),P(l)?s.createElement(`rect`,{x:ae.x||0));return P(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.x||0),l)),P(l)?s.createElement(`rect`,{x:0,y:ae==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[CD(CD({},e.next),{},{x:he(e.prev.x,e.next.x,t),y:he(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:gD,xAxisId:0,yAxisId:0,zIndex:pu.area};function OD(e,t){return e&&e!==`none`?e:t}var kD=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:OD(r,i),value:bo(n,t),payload:e}]},AD=s.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,c=e.hide,l=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:be,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:bo(o,t),hide:c,type:d,color:OD(r,a),unit:l,formatter:u,graphicalItemId:f}};return s.createElement(ew,{tooltipEntrySettings:p})});function jD(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,c=p(r);return s.createElement(Qw,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:c,needClip:i,clipPathId:t})}function MD(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 CD(CD({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return s.createElement(kC,{value:t?r:void 0},n)}function ND(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,c=e.isAnimating,l=e.isEntrance,u=a.layout,d=a.type,f=a.stroke,p=a.connectNulls,m=a.isRange,g=a.shape,_=a.id,v=bD(a,_D),y=CD(CD({},h(v)),{},{id:_,points:t,connectNulls:p,type:d,baseLine:n,layout:u,stroke:f,isRange:m,animationElapsedTime:o,isAnimating:c,isEntrance:l});return s.createElement(s.Fragment,null,t?.length>1&&s.createElement(D,{clipPath:r?`url(#clipPath-${i})`:void 0},s.createElement($C,{option:g,DefaultShape:DD.shape,shapeProps:y})),s.createElement(jD,{points:t,props:v,clipPathId:i}))}function PD(e,t,n){return P(e)?he(P(t)?t:void 0,e,n):_e(e)||ce(e)?he(P(t)?t:void 0,0,n):e}function FD(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,c=r.baseLine,l=r.isAnimationActive,u=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,m=r.animationInterpolateFn,h=(0,s.useMemo)(()=>({points:o,baseLine:c}),[o,c]),g=hw(h,a),_=Ms(),v=Sw(r.onAnimationStart,r.onAnimationEnd),y=v.isAnimating,b=v.handleAnimationStart,x=v.handleAnimationEnd,S=g.startValue;if(_==null)return null;var C=Array.isArray(c)&&Array.isArray(S)?mw(S,c,p):Array.isArray(c)?mw(null,c,p):null;return s.createElement(Cw,{animationInput:h,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:u,animationDuration:d,animationEasing:f,onAnimationStart:b,onAnimationEnd:x,animationInterpolateFn:m,animationMatchBy:p,layout:_},(e,i,a)=>{var l=i===1?c:Array.isArray(c)?m(C,i,_):a?c:PD(c,S,i);return g.syncStepValue(l,i),s.createElement(MD,{showLabels:!y,points:o},r.children,s.createElement(ND,{points:e,baseLine:l,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:y||i<1,isEntrance:a}),s.createElement(PC,{label:r.label}))})}function ID(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,s.useRef)(null),a=(0,s.useRef)();return s.createElement(FD,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var LD=class extends s.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,c=e.left,l=e.needClip,u=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,m=e.id,h=e.baseLine,g=e.zIndex;if(t)return null;var _=o(`recharts-area`,i),v=m,y=YE(n),b=y.r,x=y.strokeWidth,S=HC(n),C=b*2+x,w=l?`url(#clipPath-${S?``:`dots-`}${v})`:void 0;return s.createElement(cx,{zIndex:g},s.createElement(D,{className:_},l&&s.createElement(`defs`,null,s.createElement(JE,{clipPathId:v,xAxisId:u,yAxisId:d}),!S&&s.createElement(`clipPath`,{id:`clipPath-dots-${v}`},s.createElement(`rect`,{x:c-C/2,y:a-C/2,width:f+C,height:p+C}))),s.createElement(ID,{needClip:l,clipPathId:v,props:this.props})),s.createElement(wT,{points:r,mainColor:OD(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}),this.props.isRange&&Array.isArray(h)&&s.createElement(wT,{points:h,mainColor:OD(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}))}};function RD(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,c=e.fill,l=e.fillOpacity,u=e.hide,d=e.isAnimationActive,f=e.legendType,p=e.stroke,m=e.xAxisId,h=e.yAxisId,g=bD(e,vD),_=js(),v=Ob(),y=qE(m,h).needClip,b=Wo(),x=L(t=>sD(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=gT();if(_!==`horizontal`&&_!==`vertical`||T==null||v!==`AreaChart`&&v!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:s.createElement(LD,yD({},g,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:c,fillOpacity:l,height:E,hide:u,layout:_,isAnimationActive:d,isRange:C,legendType:f,needClip:y,points:S,stroke:p,width:D,left:O,top:k,xAxisId:m,yAxisId:h}))}var zD=(e,t,n,r,i)=>{var a=n??t;if(P(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 BD(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,_=zD(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=U(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=U(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>U(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:fo({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:fo({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 VD(e){var t=Rt(e,DD),n=Wo();return s.createElement(Nw,{id:t.id,type:`area`},e=>s.createElement(s.Fragment,null,s.createElement(tw,{legendPayload:kD(t)}),s.createElement(AD,{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}),s.createElement(Bw,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:uo(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),s.createElement(RD,yD({},t,{id:e}))))}var HD=s.memo(VD,oc);HD.displayName=`Area`;var UD=[`domain`,`range`],WD=[`domain`,`range`];function GD(e,t){if(e==null)return{};var n,r,i=KD(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return eO(eO({},a),{},{type:o})},[o,a]);return(0,s.useLayoutEffect)(()=>{c!=null&&(n.current===null?t(lT(c)):n.current!==c&&t(uT({prev:n.current,next:c})),n.current=c)},[c,t]),(0,s.useLayoutEffect)(()=>()=>{n.current&&=(t(dT(n.current)),null)},[t]),null}function sO(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,s.useRef)(null),c=(0,s.useRef)(null),l=L(Ho),u=Wo(),d=I(),f=`yAxis`,p=L(e=>Rv(e,t)),m=L(e=>Lv(e,t)),h=L(e=>Hv(e,f,t,u)),g=L(e=>Kg(e,t));if((0,s.useLayoutEffect)(()=>{if(!(r!==`auto`||!p||fC(i)||(0,s.isValidElement)(i)||g==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(p.width)!==Math.round(n)&&d(fT({id:t,width:n}))}}},[h,p,d,i,t,r,g]),p==null||m==null||g==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var _=iO(e,XD);g.id,g.scale;var v=iO(g,ZD);return s.createElement(UE,QD({},_,v,{ref:a,labelRef:c,x:m.x,y:m.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:p.width,height:p.height,className:o(`recharts-${f} ${f}`,n),viewBox:l,ticks:h,axisType:f,axisId:t}))}var cO={allowDataOverflow:Z.allowDataOverflow,allowDecimals:Z.allowDecimals,allowDuplicatedCategory:Z.allowDuplicatedCategory,angle:Z.angle,axisLine:PE.axisLine,hide:!1,includeHidden:Z.includeHidden,interval:Z.interval,label:!1,minTickGap:Z.minTickGap,mirror:Z.mirror,orientation:Z.orientation,padding:Z.padding,reversed:Z.reversed,scale:Z.scale,tick:Z.tick,tickCount:Z.tickCount,tickLine:PE.tickLine,tickSize:PE.tickSize,type:Z.type,niceTicks:Z.niceTicks,width:Z.width,yAxisId:0},lO=s.memo(e=>{var t=Rt(e,cO);return s.createElement(s.Fragment,null,s.createElement(oO,{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}),s.createElement(sO,t))},JD);lO.displayName=`YAxis`;var uO=R([(e,t)=>t,W,Nu,q,ib,ob,Mb,Bo],Wb);function dO(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function fO(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(dO(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 pO=Fi(`mouseClick`),mO=Ha();mO.startListening({actionCreator:pO,effect:(e,t)=>{var n=e.payload,r=uO(t.getState(),fO(n));r?.activeIndex!=null&&t.dispatch(ly({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var hO=Fi(`mouseMove`),gO=Ha(),_O=null,vO=null,yO=null;gO.startListening({actionCreator:hO,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);_O!==null&&(cancelAnimationFrame(_O),_O=null),vO!==null&&(typeof i!=`number`||!o)&&(clearTimeout(vO),vO=null),yO=fO(n);var s=()=>{var e=t.getState(),n=Yv(e,e.tooltip.settings.shared);if(!yO){_O=null,vO=null;return}if(n===`axis`){var r=uO(e,yO);r?.activeIndex==null?t.dispatch(sy()):t.dispatch(cy({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}_O=null,vO=null};if(!o){s();return}i===`raf`?_O=requestAnimationFrame(s):typeof i==`number`&&vO===null&&(vO=setTimeout(s,i))}});function bO(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var xO={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},SO=na({name:`rootProps`,initialState:xO,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??xO.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}}}),CO=SO.reducer,wO=SO.actions.updateOptions,TO=na({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)}});TO.actions.updatePolarOptions;var EO=TO.reducer,DO=Fi(`keyDown`),OO=Fi(`focus`),kO=Fi(`blur`),AO=Ha(),jO=null,MO=null,NO=null;AO.startListening({actionCreator:DO,effect:(e,t)=>{NO=e.payload,jO!==null&&(cancelAnimationFrame(jO),jO=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);MO!==null&&(typeof r!=`number`||!a)&&(clearTimeout(MO),MO=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=NO;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=wy(n,Ky(e),C_(e),tb(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=ob(e),c=Ky(e),l=Yv(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=Lb(e,l,`hover`,String(n.index));t.dispatch(dy({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=Gv(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=C_(e),h=tb(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(wy(_(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=Lb(e,l,`hover`,String(p));t.dispatch(dy({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{jO=null,MO=null}};if(!a){o();return}r===`raf`?jO=requestAnimationFrame(o):typeof r==`number`&&MO===null&&(o(),NO=null,MO=setTimeout(()=>{NO?o():(MO=null,jO=null)},r))}}),AO.startListening({actionCreator:OO,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=Lb(n,Yv(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(dy({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),AO.startListening({actionCreator:kO,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(dy({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function PO(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 FO=Fi(`externalEvent`),IO=Ha(),LO=new Map,RO=new Map,zO=new Map;IO.startListening({actionCreator:FO,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=PO(i);zO.set(a,{handler:r,reactEvent:o});var s=LO.get(a);s!==void 0&&(cancelAnimationFrame(s),LO.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=RO.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),RO.delete(a));var p=()=>{var e=zO.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:gb(i),activeDataKey:pb(i),activeIndex:db(i),activeLabel:fb(i),activeTooltipIndex:db(i),isTooltipActive:_b(i)};n&&n(o,r)}finally{LO.delete(a),RO.delete(a),zO.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);LO.set(a,m)}else if(typeof l==`number`){if(!RO.has(a)){p();var h=setTimeout(p,l);RO.set(a,h)}}else p()}}});var BO=R([R([Oy],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)}}}),VO=Fi(`touchMove`),HO=Ha(),UO=null,WO=null,GO=null,KO=null;HO.startListening({actionCreator:VO,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){KO=PO(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);UO!==null&&(cancelAnimationFrame(UO),UO=null),WO!==null&&(typeof i!=`number`||!o)&&(clearTimeout(WO),WO=null),GO=Array.from(n.touches).map(e=>fO({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(KO!=null){var e=t.getState(),n=Yv(e,e.tooltip.settings.shared);if(n===`axis`){var r=GO?.[0];if(r==null){UO=null,WO=null;return}var i=uO(e,r);i?.activeIndex!=null&&t.dispatch(cy({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=KO.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(ko),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=Hy(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=BO(e,s,c);t.dispatch(oy({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}UO=null,WO=null}};if(!o){s();return}i===`raf`?UO=requestAnimationFrame(s):typeof i==`number`&&WO===null&&(s(),KO=null,WO=setTimeout(()=>{KO?s():(WO=null,UO=null)},i))}}});var qO={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},JO=na({name:`eventSettings`,initialState:qO,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=B(t.payload.throttledEvents))}}}),YO=JO.actions.setEventSettings,XO=JO.reducer,ZO=ar({brush:OT,cartesianAxis:mT,chartData:wx,errorBars:KE,eventSettings:XO,graphicalItems:zw,layout:Xa,legend:Vs,options:_x,polarAxis:zC,polarOptions:EO,referenceElements:IT,renderedTicks:yE,rootProps:CO,tooltip:fy,zIndex:sx}),QO=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return Ki({reducer:ZO,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([mO.middleware,gO.middleware,AO.middleware,IO.middleware,HO.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(Wi({type:`raf`}))},devTools:sc.devToolsEnabled&&{serialize:{replacer:bO},name:`recharts-${t}`}})};function $O(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=Wo(),a=(0,s.useRef)(null);if(i)return n;a.current??=QO(t,r);var o=wn;return s.createElement(rc,{context:o,store:a.current},n)}function ek(e){var t=e.layout,n=e.margin,r=I(),i=Wo();return(0,s.useEffect)(()=>{i||(r(qa(t)),r(Ka(n)))},[r,i,t,n]),null}var tk=(0,s.memo)(ek,oc);function nk(e){var t=I();return(0,s.useEffect)(()=>{t(wO(e))},[t,e]),null}var rk=(0,s.memo)(e=>{var t=I();return(0,s.useEffect)(()=>{t(YO(e))},[t,e]),null},oc);function ik(e){var t=e.zIndex,n=e.isPanorama,r=(0,s.useRef)(null),i=I();return(0,s.useLayoutEffect)(()=>(r.current&&i(ax({zIndex:t,element:r.current,isPanorama:n})),()=>{i(ox({zIndex:t,isPanorama:n}))}),[i,t,n]),s.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function ak(e){var t=e.children,n=e.isPanorama,r=L(Kb);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return s.createElement(s.Fragment,null,i.map(e=>s.createElement(ik,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>s.createElement(ik,{key:e,zIndex:e,isPanorama:n})))}var ok=[`children`];function sk(e,t){if(e==null)return{};var n,r,i=ck(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=ks(),r=As(),i=hc();if(!Qa(n)||!Qa(r))return null;var a=e.children,o=e.otherAttributes,c=e.title,l=e.desc,u,d;return o!=null&&(u=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,d=typeof o.role==`string`?o.role:i?`application`:void 0),s.createElement(S,lk({},o,{title:c,desc:l,role:d,tabIndex:u,width:n,height:r,style:uk,ref:t}),a)}),fk=e=>{var t=e.children,n=L(Ko);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return s.createElement(S,{width:r,height:i,x:o,y:a},t)},pk=(0,s.forwardRef)((e,t)=>{var n=e.children,r=sk(e,ok);return Wo()?s.createElement(fk,null,s.createElement(ak,{isPanorama:!0},n)):s.createElement(dk,lk({ref:t},r),s.createElement(ak,{isPanorama:!1},n))});function mk(e,t){return yk(e)||vk(e,t)||gk(e,t)||hk()}function hk(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gk(e,t){if(e){if(typeof e==`string`)return _k(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)?_k(e,t):void 0}}function _k(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;H(t)&&t!==i&&e(Ya(t))}},[n,e,i]),r}function xk(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 Sk(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(Fx(),null);function Pk(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Fk=(0,s.forwardRef)((e,t)=>{var n=(0,s.useRef)(null),r=Dk((0,s.useState)({containerWidth:Pk(e.style?.width),containerHeight:Pk(e.style?.height)}),2),i=r[0],a=r[1],o=(0,s.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}})},[]),c=(0,s.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,s.useEffect)(()=>()=>{n.current?.disconnect()},[o]),s.createElement(s.Fragment,null,s.createElement(Fs,{width:i.containerWidth,height:i.containerHeight}),s.createElement(`div`,Ek({ref:c},e)))}),Ik=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=Dk((0,s.useState)({containerWidth:Pk(n),containerHeight:Pk(r)}),2),a=i[0],o=i[1],c=(0,s.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}})},[]),l=(0,s.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;c(r,i)}},[t,c]);return s.createElement(s.Fragment,null,s.createElement(Fs,{width:a.containerWidth,height:a.containerHeight}),s.createElement(`div`,Ek({ref:l},e)))}),Lk=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height;return s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(`div`,Ek({ref:t},e)))}),Rk=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?s.createElement(Ik,Ek({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?s.createElement(Lk,Ek({},e,{width:n,height:r,ref:t})):s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(`div`,Ek({ref:t},e)))});function zk(e){return e?Fk:Rk}var Bk=(0,s.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,c=e.onContextMenu,l=e.onDoubleClick,u=e.onMouseDown,d=e.onMouseEnter,f=e.onMouseLeave,p=e.onMouseMove,m=e.onMouseUp,h=e.onTouchEnd,g=e.onTouchMove,_=e.onTouchStart,v=e.style,y=e.width,b=e.responsive,x=e.dispatchTouchEvents,S=x===void 0||x,C=(0,s.useRef)(null),w=I(),T=Dk((0,s.useState)(null),2),E=T[0],D=T[1],O=Dk((0,s.useState)(null),2),k=O[0],A=O[1],j=bk(),M=Cs(),N=M?.width>0?M.width:y,ee=M?.height>0?M.height:i,te=(0,s.useCallback)(e=>{j(e),typeof t==`function`&&t(e),D(e),A(e),e!=null&&(C.current=e)},[j,t,D,A]),ne=(0,s.useCallback)(e=>{w(pO(e)),w(FO({handler:a,reactEvent:e}))},[w,a]),re=(0,s.useCallback)(e=>{w(hO(e)),w(FO({handler:d,reactEvent:e}))},[w,d]),ie=(0,s.useCallback)(e=>{w(sy()),w(FO({handler:f,reactEvent:e}))},[w,f]),ae=(0,s.useCallback)(e=>{w(hO(e)),w(FO({handler:p,reactEvent:e}))},[w,p]),oe=(0,s.useCallback)(()=>{w(OO())},[w]),se=(0,s.useCallback)(()=>{w(kO())},[w]),ce=(0,s.useCallback)(e=>{w(DO(e.key))},[w]),le=(0,s.useCallback)(e=>{w(FO({handler:c,reactEvent:e}))},[w,c]),P=(0,s.useCallback)(e=>{w(FO({handler:l,reactEvent:e}))},[w,l]),ue=(0,s.useCallback)(e=>{w(FO({handler:u,reactEvent:e}))},[w,u]),de=(0,s.useCallback)(e=>{w(FO({handler:m,reactEvent:e}))},[w,m]),fe=(0,s.useCallback)(e=>{w(FO({handler:_,reactEvent:e}))},[w,_]),pe=(0,s.useCallback)(e=>{S&&w(VO(e)),w(FO({handler:g,reactEvent:e}))},[w,S,g]),me=(0,s.useCallback)(e=>{w(FO({handler:h,reactEvent:e}))},[w,h]),he=zk(b);return s.createElement(lx.Provider,{value:E},s.createElement(Ae.Provider,{value:k},s.createElement(he,{width:N??v?.width,height:ee??v?.height,className:o(`recharts-wrapper`,r),style:Sk({position:`relative`,cursor:`default`,width:N,height:ee},v),onClick:ne,onContextMenu:le,onDoubleClick:P,onFocus:oe,onBlur:se,onKeyDown:ce,onMouseDown:ue,onMouseEnter:re,onMouseLeave:ie,onMouseMove:ae,onMouseUp:de,onTouchEnd:me,onTouchMove:pe,onTouchStart:fe,ref:te},s.createElement(Nk,null),n)))}),Vk=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function Hk(e,t){if(e==null)return{};var n,r,i=Uk(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,c=e.style,l=e.compact,u=e.title,d=e.desc,f=p(Hk(e,Vk));return l?s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(pk,{otherAttributes:f,title:u,desc:d},a)):s.createElement(Bk,{className:o,style:c,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},s.createElement(pk,{otherAttributes:f,title:u,desc:d,ref:t},s.createElement(WT,null,a)))});function Gk(){return Gk=Object.assign?Object.assign.bind():function(e){for(var t=1;tvoid 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 `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` + `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=R(t,n,r,a),p=R(t,n,r,c);d+=F(yn||=Y([`L `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=F(bn||=Y([`L `,`,`,` Z`]),t,n);return d},On=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=Ee(l-c),d=X({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=X({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?F(xn||=Y([`M `,`,`,` + a`,`,`,`,0,0,1,`,`,0 + a`,`,`,`,0,0,1,`,`,0 + `]),p.x,p.y,a,a,a*2,a,a,-a*2):Dn({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=F(Sn||=Y([`M `,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + `]),p.x,p.y,a,a,+(u<0),f.x,f.y,i,i,+(y>180),+(u<0),g.x,g.y,a,a,+(u<0),_.x,_.y);if(r>0){var x=X({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=X({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=F(Cn||=Y([`L`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,`Z`]),D.x,D.y,a,a,+(u<0),E.x,E.y,r,r,+(k>180),+(u>0),S.x,S.y,a,a,+(u<0),C.x,C.y)}else b+=F(wn||=Y([`L`,`,`,`Z`]),t,n);return b},kn={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},An=e=>{var t=ce(e,kn),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?On({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):Dn({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return U.createElement(`path`,Tn({},pe(t),{className:f,d:h}))};function jn(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(se(t)){if(e===`centric`){var r=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.angle,c=R(r,i,a,s),l=R(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return _n(t)}}function Mn(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 Nn(e){for(var t=1;tB(f),Rn=()=>{var e=Ln(),t=B(m),n=B(l);return I(!e||!n?void 0:Nn(Nn({},e),{},{scale:n}),t)};function zn(){return zn=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{D(b({shared:v,trigger:y,axisId:T,active:r,defaultIndex:O}))},[D,v,y,T,r,O]);var k=ye(),te=oe(),A=ee(v),j=B(e=>S(e,A,y,O))??{},M=j.activeIndex,ne=j.isActive,re=B(e=>w(e,A,y,O)),ie=B(e=>be(e,A,y,O)),N=B(e=>t(e,A,y,O)),ae=re,se=E(),P=r??ne??!1,le=Qn(Tt([ae,P]),2),ue=le[0],F=le[1],de=A===`axis`?ie:void 0;s(A,y,N,de,M,P);var fe=C??se;if(fe==null||k==null||A==null)return null;var I=ae??or;P||(I=or),l&&I.length&&(I=gt(I.filter(e=>e.value!=null&&(e.hide!==!0||n.includeHidden)),f,ir));var pe=I.length>0,me=Jn(Jn({},n),{},{payload:I,label:de,active:P,activeIndex:M,coordinate:N,accessibilityLayer:te}),L=U.createElement(rn,{allowEscapeViewBox:i,animationDuration:a,animationEasing:o,isAnimationActive:u,active:P,coordinate:N,hasPayload:pe,offset:d,position:p,reverseDirection:m,useTranslate3d:h,viewBox:k,wrapperStyle:g,lastBoundingBox:ue,innerRef:F,hasPortalFromProps:!!C},ar(c,me));return U.createElement(U.Fragment,null,(0,ht.createPortal)(L,fe),P&&U.createElement(Kn,{cursor:_,tooltipEventType:A,coordinate:N,payload:I,index:M}))}var lr=(0,U.createContext)({grid:{stroke:`#ccc`,fill:`none`}});lr.Provider;var ur=()=>(0,U.useContext)(lr),dr=[`x1`,`y1`,`x2`,`y2`,`key`],fr=[`offset`],pr=[`xAxisId`,`yAxisId`],mr=[`xAxisId`,`yAxisId`];function hr(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 Q(e){for(var t=1;t{var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return U.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function Sr(e){var t=e.option,n=e.lineItemProps,r;if(U.isValidElement(t))r=U.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=yr(n,dr),u=ge(l)??{};u.offset;var d=yr(u,fr),f=Array.isArray(d.strokeDasharray)?d.strokeDasharray.join(`,`):d.strokeDasharray;r=U.createElement(`line`,$({},d,{strokeDasharray:f,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function Cr(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=yr(e,pr),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return U.createElement(Sr,{key:`line-${r}`,option:i,lineItemProps:a})});return U.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function wr(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=yr(e,mr),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return U.createElement(Sr,{option:i,lineItemProps:a,key:`line-${r}`})});return U.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function Tr(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return U.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return U.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function Er(e){var t=e.vertical,n=t===void 0||t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return U.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return U.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var Dr=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return Le(Ie(Q(Q(Q({},we),n),{},{ticks:me(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},Or=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return Le(Ie(Q(Q(Q({},we),n),{},{ticks:me(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},kr={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:N.grid};function Ar(e){var t=De(),n=he(),r=Me(),i=Q(Q({},ce(e,kr)),{},{x:z(e.x)?e.x:r.left,y:z(e.y)?e.y:r.top,width:z(e.width)?e.width:r.width,height:z(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,p=i.verticalValues,m=Pe(),h=B(e=>He(e,`xAxis`,a,m)),g=B(e=>He(e,`yAxis`,o,m)),_=ur(),v={stroke:i.stroke??_.grid.stroke,strokeWidth:i.strokeWidth??_.grid.strokeWidth,strokeOpacity:i.strokeOpacity??_.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??_.grid.strokeDasharray};if(!ve(l)||!ve(u)||!z(s)||!z(c))return null;var y=i.verticalCoordinatesGenerator||Dr,b=i.horizontalCoordinatesGenerator||Or,x=i.horizontalPoints,S=i.verticalPoints;if((!x||!x.length)&&typeof b==`function`){var C=f&&f.length,w=b({yAxis:g?Q(Q({},g),{},{ticks:C?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);ke(Array.isArray(w),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof w}]`),Array.isArray(w)&&(x=w)}if((!S||!S.length)&&typeof y==`function`){var T=p&&p.length,E=y({xAxis:h?Q(Q({},h),{},{ticks:T?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},T?!0:d);ke(Array.isArray(E),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof E}]`),Array.isArray(E)&&(S=E)}return U.createElement(Se,{zIndex:i.zIndex},U.createElement(`g`,{className:`recharts-cartesian-grid`},U.createElement(xr,{fill:i.fill??_.grid.fill,fillOpacity:i.fillOpacity??_.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),U.createElement(Tr,$({},i,{horizontalPoints:x})),U.createElement(Er,$({},i,{verticalPoints:S})),U.createElement(Cr,$({},i,v,{offset:r,horizontalPoints:x,xAxis:h,yAxis:g})),U.createElement(wr,$({},i,v,{offset:r,verticalPoints:S,xAxis:h,yAxis:g}))))}Ar.displayName=`CartesianGrid`;export{cr as n,Ar as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CostChart-B4HPj0_B.js b/internal/webui/static/assets/CostChart-B4HPj0_B.js deleted file mode 100644 index 91522b46..00000000 --- a/internal/webui/static/assets/CostChart-B4HPj0_B.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,f as t,h as n,i as r,l as i,r as a}from"./index-Bk7mZAyg.js";import{i as o,n as s,wt as c}from"./CartesianChart-CsA30U9Q.js";import{n as l,r as u,t as d}from"./XAxis-CSpFNRgE.js";import{t as f}from"./AreaChart-CEDgNyR2.js";var p=n(t(),1),m=i(),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(t,n){return n===`cost`?a(t):n===`tokens`?r(t):e(t)}function y(t,n){return n===`cost`?`¥${t>=10?Math.round(t):Number(t.toFixed(1))}`:n===`tokens`?r(t):e(t)}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:e,models:t,lang:n,emptyLabel:r,totalLabel:i,metric:a=`credits`}){let v=(0,p.useMemo)(()=>t.map(e=>e.id),[t]),x=(0,p.useMemo)(()=>e.map(e=>{let t=_(e,a),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=a===`tokens`?r:Number(r.toFixed(4))}return n}),[e,v,a]),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!e.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:r}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(c,{width:`100%`,height:`100%`,children:(0,m.jsxs)(f,{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-${a}-${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)(l,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(d,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,n)}),(0,m.jsx)(s,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,a)}),(0,m.jsx)(u,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:n,models:t,totalLabel:i,metric:a})}),v.map((e,t)=>(0,m.jsx)(o,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${a}-${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:t.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/CostChart-HjooRbfZ.js b/internal/webui/static/assets/CostChart-HjooRbfZ.js new file mode 100644 index 00000000..47bde5ab --- /dev/null +++ b/internal/webui/static/assets/CostChart-HjooRbfZ.js @@ -0,0 +1 @@ +import{n as e,t}from"./CartesianGrid-BLRH4M4a.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-CZG9DLai.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-C40ZJRGg.js b/internal/webui/static/assets/LiveSparkline-C40ZJRGg.js new file mode 100644 index 00000000..e6c584e5 --- /dev/null +++ b/internal/webui/static/assets/LiveSparkline-C40ZJRGg.js @@ -0,0 +1 @@ +import{a as e,at as t,r as n,t as r,xn as i}from"./index-CZG9DLai.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/LiveSparkline-CN22hmWQ.js b/internal/webui/static/assets/LiveSparkline-CN22hmWQ.js deleted file mode 100644 index 5a49a579..00000000 --- a/internal/webui/static/assets/LiveSparkline-CN22hmWQ.js +++ /dev/null @@ -1 +0,0 @@ -import{l as e}from"./index-Bk7mZAyg.js";import{i as t,n,wt as r}from"./CartesianChart-CsA30U9Q.js";import{t as i}from"./AreaChart-CEDgNyR2.js";var a=e();function o({samples:e,capacity:o,label:s}){let c=e.length?e:[{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)(r,{width:`100%`,height:`100%`,children:(0,a.jsxs)(i,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(t,{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-DME0-Hqp.js b/internal/webui/static/assets/TrafficChart-DME0-Hqp.js new file mode 100644 index 00000000..55c675bb --- /dev/null +++ b/internal/webui/static/assets/TrafficChart-DME0-Hqp.js @@ -0,0 +1 @@ +import{n as e,t}from"./CartesianGrid-BLRH4M4a.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-CZG9DLai.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/TrafficChart-Dwkg1uTE.js b/internal/webui/static/assets/TrafficChart-Dwkg1uTE.js deleted file mode 100644 index 7def4f1f..00000000 --- a/internal/webui/static/assets/TrafficChart-Dwkg1uTE.js +++ /dev/null @@ -1 +0,0 @@ -import{f as e,h as t,i as n,l as r,n as i,o as a,s as o,t as s,u as c}from"./index-Bk7mZAyg.js";import{A as l,An as u,C as d,Cn as f,D as p,E as m,Et as h,L as g,Lt as _,M as v,Mn as y,Mt as b,N as x,Nt as S,O as C,Ot as w,P as T,Pt as E,Q as D,Rt as O,S as k,T as A,Z as j,_t as M,a as N,bn as P,bt as ee,ct as te,d as F,et as ne,f as re,g as ie,gt as ae,h as oe,hn as I,i as se,j as ce,jn as L,k as le,kt as R,m as ue,n as de,nt as fe,o as pe,p as me,pt as he,s as ge,st as z,t as _e,vn as B,w as ve,wn as ye,wt as be,x as xe,yn as V,z as H,zt as U}from"./CartesianChart-CsA30U9Q.js";import{i as Se,n as Ce,r as we,t as Te}from"./XAxis-CSpFNRgE.js";var Ee=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}},W=t(e());function G(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 K(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 Ee({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:ue(f,p)},je=(e,t)=>W.isValidElement(e)?W.cloneElement(e,t):typeof e==`function`?e(t):W.createElement(Se,q({},t,{className:`recharts-reference-area-rect`}));function Me(e){var t=O();return(0,W.useEffect)(()=>(t(re(e)),()=>{t(me(e))})),null}function Ne(e){var t=e.x1,n=e.x2,r=e.y1,i=e.y2,a=e.className,o=e.shape,s=e.xAxisId,l=e.yAxisId,d=F(),f=h(),p=U(e=>j(e,`xAxis`,s,f)),m=U(e=>j(e,`yAxis`,l,f));if(p==null||m==null)return null;var g=P(t),_=P(n),v=P(r),y=P(i);if(!g&&!_&&!v&&!y&&!o)return null;var b=Ae(g,_,v,y,p,m,e);if(!b&&!o)return null;var S=e.ifOverflow===`hidden`?`url(#${d})`:void 0;return W.createElement(H,{zIndex:e.zIndex},W.createElement(u,{className:c(`recharts-reference-area`,a)},je(o,K(K({clipPath:S},L(e)),b)),b!=null&&W.createElement(x,q({},b,{lowerWidth:b.width,upperWidth:b.width}),W.createElement(T,{label:e.label}),e.children)))}var Pe={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:z.area};function Fe(e){var t=I(e,Pe);return W.createElement(W.Fragment,null,W.createElement(Me,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),W.createElement(Ne,t))}Fe.displayName=`ReferenceArea`;var Ie=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return Be(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[...He(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function We(e,t,n){return e?Ue(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):Be(t,n)}function Ge(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Le(e,Ie),a=r??!1,o;if(t!=null){var s=i.pathRef;o=We(n,ze(s?.current??null),t)}else n!=null&&(o=String(n));return W.createElement(he,J({},i,{connectNulls:a,strokeDasharray:o}))}function Ke(e){var t=(0,W.useRef)(0),n=(0,W.useRef)(0),r=(0,W.useRef)(!1),i=(0,W.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,W.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(ye(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 qe=[`children`];function Je(e,t){if(e==null)return{};var n,r,i=Ye(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Ze(e){var t=e.children,n=Je(e,qe);return W.createElement(Xe.Provider,{value:n},t)}var Qe=(e,t,n,r)=>D(e,`xAxis`,t,r),$e=(e,t,n,r)=>ne(e,`xAxis`,t,r),et=(e,t,n,r)=>D(e,`yAxis`,n,r),tt=(e,t,n,r)=>ne(e,`yAxis`,n,r),nt=_([M,Qe,et,$e,tt],(e,t,n,r,i)=>E(e,`xAxis`)?w(t,r,!1):w(n,i,!1)),rt=(e,t,n,r,i)=>i;function it(e){return e.type===`line`}var at=_([fe,rt],(e,t)=>e.filter(it).find(e=>e.id===t)),ot=_([M,Qe,et,$e,tt,at,nt,te],(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 Dt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),st=[`id`],ct=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],lt=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function Y(){return Y=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=gt(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:B(i.prev.x,i.next.x,t),y:B(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:B(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:B(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:m,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Ge,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:z.line,type:`linear`},_t=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:b(n,t),payload:e}]},vt=W.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,p={dataDefinedOnItem:n,getPosition:f,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:b(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return W.createElement(C,{tooltipEntrySettings:p})});function yt(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=X(r,st),c=y(s);return W.createElement(xe,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function bt(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,W.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 W.createElement(ce,{value:t?i:void 0},n)}function xt(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,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=X(i,ct),g=Z(Z({},L(h)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return W.createElement(W.Fragment,null,r?.length>1&&W.createElement(le,{option:p,DefaultShape:Q.shape,shapeProps:g}),W.createElement(yt,{points:r,clipPathId:t,props:i}))}function St(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,f=n.layout,p=ht(r.current),m=A(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,y=!h,b=Ke(a),x=(0,W.useCallback)(e=>e>0&&p>0,[p]);return W.createElement(bt,{points:a,showLabels:y},n.children,W.createElement(ve,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return W.createElement(xt,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),W.createElement(v,{label:n.label}))}function Ct(e){var t=e.clipPathId,n=e.props,r=(0,W.useRef)(null),i=(0,W.useRef)(null);return W.createElement(St,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var wt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:S(e.payload,t)}),Tt=class extends W.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,d=e.left,f=e.width,p=e.height,m=e.id,h=e.needClip,g=e.zIndex;if(t)return null;var _=c(`recharts-line`,i),v=m,y=N(n),b=y.r,x=y.strokeWidth,S=l(n),C=b*2+x,w=h?`url(#clipPath-${S?``:`dots-`}${v})`:void 0;return W.createElement(H,{zIndex:g},W.createElement(u,{className:_},h&&W.createElement(`defs`,null,W.createElement(pe,{clipPathId:v,xAxisId:a,yAxisId:o}),!S&&W.createElement(`clipPath`,{id:`clipPath-dots-${v}`},W.createElement(`rect`,{x:d-C/2,y:s-C/2,width:f+C,height:p+C}))),W.createElement(Ze,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:wt,errorBarOffset:0},W.createElement(Ct,{props:this.props,clipPathId:v}))),W.createElement(oe,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}};function Et(e){var t=I(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,g=t.id,_=X(t,lt),v=ge(p,m).needClip,y=ie(),b=ee(),x=h(),S=U(e=>ot(e,p,m,x,g));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,E=y.y;return W.createElement(Tt,Y({},_,{id:g,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:E,needClip:v}))}function Dt(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=S(e,o);if(t===`horizontal`)return{x:R({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(V(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=V(l)?null:n.scale.map(l),d=R({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function Ot(e){var t=I(e,Q),n=h();return W.createElement(d,{id:t.id,type:`line`},e=>W.createElement(W.Fragment,null,W.createElement(p,{legendPayload:_t(t)}),W.createElement(vt,{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}),W.createElement(k,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),W.createElement(Et,Y({},t,{id:e}))))}var kt=W.memo(Ot,ae);kt.displayName=`Line`;var At=[`axis`],jt=(0,W.forwardRef)((e,t)=>W.createElement(_e,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:At,tooltipPayloadSearcher:g,categoricalChartProps:e,ref:t})),Mt={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=r();function Nt(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 Pt(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 Ft(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 It({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:Nt(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 Lt({series:e,lang:t,emptyLabel:r,okLabel:c,errorLabel:l,onSelectRange:u,selectHint:d,labels:f,initialMetric:p=`requests`}){let[m,h]=(0,W.useState)(p),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),b=(0,W.useRef)(!1),x=(0,W.useRef)(null),S=(0,W.useMemo)(()=>e.map(Ft),[e]),C=S[0],w=S[S.length-1],T=(C&&w?Date.parse(w.at)-Date.parse(C.at):0)>1728e5,E=f??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},D=m===`tokens`?[{key:`inputTokens`,label:E.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:E.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:E.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:m===`latency`?[{key:`p95`,label:E.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:E.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:c,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:l,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],O=e=>e==null?`—`:m===`latency`?a(e):n(e),k=m===`requests`?e=>e.requests:m===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,A=S.flatMap(e=>D.map(t=>Number(e[t.key]??0))),j=m===`requests`?Math.max(0,...S.map(e=>e.requests)):Math.max(0,...A),M=Pt(j),N=S.some(e=>e.requests>0),P=S.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,W.useLayoutEffect)(()=>{let e=x.current;if(!e||!N||b.current)return;let t=!1,n=null,r=o.context(()=>{let r=o.matchMedia(),i=()=>{let t=o.utils.toArray(`.recharts-area-area`,e),n=o.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{o.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),o.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{o.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();o.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,b.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,b.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let ee=S.length>1?Date.parse(S[1].at)-Date.parse(S[0].at):36e5,te=()=>{if(g&&v&&u){let e=Date.parse(g),t=Date.parse(v);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+ee;u(new Date(n).toISOString(),new Date(r).toISOString())}}_(null),y(null)},F=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!N?(0,$.jsx)(i,{emptyLabel:r}):(0,$.jsxs)(`div`,{ref:x,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(s,{value:m,onChange:e=>h(e),ariaLabel:E.requests,options:[{id:`requests`,label:E.requests},{id:`tokens`,label:E.tokens},{id:`latency`,label:E.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(be,{width:`100%`,height:`100%`,children:(0,$.jsxs)(jt,{data:S,margin:{top:8,right:8,bottom:0,left:0},style:u?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:u?e=>{let t=F(e);t&&(_(t),y(t))}:void 0,onMouseMove:u?e=>{if(!g)return;let t=F(e);t&&y(t)}:void 0,onMouseUp:u?te:void 0,onMouseLeave:u?()=>{_(null),y(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:D.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)(Ce,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(Te,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>Nt(e,T,t)}),(0,$.jsx)(de,{width:m===`latency`?44:36,domain:[0,M],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>m===`latency`?a(e):n(e)}),(0,$.jsx)(we,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(It,{daily:T,lang:t,specs:D,format:O,totalLabel:E.total,total:k})}),D.filter(e=>e.area).map(e=>(0,$.jsx)(se,{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)}`)),D.map(e=>(0,$.jsx)(kt,{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)}`)),g&&v?(0,$.jsx)(Fe,{x1:g,x2:v,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:D.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:[u&&d?(0,$.jsx)(`span`,{children:d}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[O(j),` peak`]})]})]})]})}export{Lt as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/XAxis-CSpFNRgE.js b/internal/webui/static/assets/XAxis-CSpFNRgE.js deleted file mode 100644 index de166747..00000000 --- a/internal/webui/static/assets/XAxis-CSpFNRgE.js +++ /dev/null @@ -1,33 +0,0 @@ -import{d as e,f as t,h as n,u as r}from"./index-Bk7mZAyg.js";import{$ as i,$t as a,At as o,B as s,Bt as c,Ct as l,Dn as u,Dt as d,En as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,Mn as E,Nn as D,On as O,Ot as k,Qt as A,R as ee,Rt as j,Sn as M,St as N,Tn as P,Tt as te,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as F,Xt as ce,Y as I,Yt as le,Zt as ue,_ as de,_n as L,an as fe,at as pe,b as me,bn as he,bt as ge,c as _e,cn as ve,dn as ye,dt as be,en as xe,fn as Se,ft as Ce,gn as we,hn as R,ht as Te,in as Ee,it as De,jn as Oe,jt as ke,kn as Ae,l as z,ln as je,lt as Me,mn as Ne,mt as Pe,nn as Fe,on as Ie,ot as Le,pn as Re,pt as ze,q as Be,qt as Ve,r as He,rn as Ue,rt as We,sn as Ge,st as B,tn as Ke,tt as qe,u as Je,un as Ye,ut as V,v as Xe,vn as Ze,vt as Qe,wn as H,xn as U,xt as $e,y as et,yn as tt,yt as nt,z as rt,zt as W}from"./CartesianChart-CsA30U9Q.js";function it(e,t){let n=new Map;for(let r=0;rvoid 0)}function mt(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return ht(e,t,n,r,i);case`function`:return Object.keys(t).length>0?mt(e,{...t},n,r,i):y(e,t);default:return ae(e)&&i?typeof t!=`string`||t===``:y(e,t)}}function ht(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return _t(e,t,n,r);if(t instanceof Map)return gt(e,t,n,r);if(t instanceof Set)return vt(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ct(e)&&(e=Object(e));else{let t=Se(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 bt(e){return e=ft(e),t=>yt(t,e)}function xt(e,t){return ut(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(Se(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),K(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Fe:case Ie:case Ve:{let t=new e.constructor(e?.valueOf());return K(t,e),t}case se:{let t={};return K(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function St(e){return xt(e)}function Ct(e){return typeof e==`object`&&!!e&&Se(e)===`[object Arguments]`}function wt(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Ae(t)&&!(t in Object(e))?u(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);nLt||Math.abs(e.left-t.left)>Lt||Math.abs(e.top-t.top)>Lt||Math.abs(e.width-t.width)>Lt}function zt(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Bt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=jt((0,q.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,q.useRef)(null),a=(0,q.useRef)(n);a.current=n;var o=(0,q.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=zt(e);if(Rt(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=zt(e);Rt(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,q.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Vt(){return Vt=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 t=e.separator,n=t===void 0?J.separator:t,i=e.contentStyle,a=e.itemStyle,o=e.labelStyle,s=o===void 0?J.labelStyle:o,c=e.payload,l=e.formatter,u=e.itemSorter,d=e.wrapperClassName,f=e.labelClassName,p=e.label,m=e.labelFormatter,h=e.accessibilityLayer,g=h===void 0?J.accessibilityLayer:h,_=()=>{if(c&&c.length){var e={padding:0,margin:0},t=en(c,u).map((e,t)=>{if(!e||e.type===`none`)return null;var r=e.formatter||l||$t,i=e.value,o=e.name,s=i,u=o;if(r){var d=r(i,o,e,t,c);if(Array.isArray(d)){var f=qt(d,2);s=f[0],u=f[1]}else if(d!=null)s=d;else return null}var p=Ut(Ut({},J.itemStyle),{},{color:e.color||J.itemStyle.color},a);return q.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},he(u)?q.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,he(u)?q.createElement(`span`,{className:`recharts-tooltip-item-separator`},n):null,q.createElement(`span`,{className:`recharts-tooltip-item-value`},s),q.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return q.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},v=Ut(Ut({},J.contentStyle),i),y=Ut({margin:0},s),b=!tt(p),x=b?p:``,S=r(`recharts-default-tooltip`,d),C=r(`recharts-tooltip-label`,f);b&&m&&c!=null&&(x=m(p,c));var w=g?{role:`status`,"aria-live":`assertive`}:{};return q.createElement(`div`,Vt({className:S,style:v},w),q.createElement(`p`,{className:C,style:y},q.isValidElement(x)?x:`${x}`),_())},nn=`recharts-tooltip-wrapper`,rn={visibility:`hidden`};function an(e){var t=e.coordinate,n=e.translateX,i=e.translateY;return r(nn,{[`${nn}-right`]:U(n)&&t&&U(t.x)&&n>=t.x,[`${nn}-left`]:U(n)&&t&&U(t.x)&&n=t.y,[`${nn}-top`]:U(i)&&t&&U(t.y)&&i0?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 sn(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function cn(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=on({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=on({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=sn({translateX:d,translateY:f,useTranslate3d:c})):u=rn,{cssProperties:u,cssClasses:an({translateX:d,translateY:f,coordinate:n})}}function ln(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 Y(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];q.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(Y(Y({},r),{},{dismissed:!1}));var a=cn({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=Y(Y({},e.hasPortalFromProps?{}:Y(Y({transition:yn({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 q.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var xn=q.memo(bn),Sn=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function Cn(){return Cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,Mn=e=>{var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.top,s=o===void 0?0:o,c=e.left,l=c===void 0?0:c,u=e.width,d=u===void 0?0:u,f=e.height,p=f===void 0?0:f,m=e.className,h=kn(e,Sn),g=Tn({x:n,y:a,top:s,left:l,width:d,height:p},h);return!U(n)||!U(a)||!U(d)||!U(p)||!U(s)||!U(l)?null:q.createElement(`path`,Cn({},Oe(g),{className:r(`recharts-cross`,m),d:jn(n,a,d,p,s,l)}))};function Nn(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}}var Pn=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),Fn=(e,t,n)=>e.map(e=>`${Pn(e)} ${t}ms ${n}`).join(`,`),In=[`radius`],Ln=[`radius`],Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn;function Jn(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 Yn(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var a=H(n),o=H(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=P(Rn||=X([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=P(zn||=X([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=P(Bn||=X([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=P(Vn||=X([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=P(Hn||=X([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=P(Un||=X([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=P(Wn||=X([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=P(Gn||=X([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=P(Kn||=X(`M .,. - A .,.,0,0,.,.,. - L .,. - A .,.,0,0,.,.,. - L .,. - A .,.,0,0,.,.,. - L .,. - A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=P(qn||=X([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},lr={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},ur=e=>{var t=R(e,lr),n=(0,q.useRef)(null),i=nr((0,q.useState)(-1),2),a=i[0],o=i[1];(0,q.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&o(e)}catch{}},[]);var s=t.x,c=t.y,l=t.width,u=t.height,d=t.radius,f=t.className,p=t.animationEasing,m=t.animationDuration,h=t.animationBegin,g=t.isAnimationActive,_=t.isUpdateAnimationActive,v=(0,q.useRef)(l),y=(0,q.useRef)(u),b=(0,q.useRef)(s),x=(0,q.useRef)(c),S=(0,q.useMemo)(()=>({x:s,y:c,width:l,height:u,radius:d}),[s,c,l,u,d]),C=be(S,`rectangle-`);if(s!==+s||c!==+c||l!==+l||u!==+u||l===0||u===0)return null;var w=r(`recharts-rectangle`,f);if(!_){var T=Oe(t);T.radius;var E=er(T,In);return q.createElement(`path`,$n({},E,{x:H(s),y:H(c),width:H(l),height:H(u),radius:typeof d==`number`?d:void 0,className:w,d:cr(s,c,l,u,d)}))}var D=v.current,O=y.current,k=b.current,A=x.current,ee=`0px ${a===-1?1:a}px`,j=`${a}px ${a}px`,M=Fn([`strokeDasharray`],m,typeof p==`string`?p:lr.animationEasing);return q.createElement(Ce,{animationId:C,key:C,canBegin:a>0,duration:m,easing:p,isActive:_,begin:h},e=>{var r=Ze(D,l,e),i=Ze(O,u,e),a=Ze(k,s,e),o=Ze(A,c,e);n.current&&(v.current=r,y.current=i,b.current=a,x.current=o);var f=g?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:ee}:{strokeDasharray:j},p=Oe(t);p.radius;var m=er(p,Ln);return q.createElement(`path`,$n({},m,{radius:typeof d==`number`?d:void 0,className:w,d:cr(a,o,r,i,d),ref:n,style:Yn(Yn({},f),t.style)}))})};function dr(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[V(t,n,r,i),V(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var fr,pr,mr,hr,gr,_r,vr;function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;tM(t-e)*Math.min(Math.abs(t-e),359.999),xr=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)/Me,d=c?i:i+a*u,f=V(t,n,l,d),p=V(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:V(t,n,l*Math.cos(u*Me),m),theta:u}},Sr=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=br(a,o),c=a+s,l=V(t,n,i,a),u=V(t,n,i,c),d=P(fr||=Z([`M `,`,`,` - A `,`,`,`,0, - `,`,`,`, - `,`,`,` - `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=V(t,n,r,a),p=V(t,n,r,c);d+=P(pr||=Z([`L `,`,`,` - A `,`,`,`,0, - `,`,`,`, - `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=P(mr||=Z([`L `,`,`,` Z`]),t,n);return d},Cr=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=M(l-c),d=xr({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=xr({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?P(hr||=Z([`M `,`,`,` - a`,`,`,`,0,0,1,`,`,0 - a`,`,`,`,0,0,1,`,`,0 - `]),p.x,p.y,a,a,a*2,a,a,-a*2):Sr({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=P(gr||=Z([`M `,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,` - A`,`,`,`,0,`,`,`,`,`,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,` - `]),p.x,p.y,a,a,+(u<0),f.x,f.y,i,i,+(y>180),+(u<0),g.x,g.y,a,a,+(u<0),_.x,_.y);if(r>0){var x=xr({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=xr({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=P(_r||=Z([`L`,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,` - A`,`,`,`,0,`,`,`,`,`,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,`Z`]),D.x,D.y,a,a,+(u<0),E.x,E.y,r,r,+(k>180),+(u>0),S.x,S.y,a,a,+(u<0),C.x,C.y)}else b+=P(vr||=Z([`L`,`,`,`Z`]),t,n);return b},wr={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Tr=e=>{var t=R(e,wr),n=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.cornerRadius,c=t.forceCornerRadius,l=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=t.className;if(o0&&Math.abs(u-d)<360?Cr({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(h,m/2),forceCornerRadius:c,cornerIsExternal:l,startAngle:u,endAngle:d}):Sr({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d});return q.createElement(`path`,yr({},Oe(t),{className:p,d:g}))};function Er(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(we(t)){if(e===`centric`){var r=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.angle,c=V(r,i,a,s),l=V(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return dr(t)}}function Dr(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 Or(e){for(var t=1;tW(qe),Nr=()=>{var e=Mr(),t=W(w),n=W(g);return k(!e||!n?void 0:Or(Or({},e),{},{scale:n}),t)};function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{E(Be({shared:y,trigger:x,axisId:T,active:n,defaultIndex:D}))},[E,y,x,T,n,D]);var O=l(),k=Pe(),A=S(y),M=W(e=>v(e,A,x,D))??{},N=M.activeIndex,P=M.isActive,te=W(e=>ne(e,A,x,D)),re=W(e=>ie(e,A,x,D)),ae=W(e=>s(e,A,x,D)),oe=te,se=ee(),F=n??P??!1,ce=Jr(Bt([oe,F]),2),I=ce[0],le=ce[1],ue=A===`axis`?re:void 0;b(A,x,ae,ue,N,F);var de=w??se;if(de==null||O==null||A==null)return null;var L=oe??ni;F||(L=ni),c&&L.length&&(L=At(L.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),f,ei));var fe=L.length>0,pe=Wr(Wr({},t),{},{payload:L,label:ue,active:F,activeIndex:N,coordinate:ae,accessibilityLayer:k}),me=q.createElement(xn,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:u,active:F,coordinate:ae,hasPayload:fe,offset:d,position:p,reverseDirection:m,useTranslate3d:h,viewBox:O,wrapperStyle:g,lastBoundingBox:I,innerRef:le,hasPortalFromProps:!!w},ti(o,pe));return q.createElement(q.Fragment,null,(0,kt.createPortal)(me,de),F&&q.createElement(Hr,{cursor:_,tooltipEventType:A,coordinate:ae,payload:L,index:N}))}var ai=(0,q.createContext)({grid:{stroke:`#ccc`,fill:`none`}});ai.Provider;var oi=()=>(0,q.useContext)(ai),si=[`x1`,`y1`,`x2`,`y2`,`key`],ci=[`offset`],li=[`xAxisId`,`yAxisId`],ui=[`xAxisId`,`yAxisId`];function di(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 Q(e){for(var t=1;t{var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return q.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function vi(e){var t=e.option,n=e.lineItemProps,r;if(q.isValidElement(t))r=q.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=hi(n,si),u=E(l)??{};u.offset;var d=hi(u,ci),f=Array.isArray(d.strokeDasharray)?d.strokeDasharray.join(`,`):d.strokeDasharray;r=q.createElement(`line`,$({},d,{strokeDasharray:f,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function yi(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=hi(e,li),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return q.createElement(vi,{key:`line-${r}`,option:i,lineItemProps:a})});return q.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function bi(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=hi(e,ui),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return q.createElement(vi,{option:i,lineItemProps:a,key:`line-${r}`})});return q.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function xi(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return q.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return q.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function Si(e){var t=e.vertical,n=t===void 0||t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return q.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return q.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var Ci=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return o(Je(Q(Q(Q({},z),n),{},{ticks:ke(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},wi=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return o(Je(Q(Q(Q({},z),n),{},{ticks:ke(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Ti={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:B.grid};function Ei(e){var t=$e(),n=nt(),r=N(),i=Q(Q({},R(e,Ti)),{},{x:U(e.x)?e.x:r.left,y:U(e.y)?e.y:r.top,width:U(e.width)?e.width:r.width,height:U(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,m=i.verticalValues,g=p(),_=W(e=>F(e,`xAxis`,a,g)),v=W(e=>F(e,`yAxis`,o,g)),y=oi(),b={stroke:i.stroke??y.grid.stroke,strokeWidth:i.strokeWidth??y.grid.strokeWidth,strokeOpacity:i.strokeOpacity??y.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??y.grid.strokeDasharray};if(!h(l)||!h(u)||!U(s)||!U(c))return null;var x=i.verticalCoordinatesGenerator||Ci,S=i.horizontalCoordinatesGenerator||wi,C=i.horizontalPoints,w=i.verticalPoints;if((!C||!C.length)&&typeof S==`function`){var T=f&&f.length,E=S({yAxis:v?Q(Q({},v),{},{ticks:T?f:v.ticks}):void 0,width:t??l,height:n??u,offset:r},T?!0:d);te(Array.isArray(E),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof E}]`),Array.isArray(E)&&(C=E)}if((!w||!w.length)&&typeof x==`function`){var D=m&&m.length,O=x({xAxis:_?Q(Q({},_),{},{ticks:D?m:_.ticks}):void 0,width:t??l,height:n??u,offset:r},D?!0:d);te(Array.isArray(O),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof O}]`),Array.isArray(O)&&(w=O)}return q.createElement(rt,{zIndex:i.zIndex},q.createElement(`g`,{className:`recharts-cartesian-grid`},q.createElement(_i,{fill:i.fill??y.grid.fill,fillOpacity:i.fillOpacity??y.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),q.createElement(xi,$({},i,{horizontalPoints:C})),q.createElement(Si,$({},i,{verticalPoints:w})),q.createElement(yi,$({},i,b,{offset:r,horizontalPoints:C,xAxis:_,yAxis:v})),q.createElement(bi,$({},i,b,{offset:r,verticalPoints:w,xAxis:_,yAxis:v}))))}Ei.displayName=`CartesianGrid`;var Di=[`type`],Oi=[`dangerouslySetInnerHTML`,`ticks`,`scale`],ki=[`id`,`scale`];function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return Mi(Mi({},a),{},{type:o})},[a,o]);return(0,q.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(de(s)):n.current!==s&&t(et({prev:n.current,next:s})),n.current=s)},[s,t]),(0,q.useLayoutEffect)(()=>()=>{n.current&&=(t(Xe(n.current)),null)},[t]),null}var zi=e=>{var t=e.xAxisId,n=e.className,a=e.height,o=e.label,s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=W(d),u=p(),f=j(),h=`xAxis`,g=W(e=>i(e,h,t,u)),_=W(e=>pe(e,t)),v=W(e=>We(e,t)),y=W(e=>De(e,t));if((0,q.useLayoutEffect)(()=>{if(!(a!==`auto`||!_||m(o)||(0,q.isValidElement)(o)||y==null)){var e=s.current;if(e){var n=e.getCalculatedHeight();Math.round(_.height)!==Math.round(n)&&f(me({id:t,height:n}))}}},[g,_,f,o,t,a,y]),_==null||v==null||y==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var b=Ii(e,Oi);y.id,y.scale;var x=Ii(y,ki);return q.createElement(_e,Ai({},b,x,{ref:s,labelRef:c,x:v.x,y:v.y,width:_.width,height:_.height,className:r(`recharts-${h} ${h}`,n),viewBox:l,ticks:g,axisType:h,axisId:t}))},Bi={allowDataOverflow:I.allowDataOverflow,allowDecimals:I.allowDecimals,allowDuplicatedCategory:I.allowDuplicatedCategory,angle:I.angle,axisLine:z.axisLine,height:I.height,hide:!1,includeHidden:I.includeHidden,interval:I.interval,label:!1,minTickGap:I.minTickGap,mirror:I.mirror,orientation:I.orientation,padding:I.padding,reversed:I.reversed,scale:I.scale,tick:I.tick,tickCount:I.tickCount,tickLine:z.tickLine,tickSize:z.tickSize,type:I.type,niceTicks:I.niceTicks,xAxisId:0},Vi=q.memo(e=>{var t=R(e,Bi);return q.createElement(q.Fragment,null,q.createElement(Ri,{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}),q.createElement(zi,t))},He);Vi.displayName=`XAxis`;export{ur as i,Ei as n,ii as r,Vi as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-Bk7mZAyg.js b/internal/webui/static/assets/index-Bk7mZAyg.js deleted file mode 100644 index 6cc71c20..00000000 --- a/internal/webui/static/assets/index-Bk7mZAyg.js +++ /dev/null @@ -1,96 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LiveSparkline-CN22hmWQ.js","assets/CartesianChart-CsA30U9Q.js","assets/AreaChart-CEDgNyR2.js","assets/TrafficChart-Dwkg1uTE.js","assets/XAxis-CSpFNRgE.js","assets/CostChart-B4HPj0_B.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 te(e,t){B++,z[B]=e.current,e.current=t}var ne=ee(null),re=ee(null),ie=ee(null),ae=ee(null);function oe(e,t){switch(te(ie,t),te(re,e),te(ne,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}}V(ne),te(ne,e)}function se(){V(ne),V(re),V(ie)}function ce(e){e.memoizedState!==null&&te(ae,e);var t=ne.current,n=Xd(t,e.type);t!==n&&(te(re,e),te(ne,n))}function le(e){re.current===e&&(V(ne),V(re)),ae.current===e&&(V(ae),ap._currentValue=R)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-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{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(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 He(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=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(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 Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(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 Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(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),sn=!1;if(on)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){sn=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{sn=!1}var ln=null,un=null,dn=null;function fn(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.textContent,a=i.length;for(e=0;e=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=fn(),dn=un=ln=null,Zn=!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=xr(n)}}function Cr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(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=Nt(e.document)}return t}function Tr(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 Er=on&&`documentMode`in document&&11>=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==Nt(r)||(r=Dr,`selectionStart`in r&&Tr(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}),kr&&br(kr,r)||(kr=r,r=Nd(Or,`onSelect`),0>=o,i-=o,Ci=1<<32-Pe(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),Mi&&Ti(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),Mi&&Ti(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 Mi&&Ti(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)}),Mi&&Ti(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&&Ea(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Na(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=pi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ea(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,Ma(o),c);if(o.$$typeof===C)return b(e,r,ea(e,o),c);Pa(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=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=b(e,t,n,r);return Aa=null,i}catch(t){if(t===ba||t===Sa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=Fa(!0),La=Fa(!1),Ra=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ba(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 Va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(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=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Ua(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,Xe(e,n)}}function Wa(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 Ga=!1;function Ka(){if(Ga){var e=da;if(e!==null)throw e}}function qa(e,t,n,r){Ga=!1;var i=e.updateQueue;Ra=!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===ua&&(Ga=!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:Ra=!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 Ja(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ya(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,ma(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 Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;U(e,a,t,R,n===null?Cs:function(){return Es(e),n(r)})}function Ts(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:Lo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},vu())}function Ds(){return $i(ap)}function Os(){return Mo().memoizedState}function W(){return Mo().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vu();e=Va(n);var r=Ha(t,e,n);r!==null&&(bu(r,t,n),Ua(r,t,n)),t={cache:oa()},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=$r(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,yr(s,o))return Qr(e,t,i,0),Bl===null&&Zr(),!1}catch{}if(n=$r(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=$r(e,n,r,2),t!==null&&bu(t,e,2)}function Ps(e){var t=e.alternate;return e===fo||t!==null&&t===fo}function Fs(e,t){go=ho=!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,Xe(e,n)}}var Ls={readContext:$i,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Ls.useEffectEvent=So;var Rs={readContext:$i,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){Ne(!0);try{n(t)}finally{Ne(!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,fo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=js.bind(null,fo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=U.bind(null,fo,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=fo,a=jo();if(Mi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Bl.identifierPrefix;if(Mi){var n=wi,r=Ci;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,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[rt]=t,o[it]=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=ie.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ai,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Ii(t,!0)}else e=Jd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(so(t),t):(so(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=zi(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[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(so(t),t):(so(t),null)}return so(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 se(),e===null&&kd(t.stateNode.containerInfo),Ic(t),null;case 10:return qi(t.type),Ic(t),null;case 19:if(V(co),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=lo(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;)ci(n,e),n=n.sibling;return te(co,co.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>ou&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=lo(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&&!Mi)return Ic(t),null}else 2*Se()-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=Se(),e.sibling=null,n=co.current,te(co,a?n&1|2:n&1),Mi&&Ti(t,r.treeForkCount),e);case 22:case 23:return so(t),eo(),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&&V(ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(aa),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(aa),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(so(t),t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(so(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(co),null;case 4:return se(),null;case 10:return qi(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&V(ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(aa),null;case 25:return null;default:return null}}function zc(e,t){switch(Oi(t),t.tag){case 3:qi(aa),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:V(co);break;case 10:qi(t.type);break;case 22:case 23:so(t),eo(),e!==null&&V(ga);break;case 24:qi(aa)}}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{Ya(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[it]=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=Xt));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[rt]=e,t[it]=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=mp,e=wr(e),Tr(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},mp=!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[rt]=e,gt(o),r=o;break a;case`link`:var s=Jf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Sr(s,h),v=Sr(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),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{L.p=a,I.T=r,Ku(e,t)}}function Yu(e,t,n){t=hi(n,t),t=Zs(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(qe(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=hi(n,e),n=Qs(2),r=Ha(t,n,2),r!==null&&($s(n,r,t,e),qe(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>Se()-iu?!(zl&2)&&Du(e,0):Ql|=n,eu===Hl&&(eu=0)),ld(e)}function $u(e,t){t===0&&(t=Ge()),e=ei(e,t),e!==null&&(qe(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 ve(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-Pe(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=He(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(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=Se(),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=Ft(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),gt(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="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Vf(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(Hf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),gt(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="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vf(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(Hf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=ht(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))&&Gf(e,n);var c=o=r.createElement(`link`);gt(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,Wf(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=ht(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=m({src:e,async:!0},t),(t=Sf.get(i))&&Kf(e,t),a=n.createElement(`script`),gt(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=ht(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&Kf(e,t),a=n.createElement(`script`),gt(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=ie.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=ht(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=ht(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||K(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=Vf(n),n=ht(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="`+Ft(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function K(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),gt(t),e.head.appendChild(t))}function Vf(e){return`[src="`+Ft(e)+`"]`}function Hf(e){return`script[async]`+e}function Uf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(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`),gt(r),Hd(r,`style`,a),Wf(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,gt(o),o;r=Bf(n),(a=Sf.get(a))&&Gf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(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,Wf(o,n.precedence,e),t.instance=o;case`script`:return o=Vf(n.src),(a=e.querySelector(Hf(o)))?(t.instance=a,gt(a),a):(r=n,(a=Sf.get(o))&&(r=m({},n),Kf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(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,Wf(r,n.precedence,e));return t.instance}function Wf(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 Xf(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 Zf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qf(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=tp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Gf(r,i),a=a.createElement(`link`),gt(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=tp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $f=0;function ep(e,t){return e.stylesheets&&e.count===0&&rp(e,e.stylesheets),0$f?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var np=null;function rp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,np=new Map,t.forEach(ip,e),np=null,tp.call(e))}function ip(e,t){if(!(t.state.loading&4)){var n=np.get(e);if(n)var r=n.get(null);else{n=new Map,np.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=_e((typeof t==`string`?I(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ee(e),s=null,c=ge(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=Te([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}".`),V(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ue(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=he(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 te(e.path))a(e,t,!0,n)}),t}function te(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=te(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 ne(e){e.sort((e,t)=>e.score===t.score?de(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var re=/^:[\w-]+$/,ie=3,ae=2,oe=1,se=10,ce=-2,le=e=>e===`*`;function ue(e,t){let n=e.split(`/`),r=n.length;return n.some(le)&&(r+=ce),t&&(r+=ae),n.filter(e=>!le(e)).reduce((e,t)=>e+(re.test(t)?ie:t===``?oe:se),r)}function de(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 fe(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 he(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 ge(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 _e(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 ve(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?I(e):e,a;return n?(n=we(n),a=n.startsWith(`/`)?ye(n.substring(1),`/`):ye(n,t)):a=t,{pathname:a,search:Oe(r),hash:ke(i)}}function ye(e,t){let n=Ee(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function be(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 xe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Se(e){let t=xe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ce(e,t,n,r=!1){let i;typeof e==`string`?i=I(e):(i={...e},A(!i.pathname||!i.pathname.includes(`?`),be(`?`,`pathname`,`search`,i)),A(!i.pathname||!i.pathname.includes(`#`),be(`#`,`pathname`,`hash`,i)),A(!i.search||!i.search.includes(`#`),be(`#`,`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=ve(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var we=e=>e.replace(/[\\/]{2,}/g,`/`),Te=e=>we(e.join(`/`)),Ee=e=>e.replace(/\/+$/,``),De=e=>Ee(e).replace(/^\/*/,`/`),Oe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ke=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ae=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 je(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Me(e){return Te(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ne=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Pe(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(Ne)try{let e=new URL(window.location.href),r=T.test(n)?new URL(E(n,e.protocol)):new URL(n),a=_e(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 Fe=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Fe);var Ie=[`GET`,...Fe];new Set(Ie);var Le=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Re(e){try{return Le.includes(new URL(e).protocol)}catch{return!1}}var ze=v.createContext(null);ze.displayName=`DataRouter`;var Be=v.createContext(null);Be.displayName=`DataRouterState`;var Ve=v.createContext(!1);function He(){return v.useContext(Ve)}var Ue=v.createContext({isTransitioning:!1});Ue.displayName=`ViewTransition`;var We=v.createContext(new Map);We.displayName=`Fetchers`;var Ge=v.createContext(null);Ge.displayName=`Await`;var Ke=v.createContext(null);Ke.displayName=`Navigation`;var qe=v.createContext(null);qe.displayName=`Location`;var Je=v.createContext({outlet:null,matches:[],isDataRoute:!1});Je.displayName=`Route`;var Ye=v.createContext(null);Ye.displayName=`RouteError`;var Xe=`REACT_ROUTER_ERROR`,Ze=`REDIRECT`,Qe=`ROUTE_ERROR_RESPONSE`;function $e(e){if(e.startsWith(`${Xe}:${Ze}:{`))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 et(e){if(e.startsWith(`${Xe}:${Qe}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ae(t.status,t.statusText,t.data)}catch{}}function tt(e,{relative:t}={}){A(nt(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=v.useContext(Ke),{hash:i,pathname:a,search:o}=ut(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Te([n,a])),r.createHref({pathname:s,search:o,hash:i})}function nt(){return v.useContext(qe)!=null}function rt(){return A(nt(),`useLocation() may be used only in the context of a component.`),v.useContext(qe).location}var it=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function at(e){v.useContext(Ke).static||v.useLayoutEffect(e)}function ot(){let{isDataRoute:e}=v.useContext(Je);return e?Dt():st()}function st(){A(nt(),`useNavigate() may be used only in the context of a component.`);let e=v.useContext(ze),{basename:t,navigator:n}=v.useContext(Ke),{matches:r}=v.useContext(Je),{pathname:i}=rt(),a=JSON.stringify(Se(r)),o=v.useRef(!1);return at(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(j(o.current,it),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ce(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Te([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var ct=v.createContext(null);function lt(e){let t=v.useContext(Je).outlet;return v.useMemo(()=>t&&v.createElement(ct.Provider,{value:e},t),[t,e])}function ut(e,{relative:t}={}){let{matches:n}=v.useContext(Je),{pathname:r}=rt(),i=JSON.stringify(Se(n));return v.useMemo(()=>Ce(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function dt(e,t){return ft(e,t)}function ft(e,t,n){A(nt(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=v.useContext(Ke),{matches:i}=v.useContext(Je),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||``;kt(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=rt(),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=yt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Te([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Te([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(qe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function pt(){let e=Et(),t=je(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 mt=v.createElement(pt,null),ht=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=et(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(Je.Provider,{value:this.props.routeContext},v.createElement(Ye.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(_t,{error:e},t):t}};ht.contextType=Ve;var gt=new WeakMap;function _t({children:e,error:t}){let{basename:n}=v.useContext(Ke);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=$e(t.digest);if(e){let r=gt.get(t);if(r)throw r;let i=Pe(e.location,n),a=i.absoluteURL||i.to;if(Re(a))throw Error(`Invalid redirect location`);if(Ne&&!gt.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 gt.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function vt({routeContext:e,match:t,children:n}){let r=v.useContext(ze);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Je.Provider,{value:e},n)}function yt(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:Me(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||mt,o&&(s<0&&c===0?(kt(`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(vt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(ht,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function bt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xt(e){let t=v.useContext(ze);return A(t,bt(e)),t}function St(e){let t=v.useContext(Be);return A(t,bt(e)),t}function Ct(e){let t=v.useContext(Je);return A(t,bt(e)),t}function wt(e){let t=Ct(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 Tt(){return wt(`useRouteId`)}function Et(){let e=v.useContext(Ye),t=St(`useRouteError`),n=wt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Dt(){let{router:e}=xt(`useNavigate`),t=wt(`useNavigate`),n=v.useRef(!1);return at(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{j(n.current,it),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ot={};function kt(e,t,n){!t&&!Ot[e]&&(Ot[e]=!0,j(!1,n))}v.memo(At);function At({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ft(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function jt({to:e,replace:t,state:n,relative:r}){A(nt(),` may be used only in the context of a component.`);let{static:i}=v.useContext(Ke);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(Je),{pathname:o}=rt(),s=ot(),c=Ce(e,Se(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 Mt(e){return lt(e.context)}function Nt(e){A(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Pt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){A(!nt(),`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=_e(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(Ke.Provider,{value:c},v.createElement(qe.Provider,{children:t,value:h}))}function Ft({children:e,location:t}){return dt(It(e),t)}v.Component;function It(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,It(e.props.children,i));return}A(e.type===Nt,`[${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=It(e.props.children,i)),n.push(a)}),n}var Lt=`get`,Rt=`application/x-www-form-urlencoded`;function zt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Bt(e){return zt(e)&&e.tagName.toLowerCase()===`button`}function Vt(e){return zt(e)&&e.tagName.toLowerCase()===`form`}function Ht(e){return zt(e)&&e.tagName.toLowerCase()===`input`}function Ut(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Wt(e,t){return e.button===0&&(!t||t===`_self`)&&!Ut(e)}function Gt(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 Kt(e,t){let n=Gt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var qt=null;function Jt(){if(qt===null)try{new FormData(document.createElement(`form`),0),qt=!1}catch{qt=!0}return qt}var Yt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Xt(e){return e!=null&&!Yt.has(e)?(j(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Rt}"`),null):e}function Zt(e,t){let n,r,i,a,o;if(Vt(e)){let o=e.getAttribute(`action`);r=o?_e(o,t):null,n=e.getAttribute(`method`)||Lt,i=Xt(e.getAttribute(`enctype`))||Rt,a=new FormData(e)}else if(Bt(e)||Ht(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a